@webviz/subsurface-viewer 0.0.1-alpha.1
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/dist/DashSubsurfaceViewer.d.ts +56 -0
- package/dist/DashSubsurfaceViewer.js +160 -0
- package/dist/DashSubsurfaceViewer.js.map +1 -0
- package/dist/SubsurfaceViewer.d.ts +65 -0
- package/dist/SubsurfaceViewer.js +208 -0
- package/dist/SubsurfaceViewer.js.map +1 -0
- package/dist/assets/glTF/north_arrow/scene.bin +0 -0
- package/dist/assets/glTF/north_arrow/scene.gltf +315 -0
- package/dist/assets/glTF/north_arrow/textures/Arrow5_baseColor.png +0 -0
- package/dist/assets/glTF/north_arrow/textures/Arrow5_metallicRoughness.png +0 -0
- package/dist/assets/glTF/north_arrow/textures/Arrow5_normal.png +0 -0
- package/dist/components/ColorLegend.d.ts +26 -0
- package/dist/components/ColorLegend.js +19 -0
- package/dist/components/ColorLegend.js.map +1 -0
- package/dist/components/ColorLegends.d.ts +12 -0
- package/dist/components/ColorLegends.js +10 -0
- package/dist/components/ColorLegends.js.map +1 -0
- package/dist/components/DistanceScale.d.ts +12 -0
- package/dist/components/DistanceScale.js +45 -0
- package/dist/components/DistanceScale.js.map +1 -0
- package/dist/components/InfoCard.d.ts +11 -0
- package/dist/components/InfoCard.js +149 -0
- package/dist/components/InfoCard.js.map +1 -0
- package/dist/components/Map.d.ts +158 -0
- package/dist/components/Map.js +867 -0
- package/dist/components/Map.js.map +1 -0
- package/dist/components/StatusIndicator.d.ts +8 -0
- package/dist/components/StatusIndicator.js +20 -0
- package/dist/components/StatusIndicator.js.map +1 -0
- package/dist/components/ViewAnnotation.d.ts +7 -0
- package/dist/components/ViewAnnotation.js +13 -0
- package/dist/components/ViewAnnotation.js.map +1 -0
- package/dist/components/ViewFooter.d.ts +6 -0
- package/dist/components/ViewFooter.js +21 -0
- package/dist/components/ViewFooter.js.map +1 -0
- package/dist/components/settings/DrawModeSelector.d.ts +18 -0
- package/dist/components/settings/DrawModeSelector.js +20 -0
- package/dist/components/settings/DrawModeSelector.js.map +1 -0
- package/dist/components/settings/LayerProperty.d.ts +6 -0
- package/dist/components/settings/LayerProperty.js +39 -0
- package/dist/components/settings/LayerProperty.js.map +1 -0
- package/dist/components/settings/LayerSettingsButton.d.ts +7 -0
- package/dist/components/settings/LayerSettingsButton.js +51 -0
- package/dist/components/settings/LayerSettingsButton.js.map +1 -0
- package/dist/components/settings/LayersButton.d.ts +8 -0
- package/dist/components/settings/LayersButton.js +45 -0
- package/dist/components/settings/LayersButton.js.map +1 -0
- package/dist/components/settings/NumericInput.d.ts +20 -0
- package/dist/components/settings/NumericInput.js +25 -0
- package/dist/components/settings/NumericInput.js.map +1 -0
- package/dist/components/settings/Settings.d.ts +7 -0
- package/dist/components/settings/Settings.js +39 -0
- package/dist/components/settings/Settings.js.map +1 -0
- package/dist/components/settings/SliderInput.d.ts +29 -0
- package/dist/components/settings/SliderInput.js +21 -0
- package/dist/components/settings/SliderInput.js.map +1 -0
- package/dist/components/settings/ToggleButton.d.ts +17 -0
- package/dist/components/settings/ToggleButton.js +19 -0
- package/dist/components/settings/ToggleButton.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/inputSchema/ColorTables.json +51 -0
- package/dist/inputSchema/FaultPolygons.json +80 -0
- package/dist/inputSchema/Grid.json +39 -0
- package/dist/inputSchema/PieChart.json +72 -0
- package/dist/inputSchema/WellLog.json +126 -0
- package/dist/inputSchema/WellLogTemplate.json +136 -0
- package/dist/inputSchema/WellLogs.json +5 -0
- package/dist/inputSchema/Wells.json +106 -0
- package/dist/inputSchema/schemaValidationUtil.d.ts +5 -0
- package/dist/inputSchema/schemaValidationUtil.js +48 -0
- package/dist/inputSchema/schemaValidationUtil.js.map +1 -0
- package/dist/inputSchema/validator.d.ts +1 -0
- package/dist/inputSchema/validator.js +64 -0
- package/dist/inputSchema/validator.js.map +1 -0
- package/dist/inputSchema/wellCompletions.json +108 -0
- package/dist/layers/BoxSelectionLayer/boxSelectionLayer.d.ts +37 -0
- package/dist/layers/BoxSelectionLayer/boxSelectionLayer.js +86 -0
- package/dist/layers/BoxSelectionLayer/boxSelectionLayer.js.map +1 -0
- package/dist/layers/axes/axes-fragment.glsl.d.ts +2 -0
- package/dist/layers/axes/axes-fragment.glsl.js +15 -0
- package/dist/layers/axes/axes-fragment.glsl.js.map +1 -0
- package/dist/layers/axes/axesLayer.d.ts +38 -0
- package/dist/layers/axes/axesLayer.js +485 -0
- package/dist/layers/axes/axesLayer.js.map +1 -0
- package/dist/layers/axes/boxLayer.d.ts +20 -0
- package/dist/layers/axes/boxLayer.js +52 -0
- package/dist/layers/axes/boxLayer.js.map +1 -0
- package/dist/layers/axes/grid-vertex.glsl.d.ts +2 -0
- package/dist/layers/axes/grid-vertex.glsl.js +14 -0
- package/dist/layers/axes/grid-vertex.glsl.js.map +1 -0
- package/dist/layers/axes2d/axes2DLayer.d.ts +58 -0
- package/dist/layers/axes2d/axes2DLayer.js +613 -0
- package/dist/layers/axes2d/axes2DLayer.js.map +1 -0
- package/dist/layers/axes2d/font-atlas.png +0 -0
- package/dist/layers/axes2d/label-fragment.glsl.d.ts +2 -0
- package/dist/layers/axes2d/label-fragment.glsl.js +38 -0
- package/dist/layers/axes2d/label-fragment.glsl.js.map +1 -0
- package/dist/layers/axes2d/label-vertex.glsl.d.ts +2 -0
- package/dist/layers/axes2d/label-vertex.glsl.js +21 -0
- package/dist/layers/axes2d/label-vertex.glsl.js.map +1 -0
- package/dist/layers/axes2d/line-fragment.glsl.d.ts +2 -0
- package/dist/layers/axes2d/line-fragment.glsl.js +15 -0
- package/dist/layers/axes2d/line-fragment.glsl.js.map +1 -0
- package/dist/layers/axes2d/line-vertex.glsl.d.ts +2 -0
- package/dist/layers/axes2d/line-vertex.glsl.js +14 -0
- package/dist/layers/axes2d/line-vertex.glsl.js.map +1 -0
- package/dist/layers/colormap/colormap.fs.glsl.d.ts +2 -0
- package/dist/layers/colormap/colormap.fs.glsl.js +42 -0
- package/dist/layers/colormap/colormap.fs.glsl.js.map +1 -0
- package/dist/layers/colormap/colormapLayer.d.ts +24 -0
- package/dist/layers/colormap/colormapLayer.js +150 -0
- package/dist/layers/colormap/colormapLayer.js.map +1 -0
- package/dist/layers/drawing/drawingLayer.d.ts +17 -0
- package/dist/layers/drawing/drawingLayer.js +202 -0
- package/dist/layers/drawing/drawingLayer.js.map +1 -0
- package/dist/layers/fault_polygons/faultPolygonsLayer.d.ts +9 -0
- package/dist/layers/fault_polygons/faultPolygonsLayer.js +43 -0
- package/dist/layers/fault_polygons/faultPolygonsLayer.js.map +1 -0
- package/dist/layers/grid3d/fragment.fs.glsl.d.ts +2 -0
- package/dist/layers/grid3d/fragment.fs.glsl.js +109 -0
- package/dist/layers/grid3d/fragment.fs.glsl.js.map +1 -0
- package/dist/layers/grid3d/fragment_lines.glsl.d.ts +2 -0
- package/dist/layers/grid3d/fragment_lines.glsl.js +21 -0
- package/dist/layers/grid3d/fragment_lines.glsl.js.map +1 -0
- package/dist/layers/grid3d/grid3dLayer.d.ts +73 -0
- package/dist/layers/grid3d/grid3dLayer.js +134 -0
- package/dist/layers/grid3d/grid3dLayer.js.map +1 -0
- package/dist/layers/grid3d/privateLayer.d.ts +73 -0
- package/dist/layers/grid3d/privateLayer.js +174 -0
- package/dist/layers/grid3d/privateLayer.js.map +1 -0
- package/dist/layers/grid3d/vertex.glsl.d.ts +2 -0
- package/dist/layers/grid3d/vertex.glsl.js +43 -0
- package/dist/layers/grid3d/vertex.glsl.js.map +1 -0
- package/dist/layers/grid3d/vertex_lines.glsl.d.ts +2 -0
- package/dist/layers/grid3d/vertex_lines.glsl.js +16 -0
- package/dist/layers/grid3d/vertex_lines.glsl.js.map +1 -0
- package/dist/layers/grid3d/webworker.d.ts +4 -0
- package/dist/layers/grid3d/webworker.js +140 -0
- package/dist/layers/grid3d/webworker.js.map +1 -0
- package/dist/layers/hillshading2d/hillshading2d.fs.glsl.d.ts +2 -0
- package/dist/layers/hillshading2d/hillshading2d.fs.glsl.js +62 -0
- package/dist/layers/hillshading2d/hillshading2d.fs.glsl.js.map +1 -0
- package/dist/layers/hillshading2d/hillshading2dLayer.d.ts +22 -0
- package/dist/layers/hillshading2d/hillshading2dLayer.js +101 -0
- package/dist/layers/hillshading2d/hillshading2dLayer.js.map +1 -0
- package/dist/layers/index.d.ts +34 -0
- package/dist/layers/index.js +19 -0
- package/dist/layers/index.js.map +1 -0
- package/dist/layers/intersection/unfoldedGeoJsonLayer.d.ts +10 -0
- package/dist/layers/intersection/unfoldedGeoJsonLayer.js +64 -0
- package/dist/layers/intersection/unfoldedGeoJsonLayer.js.map +1 -0
- package/dist/layers/map/fragment.fs.glsl.d.ts +2 -0
- package/dist/layers/map/fragment.fs.glsl.js +127 -0
- package/dist/layers/map/fragment.fs.glsl.js.map +1 -0
- package/dist/layers/map/fragment_lines.glsl.d.ts +2 -0
- package/dist/layers/map/fragment_lines.glsl.js +21 -0
- package/dist/layers/map/fragment_lines.glsl.js.map +1 -0
- package/dist/layers/map/mapLayer.d.ts +120 -0
- package/dist/layers/map/mapLayer.js +275 -0
- package/dist/layers/map/mapLayer.js.map +1 -0
- package/dist/layers/map/privateMapLayer.d.ts +76 -0
- package/dist/layers/map/privateMapLayer.js +190 -0
- package/dist/layers/map/privateMapLayer.js.map +1 -0
- package/dist/layers/map/vertex.glsl.d.ts +2 -0
- package/dist/layers/map/vertex.glsl.js +45 -0
- package/dist/layers/map/vertex.glsl.js.map +1 -0
- package/dist/layers/map/vertex_lines.glsl.d.ts +2 -0
- package/dist/layers/map/vertex_lines.glsl.js +16 -0
- package/dist/layers/map/vertex_lines.glsl.js.map +1 -0
- package/dist/layers/map/webworker.d.ts +4 -0
- package/dist/layers/map/webworker.js +362 -0
- package/dist/layers/map/webworker.js.map +1 -0
- package/dist/layers/northarrow/northArrow3DLayer.d.ts +20 -0
- package/dist/layers/northarrow/northArrow3DLayer.js +144 -0
- package/dist/layers/northarrow/northArrow3DLayer.js.map +1 -0
- package/dist/layers/northarrow/northarrow-fragment.glsl.d.ts +2 -0
- package/dist/layers/northarrow/northarrow-fragment.glsl.js +15 -0
- package/dist/layers/northarrow/northarrow-fragment.glsl.js.map +1 -0
- package/dist/layers/northarrow/northarrow-vertex.glsl.d.ts +2 -0
- package/dist/layers/northarrow/northarrow-vertex.glsl.js +14 -0
- package/dist/layers/northarrow/northarrow-vertex.glsl.js.map +1 -0
- package/dist/layers/piechart/fragment.glsl.d.ts +2 -0
- package/dist/layers/piechart/fragment.glsl.js +43 -0
- package/dist/layers/piechart/fragment.glsl.js.map +1 -0
- package/dist/layers/piechart/pieChartLayer.d.ts +40 -0
- package/dist/layers/piechart/pieChartLayer.js +174 -0
- package/dist/layers/piechart/pieChartLayer.js.map +1 -0
- package/dist/layers/piechart/vertex.glsl.d.ts +2 -0
- package/dist/layers/piechart/vertex.glsl.js +43 -0
- package/dist/layers/piechart/vertex.glsl.js.map +1 -0
- package/dist/layers/points/pointsLayer.d.ts +34 -0
- package/dist/layers/points/pointsLayer.js +78 -0
- package/dist/layers/points/pointsLayer.js.map +1 -0
- package/dist/layers/polylines/polylinesLayer.d.ts +50 -0
- package/dist/layers/polylines/polylinesLayer.js +157 -0
- package/dist/layers/polylines/polylinesLayer.js.map +1 -0
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.d.ts +6 -0
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.js +22 -0
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.js.map +1 -0
- package/dist/layers/shader_modules/decoder.d.ts +15 -0
- package/dist/layers/shader_modules/decoder.fs.glsl.d.ts +2 -0
- package/dist/layers/shader_modules/decoder.fs.glsl.js +40 -0
- package/dist/layers/shader_modules/decoder.fs.glsl.js.map +1 -0
- package/dist/layers/shader_modules/decoder.js +29 -0
- package/dist/layers/shader_modules/decoder.js.map +1 -0
- package/dist/layers/shader_modules/index.d.ts +1 -0
- package/dist/layers/shader_modules/index.js +2 -0
- package/dist/layers/shader_modules/index.js.map +1 -0
- package/dist/layers/terrain/map3DLayer.d.ts +42 -0
- package/dist/layers/terrain/map3DLayer.js +324 -0
- package/dist/layers/terrain/map3DLayer.js.map +1 -0
- package/dist/layers/terrain/terrainMapLayer.d.ts +45 -0
- package/dist/layers/terrain/terrainMapLayer.js +183 -0
- package/dist/layers/terrain/terrainMapLayer.js.map +1 -0
- package/dist/layers/terrain/terrainmap.fs.glsl.d.ts +2 -0
- package/dist/layers/terrain/terrainmap.fs.glsl.js +134 -0
- package/dist/layers/terrain/terrainmap.fs.glsl.js.map +1 -0
- package/dist/layers/triangle/fragment.fs.glsl.d.ts +2 -0
- package/dist/layers/triangle/fragment.fs.glsl.js +126 -0
- package/dist/layers/triangle/fragment.fs.glsl.js.map +1 -0
- package/dist/layers/triangle/fragment_lines.glsl.d.ts +2 -0
- package/dist/layers/triangle/fragment_lines.glsl.js +21 -0
- package/dist/layers/triangle/fragment_lines.glsl.js.map +1 -0
- package/dist/layers/triangle/privateTriangleLayer.d.ts +70 -0
- package/dist/layers/triangle/privateTriangleLayer.js +108 -0
- package/dist/layers/triangle/privateTriangleLayer.js.map +1 -0
- package/dist/layers/triangle/test_data/surfacePoints.d.ts +2 -0
- package/dist/layers/triangle/test_data/surfacePoints.js +4345 -0
- package/dist/layers/triangle/test_data/surfacePoints.js.map +1 -0
- package/dist/layers/triangle/test_data/surfaceTriangles.d.ts +2 -0
- package/dist/layers/triangle/test_data/surfaceTriangles.js +7393 -0
- package/dist/layers/triangle/test_data/surfaceTriangles.js.map +1 -0
- package/dist/layers/triangle/triangleLayer.d.ts +60 -0
- package/dist/layers/triangle/triangleLayer.js +170 -0
- package/dist/layers/triangle/triangleLayer.js.map +1 -0
- package/dist/layers/triangle/vertex.glsl.d.ts +2 -0
- package/dist/layers/triangle/vertex.glsl.js +35 -0
- package/dist/layers/triangle/vertex.glsl.js.map +1 -0
- package/dist/layers/triangle/vertex_lines.glsl.d.ts +2 -0
- package/dist/layers/triangle/vertex_lines.glsl.js +16 -0
- package/dist/layers/triangle/vertex_lines.glsl.js.map +1 -0
- package/dist/layers/triangle/webworker.d.ts +4 -0
- package/dist/layers/triangle/webworker.js +132 -0
- package/dist/layers/triangle/webworker.js.map +1 -0
- package/dist/layers/utils/layerTools.d.ts +52 -0
- package/dist/layers/utils/layerTools.js +91 -0
- package/dist/layers/utils/layerTools.js.map +1 -0
- package/dist/layers/utils/propertyMapTools.d.ts +8 -0
- package/dist/layers/utils/propertyMapTools.js +21 -0
- package/dist/layers/utils/propertyMapTools.js.map +1 -0
- package/dist/layers/wells/utils/spline.d.ts +28 -0
- package/dist/layers/wells/utils/spline.js +236 -0
- package/dist/layers/wells/utils/spline.js.map +1 -0
- package/dist/layers/wells/wellsLayer.d.ts +89 -0
- package/dist/layers/wells/wellsLayer.js +939 -0
- package/dist/layers/wells/wellsLayer.js.map +1 -0
- package/dist/package.json +35 -0
- package/dist/redux/actions.d.ts +1 -0
- package/dist/redux/actions.js +3 -0
- package/dist/redux/actions.js.map +1 -0
- package/dist/redux/reducer.d.ts +11 -0
- package/dist/redux/reducer.js +28 -0
- package/dist/redux/reducer.js.map +1 -0
- package/dist/redux/store.d.ts +4 -0
- package/dist/redux/store.js +10 -0
- package/dist/redux/store.js.map +1 -0
- package/dist/redux/types.d.ts +43 -0
- package/dist/redux/types.js +79 -0
- package/dist/redux/types.js.map +1 -0
- package/dist/storybook/SubsurfaceViewer.stories.d.ts +455 -0
- package/dist/storybook/SubsurfaceViewer.stories.js +537 -0
- package/dist/storybook/SubsurfaceViewer.stories.js.map +1 -0
- package/dist/storybook/components/InfoCard.stories.d.ts +48 -0
- package/dist/storybook/components/InfoCard.stories.js +36 -0
- package/dist/storybook/components/InfoCard.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/ContinuousLegend.stories.d.ts +31 -0
- package/dist/storybook/components/colorLegends/ContinuousLegend.stories.js +30 -0
- package/dist/storybook/components/colorLegends/ContinuousLegend.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/DiscreteLegend.stories.d.ts +31 -0
- package/dist/storybook/components/colorLegends/DiscreteLegend.stories.js +30 -0
- package/dist/storybook/components/colorLegends/DiscreteLegend.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/IndividualScaleForMap.stories.d.ts +20 -0
- package/dist/storybook/components/colorLegends/IndividualScaleForMap.stories.js +66 -0
- package/dist/storybook/components/colorLegends/IndividualScaleForMap.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/SingleScaleForMap.stories.d.ts +65 -0
- package/dist/storybook/components/colorLegends/SingleScaleForMap.stories.js +94 -0
- package/dist/storybook/components/colorLegends/SingleScaleForMap.stories.js.map +1 -0
- package/dist/storybook/components/settings/LayerSettingsButton.stories.d.ts +34 -0
- package/dist/storybook/components/settings/LayerSettingsButton.stories.js +31 -0
- package/dist/storybook/components/settings/LayerSettingsButton.stories.js.map +1 -0
- package/dist/storybook/components/settings/NumericInput.stories.d.ts +14 -0
- package/dist/storybook/components/settings/NumericInput.stories.js +15 -0
- package/dist/storybook/components/settings/NumericInput.stories.js.map +1 -0
- package/dist/storybook/components/settings/ToggleButton.stories.d.ts +13 -0
- package/dist/storybook/components/settings/ToggleButton.stories.js +14 -0
- package/dist/storybook/components/settings/ToggleButton.stories.js.map +1 -0
- package/dist/storybook/schemaValidation/sampleData.d.ts +122 -0
- package/dist/storybook/schemaValidation/sampleData.js +172 -0
- package/dist/storybook/schemaValidation/sampleData.js.map +1 -0
- package/dist/storybook/schemaValidation/schemaValidation.stories.d.ts +31 -0
- package/dist/storybook/schemaValidation/schemaValidation.stories.js +42 -0
- package/dist/storybook/schemaValidation/schemaValidation.stories.js.map +1 -0
- package/dist/utils/configuration.d.ts +631 -0
- package/dist/utils/configuration.js +36 -0
- package/dist/utils/configuration.js.map +1 -0
- package/dist/utils/fit-bounds.d.ts +15 -0
- package/dist/utils/fit-bounds.js +66 -0
- package/dist/utils/fit-bounds.js.map +1 -0
- package/dist/utils/measurement.d.ts +6 -0
- package/dist/utils/measurement.js +47 -0
- package/dist/utils/measurement.js.map +1 -0
- package/dist/utils/northArrow.d.ts +113 -0
- package/dist/utils/northArrow.js +5 -0
- package/dist/utils/northArrow.js.map +1 -0
- package/dist/utils/specExtractor.d.ts +3 -0
- package/dist/utils/specExtractor.js +24 -0
- package/dist/utils/specExtractor.js.map +1 -0
- package/dist/viewports/index.d.ts +1 -0
- package/dist/viewports/index.js +2 -0
- package/dist/viewports/index.js.map +1 -0
- package/dist/viewports/intersectionViewport.d.ts +35 -0
- package/dist/viewports/intersectionViewport.js +65 -0
- package/dist/viewports/intersectionViewport.js.map +1 -0
- package/dist/views/index.d.ts +1 -0
- package/dist/views/index.js +2 -0
- package/dist/views/index.js.map +1 -0
- package/dist/views/intersectionView.d.ts +18 -0
- package/dist/views/intersectionView.js +17 -0
- package/dist/views/intersectionView.js.map +1 -0
- package/package.json +35 -0
- package/src/DashSubsurfaceViewer.tsx +270 -0
- package/src/SubsurfaceViewer.stories.tsx +449 -0
- package/src/SubsurfaceViewer.test.tsx +98 -0
- package/src/SubsurfaceViewer.tsx +356 -0
- package/src/__snapshots__/SubsurfaceViewer.test.tsx.snap +178 -0
- package/src/assets/glTF/north_arrow/scene.bin +0 -0
- package/src/assets/glTF/north_arrow/scene.gltf +315 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_baseColor.png +0 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_metallicRoughness.png +0 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_normal.png +0 -0
- package/src/components/ColorLegend.test.tsx +32 -0
- package/src/components/ColorLegend.tsx +80 -0
- package/src/components/ColorLegends.test.tsx +97 -0
- package/src/components/ColorLegends.tsx +46 -0
- package/src/components/DistanceScale.stories.tsx +28 -0
- package/src/components/DistanceScale.test.tsx +36 -0
- package/src/components/DistanceScale.tsx +84 -0
- package/src/components/InfoCard.test.tsx +110 -0
- package/src/components/InfoCard.tsx +263 -0
- package/src/components/Map.test.tsx +142 -0
- package/src/components/Map.tsx +1435 -0
- package/src/components/StatusIndicator.test.tsx +14 -0
- package/src/components/StatusIndicator.tsx +38 -0
- package/src/components/ViewAnnotation.tsx +16 -0
- package/src/components/ViewFooter.test.tsx +12 -0
- package/src/components/ViewFooter.tsx +30 -0
- package/src/components/__snapshots__/ColorLegends.test.tsx.snap +15 -0
- package/src/components/__snapshots__/DistanceScale.test.tsx.snap +33 -0
- package/src/components/__snapshots__/InfoCard.test.tsx.snap +561 -0
- package/src/components/__snapshots__/Map.test.tsx.snap +119 -0
- package/src/components/__snapshots__/StatusIndicator.test.tsx.snap +3 -0
- package/src/components/__snapshots__/ViewFooter.test.tsx.snap +7 -0
- package/src/components/settings/DrawModeSelector.test.tsx +45 -0
- package/src/components/settings/DrawModeSelector.tsx +58 -0
- package/src/components/settings/DrawModeSelector_performance.test.tsx +35 -0
- package/src/components/settings/LayerProperty.test.tsx +35 -0
- package/src/components/settings/LayerProperty.tsx +153 -0
- package/src/components/settings/LayerProperty_performance.test.tsx +39 -0
- package/src/components/settings/LayerSettingsButton.test.tsx +133 -0
- package/src/components/settings/LayerSettingsButton.tsx +95 -0
- package/src/components/settings/LayersButton.test.tsx +102 -0
- package/src/components/settings/LayersButton.tsx +97 -0
- package/src/components/settings/NumericInput.test.tsx +25 -0
- package/src/components/settings/NumericInput.tsx +67 -0
- package/src/components/settings/Settings.tsx +71 -0
- package/src/components/settings/SliderInput.test.tsx +28 -0
- package/src/components/settings/SliderInput.tsx +71 -0
- package/src/components/settings/ToggleButton.test.tsx +25 -0
- package/src/components/settings/ToggleButton.tsx +53 -0
- package/src/components/settings/__snapshots__/DrawModeSelector.test.tsx.snap +124 -0
- package/src/components/settings/__snapshots__/LayerProperty.test.tsx.snap +124 -0
- package/src/components/settings/__snapshots__/LayerSettingsButton.test.tsx.snap +36 -0
- package/src/components/settings/__snapshots__/LayersButton.test.tsx.snap +83 -0
- package/src/components/settings/__snapshots__/NumericInput.test.tsx.snap +123 -0
- package/src/components/settings/__snapshots__/SliderInput.test.tsx.snap +244 -0
- package/src/components/settings/__snapshots__/ToggleButton.test.tsx.snap +182 -0
- package/src/custom.d.ts +9 -0
- package/src/index.ts +5 -0
- package/src/inputSchema/ColorTables.json +51 -0
- package/src/inputSchema/FaultPolygons.json +80 -0
- package/src/inputSchema/Grid.json +39 -0
- package/src/inputSchema/PieChart.json +72 -0
- package/src/inputSchema/WellLog.json +126 -0
- package/src/inputSchema/WellLogTemplate.json +136 -0
- package/src/inputSchema/WellLogs.json +5 -0
- package/src/inputSchema/Wells.json +106 -0
- package/src/inputSchema/schemaValidationUtil.tsx +55 -0
- package/src/inputSchema/validator.tsx +72 -0
- package/src/inputSchema/wellCompletions.json +108 -0
- package/src/layers/BoxSelectionLayer/boxSelectionLayer.stories.tsx +172 -0
- package/src/layers/BoxSelectionLayer/boxSelectionLayer.tsx +136 -0
- package/src/layers/axes/axes-fragment.glsl.ts +15 -0
- package/src/layers/axes/axesLayer.stories.tsx +87 -0
- package/src/layers/axes/axesLayer.ts +692 -0
- package/src/layers/axes/boxLayer.ts +71 -0
- package/src/layers/axes/grid-vertex.glsl.ts +14 -0
- package/src/layers/axes2d/axes2DLayer.stories.tsx +150 -0
- package/src/layers/axes2d/axes2DLayer.ts +841 -0
- package/src/layers/axes2d/font-atlas.png +0 -0
- package/src/layers/axes2d/label-fragment.glsl.js +37 -0
- package/src/layers/axes2d/label-vertex.glsl.js +20 -0
- package/src/layers/axes2d/line-fragment.glsl.js +14 -0
- package/src/layers/axes2d/line-vertex.glsl.js +13 -0
- package/src/layers/colormap/colormap.fs.glsl.ts +42 -0
- package/src/layers/colormap/colormapLayer.ts +247 -0
- package/src/layers/drawing/drawingLayer.tsx +256 -0
- package/src/layers/fault_polygons/faultPolygonsLayer.ts +54 -0
- package/src/layers/grid3d/fragment.fs.glsl.ts +109 -0
- package/src/layers/grid3d/fragment_lines.glsl.ts +21 -0
- package/src/layers/grid3d/grid3dLayer.stories.tsx +172 -0
- package/src/layers/grid3d/grid3dLayer.ts +248 -0
- package/src/layers/grid3d/privateLayer.ts +292 -0
- package/src/layers/grid3d/vertex.glsl.ts +43 -0
- package/src/layers/grid3d/vertex_lines.glsl.ts +15 -0
- package/src/layers/grid3d/webworker.ts +173 -0
- package/src/layers/hillshading2d/hillshading2d.fs.glsl.ts +62 -0
- package/src/layers/hillshading2d/hillshading2dLayer.ts +172 -0
- package/src/layers/index.ts +35 -0
- package/src/layers/intersection/intersectionView.stories.tsx +294 -0
- package/src/layers/intersection/unfoldedGeoJsonLayer.ts +92 -0
- package/src/layers/map/fragment.fs.glsl.ts +127 -0
- package/src/layers/map/fragment_lines.glsl.ts +21 -0
- package/src/layers/map/mapLayer.stories.tsx +1369 -0
- package/src/layers/map/mapLayer.ts +470 -0
- package/src/layers/map/privateMapLayer.ts +317 -0
- package/src/layers/map/vertex.glsl.ts +45 -0
- package/src/layers/map/vertex_lines.glsl.ts +15 -0
- package/src/layers/map/webworker.ts +479 -0
- package/src/layers/northarrow/northArrow.stories.tsx +108 -0
- package/src/layers/northarrow/northArrow3DLayer.ts +204 -0
- package/src/layers/northarrow/northarrow-fragment.glsl.js +14 -0
- package/src/layers/northarrow/northarrow-vertex.glsl.js +13 -0
- package/src/layers/piechart/fragment.glsl.js +42 -0
- package/src/layers/piechart/pieChartLayer.ts +246 -0
- package/src/layers/piechart/vertex.glsl.js +42 -0
- package/src/layers/points/pointsLayer.stories.tsx +141 -0
- package/src/layers/points/pointsLayer.ts +143 -0
- package/src/layers/polylines/polylinesLayer.stories.tsx +144 -0
- package/src/layers/polylines/polylinesLayer.ts +263 -0
- package/src/layers/selectable_geojson/selectableGeoJsonLayer.ts +25 -0
- package/src/layers/shader_modules/decoder.fs.glsl.ts +41 -0
- package/src/layers/shader_modules/decoder.ts +46 -0
- package/src/layers/shader_modules/index.ts +1 -0
- package/src/layers/terrain/map3DLayer.stories.tsx +340 -0
- package/src/layers/terrain/map3DLayer.ts +556 -0
- package/src/layers/terrain/terrainMapLayer.ts +334 -0
- package/src/layers/terrain/terrainmap.fs.glsl.ts +134 -0
- package/src/layers/triangle/fragment.fs.glsl.ts +126 -0
- package/src/layers/triangle/fragment_lines.glsl.ts +21 -0
- package/src/layers/triangle/privateTriangleLayer.ts +203 -0
- package/src/layers/triangle/test_data/surfacePoints.ts +4344 -0
- package/src/layers/triangle/test_data/surfaceTriangles.ts +7392 -0
- package/src/layers/triangle/triangleLayer.stories.tsx +191 -0
- package/src/layers/triangle/triangleLayer.ts +273 -0
- package/src/layers/triangle/vertex.glsl.ts +35 -0
- package/src/layers/triangle/vertex_lines.glsl.ts +15 -0
- package/src/layers/triangle/webworker.ts +165 -0
- package/src/layers/utils/glsl.d.ts +4 -0
- package/src/layers/utils/layerTools.ts +182 -0
- package/src/layers/utils/propertyMapTools.ts +43 -0
- package/src/layers/wells/utils/spline.ts +318 -0
- package/src/layers/wells/wellsLayer.stories.tsx +625 -0
- package/src/layers/wells/wellsLayer.ts +1377 -0
- package/src/redux/actions.ts +8 -0
- package/src/redux/reducer.ts +43 -0
- package/src/redux/store.ts +15 -0
- package/src/redux/types.ts +114 -0
- package/src/storybook/SubsurfaceViewer.stories.jsx +644 -0
- package/src/storybook/components/InfoCard.stories.jsx +39 -0
- package/src/storybook/components/colorLegends/ContinuousLegend.stories.jsx +32 -0
- package/src/storybook/components/colorLegends/DiscreteLegend.stories.jsx +33 -0
- package/src/storybook/components/colorLegends/IndividualScaleForMap.stories.jsx +99 -0
- package/src/storybook/components/colorLegends/SingleScaleForMap.stories.jsx +120 -0
- package/src/storybook/components/settings/LayerSettingsButton.stories.jsx +34 -0
- package/src/storybook/components/settings/NumericInput.stories.jsx +17 -0
- package/src/storybook/components/settings/ToggleButton.stories.jsx +16 -0
- package/src/storybook/schemaValidation/sampleData.js +177 -0
- package/src/storybook/schemaValidation/schemaValidation.stories.jsx +91 -0
- package/src/test/TestWrapper.tsx +13 -0
- package/src/utils/configuration.ts +61 -0
- package/src/utils/fit-bounds.js +85 -0
- package/src/utils/measurement.ts +61 -0
- package/src/utils/northArrow.ts +4 -0
- package/src/utils/specExtractor.ts +36 -0
- package/src/viewports/index.js +1 -0
- package/src/viewports/intersectionViewport.ts +137 -0
- package/src/views/index.js +1 -0
- package/src/views/intersectionView.ts +38 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { CompositeLayer } from "@deck.gl/core/typed";
|
|
11
|
+
import TerrainMapLayer, { DECODER } from "./terrainMapLayer";
|
|
12
|
+
import { TerrainLoader } from "@loaders.gl/terrain";
|
|
13
|
+
import { ImageLoader } from "@loaders.gl/images";
|
|
14
|
+
import { load } from "@loaders.gl/core";
|
|
15
|
+
import { Vector3 } from "@math.gl/core";
|
|
16
|
+
import { getModelMatrix } from "../utils/layerTools";
|
|
17
|
+
import { isEqual } from "lodash";
|
|
18
|
+
function getMinMax(dim) {
|
|
19
|
+
const nx = dim.count[0];
|
|
20
|
+
const ny = dim.count[1];
|
|
21
|
+
const dx = dim.increment[0];
|
|
22
|
+
const dy = dim.increment[1];
|
|
23
|
+
const xmin = dim.origin[0];
|
|
24
|
+
const ymin = dim.origin[1];
|
|
25
|
+
const xmax = xmin + nx * dx;
|
|
26
|
+
const ymax = ymin + ny * dy;
|
|
27
|
+
return [xmin, ymin, xmax, ymax];
|
|
28
|
+
}
|
|
29
|
+
function mapToRange(resolved_mesh, meshValueRange) {
|
|
30
|
+
const floatScaler = 1.0 / (256.0 * 256.0 * 256.0 - 1.0);
|
|
31
|
+
const [min, max] = meshValueRange;
|
|
32
|
+
const delta = max - min;
|
|
33
|
+
const vertexs = resolved_mesh.attributes.POSITION.value;
|
|
34
|
+
const nvertexs = vertexs.length / 3;
|
|
35
|
+
for (let i = 0; i < nvertexs; i++) {
|
|
36
|
+
let Z = vertexs[i * 3 + 2];
|
|
37
|
+
Z = Z * floatScaler; // maps to [0-1]
|
|
38
|
+
Z = min + Z * delta;
|
|
39
|
+
vertexs[i * 3 + 2] = -Z; // depths are positive along negative z axis.
|
|
40
|
+
}
|
|
41
|
+
return resolved_mesh;
|
|
42
|
+
}
|
|
43
|
+
function add_normals(resolved_mesh, meshImageData, bounds) {
|
|
44
|
+
const vertexs = resolved_mesh.attributes.POSITION.value;
|
|
45
|
+
let indices = resolved_mesh.indices.value;
|
|
46
|
+
let ntriangles = indices.length / 3;
|
|
47
|
+
////////////////////////////////////////////////////////////////
|
|
48
|
+
// Remove all triangles that are in undefined areas. That is triangles which
|
|
49
|
+
const [xmin, ymin, xmax, ymax] = bounds;
|
|
50
|
+
const w = meshImageData.width;
|
|
51
|
+
const h = meshImageData.height;
|
|
52
|
+
const int_view = new Uint8ClampedArray(meshImageData.data, 0, meshImageData.data.length);
|
|
53
|
+
const dx = (xmax - xmin) / (w - 1);
|
|
54
|
+
const dy = (ymax - ymin) / (h - 1);
|
|
55
|
+
const indices_reduced = [];
|
|
56
|
+
for (let tn = 0; tn < ntriangles; tn++) {
|
|
57
|
+
const i0 = indices[tn * 3 + 0];
|
|
58
|
+
const i1 = indices[tn * 3 + 1];
|
|
59
|
+
const i2 = indices[tn * 3 + 2];
|
|
60
|
+
const triangle_indices = [i0, i1, i2];
|
|
61
|
+
const alphas = triangle_indices.map((index) => {
|
|
62
|
+
const x = vertexs[index * 3 + 0];
|
|
63
|
+
const y = vertexs[index * 3 + 1];
|
|
64
|
+
// Note: assumes increasing 'j' along increasing X axis and Y axis and
|
|
65
|
+
// increasing 'i' along decreasing Y axis.
|
|
66
|
+
// 'j' along image width. 'i' along image height.
|
|
67
|
+
const j = Math.round((x - xmin) / dx);
|
|
68
|
+
const i = h - Math.round((y - ymin) / dy);
|
|
69
|
+
const pixelNo = i * w + j;
|
|
70
|
+
// Check alpha (transparency) for this triangle corner.
|
|
71
|
+
const is_transparent = int_view[pixelNo * 4 + 3] < 255;
|
|
72
|
+
return is_transparent;
|
|
73
|
+
});
|
|
74
|
+
const do_remove = alphas.some((a) => a);
|
|
75
|
+
if (!do_remove) {
|
|
76
|
+
indices_reduced.push(i0);
|
|
77
|
+
indices_reduced.push(i1);
|
|
78
|
+
indices_reduced.push(i2);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
resolved_mesh.indices.value = new Uint32Array(indices_reduced);
|
|
82
|
+
indices = resolved_mesh.indices.value;
|
|
83
|
+
ntriangles = indices.length / 3;
|
|
84
|
+
////////////////////////////////////////////////////////////////
|
|
85
|
+
// Calculate one normal pr triangle. And record the triangles each vertex' belongs to.
|
|
86
|
+
const no_unique_vertexes = vertexs.length / 3;
|
|
87
|
+
const vertex_triangles = Array(no_unique_vertexes); // for each vertex a list of triangles it belongs to.
|
|
88
|
+
for (let i = 0; i < no_unique_vertexes; i++) {
|
|
89
|
+
vertex_triangles[i] = new Set();
|
|
90
|
+
}
|
|
91
|
+
const triangle_normals = Array(ntriangles);
|
|
92
|
+
for (let t = 0; t < ntriangles; t++) {
|
|
93
|
+
const i0 = indices[t * 3 + 0];
|
|
94
|
+
const i1 = indices[t * 3 + 1];
|
|
95
|
+
const i2 = indices[t * 3 + 2];
|
|
96
|
+
vertex_triangles[i0].add(t);
|
|
97
|
+
vertex_triangles[i1].add(t);
|
|
98
|
+
vertex_triangles[i2].add(t);
|
|
99
|
+
// Triangles' three corners.
|
|
100
|
+
const v0 = new Vector3(vertexs[i0 * 3 + 0], vertexs[i0 * 3 + 1], vertexs[i0 * 3 + 2]);
|
|
101
|
+
const v1 = new Vector3(vertexs[i1 * 3 + 0], vertexs[i1 * 3 + 1], vertexs[i1 * 3 + 2]);
|
|
102
|
+
const v2 = new Vector3(vertexs[i2 * 3 + 0], vertexs[i2 * 3 + 1], vertexs[i2 * 3 + 2]);
|
|
103
|
+
const vec1 = v1.subtract(v0);
|
|
104
|
+
const vec2 = v2.subtract(v0);
|
|
105
|
+
const normal = vec1.cross(vec2).normalize();
|
|
106
|
+
triangle_normals[t] = normal;
|
|
107
|
+
}
|
|
108
|
+
// Calculate normals. The vertex normal will be the mean of the normals of every triangle the vertex
|
|
109
|
+
// belongs to.
|
|
110
|
+
const normals = Array(vertexs.length).fill(0.0);
|
|
111
|
+
for (let i = 0; i < no_unique_vertexes; i++) {
|
|
112
|
+
const triangles = [...vertex_triangles[i]];
|
|
113
|
+
// Set normal to mean of all triangle normals.
|
|
114
|
+
const v = triangles.length !== 0
|
|
115
|
+
? triangle_normals[triangles[0]]
|
|
116
|
+
: new Vector3(0.0, 0.0, 1.0);
|
|
117
|
+
for (let t = 1; t < triangles.length; t++) {
|
|
118
|
+
v.add(triangle_normals[triangles[t]]);
|
|
119
|
+
}
|
|
120
|
+
v.normalize();
|
|
121
|
+
const idx = i * 3;
|
|
122
|
+
normals[idx + 0] = v[0];
|
|
123
|
+
normals[idx + 1] = v[1];
|
|
124
|
+
normals[idx + 2] = v[2];
|
|
125
|
+
}
|
|
126
|
+
resolved_mesh.attributes.normals = {
|
|
127
|
+
value: new Float32Array(normals),
|
|
128
|
+
size: 3,
|
|
129
|
+
};
|
|
130
|
+
return resolved_mesh;
|
|
131
|
+
}
|
|
132
|
+
function load_mesh_and_texture(mesh_name, bounds, meshMaxError, meshValueRange, smoothShading, texture_name) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const isMesh = mesh_name !== "";
|
|
135
|
+
const isTexture = texture_name !== "";
|
|
136
|
+
if (!isMesh && !isTexture) {
|
|
137
|
+
console.error("Error. One or both of texture and mesh must be given!");
|
|
138
|
+
}
|
|
139
|
+
const image_name = isTexture ? texture_name : mesh_name;
|
|
140
|
+
const texture = yield load(image_name, ImageLoader, {
|
|
141
|
+
image: { type: "data" }, // Will load as ImageData.
|
|
142
|
+
});
|
|
143
|
+
let meshImageData = null;
|
|
144
|
+
let mesh;
|
|
145
|
+
if (isMesh) {
|
|
146
|
+
mesh = yield load(mesh_name, TerrainLoader, {
|
|
147
|
+
terrain: {
|
|
148
|
+
elevationDecoder: DECODER,
|
|
149
|
+
bounds,
|
|
150
|
+
meshMaxError,
|
|
151
|
+
skirtHeight: 0.0,
|
|
152
|
+
},
|
|
153
|
+
worker: false,
|
|
154
|
+
});
|
|
155
|
+
// Remap height to meshValueRange
|
|
156
|
+
mesh = mapToRange(mesh, meshValueRange);
|
|
157
|
+
meshImageData = yield load(mesh_name, ImageLoader, {
|
|
158
|
+
image: { type: "data" }, // Will load as ImageData.
|
|
159
|
+
});
|
|
160
|
+
// Note: mesh contains triangles. No normals they must be added.
|
|
161
|
+
if (smoothShading && meshImageData) {
|
|
162
|
+
mesh = add_normals(mesh, meshImageData, bounds);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// Mesh data is missing.
|
|
167
|
+
// Make a flat square size of enclosing dim using two triangles. z = 0.
|
|
168
|
+
const [minX, minY, maxX, maxY] = bounds;
|
|
169
|
+
const p0 = [minX, minY, 0.0];
|
|
170
|
+
const p1 = [minX, maxY, 0.0];
|
|
171
|
+
const p2 = [maxX, maxY, 0.0];
|
|
172
|
+
const p3 = [maxX, minY, 0.0];
|
|
173
|
+
const vertexes = [...p0, ...p1, ...p2, ...p3];
|
|
174
|
+
const texture_coord = [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0];
|
|
175
|
+
mesh = {
|
|
176
|
+
attributes: {
|
|
177
|
+
POSITION: { value: new Float32Array(vertexes), size: 3 },
|
|
178
|
+
TEXCOORD_0: { value: new Float32Array(texture_coord), size: 2 },
|
|
179
|
+
},
|
|
180
|
+
indices: { value: new Uint32Array([0, 1, 3, 1, 3, 2]), size: 1 },
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return Promise.all([mesh, meshImageData, texture]);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const defaultProps = {
|
|
187
|
+
"@@type": "Map3DLayer",
|
|
188
|
+
name: "Map 3D",
|
|
189
|
+
id: "map3d-layer",
|
|
190
|
+
pickable: true,
|
|
191
|
+
visible: true,
|
|
192
|
+
// Url to png image for height field.
|
|
193
|
+
mesh: "",
|
|
194
|
+
meshValueRange: { type: "array", value: [0, 1] },
|
|
195
|
+
// Mesh error in meters. The output mesh is in higher resolution (more vertices) if the error is smaller.
|
|
196
|
+
meshMaxError: { type: "number", value: 5 },
|
|
197
|
+
// Url to png image for map properties. (ex, poro or perm values as a texture)
|
|
198
|
+
propertyTexture: "",
|
|
199
|
+
propertyValueRange: { type: "array", value: [0, 1] },
|
|
200
|
+
contours: [-1.0, -1.0],
|
|
201
|
+
// If contour lines should follow depth or properties.
|
|
202
|
+
isContoursDepth: true,
|
|
203
|
+
smoothShading: true,
|
|
204
|
+
material: true,
|
|
205
|
+
depthTest: true,
|
|
206
|
+
};
|
|
207
|
+
export default class Map3DLayer extends CompositeLayer {
|
|
208
|
+
initializeState() {
|
|
209
|
+
// Load mesh and texture and store in state.
|
|
210
|
+
const isBounds = typeof this.props.bounds !== "undefined";
|
|
211
|
+
if (isBounds) {
|
|
212
|
+
console.warn('"bounds" is deprecated. Use "frame" instead.');
|
|
213
|
+
}
|
|
214
|
+
const isFrame = typeof this.props.frame !== "undefined";
|
|
215
|
+
if (!isBounds && !isFrame) {
|
|
216
|
+
console.error('Error. Either "Frame" or "bounds" must be given for map3DLayer!');
|
|
217
|
+
}
|
|
218
|
+
const bounds = (isFrame ? getMinMax(this.props.frame) : this.props.bounds);
|
|
219
|
+
const p = load_mesh_and_texture(this.props.mesh, bounds, this.props.meshMaxError, this.props.meshValueRange, this.props.smoothShading, this.props.propertyTexture);
|
|
220
|
+
p.then(([mesh, meshImageData, texture]) => {
|
|
221
|
+
this.setState({
|
|
222
|
+
mesh,
|
|
223
|
+
meshImageData,
|
|
224
|
+
texture,
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
// Report back calculated bounding box now that data is loaded.
|
|
228
|
+
p.then(() => {
|
|
229
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
230
|
+
const xinc = (_c = (_b = (_a = this.props.frame) === null || _a === void 0 ? void 0 : _a.increment) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : 0;
|
|
231
|
+
const yinc = (_f = (_e = (_d = this.props.frame) === null || _d === void 0 ? void 0 : _d.increment) === null || _e === void 0 ? void 0 : _e[1]) !== null && _f !== void 0 ? _f : 0;
|
|
232
|
+
const xcount = (_j = (_h = (_g = this.props.frame) === null || _g === void 0 ? void 0 : _g.count) === null || _h === void 0 ? void 0 : _h[0]) !== null && _j !== void 0 ? _j : 1;
|
|
233
|
+
const ycount = (_m = (_l = (_k = this.props.frame) === null || _k === void 0 ? void 0 : _k.count) === null || _l === void 0 ? void 0 : _l[1]) !== null && _m !== void 0 ? _m : 1;
|
|
234
|
+
const xMin = (_q = (_p = (_o = this.props.frame) === null || _o === void 0 ? void 0 : _o.origin) === null || _p === void 0 ? void 0 : _p[0]) !== null && _q !== void 0 ? _q : bounds[0];
|
|
235
|
+
const yMin = (_t = (_s = (_r = this.props.frame) === null || _r === void 0 ? void 0 : _r.origin) === null || _s === void 0 ? void 0 : _s[1]) !== null && _t !== void 0 ? _t : bounds[1];
|
|
236
|
+
const zMin = -this.props.meshValueRange[1];
|
|
237
|
+
const xMax = isFrame ? xMin + xinc * xcount : bounds[2];
|
|
238
|
+
const yMax = isFrame ? yMin + yinc * ycount : bounds[3];
|
|
239
|
+
const zMax = -this.props.meshValueRange[0];
|
|
240
|
+
if (typeof this.props.setReportedBoundingBox !== "undefined") {
|
|
241
|
+
this.props.setReportedBoundingBox([
|
|
242
|
+
xMin,
|
|
243
|
+
yMin,
|
|
244
|
+
zMin,
|
|
245
|
+
xMax,
|
|
246
|
+
yMax,
|
|
247
|
+
zMax,
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
updateState({ props, oldProps, }) {
|
|
253
|
+
const needs_reload = !isEqual(props.mesh, oldProps.mesh) ||
|
|
254
|
+
!isEqual(props.bounds, oldProps.bounds) ||
|
|
255
|
+
!isEqual(props.frame, oldProps.frame) ||
|
|
256
|
+
!isEqual(props.meshMaxError, oldProps.meshMaxError) ||
|
|
257
|
+
!isEqual(props.meshValueRange, oldProps.meshValueRange) ||
|
|
258
|
+
!isEqual(props.smoothShading, oldProps.smoothShading) ||
|
|
259
|
+
!isEqual(props.propertyTexture, oldProps.propertyTexture);
|
|
260
|
+
if (needs_reload) {
|
|
261
|
+
// Reload mesh and texture.
|
|
262
|
+
this.initializeState();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
renderLayers() {
|
|
266
|
+
var _a, _b, _c, _d;
|
|
267
|
+
const isBounds = typeof this.props.bounds !== "undefined";
|
|
268
|
+
const bounds = (isBounds ? this.props.bounds : getMinMax(this.props.frame));
|
|
269
|
+
// Note: these are deprecated so this code may be deleted later.
|
|
270
|
+
const isRotDegDefined = typeof this.props.rotDeg !== "undefined";
|
|
271
|
+
const isRotPointDefined = typeof this.props.rotPoint !== "undefined";
|
|
272
|
+
if (isRotDegDefined) {
|
|
273
|
+
console.warn('"rotDeg" is deprecated. Use "frame.rotDeg" instead.');
|
|
274
|
+
}
|
|
275
|
+
if (isRotPointDefined) {
|
|
276
|
+
console.warn('"rotPoint" is deprecated. Use "frame.rotPoint" instead.');
|
|
277
|
+
}
|
|
278
|
+
const [minX, minY] = [bounds[0], bounds[1]];
|
|
279
|
+
const center = (_b = (_a = this.props.frame) === null || _a === void 0 ? void 0 : _a.rotPoint) !== null && _b !== void 0 ? _b : (isRotPointDefined ? this.props.rotPoint : [minX, minY]);
|
|
280
|
+
const rotatingModelMatrix = getModelMatrix((_d = (_c = this.props.frame) === null || _c === void 0 ? void 0 : _c.rotDeg) !== null && _d !== void 0 ? _d : (isRotDegDefined ? this.props.rotDeg : 0), center[0], center[1]);
|
|
281
|
+
const isModelMatrix = typeof this.props.modelMatrix !== "undefined" &&
|
|
282
|
+
this.props.modelMatrix !== null;
|
|
283
|
+
if (isModelMatrix) {
|
|
284
|
+
rotatingModelMatrix.multiplyRight(this.props.modelMatrix);
|
|
285
|
+
}
|
|
286
|
+
const isMesh = typeof this.props.mesh !== "undefined" && this.props.mesh !== "";
|
|
287
|
+
const layer = new TerrainMapLayer(this.getSubLayerProps({
|
|
288
|
+
mesh: this.state["mesh"],
|
|
289
|
+
texture: this.state["texture"],
|
|
290
|
+
textureImageData: this.state["texture"],
|
|
291
|
+
meshImageData: this.state["meshImageData"],
|
|
292
|
+
meshValueRange: this.props.meshValueRange,
|
|
293
|
+
pickable: this.props.pickable,
|
|
294
|
+
modelMatrix: rotatingModelMatrix,
|
|
295
|
+
contours: this.props.contours,
|
|
296
|
+
colorMapName: this.props.colorMapName,
|
|
297
|
+
colorMapFunction: this.props.colorMapFunction,
|
|
298
|
+
propertyValueRange: this.props.propertyValueRange,
|
|
299
|
+
colorMapRange: this.props.colorMapRange,
|
|
300
|
+
colorMapClampColor: this.props.colorMapClampColor,
|
|
301
|
+
isContoursDepth: !isMesh ? false : this.props.isContoursDepth,
|
|
302
|
+
material: this.props.material,
|
|
303
|
+
wireframe: false,
|
|
304
|
+
depthTest: this.props.depthTest,
|
|
305
|
+
}));
|
|
306
|
+
return [layer];
|
|
307
|
+
}
|
|
308
|
+
getLegendData() {
|
|
309
|
+
const colorRange = this.props.colorMapRange;
|
|
310
|
+
const propertyRange = this.props.propertyTexture && this.props.propertyValueRange;
|
|
311
|
+
const meshRange = this.props.mesh && this.props.meshValueRange;
|
|
312
|
+
const legendRange = colorRange || propertyRange || meshRange;
|
|
313
|
+
return {
|
|
314
|
+
discrete: false,
|
|
315
|
+
valueRange: legendRange,
|
|
316
|
+
colorName: this.props.colorMapName,
|
|
317
|
+
title: "Map3dLayer",
|
|
318
|
+
colorMapFunction: this.props.colorMapFunction,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
Map3DLayer.layerName = "Map3DLayer";
|
|
323
|
+
Map3DLayer.defaultProps = defaultProps;
|
|
324
|
+
//# sourceMappingURL=map3DLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map3DLayer.js","sourceRoot":"","sources":["../../../src/layers/terrain/map3DLayer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,eAAe,EAAE,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAgCjC,SAAS,SAAS,CAAC,GAAU;IACzB,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAE5B,MAAM,IAAI,G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leMeshLayer, SimpleMeshLayerProps } from "@deck.gl/mesh-layers/typed";
|
|
2
|
+
import { Color, PickingInfo } from "@deck.gl/core/typed";
|
|
3
|
+
import { PropertyDataType, colorMapFunctionType } from "../utils/layerTools";
|
|
4
|
+
export type Material = {
|
|
5
|
+
ambient: number;
|
|
6
|
+
diffuse: number;
|
|
7
|
+
shininess: number;
|
|
8
|
+
specularColor: [number, number, number];
|
|
9
|
+
} | boolean;
|
|
10
|
+
export declare const DECODER: {
|
|
11
|
+
rScaler: number;
|
|
12
|
+
gScaler: number;
|
|
13
|
+
bScaler: number;
|
|
14
|
+
offset: number;
|
|
15
|
+
};
|
|
16
|
+
export type DataItem = {
|
|
17
|
+
position: [number, number];
|
|
18
|
+
angle: number;
|
|
19
|
+
color: [number, number, number];
|
|
20
|
+
};
|
|
21
|
+
export type TerrainMapLayerData = [DataItem?];
|
|
22
|
+
export interface TerrainMapLayerProps<D> extends SimpleMeshLayerProps<D> {
|
|
23
|
+
textureImageData: ImageData;
|
|
24
|
+
meshImageData: ImageData;
|
|
25
|
+
meshValueRange: [number, number];
|
|
26
|
+
contours: [number, number];
|
|
27
|
+
isContoursDepth: boolean;
|
|
28
|
+
colorMapName: string;
|
|
29
|
+
colorMapFunction?: colorMapFunctionType;
|
|
30
|
+
propertyValueRange: [number, number];
|
|
31
|
+
colorMapRange: [number, number];
|
|
32
|
+
colorMapClampColor: Color | undefined | boolean;
|
|
33
|
+
depthTest: boolean;
|
|
34
|
+
}
|
|
35
|
+
export default class TerrainMapLayer extends SimpleMeshLayer<TerrainMapLayerData, TerrainMapLayerProps<TerrainMapLayerData>> {
|
|
36
|
+
properties?: PropertyDataType[];
|
|
37
|
+
draw({ uniforms, context }: any): void;
|
|
38
|
+
getShaders(): unknown;
|
|
39
|
+
decodePickingColor(): number;
|
|
40
|
+
getPickingInfo({ info }: {
|
|
41
|
+
info: PickingInfo;
|
|
42
|
+
}): PickingInfo & {
|
|
43
|
+
properties?: PropertyDataType[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { SimpleMeshLayer, } from "@deck.gl/mesh-layers/typed";
|
|
2
|
+
import { COORDINATE_SYSTEM } from "@deck.gl/core/typed";
|
|
3
|
+
import fsShader from "./terrainmap.fs.glsl";
|
|
4
|
+
import GL from "@luma.gl/constants";
|
|
5
|
+
import { Texture2D } from "@luma.gl/webgl";
|
|
6
|
+
import { rgbValues } from "@emerson-eps/color-tables/";
|
|
7
|
+
import { createDefaultContinuousColorScale } from "@emerson-eps/color-tables/dist/component/Utils/legendCommonFunction";
|
|
8
|
+
import { createPropertyData, } from "../utils/layerTools";
|
|
9
|
+
const DEFAULT_TEXTURE_PARAMETERS = {
|
|
10
|
+
[GL.TEXTURE_MIN_FILTER]: GL.LINEAR_MIPMAP_LINEAR,
|
|
11
|
+
[GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
12
|
+
[GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
13
|
+
[GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE,
|
|
14
|
+
};
|
|
15
|
+
export const DECODER = {
|
|
16
|
+
rScaler: 256 * 256,
|
|
17
|
+
gScaler: 256,
|
|
18
|
+
bScaler: 1,
|
|
19
|
+
offset: 0,
|
|
20
|
+
};
|
|
21
|
+
function getImageData(colorMapName, colorTables, colorMapFunction) {
|
|
22
|
+
const isColorMapFunctionDefined = typeof colorMapFunction !== "undefined";
|
|
23
|
+
const isColorMapNameDefined = !!colorMapName;
|
|
24
|
+
const data = new Uint8Array(256 * 3);
|
|
25
|
+
const defaultColorMap = createDefaultContinuousColorScale;
|
|
26
|
+
const colorMap = isColorMapFunctionDefined
|
|
27
|
+
? colorMapFunction
|
|
28
|
+
: isColorMapNameDefined
|
|
29
|
+
? (value) => rgbValues(value, colorMapName, colorTables)
|
|
30
|
+
: defaultColorMap();
|
|
31
|
+
for (let i = 0; i < 256; i++) {
|
|
32
|
+
const value = i / 255.0;
|
|
33
|
+
const color = colorMap ? colorMap(value) : [0, 0, 0];
|
|
34
|
+
if (color) {
|
|
35
|
+
data[3 * i + 0] = color[0];
|
|
36
|
+
data[3 * i + 1] = color[1];
|
|
37
|
+
data[3 * i + 2] = color[2];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return data ? data : [0, 0, 0];
|
|
41
|
+
}
|
|
42
|
+
const defaultProps = {
|
|
43
|
+
data: [{ position: [0, 0], angle: 0, color: [255, 0, 0, 0] }],
|
|
44
|
+
getPosition: (d) => d.position,
|
|
45
|
+
getColor: (d) => d.color,
|
|
46
|
+
getOrientation: (d) => [0, d.angle, 0],
|
|
47
|
+
contours: [-1, -1],
|
|
48
|
+
colorMapName: "",
|
|
49
|
+
propertyValueRange: [0.0, 1.0],
|
|
50
|
+
isContoursDepth: true,
|
|
51
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
52
|
+
textureImageData: { value: null, type: "object", async: true },
|
|
53
|
+
meshImageData: { value: null, type: "object", async: true },
|
|
54
|
+
meshValueRange: [0.0, 1.0],
|
|
55
|
+
depthTest: true,
|
|
56
|
+
};
|
|
57
|
+
// This is a private layer used only by the composite Map3DLayer.
|
|
58
|
+
// It is an extension of SimpleMeshLayer but with modified fragment shader
|
|
59
|
+
// so that the texture pixel values can be used as lookup in a supplied color map.
|
|
60
|
+
export default class TerrainMapLayer extends SimpleMeshLayer {
|
|
61
|
+
// Signature from the base class, eslint doesn't like the any type.
|
|
62
|
+
// eslint-disable-next-line
|
|
63
|
+
draw({ uniforms, context }) {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
65
|
+
const { gl } = context;
|
|
66
|
+
const contourReferencePoint = (_a = this.props.contours[0]) !== null && _a !== void 0 ? _a : -1.0;
|
|
67
|
+
const contourInterval = (_b = this.props.contours[1]) !== null && _b !== void 0 ? _b : -1.0;
|
|
68
|
+
const isContoursDepth = this.props.isContoursDepth;
|
|
69
|
+
const valueRangeMin = (_c = this.props.propertyValueRange[0]) !== null && _c !== void 0 ? _c : 0.0;
|
|
70
|
+
const valueRangeMax = (_d = this.props.propertyValueRange[1]) !== null && _d !== void 0 ? _d : 1.0;
|
|
71
|
+
// If specified color map will extend from colorMapRangeMin to colorMapRangeMax.
|
|
72
|
+
// Otherwise it will extend from valueRangeMin to valueRangeMax.
|
|
73
|
+
const colorMapRangeMin = (_f = (_e = this.props.colorMapRange) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : valueRangeMin;
|
|
74
|
+
const colorMapRangeMax = (_h = (_g = this.props.colorMapRange) === null || _g === void 0 ? void 0 : _g[1]) !== null && _h !== void 0 ? _h : valueRangeMax;
|
|
75
|
+
const isClampColor = this.props.colorMapClampColor !== undefined &&
|
|
76
|
+
this.props.colorMapClampColor !== true &&
|
|
77
|
+
this.props.colorMapClampColor !== false;
|
|
78
|
+
let colorMapClampColor = isClampColor
|
|
79
|
+
? this.props.colorMapClampColor
|
|
80
|
+
: [0, 0, 0];
|
|
81
|
+
// Normalize to [0,1] range.
|
|
82
|
+
colorMapClampColor = colorMapClampColor.map((x) => (x !== null && x !== void 0 ? x : 0) / 255);
|
|
83
|
+
const isColorMapClampColorTransparent = this.props.colorMapClampColor === false;
|
|
84
|
+
if (!this.props.depthTest) {
|
|
85
|
+
gl.disable(GL.DEPTH_TEST);
|
|
86
|
+
}
|
|
87
|
+
super.draw({
|
|
88
|
+
uniforms: Object.assign(Object.assign({}, uniforms), { colormap: new Texture2D(context.gl, {
|
|
89
|
+
width: 256,
|
|
90
|
+
height: 1,
|
|
91
|
+
format: GL.RGB,
|
|
92
|
+
data: getImageData(this.props.colorMapName, this.context.userData
|
|
93
|
+
.colorTables, this.props.colorMapFunction),
|
|
94
|
+
parameters: DEFAULT_TEXTURE_PARAMETERS,
|
|
95
|
+
}), valueRangeMin,
|
|
96
|
+
valueRangeMax,
|
|
97
|
+
colorMapRangeMin,
|
|
98
|
+
colorMapRangeMax,
|
|
99
|
+
contourReferencePoint,
|
|
100
|
+
contourInterval,
|
|
101
|
+
isContoursDepth,
|
|
102
|
+
colorMapClampColor,
|
|
103
|
+
isColorMapClampColorTransparent,
|
|
104
|
+
isClampColor }),
|
|
105
|
+
});
|
|
106
|
+
if (!this.props.depthTest) {
|
|
107
|
+
gl.enable(GL.DEPTH_TEST);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
getShaders() {
|
|
111
|
+
const parentShaders = super.getShaders();
|
|
112
|
+
// Overwrite the default fragment shader with ours.
|
|
113
|
+
parentShaders.fs = fsShader;
|
|
114
|
+
return Object.assign(Object.assign({}, parentShaders), {
|
|
115
|
+
// Inject this into vertex shader. Vi want to export vertex world position to
|
|
116
|
+
// fragment shader for making contour lines.
|
|
117
|
+
inject: {
|
|
118
|
+
"vs:#decl": `
|
|
119
|
+
out vec3 worldPos;
|
|
120
|
+
`,
|
|
121
|
+
"vs:#main-start": `
|
|
122
|
+
worldPos = positions;
|
|
123
|
+
`,
|
|
124
|
+
} });
|
|
125
|
+
}
|
|
126
|
+
decodePickingColor() {
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
getPickingInfo({ info }) {
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
131
|
+
const pickColor = info.color;
|
|
132
|
+
if (!pickColor) {
|
|
133
|
+
return info;
|
|
134
|
+
}
|
|
135
|
+
// Texture coordinates.
|
|
136
|
+
const s = pickColor[0] / 255.0;
|
|
137
|
+
const t = pickColor[1] / 255.0;
|
|
138
|
+
const is_outside = pickColor[2] == 0;
|
|
139
|
+
if (is_outside) {
|
|
140
|
+
// Mouse is outside the non-transparent part of the map.
|
|
141
|
+
return info;
|
|
142
|
+
}
|
|
143
|
+
// MESH HEIGHT VALUE.
|
|
144
|
+
const meshImageData = this.props.meshImageData;
|
|
145
|
+
const isMeshImageData = meshImageData !== null;
|
|
146
|
+
const value_mesh = isMeshImageData
|
|
147
|
+
? getValue(meshImageData, s, t, DECODER)
|
|
148
|
+
: 0;
|
|
149
|
+
// TEXTURE PROPERTY VALUE.
|
|
150
|
+
const textureImageData = this.props.textureImageData;
|
|
151
|
+
const value_property = getValue(textureImageData, s, t, DECODER);
|
|
152
|
+
const layer_properties = [];
|
|
153
|
+
layer_properties.push(getMapProperty("Property", value_property, this.props.propertyValueRange), isMeshImageData
|
|
154
|
+
? getMapProperty("Depth", value_mesh, this.props.meshValueRange)
|
|
155
|
+
: { name: "Depth", value: 0 });
|
|
156
|
+
return Object.assign(Object.assign({}, info), { properties: layer_properties });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
TerrainMapLayer.layerName = "TerrainMapLayer";
|
|
160
|
+
TerrainMapLayer.defaultProps = defaultProps;
|
|
161
|
+
//================= Local help functions. ==================
|
|
162
|
+
function getMapProperty(name, value, value_range) {
|
|
163
|
+
// Remap the [0, 1] decoded value to property value range.
|
|
164
|
+
const [min, max] = value_range;
|
|
165
|
+
const floatScaler = 1.0 / (256.0 * 256.0 * 256.0 - 1.0);
|
|
166
|
+
const scaled_value = value * floatScaler;
|
|
167
|
+
value = scaled_value * (max - min) + min;
|
|
168
|
+
return createPropertyData(name, value);
|
|
169
|
+
}
|
|
170
|
+
function getValue(imageData, s, t, decoder) {
|
|
171
|
+
const int_view = new Uint8ClampedArray(imageData.data, 0, imageData.data.length);
|
|
172
|
+
const w = imageData.width;
|
|
173
|
+
const h = imageData.height;
|
|
174
|
+
const j = Math.min(Math.floor(w * s), w - 1);
|
|
175
|
+
const i = Math.min(Math.floor(h * t), h - 1);
|
|
176
|
+
const pixelNo = i * w + j;
|
|
177
|
+
const r = int_view[pixelNo * 4 + 0] * decoder.rScaler;
|
|
178
|
+
const g = int_view[pixelNo * 4 + 1] * decoder.gScaler;
|
|
179
|
+
const b = int_view[pixelNo * 4 + 2] * decoder.bScaler;
|
|
180
|
+
const value = r + g + b;
|
|
181
|
+
return value;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=terrain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
|
+
declare const fsShader = "#version 300 es\n#define SHADER_NAME terrainmap-shader\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nuniform bool isContoursDepth;\n\nuniform float contourReferencePoint;\nuniform float contourInterval;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\nin vec4 positions;\n\nout vec4 fragColor;\n\nin vec3 worldPos; // we export this from vertex shader (by injecting into it).\n\nuniform sampler2D colormap;\n\nuniform float valueRangeMin;\nuniform float valueRangeMax;\nuniform float colorMapRangeMin;\nuniform float colorMapRangeMax;\n\nuniform vec3 colorMapClampColor;\nuniform bool isClampColor;\nuniform bool isColorMapClampColorTransparent;\n\n\nvoid main(void) {\n geometry.uv = vTexCoord;\n\n vec3 normal;\n if (flatShading) {\n#ifdef DERIVATIVES_AVAILABLE\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n normal = vec3(0.0, 0.0, 1.0);\n#endif\n } else {\n normal = normals_commonspace;\n }\n\n vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n\n float texture_alpha = color.a;\n\n // Discard transparent pixels.\n if (!picking_uActive && color.w < 0.99) {\n discard;\n return;\n }\n\n // Picking pass.\n if (picking_uActive) {\n // Send texture coordinates.\n float s = vTexCoord.x;\n float t = vTexCoord.y;\n float b = texture_alpha > 0.95 ? 255.0 : 0.0;\n\n fragColor = vec4(s, t, b, 1.0);\n return;\n }\n\n float propertyValue = 0.0;\n if (hasTexture) {\n float opcacity = color.w;\n float floatScaler = 1.0 / (256.0 * 256.0 * 256.0 - 1.0);\n vec3 rgb = color.rgb;\n rgb *= vec3(16711680.0, 65280.0, 255.0); //255*256*256, 255*256, 255\n float propertyValue_norm = (rgb.r + rgb.g + rgb.b) * floatScaler; // propertyValue_norm will be in range [0-1]\n\n // If colorMapRangeMin/Max specified, color map will span this interval.\n propertyValue = propertyValue_norm * (valueRangeMax - valueRangeMin) + valueRangeMin;\n float x = (propertyValue - colorMapRangeMin) / (colorMapRangeMax - colorMapRangeMin);\n;\n if (x < 0.0 || x > 1.0) {\n // Out of range. Use clampcolor.\n if (isClampColor) {\n color = vec4(colorMapClampColor.rgb, 1.0);\n\n }\n else if (isColorMapClampColorTransparent) {\n discard;\n return;\n }\n else {\n // Use min/max color to clamp.\n x = max(0.0, x);\n x = min(1.0, x);\n\n color = texture2D(colormap, vec2(x, 0.5));\n color.a = opcacity;\n }\n }\n else {\n color = texture2D(colormap, vec2(x, 0.5));\n color.a = opcacity;\n }\n }\n\n bool is_contours = contourReferencePoint != -1.0 && contourInterval != -1.0;\n if (is_contours) {\n // Contours are made of either depths or properties.\n float val = (hasTexture && !isContoursDepth) ? (propertyValue - contourReferencePoint) / contourInterval\n : (abs(worldPos.z) - contourReferencePoint) / contourInterval;\n\n float f = fract(val);\n float df = fwidth(val);\n\n // keep: float c = smoothstep(df * 1.0, df * 2.0, f); // smootstep from/to no of pixels distance fronm contour line.\n float c = smoothstep(0.0, df * 2.0, f);\n\n color = color * vec4(c, c, c, 1.0);\n }\n\n // Use normal lighting.\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, color.a * opacity);\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
|
2
|
+
export default fsShader;
|