molstar 3.26.0 → 3.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +202 -202
- package/build/viewer/embedded.html +52 -52
- package/build/viewer/index.html +115 -115
- package/build/viewer/molstar.css +1 -1
- package/build/viewer/molstar.js +1 -1
- package/lib/apps/docking-viewer/index.html +36 -36
- package/lib/apps/docking-viewer/viewport.d.ts +2 -0
- package/lib/apps/docking-viewer/viewport.js +1 -0
- package/lib/apps/viewer/app.d.ts +3 -1
- package/lib/apps/viewer/app.js +4 -0
- package/lib/apps/viewer/embedded.html +52 -52
- package/lib/apps/viewer/index.html +115 -115
- package/lib/cli/structure-info/volume.js +1 -1
- package/lib/commonjs/apps/docking-viewer/viewport.d.ts +2 -0
- package/lib/commonjs/apps/docking-viewer/viewport.js +1 -0
- package/lib/commonjs/apps/viewer/app.d.ts +3 -1
- package/lib/commonjs/apps/viewer/app.js +4 -0
- package/lib/commonjs/cli/structure-info/volume.js +1 -1
- package/lib/commonjs/examples/lighting/index.js +1 -1
- package/lib/commonjs/extensions/anvil/behavior.d.ts +1 -0
- package/lib/commonjs/extensions/cellpack/model.js +2 -1
- package/lib/commonjs/extensions/dnatco/confal-pyramids/behavior.d.ts +1 -0
- package/lib/commonjs/extensions/meshes/choice.d.ts +26 -0
- package/lib/commonjs/extensions/meshes/choice.js +31 -0
- package/lib/commonjs/extensions/meshes/examples.d.ts +26 -0
- package/lib/commonjs/extensions/meshes/examples.js +337 -0
- package/lib/commonjs/extensions/meshes/mesh-cif-schema.d.ts +29 -0
- package/lib/commonjs/extensions/meshes/mesh-cif-schema.js +34 -0
- package/lib/commonjs/extensions/meshes/mesh-extension.d.ts +66 -0
- package/lib/commonjs/extensions/meshes/mesh-extension.js +221 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/behavior.d.ts +105 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/behavior.js +379 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/server-info.d.ts +54 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/server-info.js +30 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/transformers.d.ts +42 -0
- package/lib/commonjs/extensions/meshes/mesh-streaming/transformers.js +273 -0
- package/lib/commonjs/extensions/meshes/mesh-utils.d.ts +41 -0
- package/lib/commonjs/extensions/meshes/mesh-utils.js +357 -0
- package/lib/commonjs/extensions/meshes/metadata.d.ts +108 -0
- package/lib/commonjs/extensions/meshes/metadata.js +72 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/behavior.d.ts +2 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/prop.d.ts +1 -0
- package/lib/commonjs/extensions/model-archive/quality-assessment/prop.js +16 -4
- package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +4 -2
- package/lib/commonjs/extensions/rcsb/validation-report/behavior.d.ts +3 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-meshes.d.ts +17 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-meshes.js +156 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-models.d.ts +12 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-models.js +96 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-root.d.ts +122 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-root.js +576 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-segmentation.d.ts +20 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-segmentation.js +200 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-state.d.ts +88 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-state.js +32 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-volume.d.ts +35 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/entry-volume.js +234 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/external-api.d.ts +11 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/external-api.js +85 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/global-state.d.ts +51 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/global-state.js +83 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/helpers.d.ts +56 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/helpers.js +171 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/index.d.ts +20 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/index.js +130 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/transformers.d.ts +33 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/transformers.js +85 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/ui.d.ts +29 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/ui.js +232 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/api.d.ts +22 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/api.js +83 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/data.d.ts +92 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/data.js +7 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/utils.d.ts +23 -0
- package/lib/commonjs/extensions/volumes-and-segmentations/volseg-api/utils.js +78 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +2 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.js +3 -3
- package/lib/commonjs/mol-canvas3d/passes/image.d.ts +1 -0
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +2 -1
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +27 -13
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.d.ts +2 -1
- package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +3 -2
- package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/commonjs/mol-geo/geometry/points/points.d.ts +1 -1
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.d.ts +1 -0
- package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +3 -2
- package/lib/commonjs/mol-gl/compute/histogram-pyramid/reduction.js +1 -2
- package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +4 -6
- package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/cylinders.js +1 -1
- package/lib/commonjs/mol-gl/renderable/spheres.d.ts +1 -0
- package/lib/commonjs/mol-gl/renderable/spheres.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.js +1 -1
- package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.d.ts +2 -2
- package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.js +2 -2
- package/lib/commonjs/mol-gl/shader/cylinders.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/cylinders.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/cylinders.vert.d.ts +2 -2
- package/lib/commonjs/mol-gl/shader/cylinders.vert.js +2 -2
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/outlines.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/outlines.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/postprocessing.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.frag.d.ts +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.frag.js +1 -1
- package/lib/commonjs/mol-gl/shader/spheres.vert.d.ts +2 -2
- package/lib/commonjs/mol-gl/shader/spheres.vert.js +2 -2
- package/lib/commonjs/mol-gl/webgl/renderbuffer.d.ts +1 -1
- package/lib/commonjs/mol-gl/webgl/renderbuffer.js +15 -0
- package/lib/commonjs/mol-gl/webgl/state.d.ts +12 -0
- package/lib/commonjs/mol-gl/webgl/state.js +136 -0
- package/lib/commonjs/mol-io/reader/cif/schema/segmentation.d.ts +38 -0
- package/lib/commonjs/mol-io/reader/cif/schema/segmentation.js +22 -0
- package/lib/commonjs/mol-io/reader/cif.d.ts +3 -1
- package/lib/commonjs/mol-io/reader/cif.js +3 -1
- package/lib/commonjs/mol-model/location.d.ts +2 -1
- package/lib/commonjs/mol-model/loci.d.ts +11 -11
- package/lib/commonjs/mol-model/loci.js +13 -1
- package/lib/commonjs/mol-model/sequence/alignment/sequence.d.ts +4 -1
- package/lib/commonjs/mol-model/sequence/alignment/sequence.js +4 -1
- package/lib/commonjs/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -0
- package/lib/commonjs/mol-model/structure/model/properties/utils/atomic-index.js +8 -0
- package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.js +21 -5
- package/lib/commonjs/mol-model/structure/structure/util/superposition.d.ts +1 -0
- package/lib/commonjs/mol-model/structure/structure/util/superposition.js +2 -1
- package/lib/commonjs/mol-model/volume/volume.d.ts +35 -2
- package/lib/commonjs/mol-model/volume/volume.js +77 -2
- package/lib/commonjs/mol-model-formats/volume/segmentation.d.ts +23 -0
- package/lib/commonjs/mol-model-formats/volume/segmentation.js +138 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/representation.d.ts +2 -2
- package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +2 -1
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
- package/lib/commonjs/mol-plugin/commands.d.ts +1 -0
- package/lib/commonjs/mol-plugin-state/animation/built-in/model-index.js +4 -1
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +2 -0
- package/lib/commonjs/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -0
- package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +13 -4
- package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.js +6 -1
- package/lib/commonjs/mol-plugin-state/builder/structure/representation.d.ts +1 -0
- package/lib/commonjs/mol-plugin-state/formats/provider.d.ts +2 -2
- package/lib/commonjs/mol-plugin-state/formats/provider.js +11 -3
- package/lib/commonjs/mol-plugin-state/formats/registry.js +6 -5
- package/lib/commonjs/mol-plugin-state/formats/volume.d.ts +27 -0
- package/lib/commonjs/mol-plugin-state/formats/volume.js +65 -1
- package/lib/commonjs/mol-plugin-state/manager/structure/component.d.ts +1 -1
- package/lib/commonjs/mol-plugin-state/manager/structure/component.js +18 -13
- package/lib/commonjs/mol-plugin-state/transforms/representation.d.ts +1 -2
- package/lib/commonjs/mol-plugin-state/transforms/representation.js +5 -6
- package/lib/commonjs/mol-plugin-state/transforms/volume.d.ts +11 -1
- package/lib/commonjs/mol-plugin-state/transforms/volume.js +55 -2
- package/lib/commonjs/mol-plugin-ui/controls/line-graph/line-graph-component.d.ts +1 -0
- package/lib/commonjs/mol-plugin-ui/controls/line-graph/line-graph-component.js +33 -13
- package/lib/commonjs/mol-plugin-ui/controls/parameters.d.ts +1 -0
- package/lib/commonjs/mol-plugin-ui/controls/parameters.js +22 -5
- package/lib/commonjs/mol-plugin-ui/sequence/sequence.d.ts +25 -17
- package/lib/commonjs/mol-plugin-ui/sequence.d.ts +19 -1
- package/lib/commonjs/mol-plugin-ui/sequence.js +8 -1
- package/lib/commonjs/mol-plugin-ui/state/apply-action.d.ts +2 -10
- package/lib/commonjs/mol-plugin-ui/state/apply-action.js +2 -2
- package/lib/commonjs/mol-plugin-ui/structure/quick-styles.js +2 -2
- package/lib/commonjs/mol-plugin-ui/structure/superposition.d.ts +1 -1
- package/lib/commonjs/mol-plugin-ui/structure/volume.d.ts +1 -1
- package/lib/commonjs/mol-plugin-ui/structure/volume.js +3 -2
- package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/params.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/registry.d.ts +12 -0
- package/lib/commonjs/mol-repr/structure/representation/backbone.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.d.ts +6 -0
- package/lib/commonjs/mol-repr/structure/representation/ellipsoid.d.ts +6 -0
- package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/line.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/point.d.ts +3 -0
- package/lib/commonjs/mol-repr/structure/representation/spacefill.d.ts +6 -0
- package/lib/commonjs/mol-repr/structure/units-visual.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.js +2 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.js +1 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.js +1 -0
- package/lib/commonjs/mol-repr/structure/visual/element-cross.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/element-cross.js +2 -1
- package/lib/commonjs/mol-repr/structure/visual/element-point.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/element-point.js +2 -1
- package/lib/commonjs/mol-repr/structure/visual/element-sphere.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/element-sphere.js +3 -1
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.js +6 -2
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -1
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.js +3 -1
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.js +4 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.js +2 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
- package/lib/commonjs/mol-repr/structure/visual/util/bond.d.ts +7 -0
- package/lib/commonjs/mol-repr/structure/visual/util/bond.js +18 -7
- package/lib/commonjs/mol-repr/structure/visual/util/common.d.ts +4 -1
- package/lib/commonjs/mol-repr/structure/visual/util/common.js +10 -6
- package/lib/commonjs/mol-repr/structure/visual/util/element.d.ts +1 -0
- package/lib/commonjs/mol-repr/structure/visual/util/element.js +2 -3
- package/lib/commonjs/mol-repr/structure/visual/util/gaussian.d.ts +2 -0
- package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +4 -4
- package/lib/commonjs/mol-repr/volume/direct-volume.js +8 -6
- package/lib/commonjs/mol-repr/volume/isosurface.d.ts +4 -4
- package/lib/commonjs/mol-repr/volume/isosurface.js +17 -16
- package/lib/commonjs/mol-repr/volume/registry.d.ts +54 -1
- package/lib/commonjs/mol-repr/volume/registry.js +3 -1
- package/lib/commonjs/mol-repr/volume/representation.d.ts +11 -7
- package/lib/commonjs/mol-repr/volume/representation.js +142 -47
- package/lib/commonjs/mol-repr/volume/segment.d.ts +291 -0
- package/lib/commonjs/mol-repr/volume/segment.js +289 -0
- package/lib/commonjs/mol-repr/volume/slice.d.ts +2 -2
- package/lib/commonjs/mol-repr/volume/slice.js +5 -5
- package/lib/commonjs/mol-repr/volume/util.d.ts +12 -3
- package/lib/commonjs/mol-repr/volume/util.js +72 -6
- package/lib/commonjs/mol-script/language/builder.d.ts +1 -0
- package/lib/commonjs/mol-theme/color/volume-segment.d.ts +41 -0
- package/lib/commonjs/mol-theme/color/volume-segment.js +58 -0
- package/lib/commonjs/mol-theme/color/volume-value.js +2 -1
- package/lib/commonjs/mol-theme/color.d.ts +15 -0
- package/lib/commonjs/mol-theme/color.js +2 -0
- package/lib/commonjs/mol-theme/label.d.ts +1 -1
- package/lib/commonjs/mol-theme/label.js +13 -1
- package/lib/commonjs/mol-util/param-definition.d.ts +4 -1
- package/lib/commonjs/mol-util/param-definition.js +5 -2
- package/lib/examples/alpha-orbitals/index.html +72 -72
- package/lib/examples/basic-wrapper/index.html +137 -137
- package/lib/examples/lighting/index.html +88 -88
- package/lib/examples/lighting/index.js +1 -1
- package/lib/examples/proteopedia-wrapper/index.html +236 -236
- package/lib/extensions/anvil/behavior.d.ts +1 -0
- package/lib/extensions/cellpack/model.js +2 -1
- package/lib/extensions/dnatco/confal-pyramids/behavior.d.ts +1 -0
- package/lib/extensions/meshes/choice.d.ts +26 -0
- package/lib/extensions/meshes/choice.js +28 -0
- package/lib/extensions/meshes/examples.d.ts +26 -0
- package/lib/extensions/meshes/examples.js +325 -0
- package/lib/extensions/meshes/mesh-cif-schema.d.ts +29 -0
- package/lib/extensions/meshes/mesh-cif-schema.js +30 -0
- package/lib/extensions/meshes/mesh-extension.d.ts +66 -0
- package/lib/extensions/meshes/mesh-extension.js +218 -0
- package/lib/extensions/meshes/mesh-streaming/behavior.d.ts +105 -0
- package/lib/extensions/meshes/mesh-streaming/behavior.js +375 -0
- package/lib/extensions/meshes/mesh-streaming/server-info.d.ts +54 -0
- package/lib/extensions/meshes/mesh-streaming/server-info.js +26 -0
- package/lib/extensions/meshes/mesh-streaming/transformers.d.ts +42 -0
- package/lib/extensions/meshes/mesh-streaming/transformers.js +270 -0
- package/lib/extensions/meshes/mesh-utils.d.ts +41 -0
- package/lib/extensions/meshes/mesh-utils.js +346 -0
- package/lib/extensions/meshes/metadata.d.ts +108 -0
- package/lib/extensions/meshes/metadata.js +69 -0
- package/lib/extensions/model-archive/quality-assessment/behavior.d.ts +2 -0
- package/lib/extensions/model-archive/quality-assessment/prop.d.ts +1 -0
- package/lib/extensions/model-archive/quality-assessment/prop.js +16 -4
- package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +4 -2
- package/lib/extensions/rcsb/validation-report/behavior.d.ts +3 -0
- package/lib/extensions/volumes-and-segmentations/entry-meshes.d.ts +17 -0
- package/lib/extensions/volumes-and-segmentations/entry-meshes.js +153 -0
- package/lib/extensions/volumes-and-segmentations/entry-models.d.ts +12 -0
- package/lib/extensions/volumes-and-segmentations/entry-models.js +93 -0
- package/lib/extensions/volumes-and-segmentations/entry-root.d.ts +122 -0
- package/lib/extensions/volumes-and-segmentations/entry-root.js +571 -0
- package/lib/extensions/volumes-and-segmentations/entry-segmentation.d.ts +20 -0
- package/lib/extensions/volumes-and-segmentations/entry-segmentation.js +197 -0
- package/lib/extensions/volumes-and-segmentations/entry-state.d.ts +88 -0
- package/lib/extensions/volumes-and-segmentations/entry-state.js +29 -0
- package/lib/extensions/volumes-and-segmentations/entry-volume.d.ts +35 -0
- package/lib/extensions/volumes-and-segmentations/entry-volume.js +231 -0
- package/lib/extensions/volumes-and-segmentations/external-api.d.ts +11 -0
- package/lib/extensions/volumes-and-segmentations/external-api.js +80 -0
- package/lib/extensions/volumes-and-segmentations/global-state.d.ts +51 -0
- package/lib/extensions/volumes-and-segmentations/global-state.js +80 -0
- package/lib/extensions/volumes-and-segmentations/helpers.d.ts +56 -0
- package/lib/extensions/volumes-and-segmentations/helpers.js +163 -0
- package/lib/extensions/volumes-and-segmentations/index.d.ts +20 -0
- package/lib/extensions/volumes-and-segmentations/index.js +127 -0
- package/lib/extensions/volumes-and-segmentations/transformers.d.ts +33 -0
- package/lib/extensions/volumes-and-segmentations/transformers.js +82 -0
- package/lib/extensions/volumes-and-segmentations/ui.d.ts +29 -0
- package/lib/extensions/volumes-and-segmentations/ui.js +229 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/api.d.ts +22 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/api.js +80 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/data.d.ts +92 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/data.js +6 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/utils.d.ts +23 -0
- package/lib/extensions/volumes-and-segmentations/volseg-api/utils.js +75 -0
- package/lib/mol-canvas3d/canvas3d.d.ts +2 -0
- package/lib/mol-canvas3d/passes/draw.js +3 -3
- package/lib/mol-canvas3d/passes/image.d.ts +1 -0
- package/lib/mol-canvas3d/passes/postprocessing.d.ts +2 -1
- package/lib/mol-canvas3d/passes/postprocessing.js +27 -13
- package/lib/mol-geo/geometry/cylinders/cylinders.d.ts +2 -1
- package/lib/mol-geo/geometry/cylinders/cylinders.js +3 -2
- package/lib/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/mol-geo/geometry/points/points.d.ts +1 -1
- package/lib/mol-geo/geometry/spheres/spheres.d.ts +1 -0
- package/lib/mol-geo/geometry/spheres/spheres.js +3 -2
- package/lib/mol-gl/compute/histogram-pyramid/reduction.js +1 -2
- package/lib/mol-gl/compute/marching-cubes/isosurface.js +4 -6
- package/lib/mol-gl/renderable/cylinders.d.ts +1 -0
- package/lib/mol-gl/renderable/cylinders.js +1 -1
- package/lib/mol-gl/renderable/spheres.d.ts +1 -0
- package/lib/mol-gl/renderable/spheres.js +1 -1
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/clip-instance.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/clip-instance.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/clip-pixel.glsl.d.ts +1 -1
- package/lib/mol-gl/shader/chunks/clip-pixel.glsl.js +1 -1
- package/lib/mol-gl/shader/chunks/common-clip.glsl.d.ts +2 -2
- package/lib/mol-gl/shader/chunks/common-clip.glsl.js +2 -2
- package/lib/mol-gl/shader/cylinders.frag.d.ts +1 -1
- package/lib/mol-gl/shader/cylinders.frag.js +1 -1
- package/lib/mol-gl/shader/cylinders.vert.d.ts +2 -2
- package/lib/mol-gl/shader/cylinders.vert.js +2 -2
- package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
- package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
- package/lib/mol-gl/shader/outlines.frag.d.ts +1 -1
- package/lib/mol-gl/shader/outlines.frag.js +1 -1
- package/lib/mol-gl/shader/postprocessing.frag.d.ts +1 -1
- package/lib/mol-gl/shader/postprocessing.frag.js +1 -1
- package/lib/mol-gl/shader/spheres.frag.d.ts +1 -1
- package/lib/mol-gl/shader/spheres.frag.js +1 -1
- package/lib/mol-gl/shader/spheres.vert.d.ts +2 -2
- package/lib/mol-gl/shader/spheres.vert.js +2 -2
- package/lib/mol-gl/webgl/renderbuffer.d.ts +1 -1
- package/lib/mol-gl/webgl/renderbuffer.js +15 -0
- package/lib/mol-gl/webgl/state.d.ts +12 -0
- package/lib/mol-gl/webgl/state.js +136 -0
- package/lib/mol-io/reader/cif/schema/segmentation.d.ts +38 -0
- package/lib/mol-io/reader/cif/schema/segmentation.js +19 -0
- package/lib/mol-io/reader/cif.d.ts +3 -1
- package/lib/mol-io/reader/cif.js +3 -1
- package/lib/mol-model/location.d.ts +2 -1
- package/lib/mol-model/loci.d.ts +11 -11
- package/lib/mol-model/loci.js +13 -1
- package/lib/mol-model/sequence/alignment/sequence.d.ts +4 -1
- package/lib/mol-model/sequence/alignment/sequence.js +3 -2
- package/lib/mol-model/structure/model/properties/atomic/hierarchy.d.ts +6 -0
- package/lib/mol-model/structure/model/properties/utils/atomic-index.js +8 -0
- package/lib/mol-model/structure/structure/unit/bonds/inter-compute.js +21 -5
- package/lib/mol-model/structure/structure/util/superposition.d.ts +1 -0
- package/lib/mol-model/structure/structure/util/superposition.js +1 -1
- package/lib/mol-model/volume/volume.d.ts +35 -2
- package/lib/mol-model/volume/volume.js +79 -4
- package/lib/mol-model-formats/volume/segmentation.d.ts +23 -0
- package/lib/mol-model-formats/volume/segmentation.js +135 -0
- package/lib/mol-plugin/behavior/dynamic/representation.d.ts +2 -2
- package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
- package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.js +2 -1
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
- package/lib/mol-plugin/commands.d.ts +1 -0
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/animation/built-in/model-index.js +4 -1
- package/lib/mol-plugin-state/builder/structure/hierarchy-preset.d.ts +2 -0
- package/lib/mol-plugin-state/builder/structure/hierarchy.d.ts +1 -0
- package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +13 -4
- package/lib/mol-plugin-state/builder/structure/representation-preset.js +6 -1
- package/lib/mol-plugin-state/builder/structure/representation.d.ts +1 -0
- package/lib/mol-plugin-state/formats/provider.d.ts +2 -2
- package/lib/mol-plugin-state/formats/provider.js +11 -3
- package/lib/mol-plugin-state/formats/registry.js +6 -5
- package/lib/mol-plugin-state/formats/volume.d.ts +27 -0
- package/lib/mol-plugin-state/formats/volume.js +64 -0
- package/lib/mol-plugin-state/manager/structure/component.d.ts +1 -1
- package/lib/mol-plugin-state/manager/structure/component.js +18 -13
- package/lib/mol-plugin-state/transforms/representation.d.ts +1 -2
- package/lib/mol-plugin-state/transforms/representation.js +5 -6
- package/lib/mol-plugin-state/transforms/volume.d.ts +11 -1
- package/lib/mol-plugin-state/transforms/volume.js +54 -1
- package/lib/mol-plugin-ui/controls/line-graph/line-graph-component.d.ts +1 -0
- package/lib/mol-plugin-ui/controls/line-graph/line-graph-component.js +33 -13
- package/lib/mol-plugin-ui/controls/parameters.d.ts +1 -0
- package/lib/mol-plugin-ui/controls/parameters.js +22 -5
- package/lib/mol-plugin-ui/sequence/sequence.d.ts +25 -17
- package/lib/mol-plugin-ui/sequence.d.ts +19 -1
- package/lib/mol-plugin-ui/sequence.js +7 -7
- package/lib/mol-plugin-ui/skin/base/base.scss +32 -32
- package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
- package/lib/mol-plugin-ui/skin/base/components/controls.scss +418 -418
- package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
- package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
- package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
- package/lib/mol-plugin-ui/skin/base/components/misc.scss +643 -643
- package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
- package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
- package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
- package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
- package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
- package/lib/mol-plugin-ui/skin/base/components/viewport.scss +137 -128
- package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
- package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
- package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
- package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
- package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
- package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
- package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/variables.scss +85 -85
- package/lib/mol-plugin-ui/skin/blue.scss +1 -1
- package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
- package/lib/mol-plugin-ui/skin/dark.scss +1 -1
- package/lib/mol-plugin-ui/skin/light.scss +1 -1
- package/lib/mol-plugin-ui/state/apply-action.d.ts +2 -10
- package/lib/mol-plugin-ui/state/apply-action.js +2 -2
- package/lib/mol-plugin-ui/structure/quick-styles.js +2 -2
- package/lib/mol-plugin-ui/structure/superposition.d.ts +1 -1
- package/lib/mol-plugin-ui/structure/volume.d.ts +1 -1
- package/lib/mol-plugin-ui/structure/volume.js +3 -2
- package/lib/mol-repr/structure/complex-visual.d.ts +1 -0
- package/lib/mol-repr/structure/params.d.ts +2 -0
- package/lib/mol-repr/structure/registry.d.ts +12 -0
- package/lib/mol-repr/structure/representation/backbone.d.ts +3 -0
- package/lib/mol-repr/structure/representation/ball-and-stick.d.ts +6 -0
- package/lib/mol-repr/structure/representation/ellipsoid.d.ts +6 -0
- package/lib/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
- package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
- package/lib/mol-repr/structure/representation/line.d.ts +3 -0
- package/lib/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
- package/lib/mol-repr/structure/representation/point.d.ts +3 -0
- package/lib/mol-repr/structure/representation/spacefill.d.ts +6 -0
- package/lib/mol-repr/structure/units-visual.d.ts +2 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +4 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.js +2 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
- package/lib/mol-repr/structure/visual/bond-inter-unit-line.js +1 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +4 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.js +2 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
- package/lib/mol-repr/structure/visual/bond-intra-unit-line.js +1 -0
- package/lib/mol-repr/structure/visual/element-cross.d.ts +1 -0
- package/lib/mol-repr/structure/visual/element-cross.js +2 -1
- package/lib/mol-repr/structure/visual/element-point.d.ts +1 -0
- package/lib/mol-repr/structure/visual/element-point.js +2 -1
- package/lib/mol-repr/structure/visual/element-sphere.d.ts +4 -0
- package/lib/mol-repr/structure/visual/element-sphere.js +3 -1
- package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
- package/lib/mol-repr/structure/visual/gaussian-density-volume.js +6 -2
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
- package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +9 -1
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
- package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.js +3 -1
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
- package/lib/mol-repr/structure/visual/molecular-surface-mesh.js +4 -0
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
- package/lib/mol-repr/structure/visual/molecular-surface-wireframe.js +2 -0
- package/lib/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
- package/lib/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
- package/lib/mol-repr/structure/visual/util/bond.d.ts +7 -0
- package/lib/mol-repr/structure/visual/util/bond.js +19 -8
- package/lib/mol-repr/structure/visual/util/common.d.ts +4 -1
- package/lib/mol-repr/structure/visual/util/common.js +10 -6
- package/lib/mol-repr/structure/visual/util/element.d.ts +1 -0
- package/lib/mol-repr/structure/visual/util/element.js +3 -4
- package/lib/mol-repr/structure/visual/util/gaussian.d.ts +2 -0
- package/lib/mol-repr/volume/direct-volume.d.ts +4 -4
- package/lib/mol-repr/volume/direct-volume.js +8 -6
- package/lib/mol-repr/volume/isosurface.d.ts +4 -4
- package/lib/mol-repr/volume/isosurface.js +17 -16
- package/lib/mol-repr/volume/registry.d.ts +54 -1
- package/lib/mol-repr/volume/registry.js +3 -1
- package/lib/mol-repr/volume/representation.d.ts +11 -7
- package/lib/mol-repr/volume/representation.js +144 -49
- package/lib/mol-repr/volume/segment.d.ts +291 -0
- package/lib/mol-repr/volume/segment.js +279 -0
- package/lib/mol-repr/volume/slice.d.ts +2 -2
- package/lib/mol-repr/volume/slice.js +5 -5
- package/lib/mol-repr/volume/util.d.ts +12 -3
- package/lib/mol-repr/volume/util.js +71 -6
- package/lib/mol-script/language/builder.d.ts +1 -0
- package/lib/mol-theme/color/volume-segment.d.ts +41 -0
- package/lib/mol-theme/color/volume-segment.js +53 -0
- package/lib/mol-theme/color/volume-value.js +2 -1
- package/lib/mol-theme/color.d.ts +15 -0
- package/lib/mol-theme/color.js +2 -0
- package/lib/mol-theme/label.d.ts +1 -1
- package/lib/mol-theme/label.js +13 -1
- package/lib/mol-util/param-definition.d.ts +4 -1
- package/lib/mol-util/param-definition.js +5 -2
- package/package.json +169 -168
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { __awaiter, __generator } from "tslib";
|
|
7
|
+
/** Testing examples for using mesh-extension.ts. */
|
|
8
|
+
import { ParseMeshlistTransformer, MeshShapeTransformer, MeshlistData } from './mesh-extension';
|
|
9
|
+
import * as MeshUtils from './mesh-utils';
|
|
10
|
+
import { BACKGROUND_OPACITY, FOREROUND_OPACITY, InitMeshStreaming } from './mesh-streaming/transformers';
|
|
11
|
+
import { MeshServerInfo } from './mesh-streaming/server-info';
|
|
12
|
+
import { Color } from '../../mol-util/color';
|
|
13
|
+
import { Download } from '../../mol-plugin-state/transforms/data';
|
|
14
|
+
import { StateTransforms } from '../../mol-plugin-state/transforms';
|
|
15
|
+
import { Box3D } from '../../mol-math/geometry';
|
|
16
|
+
import { ShapeRepresentation3D } from '../../mol-plugin-state/transforms/representation';
|
|
17
|
+
import { ParamDefinition } from '../../mol-util/param-definition';
|
|
18
|
+
import { createStructureRepresentationParams } from '../../mol-plugin-state/helpers/structure-representation-params';
|
|
19
|
+
import { Volume } from '../../mol-model/volume';
|
|
20
|
+
import { createVolumeRepresentationParams } from '../../mol-plugin-state/helpers/volume-representation-params';
|
|
21
|
+
import { Asset } from '../../mol-util/assets';
|
|
22
|
+
import { CIF } from '../../mol-io/reader/cif';
|
|
23
|
+
export var DB_URL = '/db'; // local
|
|
24
|
+
export function runMeshExtensionExamples(plugin, db_url) {
|
|
25
|
+
if (db_url === void 0) { db_url = DB_URL; }
|
|
26
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27
|
+
return __generator(this, function (_a) {
|
|
28
|
+
switch (_a.label) {
|
|
29
|
+
case 0:
|
|
30
|
+
console.time('TIME MESH EXAMPLES');
|
|
31
|
+
// await runIsosurfaceExample(plugin, db_url);
|
|
32
|
+
// await runMolsurfaceExample(plugin);
|
|
33
|
+
// Focused Ion Beam-Scanning Electron Microscopy of mitochondrial reticulum in murine skeletal muscle: https://www.ebi.ac.uk/empiar/EMPIAR-10070/
|
|
34
|
+
// await runMeshExample(plugin, 'all', db_url);
|
|
35
|
+
// await runMeshExample(plugin, 'fg', db_url);
|
|
36
|
+
// await runMultimeshExample(plugin, 'fg', 'worst', db_url);
|
|
37
|
+
// await runCifMeshExample(plugin);
|
|
38
|
+
// await runMeshExample2(plugin, 'fg');
|
|
39
|
+
return [4 /*yield*/, runMeshStreamingExample(plugin)];
|
|
40
|
+
case 1:
|
|
41
|
+
// await runIsosurfaceExample(plugin, db_url);
|
|
42
|
+
// await runMolsurfaceExample(plugin);
|
|
43
|
+
// Focused Ion Beam-Scanning Electron Microscopy of mitochondrial reticulum in murine skeletal muscle: https://www.ebi.ac.uk/empiar/EMPIAR-10070/
|
|
44
|
+
// await runMeshExample(plugin, 'all', db_url);
|
|
45
|
+
// await runMeshExample(plugin, 'fg', db_url);
|
|
46
|
+
// await runMultimeshExample(plugin, 'fg', 'worst', db_url);
|
|
47
|
+
// await runCifMeshExample(plugin);
|
|
48
|
+
// await runMeshExample2(plugin, 'fg');
|
|
49
|
+
_a.sent();
|
|
50
|
+
console.timeEnd('TIME MESH EXAMPLES');
|
|
51
|
+
return [2 /*return*/];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Example for downloading multiple separate segments, each containing 1 mesh. */
|
|
57
|
+
export function runMeshExample(plugin, segments, db_url) {
|
|
58
|
+
if (db_url === void 0) { db_url = DB_URL; }
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
var detail, segmentIds, _i, segmentIds_1, segmentId;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
detail = 2;
|
|
65
|
+
segmentIds = (segments === 'all') ?
|
|
66
|
+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17] // segment-16 has no detail-2
|
|
67
|
+
: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17];
|
|
68
|
+
_i = 0, segmentIds_1 = segmentIds;
|
|
69
|
+
_a.label = 1;
|
|
70
|
+
case 1:
|
|
71
|
+
if (!(_i < segmentIds_1.length)) return [3 /*break*/, 4];
|
|
72
|
+
segmentId = segmentIds_1[_i];
|
|
73
|
+
return [4 /*yield*/, createMeshFromUrl(plugin, "".concat(db_url, "/empiar-10070-mesh-rounded/segment-").concat(segmentId, "/detail-").concat(detail), segmentId, detail, true, undefined)];
|
|
74
|
+
case 2:
|
|
75
|
+
_a.sent();
|
|
76
|
+
_a.label = 3;
|
|
77
|
+
case 3:
|
|
78
|
+
_i++;
|
|
79
|
+
return [3 /*break*/, 1];
|
|
80
|
+
case 4: return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/** Example for downloading multiple separate segments, each containing 1 mesh. */
|
|
86
|
+
export function runMeshExample2(plugin, segments) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var detail, segmentIds, _i, segmentIds_2, segmentId;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
detail = 1;
|
|
93
|
+
segmentIds = (segments === 'one') ? [15]
|
|
94
|
+
: (segments === 'few') ? [1, 4, 7, 10, 16]
|
|
95
|
+
: (segments === 'all') ? [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17] // segment-16 has no detail-2
|
|
96
|
+
: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17];
|
|
97
|
+
_i = 0, segmentIds_2 = segmentIds;
|
|
98
|
+
_a.label = 1;
|
|
99
|
+
case 1:
|
|
100
|
+
if (!(_i < segmentIds_2.length)) return [3 /*break*/, 4];
|
|
101
|
+
segmentId = segmentIds_2[_i];
|
|
102
|
+
return [4 /*yield*/, createMeshFromUrl(plugin, "http://localhost:9000/v2/empiar/empiar-10070/mesh_bcif/".concat(segmentId, "/").concat(detail), segmentId, detail, false, undefined)];
|
|
103
|
+
case 2:
|
|
104
|
+
_a.sent();
|
|
105
|
+
_a.label = 3;
|
|
106
|
+
case 3:
|
|
107
|
+
_i++;
|
|
108
|
+
return [3 /*break*/, 1];
|
|
109
|
+
case 4: return [2 /*return*/];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** Example for downloading a single segment containing multiple meshes. */
|
|
115
|
+
export function runMultimeshExample(plugin, segments, detailChoice, db_url) {
|
|
116
|
+
if (db_url === void 0) { db_url = DB_URL; }
|
|
117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var urlDetail, numDetail;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
urlDetail = (detailChoice === 'best') ? '2' : 'worst';
|
|
123
|
+
numDetail = (detailChoice === 'best') ? 2 : 1000;
|
|
124
|
+
return [4 /*yield*/, createMeshFromUrl(plugin, "".concat(db_url, "/empiar-10070-multimesh-rounded/segments-").concat(segments, "/detail-").concat(urlDetail), 0, numDetail, false, undefined)];
|
|
125
|
+
case 1:
|
|
126
|
+
_a.sent();
|
|
127
|
+
return [2 /*return*/];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Download data and create state tree hierarchy down to visual representation. */
|
|
133
|
+
export function createMeshFromUrl(plugin, meshDataUrl, segmentId, detail, collapseTree, color, parent, transparentIfBboxAbove, name, ownerId) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
var update, rawDataNodeRef, parsedDataNode, transparent, bbox;
|
|
136
|
+
return __generator(this, function (_a) {
|
|
137
|
+
switch (_a.label) {
|
|
138
|
+
case 0:
|
|
139
|
+
update = parent ? plugin.build().to(parent) : plugin.build().toRoot();
|
|
140
|
+
rawDataNodeRef = update.apply(Download, { url: meshDataUrl, isBinary: true, label: "Downloaded Data ".concat(segmentId) }, { state: { isCollapsed: collapseTree } }).ref;
|
|
141
|
+
return [4 /*yield*/, update.to(rawDataNodeRef)
|
|
142
|
+
.apply(StateTransforms.Data.ParseCif)
|
|
143
|
+
.apply(ParseMeshlistTransformer, { label: undefined, segmentId: segmentId, segmentName: name !== null && name !== void 0 ? name : "Segment ".concat(segmentId), detail: detail, ownerId: ownerId }, {})
|
|
144
|
+
.commit()];
|
|
145
|
+
case 1:
|
|
146
|
+
parsedDataNode = _a.sent();
|
|
147
|
+
transparent = false;
|
|
148
|
+
if (transparentIfBboxAbove !== undefined && parsedDataNode.data) {
|
|
149
|
+
bbox = MeshlistData.bbox(parsedDataNode.data) || Box3D.zero();
|
|
150
|
+
transparent = Box3D.volume(bbox) > transparentIfBboxAbove;
|
|
151
|
+
}
|
|
152
|
+
return [4 /*yield*/, plugin.build().to(parsedDataNode)
|
|
153
|
+
.apply(MeshShapeTransformer, { color: color })
|
|
154
|
+
.apply(ShapeRepresentation3D, { alpha: transparent ? BACKGROUND_OPACITY : FOREROUND_OPACITY }, { tags: ['mesh-segment-visual', "segment-".concat(segmentId)] })
|
|
155
|
+
.commit()];
|
|
156
|
+
case 2:
|
|
157
|
+
_a.sent();
|
|
158
|
+
return [2 /*return*/, rawDataNodeRef];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
export function runMeshStreamingExample(plugin, source, entryId, serverUrl, parent) {
|
|
164
|
+
if (source === void 0) { source = 'empiar'; }
|
|
165
|
+
if (entryId === void 0) { entryId = 'empiar-10070'; }
|
|
166
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
+
var params;
|
|
168
|
+
return __generator(this, function (_a) {
|
|
169
|
+
switch (_a.label) {
|
|
170
|
+
case 0:
|
|
171
|
+
params = ParamDefinition.getDefaultValues(MeshServerInfo.Params);
|
|
172
|
+
if (serverUrl)
|
|
173
|
+
params.serverUrl = serverUrl;
|
|
174
|
+
params.source = source;
|
|
175
|
+
params.entryId = entryId;
|
|
176
|
+
return [4 /*yield*/, plugin.runTask(plugin.state.data.applyAction(InitMeshStreaming, params, parent === null || parent === void 0 ? void 0 : parent.ref), { useOverlay: false })];
|
|
177
|
+
case 1:
|
|
178
|
+
_a.sent();
|
|
179
|
+
return [2 /*return*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/** Example for downloading a protein structure and visualizing molecular surface. */
|
|
185
|
+
export function runMolsurfaceExample(plugin) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
187
|
+
var entryId, data, parsed, trajectory, model, structure, reprParams, repr;
|
|
188
|
+
return __generator(this, function (_a) {
|
|
189
|
+
switch (_a.label) {
|
|
190
|
+
case 0:
|
|
191
|
+
entryId = 'pdb-7etq';
|
|
192
|
+
return [4 /*yield*/, plugin.builders.data.download({ url: 'https://www.ebi.ac.uk/pdbe/entry-files/download/7etq.bcif', isBinary: true }, { state: { isGhost: false } })];
|
|
193
|
+
case 1:
|
|
194
|
+
data = _a.sent();
|
|
195
|
+
console.log('formats:', plugin.dataFormats.list);
|
|
196
|
+
return [4 /*yield*/, plugin.dataFormats.get('mmcif').parse(plugin, data, { entryId: entryId })];
|
|
197
|
+
case 2:
|
|
198
|
+
parsed = _a.sent();
|
|
199
|
+
trajectory = parsed.trajectory;
|
|
200
|
+
console.log('parsed', parsed);
|
|
201
|
+
console.log('trajectory', trajectory);
|
|
202
|
+
return [4 /*yield*/, plugin.build().to(trajectory).apply(StateTransforms.Model.ModelFromTrajectory).commit()];
|
|
203
|
+
case 3:
|
|
204
|
+
model = _a.sent();
|
|
205
|
+
console.log('model:', model);
|
|
206
|
+
return [4 /*yield*/, plugin.build().to(model).apply(StateTransforms.Model.StructureFromModel).commit()];
|
|
207
|
+
case 4:
|
|
208
|
+
structure = _a.sent();
|
|
209
|
+
console.log('structure:', structure);
|
|
210
|
+
reprParams = createStructureRepresentationParams(plugin, undefined, { type: 'molecular-surface' });
|
|
211
|
+
return [4 /*yield*/, plugin.build().to(structure).apply(StateTransforms.Representation.StructureRepresentation3D, reprParams).commit()];
|
|
212
|
+
case 5:
|
|
213
|
+
repr = _a.sent();
|
|
214
|
+
console.log('repr:', repr);
|
|
215
|
+
return [2 /*return*/];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/** Example for downloading an EMDB density data and visualizing isosurface. */
|
|
221
|
+
export function runIsosurfaceExample(plugin, db_url) {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
if (db_url === void 0) { db_url = DB_URL; }
|
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
225
|
+
var entryId, isoLevel, root, data, parsed, volume, volumeData, volumeParams;
|
|
226
|
+
return __generator(this, function (_c) {
|
|
227
|
+
switch (_c.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
entryId = 'emd-1832';
|
|
230
|
+
isoLevel = 2.73;
|
|
231
|
+
return [4 /*yield*/, plugin.build()];
|
|
232
|
+
case 1:
|
|
233
|
+
root = _c.sent();
|
|
234
|
+
return [4 /*yield*/, plugin.builders.data.download({ url: "".concat(db_url, "/emd-1832-box"), isBinary: true }, { state: { isGhost: false } })];
|
|
235
|
+
case 2:
|
|
236
|
+
data = _c.sent();
|
|
237
|
+
return [4 /*yield*/, plugin.dataFormats.get('dscif').parse(plugin, data, { entryId: entryId })];
|
|
238
|
+
case 3:
|
|
239
|
+
parsed = _c.sent();
|
|
240
|
+
volume = (_b = (_a = parsed.volumes) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : parsed.volume;
|
|
241
|
+
volumeData = volume.cell.obj.data;
|
|
242
|
+
console.log('data:', data);
|
|
243
|
+
console.log('parsed:', parsed);
|
|
244
|
+
console.log('volume:', volume);
|
|
245
|
+
console.log('volumeData:', volumeData);
|
|
246
|
+
return [4 /*yield*/, plugin.build()];
|
|
247
|
+
case 4:
|
|
248
|
+
root = _c.sent();
|
|
249
|
+
console.log('root:', root);
|
|
250
|
+
console.log('to:', root.to(volume));
|
|
251
|
+
console.log('toRoot:', root.toRoot());
|
|
252
|
+
volumeParams = createVolumeRepresentationParams(plugin, volumeData, {
|
|
253
|
+
type: 'isosurface',
|
|
254
|
+
typeParams: {
|
|
255
|
+
alpha: 0.5,
|
|
256
|
+
isoValue: Volume.adjustedIsoValue(volumeData, isoLevel, 'relative'),
|
|
257
|
+
visuals: ['solid'],
|
|
258
|
+
sizeFactor: 1,
|
|
259
|
+
},
|
|
260
|
+
color: 'uniform',
|
|
261
|
+
colorParams: { value: Color(0x00aaaa) },
|
|
262
|
+
});
|
|
263
|
+
root.to(volume).apply(StateTransforms.Representation.VolumeRepresentation3D, volumeParams);
|
|
264
|
+
volumeParams = createVolumeRepresentationParams(plugin, volumeData, {
|
|
265
|
+
type: 'isosurface',
|
|
266
|
+
typeParams: {
|
|
267
|
+
alpha: 1.0,
|
|
268
|
+
isoValue: Volume.adjustedIsoValue(volumeData, isoLevel, 'relative'),
|
|
269
|
+
visuals: ['wireframe'],
|
|
270
|
+
sizeFactor: 1,
|
|
271
|
+
},
|
|
272
|
+
color: 'uniform',
|
|
273
|
+
colorParams: { value: Color(0x8800aa) },
|
|
274
|
+
});
|
|
275
|
+
root.to(volume).apply(StateTransforms.Representation.VolumeRepresentation3D, volumeParams);
|
|
276
|
+
return [4 /*yield*/, root.commit()];
|
|
277
|
+
case 5:
|
|
278
|
+
_c.sent();
|
|
279
|
+
return [2 /*return*/];
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
export function runCifMeshExample(plugin, api, source, entryId, segmentId, detail) {
|
|
285
|
+
if (api === void 0) { api = 'http://localhost:9000/v2'; }
|
|
286
|
+
if (source === void 0) { source = 'empiar'; }
|
|
287
|
+
if (entryId === void 0) { entryId = 'empiar-10070'; }
|
|
288
|
+
if (segmentId === void 0) { segmentId = 1; }
|
|
289
|
+
if (detail === void 0) { detail = 10; }
|
|
290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
291
|
+
var url;
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
url = "".concat(api, "/").concat(source, "/").concat(entryId, "/mesh_bcif/").concat(segmentId, "/").concat(detail);
|
|
294
|
+
getMeshFromBcif(plugin, url);
|
|
295
|
+
return [2 /*return*/];
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function getMeshFromBcif(plugin, url) {
|
|
300
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
301
|
+
var urlAsset, asset, parsed, mesh;
|
|
302
|
+
return __generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
304
|
+
case 0:
|
|
305
|
+
urlAsset = Asset.getUrlAsset(plugin.managers.asset, url);
|
|
306
|
+
return [4 /*yield*/, plugin.runTask(plugin.managers.asset.resolve(urlAsset, 'binary'))];
|
|
307
|
+
case 1:
|
|
308
|
+
asset = _a.sent();
|
|
309
|
+
return [4 /*yield*/, plugin.runTask(CIF.parseBinary(asset.data))];
|
|
310
|
+
case 2:
|
|
311
|
+
parsed = _a.sent();
|
|
312
|
+
if (parsed.isError) {
|
|
313
|
+
plugin.log.error('VolumeStreaming, parsing CIF: ' + parsed.toString());
|
|
314
|
+
return [2 /*return*/];
|
|
315
|
+
}
|
|
316
|
+
console.log('blocks:', parsed.result.blocks);
|
|
317
|
+
return [4 /*yield*/, MeshUtils.meshFromCif(parsed.result)];
|
|
318
|
+
case 3:
|
|
319
|
+
mesh = _a.sent();
|
|
320
|
+
console.log(mesh);
|
|
321
|
+
return [2 /*return*/];
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { Column, Database } from '../../mol-data/db';
|
|
7
|
+
import { CifFrame } from '../../mol-io/reader/cif';
|
|
8
|
+
export declare const Mesh_Data_Schema: {
|
|
9
|
+
mesh: {
|
|
10
|
+
id: Column.Schema.Int;
|
|
11
|
+
};
|
|
12
|
+
mesh_vertex: {
|
|
13
|
+
mesh_id: Column.Schema.Int;
|
|
14
|
+
vertex_id: Column.Schema.Int;
|
|
15
|
+
x: Column.Schema.Float;
|
|
16
|
+
y: Column.Schema.Float;
|
|
17
|
+
z: Column.Schema.Float;
|
|
18
|
+
};
|
|
19
|
+
/** Table of triangles, 3 rows per triangle */
|
|
20
|
+
mesh_triangle: {
|
|
21
|
+
mesh_id: Column.Schema.Int;
|
|
22
|
+
/** Indices of vertices within mesh */
|
|
23
|
+
vertex_id: Column.Schema.Int;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type Mesh_Data_Schema = typeof Mesh_Data_Schema;
|
|
27
|
+
export interface Mesh_Data_Database extends Database<Mesh_Data_Schema> {
|
|
28
|
+
}
|
|
29
|
+
export declare const CIF_schema_mesh: (frame: CifFrame) => Mesh_Data_Database;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { Column } from '../../mol-data/db';
|
|
7
|
+
import { toDatabase } from '../../mol-io/reader/cif/schema';
|
|
8
|
+
var int = Column.Schema.int;
|
|
9
|
+
var float = Column.Schema.float;
|
|
10
|
+
// TODO in future, move to molstar/src/mol-io/reader/cif/schema/mesh.ts
|
|
11
|
+
export var Mesh_Data_Schema = {
|
|
12
|
+
mesh: {
|
|
13
|
+
id: int,
|
|
14
|
+
},
|
|
15
|
+
mesh_vertex: {
|
|
16
|
+
mesh_id: int,
|
|
17
|
+
vertex_id: int,
|
|
18
|
+
x: float,
|
|
19
|
+
y: float,
|
|
20
|
+
z: float,
|
|
21
|
+
},
|
|
22
|
+
/** Table of triangles, 3 rows per triangle */
|
|
23
|
+
mesh_triangle: {
|
|
24
|
+
mesh_id: int,
|
|
25
|
+
/** Indices of vertices within mesh */
|
|
26
|
+
vertex_id: int,
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
// TODO in future, move to molstar/src/mol-io/reader/cif.ts: CIF.schema.mesh
|
|
30
|
+
export var CIF_schema_mesh = function (frame) { return toDatabase(Mesh_Data_Schema, frame); };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { Mesh } from '../../mol-geo/geometry/mesh/mesh';
|
|
7
|
+
import { CifFile } from '../../mol-io/reader/cif';
|
|
8
|
+
import { Box3D } from '../../mol-math/geometry';
|
|
9
|
+
import { Shape } from '../../mol-model/shape';
|
|
10
|
+
import { PluginStateObject } from '../../mol-plugin-state/objects';
|
|
11
|
+
import { StateTransformer } from '../../mol-state';
|
|
12
|
+
import { Color } from '../../mol-util/color';
|
|
13
|
+
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
14
|
+
export declare const VolsegTransform: StateTransformer.Builder.Root;
|
|
15
|
+
/** Data type for `MeshlistStateObject` - list of meshes */
|
|
16
|
+
export interface MeshlistData {
|
|
17
|
+
segmentId: number;
|
|
18
|
+
segmentName: string;
|
|
19
|
+
detail: number;
|
|
20
|
+
meshIds: number[];
|
|
21
|
+
mesh: Mesh;
|
|
22
|
+
/** Reference to the object which created this meshlist (e.g. `MeshStreaming.Behavior`) */
|
|
23
|
+
ownerId?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare namespace MeshlistData {
|
|
26
|
+
function empty(): MeshlistData;
|
|
27
|
+
function fromCIF(data: CifFile, segmentId: number, segmentName: string, detail: number): Promise<MeshlistData>;
|
|
28
|
+
function stats(meshListData: MeshlistData): string;
|
|
29
|
+
function getShape(data: MeshlistData, color: Color): Shape<Mesh>;
|
|
30
|
+
function combineBBoxes(boxes: (Box3D | null)[]): Box3D | null;
|
|
31
|
+
function bbox(data: MeshlistData): Box3D | null;
|
|
32
|
+
function allVerticesUsed(data: MeshlistData): boolean;
|
|
33
|
+
}
|
|
34
|
+
declare const MeshlistStateObject_base: {
|
|
35
|
+
new (data: MeshlistData, props?: {
|
|
36
|
+
label: string;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
} | undefined): {
|
|
39
|
+
id: import("../../mol-util/uuid").UUID;
|
|
40
|
+
type: PluginStateObject.TypeInfo;
|
|
41
|
+
label: string;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
data: MeshlistData;
|
|
44
|
+
};
|
|
45
|
+
type: PluginStateObject.TypeInfo;
|
|
46
|
+
is(obj?: import("../../mol-state/object").StateObject<any, import("../../mol-state/object").StateObject.Type<any>> | undefined): obj is {
|
|
47
|
+
id: import("../../mol-util/uuid").UUID;
|
|
48
|
+
type: PluginStateObject.TypeInfo;
|
|
49
|
+
label: string;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
data: MeshlistData;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare class MeshlistStateObject extends MeshlistStateObject_base {
|
|
55
|
+
}
|
|
56
|
+
export declare const ParseMeshlistTransformer: StateTransformer<PluginStateObject.Format.Cif, MeshlistStateObject, PD.Normalize<{
|
|
57
|
+
label: string;
|
|
58
|
+
segmentId: number;
|
|
59
|
+
segmentName: string;
|
|
60
|
+
detail: number;
|
|
61
|
+
ownerId: string;
|
|
62
|
+
}>>;
|
|
63
|
+
export declare const MeshShapeTransformer: StateTransformer<MeshlistStateObject, PluginStateObject.Shape.Provider, PD.Normalize<{
|
|
64
|
+
color: Color | undefined;
|
|
65
|
+
}>>;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
3
|
+
*
|
|
4
|
+
* @author Adam Midlik <midlik@gmail.com>
|
|
5
|
+
*/
|
|
6
|
+
import { __awaiter, __extends, __generator } from "tslib";
|
|
7
|
+
/** Defines new types of State tree transformers for dealing with mesh data. */
|
|
8
|
+
import { BaseGeometry, VisualQualityOptions } from '../../mol-geo/geometry/base';
|
|
9
|
+
import { Mesh } from '../../mol-geo/geometry/mesh/mesh';
|
|
10
|
+
import { Box3D } from '../../mol-math/geometry';
|
|
11
|
+
import { Vec3 } from '../../mol-math/linear-algebra';
|
|
12
|
+
import { Shape } from '../../mol-model/shape';
|
|
13
|
+
import { PluginStateObject } from '../../mol-plugin-state/objects';
|
|
14
|
+
import { StateTransformer } from '../../mol-state';
|
|
15
|
+
import { Task } from '../../mol-task';
|
|
16
|
+
import { Material } from '../../mol-util/material';
|
|
17
|
+
import { ParamDefinition as PD } from '../../mol-util/param-definition';
|
|
18
|
+
import * as MeshUtils from './mesh-utils';
|
|
19
|
+
export var VolsegTransform = StateTransformer.builderFactory('volseg');
|
|
20
|
+
export var MeshlistData;
|
|
21
|
+
(function (MeshlistData) {
|
|
22
|
+
function empty() {
|
|
23
|
+
return {
|
|
24
|
+
segmentId: 0,
|
|
25
|
+
segmentName: 'Empty',
|
|
26
|
+
detail: 0,
|
|
27
|
+
meshIds: [],
|
|
28
|
+
mesh: Mesh.createEmpty(),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
MeshlistData.empty = empty;
|
|
32
|
+
;
|
|
33
|
+
function fromCIF(data, segmentId, segmentName, detail) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
35
|
+
var _a, mesh, meshIds;
|
|
36
|
+
return __generator(this, function (_b) {
|
|
37
|
+
switch (_b.label) {
|
|
38
|
+
case 0: return [4 /*yield*/, MeshUtils.meshFromCif(data)];
|
|
39
|
+
case 1:
|
|
40
|
+
_a = _b.sent(), mesh = _a.mesh, meshIds = _a.meshIds;
|
|
41
|
+
return [2 /*return*/, {
|
|
42
|
+
segmentId: segmentId,
|
|
43
|
+
segmentName: segmentName,
|
|
44
|
+
detail: detail,
|
|
45
|
+
meshIds: meshIds,
|
|
46
|
+
mesh: mesh,
|
|
47
|
+
}];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
MeshlistData.fromCIF = fromCIF;
|
|
53
|
+
function stats(meshListData) {
|
|
54
|
+
return "Meshlist \"".concat(meshListData.segmentName, "\" (detail ").concat(meshListData.detail, "): ").concat(meshListData.meshIds.length, " meshes, ").concat(meshListData.mesh.vertexCount, " vertices, ").concat(meshListData.mesh.triangleCount, " triangles");
|
|
55
|
+
}
|
|
56
|
+
MeshlistData.stats = stats;
|
|
57
|
+
function getShape(data, color) {
|
|
58
|
+
var mesh = data.mesh;
|
|
59
|
+
var meshShape = Shape.create(data.segmentName, data, mesh, function () { return color; }, function () { return 1; },
|
|
60
|
+
// group => `${data.segmentName} | Segment ${data.segmentId} | Detail ${data.detail} | Mesh ${group}`,
|
|
61
|
+
function (group) { return data.segmentName; });
|
|
62
|
+
return meshShape;
|
|
63
|
+
}
|
|
64
|
+
MeshlistData.getShape = getShape;
|
|
65
|
+
function combineBBoxes(boxes) {
|
|
66
|
+
var result = null;
|
|
67
|
+
for (var _i = 0, boxes_1 = boxes; _i < boxes_1.length; _i++) {
|
|
68
|
+
var box = boxes_1[_i];
|
|
69
|
+
if (!box)
|
|
70
|
+
continue;
|
|
71
|
+
if (result) {
|
|
72
|
+
Vec3.min(result.min, result.min, box.min);
|
|
73
|
+
Vec3.max(result.max, result.max, box.max);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
result = Box3D.zero();
|
|
77
|
+
Box3D.copy(result, box);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
MeshlistData.combineBBoxes = combineBBoxes;
|
|
83
|
+
function bbox(data) {
|
|
84
|
+
return MeshUtils.bbox(data.mesh);
|
|
85
|
+
}
|
|
86
|
+
MeshlistData.bbox = bbox;
|
|
87
|
+
function allVerticesUsed(data) {
|
|
88
|
+
var unusedVertices = new Set();
|
|
89
|
+
for (var i = 0; i < data.mesh.vertexCount; i++) {
|
|
90
|
+
unusedVertices.add(i);
|
|
91
|
+
}
|
|
92
|
+
for (var i = 0; i < 3 * data.mesh.triangleCount; i++) {
|
|
93
|
+
var v = data.mesh.vertexBuffer.ref.value[i];
|
|
94
|
+
unusedVertices.delete(v);
|
|
95
|
+
}
|
|
96
|
+
return unusedVertices.size === 0;
|
|
97
|
+
}
|
|
98
|
+
MeshlistData.allVerticesUsed = allVerticesUsed;
|
|
99
|
+
})(MeshlistData || (MeshlistData = {}));
|
|
100
|
+
// // // // // // // // // // // // // // // // // // // // // // // //
|
|
101
|
+
// Raw Data -> Parsed data
|
|
102
|
+
var MeshlistStateObject = /** @class */ (function (_super) {
|
|
103
|
+
__extends(MeshlistStateObject, _super);
|
|
104
|
+
function MeshlistStateObject() {
|
|
105
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
106
|
+
}
|
|
107
|
+
return MeshlistStateObject;
|
|
108
|
+
}(PluginStateObject.Create({ name: 'Parsed Meshlist', typeClass: 'Object' })));
|
|
109
|
+
export { MeshlistStateObject };
|
|
110
|
+
// QUESTION: is typeClass just for color, or does do something?
|
|
111
|
+
export var ParseMeshlistTransformer = VolsegTransform({
|
|
112
|
+
name: 'meshlist-from-string',
|
|
113
|
+
from: PluginStateObject.Format.Cif,
|
|
114
|
+
to: MeshlistStateObject,
|
|
115
|
+
params: {
|
|
116
|
+
label: PD.Text(MeshlistStateObject.type.name, { isHidden: true }),
|
|
117
|
+
segmentId: PD.Numeric(1, {}, { isHidden: true }),
|
|
118
|
+
segmentName: PD.Text('Segment'),
|
|
119
|
+
detail: PD.Numeric(1, {}, { isHidden: true }),
|
|
120
|
+
/** Reference to the object which manages this meshlist (e.g. `MeshStreaming.Behavior`) */
|
|
121
|
+
ownerId: PD.Text('', { isHidden: true }),
|
|
122
|
+
}
|
|
123
|
+
})({
|
|
124
|
+
apply: function (_a, globalCtx) {
|
|
125
|
+
var _this = this;
|
|
126
|
+
var a = _a.a, params = _a.params;
|
|
127
|
+
return Task.create('Create Parsed Meshlist', function (ctx) { return __awaiter(_this, void 0, void 0, function () {
|
|
128
|
+
var meshlistData, es;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0: return [4 /*yield*/, MeshlistData.fromCIF(a.data, params.segmentId, params.segmentName, params.detail)];
|
|
132
|
+
case 1:
|
|
133
|
+
meshlistData = _a.sent();
|
|
134
|
+
meshlistData.ownerId = params.ownerId;
|
|
135
|
+
es = meshlistData.meshIds.length === 1 ? '' : 'es';
|
|
136
|
+
return [2 /*return*/, new MeshlistStateObject(meshlistData, { label: params.label, description: "".concat(meshlistData.segmentName, " (").concat(meshlistData.meshIds.length, " mesh").concat(es, ")") })];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}); });
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
var MeshShapeProvider;
|
|
143
|
+
(function (MeshShapeProvider) {
|
|
144
|
+
function fromMeshlistData(meshlist, color) {
|
|
145
|
+
var theColor = color !== null && color !== void 0 ? color : MeshUtils.ColorGenerator.next().value;
|
|
146
|
+
return {
|
|
147
|
+
label: 'Mesh',
|
|
148
|
+
data: meshlist,
|
|
149
|
+
params: meshParamDef,
|
|
150
|
+
geometryUtils: Mesh.Utils,
|
|
151
|
+
getShape: function (ctx, data) { return MeshlistData.getShape(data, theColor); },
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
MeshShapeProvider.fromMeshlistData = fromMeshlistData;
|
|
155
|
+
})(MeshShapeProvider || (MeshShapeProvider = {}));
|
|
156
|
+
/** Params for MeshShapeTransformer */
|
|
157
|
+
var meshShapeParamDef = {
|
|
158
|
+
color: PD.Value(undefined), // undefined means random color
|
|
159
|
+
};
|
|
160
|
+
var meshParamDef = {
|
|
161
|
+
// These are basically original MS.Mesh.Params:
|
|
162
|
+
// BaseGeometry.Params
|
|
163
|
+
alpha: PD.Numeric(1, { min: 0, max: 1, step: 0.01 }, { label: 'Opacity', isEssential: true, description: 'How opaque/transparent the representation is rendered.' }),
|
|
164
|
+
quality: PD.Select('custom', VisualQualityOptions, { isEssential: true, description: 'Visual/rendering quality of the representation.' }),
|
|
165
|
+
material: Material.getParam(),
|
|
166
|
+
clip: Mesh.Params.clip,
|
|
167
|
+
instanceGranularity: PD.Boolean(false, { description: 'Use instance granularity for marker, transparency, clipping, overpaint, substance data to save memory.' }),
|
|
168
|
+
// Mesh.Params
|
|
169
|
+
doubleSided: PD.Boolean(true, BaseGeometry.CustomQualityParamInfo),
|
|
170
|
+
flipSided: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
|
171
|
+
flatShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
|
172
|
+
ignoreLight: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
|
173
|
+
xrayShaded: PD.Boolean(false, BaseGeometry.ShadingCategory),
|
|
174
|
+
transparentBackfaces: PD.Select('off', PD.arrayToOptions(['off', 'on', 'opaque']), BaseGeometry.ShadingCategory),
|
|
175
|
+
bumpFrequency: PD.Numeric(0, { min: 0, max: 10, step: 0.1 }, BaseGeometry.ShadingCategory),
|
|
176
|
+
bumpAmplitude: PD.Numeric(1, { min: 0, max: 5, step: 0.1 }, BaseGeometry.ShadingCategory),
|
|
177
|
+
// TODO when I change values here, it has effect, but not if I change them in GUI
|
|
178
|
+
};
|
|
179
|
+
export var MeshShapeTransformer = VolsegTransform({
|
|
180
|
+
name: 'shape-from-meshlist',
|
|
181
|
+
display: { name: 'Shape from Meshlist', description: 'Create Shape from Meshlist data' },
|
|
182
|
+
from: MeshlistStateObject,
|
|
183
|
+
to: PluginStateObject.Shape.Provider,
|
|
184
|
+
params: meshShapeParamDef
|
|
185
|
+
})({
|
|
186
|
+
apply: function (_a) {
|
|
187
|
+
var a = _a.a, params = _a.params;
|
|
188
|
+
// you can look for example at ShapeFromPly in mol-plugin-state/tansforms/model.ts as an example
|
|
189
|
+
var shapeProvider = MeshShapeProvider.fromMeshlistData(a.data, params.color);
|
|
190
|
+
return new PluginStateObject.Shape.Provider(shapeProvider, { label: PluginStateObject.Shape.Provider.type.name, description: a.description });
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
// // // // // // // // // // // // // // // // // // // // // // // //
|
|
194
|
+
// Shape -> Repr
|
|
195
|
+
// type MeshRepr = MS.PluginStateObject.Representation3DData<MS.ShapeRepresentation<MS.ShapeProvider<any,any,any>, MS.Mesh, MS.Mesh.Params>, any>;
|
|
196
|
+
// export const CustomMeshReprTransformer = VolsegTransform({
|
|
197
|
+
// name: 'custom-repr',
|
|
198
|
+
// from: MS.PluginStateObject.Shape.Provider, // later we can change this
|
|
199
|
+
// to: MS.PluginStateObject.Shape.Representation3D,
|
|
200
|
+
// })({
|
|
201
|
+
// apply({ a }, globalCtx) {
|
|
202
|
+
// const repr: MeshRepr = createRepr(a.data); // TODO implement createRepr
|
|
203
|
+
// // have a look at MS.StateTransforms.Representation.ShapeRepresentation3D if you want to try implementing yourself
|
|
204
|
+
// return new MS.PluginStateObject.Shape.Representation3D(repr)
|
|
205
|
+
// },
|
|
206
|
+
// })
|
|
207
|
+
// export async function createMeshRepr(plugin: MS.PluginContext, data: any) {
|
|
208
|
+
// await plugin.build()
|
|
209
|
+
// .toRoot()
|
|
210
|
+
// .apply(CreateMyShapeTransformer, { data })
|
|
211
|
+
// .apply(MS.StateTransforms.Representation.ShapeRepresentation3D) // this should work
|
|
212
|
+
// // or .apply(CustomMeshRepr)
|
|
213
|
+
// .commit();
|
|
214
|
+
// }
|
|
215
|
+
// export function createRepr(reprData: MS.ShapeProvider<any,any,any>): MeshRepr {
|
|
216
|
+
// throw new Error('NotImplemented');
|
|
217
|
+
// return {} as MeshRepr;
|
|
218
|
+
// }
|