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