@geode/opengeodeweb-front 10.6.2 → 10.6.3-rc.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/.eslintrc.cjs +1 -1
- package/.oxlintrc.json +3 -22
- package/app/assets/geode_objects.js +26 -26
- package/app/components/Carousel.vue +62 -66
- package/app/components/CrsSelector.vue +48 -52
- package/app/components/DeleteDialog.vue +21 -37
- package/app/components/DragAndDrop.vue +35 -41
- package/app/components/ExtensionSelector.vue +50 -63
- package/app/components/FeedBack/ErrorBanner.vue +7 -10
- package/app/components/FeedBack/Snackers.vue +12 -14
- package/app/components/FetchingData.vue +1 -6
- package/app/components/FileSelector.vue +41 -47
- package/app/components/FileUploader.vue +62 -79
- package/app/components/GlassCard.vue +19 -19
- package/app/components/HybridRenderingView.vue +37 -38
- package/app/components/InfraConnected.vue +3 -3
- package/app/components/Inspector/InspectionButton.vue +27 -31
- package/app/components/Inspector/ResultPanel.vue +13 -24
- package/app/components/Launcher.vue +13 -13
- package/app/components/Loading.vue +63 -69
- package/app/components/MissingFilesSelector.vue +53 -73
- package/app/components/ObjectSelector.vue +81 -99
- package/app/components/PackagesVersions.vue +27 -30
- package/app/components/Recaptcha.vue +60 -71
- package/app/components/RemoteRenderingView.vue +102 -108
- package/app/components/Screenshot.vue +36 -42
- package/app/components/SearchBar.vue +5 -5
- package/app/components/Step.vue +37 -44
- package/app/components/Stepper.vue +29 -35
- package/app/components/VeaseViewToolbar.vue +69 -78
- package/app/components/ViewToolbar.vue +41 -45
- package/app/components/Viewer/BreadCrumb.vue +18 -30
- package/app/components/Viewer/ContextMenu.vue +176 -179
- package/app/components/Viewer/ContextMenuItem.vue +105 -117
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +6 -9
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +82 -93
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +84 -99
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +83 -98
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +62 -73
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +84 -108
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +82 -105
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +19 -23
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +26 -30
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +5 -5
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +6 -9
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +6 -9
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +5 -5
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +6 -9
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +5 -5
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/EdgesOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/PointsOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +6 -9
- package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +6 -9
- package/app/components/Viewer/Options/AttributeColorBar.vue +8 -8
- package/app/components/Viewer/Options/AttributeSelector.vue +73 -78
- package/app/components/Viewer/Options/ColorMapList.vue +115 -140
- package/app/components/Viewer/Options/ColorMapPicker.vue +128 -142
- package/app/components/Viewer/Options/ColorPicker.vue +9 -9
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +77 -91
- package/app/components/Viewer/Options/TextureItem.vue +54 -58
- package/app/components/Viewer/Options/TexturesSelector.vue +22 -26
- package/app/components/Viewer/Options/VisibilitySwitch.vue +1 -1
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +61 -68
- package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +6 -9
- package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +6 -9
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +83 -103
- package/app/components/Viewer/Solid/EdgesOptions.vue +6 -9
- package/app/components/Viewer/Solid/PointsOptions.vue +6 -9
- package/app/components/Viewer/Solid/PolygonsOptions.vue +6 -9
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +82 -105
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +5 -5
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +5 -5
- package/app/components/Viewer/Tree/ObjectTree.vue +80 -89
- package/app/components/Viewer/TreeComponent.vue +43 -49
- package/app/components/Viewer/TreeObject.vue +48 -50
- package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +6 -9
- package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +5 -5
- package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +5 -5
- package/app/components/Wrapper.vue +8 -8
- package/app/components/ZScaling.vue +18 -27
- package/app/composables/project_manager.js +57 -67
- package/app/composables/run_function_when_microservices_connected.js +8 -8
- package/app/plugins/auto_store_register.js +11 -13
- package/app/stores/app.js +118 -138
- package/app/stores/data.js +52 -68
- package/app/stores/data_style.js +36 -36
- package/app/stores/feedback.js +17 -20
- package/app/stores/geode.js +54 -55
- package/app/stores/hybrid_viewer.js +164 -177
- package/app/stores/infra.js +45 -55
- package/app/stores/lambda.js +26 -26
- package/app/stores/menu.js +78 -85
- package/app/stores/treeview.js +57 -65
- package/app/stores/viewer.js +92 -104
- package/app/utils/colormap.js +3 -3
- package/app/utils/config.js +16 -22
- package/app/utils/default_styles.js +50 -62
- package/app/utils/extension.js +44 -44
- package/app/utils/file_import_workflow.js +50 -64
- package/app/utils/local/app_mode.js +2 -2
- package/app/utils/local/cleanup.js +66 -72
- package/app/utils/local/microservices.js +61 -71
- package/app/utils/local/path.js +16 -19
- package/app/utils/local/scripts.js +22 -22
- package/app/utils/recaptcha.js +6 -6
- package/app/utils/server.js +21 -24
- package/app/utils/status.js +2 -2
- package/app/utils/treeview.js +4 -4
- package/app/utils/validate_schema.js +7 -7
- package/commitlint.config.js +2 -2
- package/eslint.config.js +4 -4
- package/internal/database/database.js +38 -46
- package/internal/database/extended_database.js +9 -10
- package/internal/database/tables/data.js +2 -3
- package/internal/database/tables/model_components.js +1 -1
- package/internal/database/tables/model_components_relation.js +1 -1
- package/internal/stores/data_style/mesh/cells/cell.js +47 -63
- package/internal/stores/data_style/mesh/cells/color.js +11 -16
- package/internal/stores/data_style/mesh/cells/common.js +6 -6
- package/internal/stores/data_style/mesh/cells/index.js +37 -47
- package/internal/stores/data_style/mesh/cells/textures.js +11 -12
- package/internal/stores/data_style/mesh/cells/vertex.js +47 -58
- package/internal/stores/data_style/mesh/cells/visibility.js +11 -16
- package/internal/stores/data_style/mesh/edges/color.js +11 -16
- package/internal/stores/data_style/mesh/edges/common.js +6 -6
- package/internal/stores/data_style/mesh/edges/edge.js +47 -63
- package/internal/stores/data_style/mesh/edges/index.js +38 -52
- package/internal/stores/data_style/mesh/edges/vertex.js +47 -58
- package/internal/stores/data_style/mesh/edges/visibility.js +11 -16
- package/internal/stores/data_style/mesh/edges/width.js +11 -16
- package/internal/stores/data_style/mesh/index.js +34 -34
- package/internal/stores/data_style/mesh/points/color.js +11 -16
- package/internal/stores/data_style/mesh/points/common.js +6 -6
- package/internal/stores/data_style/mesh/points/index.js +35 -49
- package/internal/stores/data_style/mesh/points/size.js +11 -16
- package/internal/stores/data_style/mesh/points/vertex.js +47 -58
- package/internal/stores/data_style/mesh/points/visibility.js +11 -16
- package/internal/stores/data_style/mesh/polygons/color.js +11 -16
- package/internal/stores/data_style/mesh/polygons/common.js +6 -6
- package/internal/stores/data_style/mesh/polygons/index.js +36 -45
- package/internal/stores/data_style/mesh/polygons/polygon.js +45 -56
- package/internal/stores/data_style/mesh/polygons/textures.js +11 -16
- package/internal/stores/data_style/mesh/polygons/vertex.js +47 -58
- package/internal/stores/data_style/mesh/polygons/visibility.js +11 -16
- package/internal/stores/data_style/mesh/polyhedra/color.js +11 -16
- package/internal/stores/data_style/mesh/polyhedra/common.js +6 -6
- package/internal/stores/data_style/mesh/polyhedra/index.js +29 -42
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +43 -47
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +47 -58
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +11 -17
- package/internal/stores/data_style/model/blocks/color.js +21 -24
- package/internal/stores/data_style/model/blocks/common.js +6 -6
- package/internal/stores/data_style/model/blocks/index.js +13 -17
- package/internal/stores/data_style/model/blocks/visibility.js +21 -24
- package/internal/stores/data_style/model/corners/color.js +21 -24
- package/internal/stores/data_style/model/corners/common.js +6 -6
- package/internal/stores/data_style/model/corners/index.js +14 -18
- package/internal/stores/data_style/model/corners/visibility.js +21 -25
- package/internal/stores/data_style/model/edges/common.js +4 -4
- package/internal/stores/data_style/model/edges/index.js +7 -7
- package/internal/stores/data_style/model/edges/visibility.js +11 -15
- package/internal/stores/data_style/model/index.js +84 -100
- package/internal/stores/data_style/model/lines/color.js +21 -24
- package/internal/stores/data_style/model/lines/common.js +6 -6
- package/internal/stores/data_style/model/lines/index.js +13 -17
- package/internal/stores/data_style/model/lines/visibility.js +21 -24
- package/internal/stores/data_style/model/points/common.js +4 -4
- package/internal/stores/data_style/model/points/index.js +9 -9
- package/internal/stores/data_style/model/points/size.js +11 -11
- package/internal/stores/data_style/model/points/visibility.js +11 -15
- package/internal/stores/data_style/model/surfaces/color.js +21 -24
- package/internal/stores/data_style/model/surfaces/common.js +6 -6
- package/internal/stores/data_style/model/surfaces/index.js +14 -22
- package/internal/stores/data_style/model/surfaces/visibility.js +18 -22
- package/internal/stores/data_style/state.js +11 -11
- package/internal/utils/api_fetch.js +24 -34
- package/internal/utils/upload_file.js +19 -24
- package/internal/utils/viewer_call.js +23 -36
- package/nuxt.config.js +7 -11
- package/package.json +3 -3
- package/scripts/generate_geode_objects.js +14 -16
- package/server/api/app/kill.post.js +4 -4
- package/server/api/app/project_folder_path.post.js +11 -11
- package/server/api/app/run_back.post.js +12 -12
- package/server/api/app/run_viewer.post.js +12 -12
- package/server/api/extensions/run.post.js +34 -41
- package/server/api/extensions/upload.put.js +48 -62
- package/tests/integration/setup.js +43 -53
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +90 -116
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +81 -107
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +38 -41
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +85 -101
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +89 -113
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +81 -105
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +56 -73
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +59 -76
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +39 -42
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +31 -34
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +60 -73
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +52 -55
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +59 -80
- package/tests/integration/stores/viewer.nuxt.test.js +35 -38
- package/tests/setup_indexeddb.js +2 -2
- package/tests/unit/components/CrsSelector.nuxt.test.js +28 -28
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +33 -35
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -23
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +18 -18
- package/tests/unit/components/FileSelector.nuxt.test.js +57 -59
- package/tests/unit/components/FileUploader.nuxt.test.js +35 -39
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +28 -28
- package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +22 -27
- package/tests/unit/components/Launcher.nuxt.test.js +20 -22
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +37 -37
- package/tests/unit/components/ObjectSelector.nuxt.test.js +62 -62
- package/tests/unit/components/PackagesVersions.nuxt.test.js +16 -16
- package/tests/unit/components/Step.nuxt.test.js +18 -19
- package/tests/unit/components/Stepper.nuxt.test.js +18 -18
- package/tests/unit/composables/api_fetch.nuxt.test.js +34 -36
- package/tests/unit/composables/project_manager.nuxt.test.js +93 -112
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -36
- package/tests/unit/composables/upload_file.nuxt.test.js +27 -29
- package/tests/unit/plugins/project_load.nuxt.test.js +31 -33
- package/tests/unit/stores/app.nuxt.test.js +90 -92
- package/tests/unit/stores/feedback.nuxt.test.js +47 -57
- package/tests/unit/stores/geode.nuxt.test.js +111 -115
- package/tests/unit/stores/infra.nuxt.test.js +148 -148
- package/tests/unit/stores/lambda.nuxt.test.js +72 -74
- package/tests/unit/stores/treeview.nuxt.test.js +19 -21
- package/tests/unit/stores/viewer.nuxt.test.js +109 -122
- package/tests/unit/utils/recaptcha.nuxt.test.js +25 -29
- package/tests/unit/utils/validate_schema.nuxt.test.js +17 -17
- package/tests/utils.js +11 -11
- package/tests/vitest.config.js +9 -9
- package/vuetify_config.js +2 -2
|
@@ -1,127 +1,117 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import vtkColorMaps from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps";
|
|
3
|
+
import { newInstance as vtkColorTransferFunction } from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const LAST_POINT_OFFSET = 4;
|
|
6
|
+
const THREE = 3;
|
|
7
|
+
const CHUNK_SIZE = 5;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const { presets } = defineProps({
|
|
10
|
+
presets: { type: Array, required: true },
|
|
11
|
+
});
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const emit = defineEmits(["select"]);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const filterText = ref("");
|
|
16
|
+
const canvasRefs = ref({});
|
|
17
|
+
const loading = ref(true);
|
|
18
|
+
const renderJobId = ref(0);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
20
|
+
function setCanvasRef(presetName, element, id) {
|
|
21
|
+
if (element) {
|
|
22
|
+
canvasRefs.value[id] = { element, presetName };
|
|
23
|
+
} else {
|
|
24
|
+
delete canvasRefs.value[id];
|
|
26
25
|
}
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
40
|
-
if (children.length > 0) {
|
|
41
|
-
result.push({ ...item, Children: children })
|
|
42
|
-
}
|
|
43
|
-
} else if (item.Name.toLowerCase().includes(term)) {
|
|
44
|
-
result.push(item)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return result
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
function drawPresetCanvas(presetName, canvas) {
|
|
51
|
-
if (!canvas) {
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
const preset = vtkColorMaps.getPresetByName(presetName)
|
|
55
|
-
if (!preset || !preset.RGBPoints) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
const ctx = canvas.getContext("2d")
|
|
59
|
-
const { height, width } = canvas
|
|
60
|
-
const lut = vtkColorTransferFunction()
|
|
61
|
-
const rgbPoints = preset.RGBPoints
|
|
62
|
-
for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
|
|
63
|
-
lut.addRGBPoint(
|
|
64
|
-
rgbPoints[pointIdx],
|
|
65
|
-
rgbPoints[pointIdx + 1],
|
|
66
|
-
rgbPoints[pointIdx + 2],
|
|
67
|
-
rgbPoints[pointIdx + THREE],
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
const table = lut.getUint8Table(
|
|
71
|
-
rgbPoints[0],
|
|
72
|
-
rgbPoints.at(-LAST_POINT_OFFSET),
|
|
73
|
-
width,
|
|
74
|
-
true,
|
|
75
|
-
)
|
|
76
|
-
const imageData = ctx.createImageData(width, height)
|
|
77
|
-
for (let xCoord = 0; xCoord < width; xCoord += 1) {
|
|
78
|
-
const alpha = table[xCoord * 4 + THREE],
|
|
79
|
-
blue = table[xCoord * 4 + 2],
|
|
80
|
-
green = table[xCoord * 4 + 1],
|
|
81
|
-
red = table[xCoord * 4]
|
|
82
|
-
for (let yCoord = 0; yCoord < height; yCoord += 1) {
|
|
83
|
-
const pixelIdx = (yCoord * width + xCoord) * 4
|
|
84
|
-
imageData.data[pixelIdx] = red
|
|
85
|
-
imageData.data[pixelIdx + 1] = green
|
|
86
|
-
imageData.data[pixelIdx + 2] = blue
|
|
87
|
-
imageData.data[pixelIdx + THREE] = alpha
|
|
28
|
+
const filteredPresets = computed(() => {
|
|
29
|
+
if (!filterText.value) {
|
|
30
|
+
return presets;
|
|
31
|
+
}
|
|
32
|
+
const term = filterText.value.toLowerCase();
|
|
33
|
+
|
|
34
|
+
const result = [];
|
|
35
|
+
for (const item of presets) {
|
|
36
|
+
if (item.Children) {
|
|
37
|
+
const children = item.Children.filter((child) => child.Name.toLowerCase().includes(term));
|
|
38
|
+
if (children.length > 0) {
|
|
39
|
+
result.push({ ...item, Children: children });
|
|
88
40
|
}
|
|
41
|
+
} else if (item.Name.toLowerCase().includes(term)) {
|
|
42
|
+
result.push(item);
|
|
89
43
|
}
|
|
90
|
-
ctx.putImageData(imageData, 0, 0)
|
|
91
44
|
}
|
|
45
|
+
return result;
|
|
46
|
+
});
|
|
92
47
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
48
|
+
function drawPresetCanvas(presetName, canvas) {
|
|
49
|
+
if (!canvas) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const preset = vtkColorMaps.getPresetByName(presetName);
|
|
53
|
+
if (!preset || !preset.RGBPoints) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const ctx = canvas.getContext("2d");
|
|
57
|
+
const { height, width } = canvas;
|
|
58
|
+
const lut = vtkColorTransferFunction();
|
|
59
|
+
const rgbPoints = preset.RGBPoints;
|
|
60
|
+
for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
|
|
61
|
+
lut.addRGBPoint(
|
|
62
|
+
rgbPoints[pointIdx],
|
|
63
|
+
rgbPoints[pointIdx + 1],
|
|
64
|
+
rgbPoints[pointIdx + 2],
|
|
65
|
+
rgbPoints[pointIdx + THREE],
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
const table = lut.getUint8Table(rgbPoints[0], rgbPoints.at(-LAST_POINT_OFFSET), width, true);
|
|
69
|
+
const imageData = ctx.createImageData(width, height);
|
|
70
|
+
for (let xCoord = 0; xCoord < width; xCoord += 1) {
|
|
71
|
+
const alpha = table[xCoord * 4 + THREE],
|
|
72
|
+
blue = table[xCoord * 4 + 2],
|
|
73
|
+
green = table[xCoord * 4 + 1],
|
|
74
|
+
red = table[xCoord * 4];
|
|
75
|
+
for (let yCoord = 0; yCoord < height; yCoord += 1) {
|
|
76
|
+
const pixelIdx = (yCoord * width + xCoord) * 4;
|
|
77
|
+
imageData.data[pixelIdx] = red;
|
|
78
|
+
imageData.data[pixelIdx + 1] = green;
|
|
79
|
+
imageData.data[pixelIdx + 2] = blue;
|
|
80
|
+
imageData.data[pixelIdx + THREE] = alpha;
|
|
99
81
|
}
|
|
82
|
+
}
|
|
83
|
+
ctx.putImageData(imageData, 0, 0);
|
|
84
|
+
}
|
|
100
85
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
function processChunk(entries, index, jobId) {
|
|
87
|
+
if (jobId !== renderJobId.value || index >= entries.length) {
|
|
88
|
+
if (jobId === renderJobId.value) {
|
|
89
|
+
loading.value = false;
|
|
105
90
|
}
|
|
106
|
-
|
|
107
|
-
setTimeout(() => processChunk(entries, end, jobId), ZERO)
|
|
91
|
+
return;
|
|
108
92
|
}
|
|
109
93
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
nextTick(() => {
|
|
115
|
-
const WAIT_MS = 50
|
|
116
|
-
setTimeout(
|
|
117
|
-
() => processChunk(Object.entries(canvasRefs.value), 0, jobId),
|
|
118
|
-
WAIT_MS,
|
|
119
|
-
)
|
|
120
|
-
})
|
|
94
|
+
const end = Math.min(index + CHUNK_SIZE, entries.length);
|
|
95
|
+
for (let i = index; i < end; i += 1) {
|
|
96
|
+
const [unusedKey, refValue] = entries[i];
|
|
97
|
+
drawPresetCanvas(refValue.presetName, refValue.element);
|
|
121
98
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
99
|
+
const ZERO = 0;
|
|
100
|
+
setTimeout(() => processChunk(entries, end, jobId), ZERO);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function drawAllCanvases() {
|
|
104
|
+
renderJobId.value += 1;
|
|
105
|
+
const jobId = renderJobId.value;
|
|
106
|
+
loading.value = true;
|
|
107
|
+
nextTick(() => {
|
|
108
|
+
const WAIT_MS = 50;
|
|
109
|
+
setTimeout(() => processChunk(Object.entries(canvasRefs.value), 0, jobId), WAIT_MS);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
onMounted(drawAllCanvases);
|
|
114
|
+
watch(filteredPresets, drawAllCanvases);
|
|
125
115
|
</script>
|
|
126
116
|
|
|
127
117
|
<template>
|
|
@@ -166,11 +156,7 @@
|
|
|
166
156
|
<template v-for="(item, index) in filteredPresets" :key="index">
|
|
167
157
|
<v-list-group v-if="item.Children" :value="item.Name">
|
|
168
158
|
<template #activator="{ props: gProps }">
|
|
169
|
-
<v-list-item
|
|
170
|
-
v-bind="gProps"
|
|
171
|
-
:title="item.Name"
|
|
172
|
-
class="text-white font-weight-bold"
|
|
173
|
-
/>
|
|
159
|
+
<v-list-item v-bind="gProps" :title="item.Name" class="text-white font-weight-bold" />
|
|
174
160
|
</template>
|
|
175
161
|
|
|
176
162
|
<v-list-item
|
|
@@ -181,13 +167,9 @@
|
|
|
181
167
|
rounded="md"
|
|
182
168
|
>
|
|
183
169
|
<div class="d-flex flex-column py-1">
|
|
184
|
-
<span class="text-caption text-grey-lighten-1 mb-1">{{
|
|
185
|
-
child.Name
|
|
186
|
-
}}</span>
|
|
170
|
+
<span class="text-caption text-grey-lighten-1 mb-1">{{ child.Name }}</span>
|
|
187
171
|
<canvas
|
|
188
|
-
:ref="
|
|
189
|
-
(el) => setCanvasRef(child.Name, el, `g-${index}-${cIdx}`)
|
|
190
|
-
"
|
|
172
|
+
:ref="(el) => setCanvasRef(child.Name, el, `g-${index}-${cIdx}`)"
|
|
191
173
|
width="200"
|
|
192
174
|
height="18"
|
|
193
175
|
class="w-100 rounded-xs border-thin"
|
|
@@ -196,16 +178,9 @@
|
|
|
196
178
|
</v-list-item>
|
|
197
179
|
</v-list-group>
|
|
198
180
|
|
|
199
|
-
<v-list-item
|
|
200
|
-
v-else
|
|
201
|
-
@click="emit('select', item)"
|
|
202
|
-
class="px-2 mb-1"
|
|
203
|
-
rounded="md"
|
|
204
|
-
>
|
|
181
|
+
<v-list-item v-else @click="emit('select', item)" class="px-2 mb-1" rounded="md">
|
|
205
182
|
<div class="d-flex flex-column py-1">
|
|
206
|
-
<span class="text-caption text-grey-lighten-1 mb-1">{{
|
|
207
|
-
item.Name
|
|
208
|
-
}}</span>
|
|
183
|
+
<span class="text-caption text-grey-lighten-1 mb-1">{{ item.Name }}</span>
|
|
209
184
|
<canvas
|
|
210
185
|
:ref="(el) => setCanvasRef(item.Name, el, `s-${index}`)"
|
|
211
186
|
width="200"
|
|
@@ -220,18 +195,18 @@
|
|
|
220
195
|
</template>
|
|
221
196
|
|
|
222
197
|
<style scoped>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
198
|
+
.blur-card {
|
|
199
|
+
background-color: rgba(35, 35, 35, 0.8) !important;
|
|
200
|
+
backdrop-filter: blur(16px);
|
|
201
|
+
-webkit-backdrop-filter: blur(16px);
|
|
202
|
+
border-color: rgba(255, 255, 255, 0.1) !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.border-thin {
|
|
206
|
+
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.v-list-item {
|
|
210
|
+
background-color: rgba(255, 255, 255, 0.1) !important;
|
|
211
|
+
}
|
|
237
212
|
</style>
|
|
@@ -1,131 +1,122 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const preset = vtkColorMaps.getPresetByName(selectedPresetName.value)
|
|
69
|
-
if (!preset || !preset.RGBPoints) {
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const canvas = lutCanvas.value
|
|
74
|
-
const ctx = canvas.getContext("2d")
|
|
75
|
-
const { height, width } = canvas
|
|
2
|
+
import ColorMapList from "./ColorMapList.vue";
|
|
3
|
+
import { newInstance } from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction";
|
|
4
|
+
import vtkColorMaps from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps";
|
|
5
|
+
|
|
6
|
+
const LAST_POINT_OFFSET = 4;
|
|
7
|
+
const THREE = 3;
|
|
8
|
+
|
|
9
|
+
const { max, min, modelValue } = defineProps({
|
|
10
|
+
modelValue: { type: String, default: "Cool to Warm" },
|
|
11
|
+
min: { type: Number, required: true },
|
|
12
|
+
max: { type: Number, required: true },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
16
|
+
|
|
17
|
+
const menuOpen = ref(false);
|
|
18
|
+
const lutCanvas = ref();
|
|
19
|
+
const selectedPresetName = ref(modelValue);
|
|
20
|
+
|
|
21
|
+
const presets = computed(() => {
|
|
22
|
+
const allPresets = vtkColorMaps.rgbPresetNames.map((name) => vtkColorMaps.getPresetByName(name));
|
|
23
|
+
|
|
24
|
+
const defaultPreset = vtkColorMaps.getPresetByName("Cool to Warm");
|
|
25
|
+
|
|
26
|
+
const paraviewNames = [
|
|
27
|
+
"Cool to Warm",
|
|
28
|
+
"Warm to Cool",
|
|
29
|
+
"rainbow",
|
|
30
|
+
"Grayscale",
|
|
31
|
+
"X Ray",
|
|
32
|
+
"Black-Body Radiation",
|
|
33
|
+
"erdc_rainbow_bright",
|
|
34
|
+
];
|
|
35
|
+
const matplotlibNames = [
|
|
36
|
+
"Viridis (matplotlib)",
|
|
37
|
+
"Plasma (matplotlib)",
|
|
38
|
+
"Inferno (matplotlib)",
|
|
39
|
+
"Magma (matplotlib)",
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const paraviewPresets = paraviewNames
|
|
43
|
+
.map((name) => vtkColorMaps.getPresetByName(name))
|
|
44
|
+
.filter(Boolean);
|
|
45
|
+
const matplotlibPresets = matplotlibNames
|
|
46
|
+
.map((name) => vtkColorMaps.getPresetByName(name))
|
|
47
|
+
.filter(Boolean);
|
|
48
|
+
const otherPresets = allPresets.filter(
|
|
49
|
+
(preset) => !paraviewNames.includes(preset.Name) && !matplotlibNames.includes(preset.Name),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return [
|
|
53
|
+
defaultPreset,
|
|
54
|
+
{ Name: "ParaView", Children: paraviewPresets },
|
|
55
|
+
{ Name: "Matplotlib", Children: matplotlibPresets },
|
|
56
|
+
{ Name: "Others", Children: otherPresets },
|
|
57
|
+
];
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function drawLutCanvas() {
|
|
61
|
+
if (!lutCanvas.value) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const preset = vtkColorMaps.getPresetByName(selectedPresetName.value);
|
|
65
|
+
if (!preset || !preset.RGBPoints) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
76
68
|
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
const canvas = lutCanvas.value;
|
|
70
|
+
const ctx = canvas.getContext("2d");
|
|
71
|
+
const { height, width } = canvas;
|
|
79
72
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
rgbPoints[pointIdx],
|
|
83
|
-
rgbPoints[pointIdx + 1],
|
|
84
|
-
rgbPoints[pointIdx + 2],
|
|
85
|
-
rgbPoints[pointIdx + THREE],
|
|
86
|
-
)
|
|
87
|
-
}
|
|
73
|
+
const lut = newInstance();
|
|
74
|
+
const rgbPoints = preset.RGBPoints;
|
|
88
75
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
rgbPoints
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
for (let xCoord = 0; xCoord < width; xCoord += 1) {
|
|
98
|
-
const red = table[xCoord * 4]
|
|
99
|
-
const green = table[xCoord * 4 + 1]
|
|
100
|
-
const blue = table[xCoord * 4 + 2]
|
|
101
|
-
const alpha = table[xCoord * 4 + THREE]
|
|
102
|
-
for (let yCoord = 0; yCoord < height; yCoord += 1) {
|
|
103
|
-
const pixelIdx = (yCoord * width + xCoord) * 4
|
|
104
|
-
imageData.data[pixelIdx] = red
|
|
105
|
-
imageData.data[pixelIdx + 1] = green
|
|
106
|
-
imageData.data[pixelIdx + 2] = blue
|
|
107
|
-
imageData.data[pixelIdx + THREE] = alpha
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
ctx.putImageData(imageData, 0, 0)
|
|
76
|
+
for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
|
|
77
|
+
lut.addRGBPoint(
|
|
78
|
+
rgbPoints[pointIdx],
|
|
79
|
+
rgbPoints[pointIdx + 1],
|
|
80
|
+
rgbPoints[pointIdx + 2],
|
|
81
|
+
rgbPoints[pointIdx + THREE],
|
|
82
|
+
);
|
|
111
83
|
}
|
|
112
84
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
85
|
+
const table = lut.getUint8Table(rgbPoints[0], rgbPoints.at(-LAST_POINT_OFFSET), width, true);
|
|
86
|
+
const imageData = ctx.createImageData(width, height);
|
|
87
|
+
|
|
88
|
+
for (let xCoord = 0; xCoord < width; xCoord += 1) {
|
|
89
|
+
const red = table[xCoord * 4];
|
|
90
|
+
const green = table[xCoord * 4 + 1];
|
|
91
|
+
const blue = table[xCoord * 4 + 2];
|
|
92
|
+
const alpha = table[xCoord * 4 + THREE];
|
|
93
|
+
for (let yCoord = 0; yCoord < height; yCoord += 1) {
|
|
94
|
+
const pixelIdx = (yCoord * width + xCoord) * 4;
|
|
95
|
+
imageData.data[pixelIdx] = red;
|
|
96
|
+
imageData.data[pixelIdx + 1] = green;
|
|
97
|
+
imageData.data[pixelIdx + 2] = blue;
|
|
98
|
+
imageData.data[pixelIdx + THREE] = alpha;
|
|
99
|
+
}
|
|
117
100
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
101
|
+
ctx.putImageData(imageData, 0, 0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function onSelectPreset(preset) {
|
|
105
|
+
selectedPresetName.value = preset.Name;
|
|
106
|
+
emit("update:modelValue", preset.Name);
|
|
107
|
+
menuOpen.value = false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onMounted(() => nextTick(drawLutCanvas));
|
|
111
|
+
watch([lutCanvas, selectedPresetName, () => min, () => max], drawLutCanvas);
|
|
112
|
+
watch(
|
|
113
|
+
() => modelValue,
|
|
114
|
+
(newValue) => {
|
|
115
|
+
if (newValue !== selectedPresetName.value) {
|
|
116
|
+
selectedPresetName.value = newValue;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
);
|
|
129
120
|
</script>
|
|
130
121
|
|
|
131
122
|
<template>
|
|
@@ -142,12 +133,7 @@
|
|
|
142
133
|
<span class="text-caption text-white font-weight-medium">
|
|
143
134
|
{{ selectedPresetName }}
|
|
144
135
|
</span>
|
|
145
|
-
<canvas
|
|
146
|
-
ref="lutCanvas"
|
|
147
|
-
width="200"
|
|
148
|
-
height="18"
|
|
149
|
-
class="w-100 rounded-xs border-thin"
|
|
150
|
-
/>
|
|
136
|
+
<canvas ref="lutCanvas" width="200" height="18" class="w-100 rounded-xs border-thin" />
|
|
151
137
|
</v-card>
|
|
152
138
|
</template>
|
|
153
139
|
|
|
@@ -156,19 +142,19 @@
|
|
|
156
142
|
</template>
|
|
157
143
|
|
|
158
144
|
<style scoped>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
145
|
+
.blur-picker {
|
|
146
|
+
background-color: rgba(40, 40, 40, 0.7) !important;
|
|
147
|
+
backdrop-filter: blur(12px);
|
|
148
|
+
-webkit-backdrop-filter: blur(12px);
|
|
149
|
+
border-color: rgba(255, 255, 255, 0.2) !important;
|
|
150
|
+
transition: background-color 0.2s;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.blur-picker {
|
|
154
|
+
background-color: rgba(60, 60, 60, 0.9) !important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.border-thin {
|
|
158
|
+
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
|
159
|
+
}
|
|
174
160
|
</style>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const colorPickerRef = useTemplateRef("colorPickerRef");
|
|
3
|
+
const model = defineModel();
|
|
4
|
+
const { pressed } = useMousePressed({ target: colorPickerRef });
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const color = ref(model);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
watch(pressed, (value) => {
|
|
9
|
+
if (!value) {
|
|
10
|
+
model.value = color.value;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<template>
|