@geode/opengeodeweb-front 10.22.1 → 10.23.0-rc.2

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 (39) hide show
  1. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +256 -0
  2. package/app/components/Viewer/Generic/Model/CornersOptions.vue +187 -0
  3. package/app/components/Viewer/Generic/Model/LinesOptions.vue +252 -0
  4. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +72 -132
  5. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +260 -0
  6. package/app/components/Viewer/Options/AttributeSelector.vue +15 -2
  7. package/app/components/Viewer/Options/ColoringTypeSelector.vue +53 -11
  8. package/app/stores/app.js +1 -0
  9. package/app/stores/hybrid_viewer.js +21 -2
  10. package/app/utils/default_styles/constants.js +57 -0
  11. package/app/utils/default_styles/index.js +54 -0
  12. package/app/utils/default_styles/meshes.js +185 -0
  13. package/app/utils/default_styles/models.js +192 -0
  14. package/internal/stores/data_style/model/blocks/color.js +6 -1
  15. package/internal/stores/data_style/model/blocks/index.js +60 -4
  16. package/internal/stores/data_style/model/blocks/polyhedron.js +144 -0
  17. package/internal/stores/data_style/model/blocks/vertex.js +141 -0
  18. package/internal/stores/data_style/model/color.js +119 -12
  19. package/internal/stores/data_style/model/common.js +18 -21
  20. package/internal/stores/data_style/model/corners/color.js +6 -1
  21. package/internal/stores/data_style/model/corners/index.js +48 -4
  22. package/internal/stores/data_style/model/corners/vertex.js +144 -0
  23. package/internal/stores/data_style/model/lines/color.js +6 -1
  24. package/internal/stores/data_style/model/lines/edge.js +138 -0
  25. package/internal/stores/data_style/model/lines/index.js +58 -4
  26. package/internal/stores/data_style/model/lines/vertex.js +138 -0
  27. package/internal/stores/data_style/model/selection.js +50 -29
  28. package/internal/stores/data_style/model/surfaces/color.js +11 -1
  29. package/internal/stores/data_style/model/surfaces/index.js +60 -4
  30. package/internal/stores/data_style/model/surfaces/polygon.js +144 -0
  31. package/internal/stores/data_style/model/surfaces/vertex.js +144 -0
  32. package/internal/stores/data_style/model/visibility.js +17 -4
  33. package/internal/stores/data_style/state.js +101 -21
  34. package/package.json +3 -3
  35. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +118 -0
  36. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +64 -0
  37. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +112 -0
  38. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +118 -0
  39. package/app/utils/default_styles.js +0 -327
@@ -90,6 +90,78 @@ describe("model blocks", () => {
90
90
  expect(viewerStore.status).toBe(Status.CONNECTED);
91
91
  });
92
92
  });
93
+ describe("blocks vertex attribute", () => {
94
+ test("coloring vertex attribute", async () => {
95
+ const dataStyleStore = useDataStyleStore();
96
+ const viewerStore = useViewerStore();
97
+ const dataStore = useDataStore();
98
+ const block_ids = await dataStore.getBlocksGeodeIds(id);
99
+ const block_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, block_ids);
100
+ const spy = vi.spyOn(viewerStore, "request");
101
+ spy.mockClear();
102
+ const result = dataStyleStore.setModelBlocksVertexAttributeName(id, block_ids, "points");
103
+ expect(result).toBeInstanceOf(Promise);
104
+ await result;
105
+ await sleep(SLEEP_MS);
106
+ expect(spy).toHaveBeenCalledWith(
107
+ {
108
+ schema: model_blocks_schemas.attribute.vertex.name,
109
+ params: {
110
+ id,
111
+ block_ids: block_viewer_ids,
112
+ name: "points",
113
+ },
114
+ },
115
+ {
116
+ response_function: expect.any(Function),
117
+ },
118
+ );
119
+ for (const block_id of block_ids) {
120
+ expect(dataStyleStore.modelBlocksVertexAttributeName(id, block_id)).toBe("points");
121
+ }
122
+ expect(viewerStore.status).toBe(Status.CONNECTED);
123
+ });
124
+ });
125
+
126
+ describe("blocks polyhedron attribute", () => {
127
+ test("coloring polyhedron attribute", async () => {
128
+ const dataStyleStore = useDataStyleStore();
129
+ const viewerStore = useViewerStore();
130
+ const dataStore = useDataStore();
131
+ const block_ids = await dataStore.getBlocksGeodeIds(id);
132
+ const block_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, block_ids);
133
+ const spy = vi.spyOn(viewerStore, "request");
134
+ spy.mockClear();
135
+ const result = dataStyleStore.setModelBlocksPolyhedronAttributeName(
136
+ id,
137
+ block_ids,
138
+ "test_attribute",
139
+ );
140
+ expect(result).toBeInstanceOf(Promise);
141
+ await result;
142
+ await sleep(SLEEP_MS);
143
+ expect(spy).toHaveBeenCalledWith(
144
+ {
145
+ schema: model_blocks_schemas.attribute.polyhedron.name,
146
+ params: {
147
+ id,
148
+ block_ids: block_viewer_ids,
149
+ name: "test_attribute",
150
+ },
151
+ },
152
+ {
153
+ response_function: expect.any(Function),
154
+ },
155
+ );
156
+ for (const block_id of block_ids) {
157
+ expect(dataStyleStore.modelBlocksPolyhedronAttributeName(id, block_id)).toBe(
158
+ "test_attribute",
159
+ );
160
+ }
161
+ expect(viewerStore.status).toBe(Status.CONNECTED);
162
+ });
163
+ });
164
+
93
165
  describe("blocks style", () => {
94
166
  test("blocks apply style", async () => {
95
167
  const dataStyleStore = useDataStyleStore();
@@ -100,4 +172,50 @@ describe("model blocks", () => {
100
172
  expect(viewerStore.status).toBe(Status.CONNECTED);
101
173
  });
102
174
  });
175
+
176
+ describe("block component active coloring", () => {
177
+ test("coloring color", async () => {
178
+ const dataStyleStore = useDataStyleStore();
179
+ const viewerStore = useViewerStore();
180
+ const dataStore = useDataStore();
181
+ const block_ids = await dataStore.getBlocksGeodeIds(id);
182
+ const [block_id] = block_ids;
183
+ const coloringName = "color";
184
+ const result = dataStyleStore.setModelComponentColorMode(id, block_id, coloringName);
185
+ expect(result).toBeInstanceOf(Promise);
186
+ await result;
187
+ expect(dataStyleStore.modelBlockColorMode(id, block_id)).toBe(coloringName);
188
+ expect(viewerStore.status).toBe(Status.CONNECTED);
189
+ });
190
+
191
+ test("coloring vertex", async () => {
192
+ const dataStyleStore = useDataStyleStore();
193
+ const viewerStore = useViewerStore();
194
+ const dataStore = useDataStore();
195
+ const block_ids = await dataStore.getBlocksGeodeIds(id);
196
+ const [block_id] = block_ids;
197
+ await dataStyleStore.setModelBlocksVertexAttributeName(id, [block_id], "points");
198
+ const coloringName = "vertex";
199
+ const result = dataStyleStore.setModelComponentColorMode(id, block_id, coloringName);
200
+ expect(result).toBeInstanceOf(Promise);
201
+ await result;
202
+ expect(dataStyleStore.modelBlockColorMode(id, block_id)).toBe(coloringName);
203
+ expect(viewerStore.status).toBe(Status.CONNECTED);
204
+ });
205
+
206
+ test("coloring polyhedron", async () => {
207
+ const dataStyleStore = useDataStyleStore();
208
+ const viewerStore = useViewerStore();
209
+ const dataStore = useDataStore();
210
+ const block_ids = await dataStore.getBlocksGeodeIds(id);
211
+ const [block_id] = block_ids;
212
+ await dataStyleStore.setModelBlocksPolyhedronAttributeName(id, [block_id], "test_attribute");
213
+ const coloringName = "polyhedron";
214
+ const result = dataStyleStore.setModelComponentColorMode(id, block_id, coloringName);
215
+ expect(result).toBeInstanceOf(Promise);
216
+ await result;
217
+ expect(dataStyleStore.modelBlockColorMode(id, block_id)).toBe(coloringName);
218
+ expect(viewerStore.status).toBe(Status.CONNECTED);
219
+ });
220
+ });
103
221
  });
@@ -94,6 +94,39 @@ describe("model corners", () => {
94
94
  });
95
95
  });
96
96
 
97
+ describe("corners vertex attribute", () => {
98
+ test("coloring vertex attribute", async () => {
99
+ const dataStyleStore = useDataStyleStore();
100
+ const viewerStore = useViewerStore();
101
+ const dataStore = useDataStore();
102
+ const corner_ids = await dataStore.getCornersGeodeIds(id);
103
+ const corner_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, corner_ids);
104
+ const spy = vi.spyOn(viewerStore, "request");
105
+ spy.mockClear();
106
+ const result = dataStyleStore.setModelCornersVertexAttributeName(id, corner_ids, "points");
107
+ expect(result).toBeInstanceOf(Promise);
108
+ await result;
109
+ await sleep(SLEEP_MS);
110
+ expect(spy).toHaveBeenCalledWith(
111
+ {
112
+ schema: model_corners_schemas.attribute.vertex.name,
113
+ params: {
114
+ id,
115
+ block_ids: corner_viewer_ids,
116
+ name: "points",
117
+ },
118
+ },
119
+ {
120
+ response_function: expect.any(Function),
121
+ },
122
+ );
123
+ for (const corner_id of corner_ids) {
124
+ expect(dataStyleStore.modelCornersVertexAttributeName(id, corner_id)).toBe("points");
125
+ }
126
+ expect(viewerStore.status).toBe(Status.CONNECTED);
127
+ });
128
+ });
129
+
97
130
  describe("corner style", () => {
98
131
  test("corners apply style", async () => {
99
132
  const dataStyleStore = useDataStyleStore();
@@ -104,4 +137,35 @@ describe("model corners", () => {
104
137
  expect(viewerStore.status).toBe(Status.CONNECTED);
105
138
  });
106
139
  });
140
+
141
+ describe("corner component active coloring", () => {
142
+ test("coloring color", async () => {
143
+ const dataStyleStore = useDataStyleStore();
144
+ const viewerStore = useViewerStore();
145
+ const dataStore = useDataStore();
146
+ const corner_ids = await dataStore.getCornersGeodeIds(id);
147
+ const [corner_id] = corner_ids;
148
+ const coloringName = "color";
149
+ const result = dataStyleStore.setModelComponentColorMode(id, corner_id, coloringName);
150
+ expect(result).toBeInstanceOf(Promise);
151
+ await result;
152
+ expect(dataStyleStore.modelCornerColorMode(id, corner_id)).toBe(coloringName);
153
+ expect(viewerStore.status).toBe(Status.CONNECTED);
154
+ });
155
+
156
+ test("coloring vertex", async () => {
157
+ const dataStyleStore = useDataStyleStore();
158
+ const viewerStore = useViewerStore();
159
+ const dataStore = useDataStore();
160
+ const corner_ids = await dataStore.getCornersGeodeIds(id);
161
+ const [corner_id] = corner_ids;
162
+ await dataStyleStore.setModelCornersVertexAttributeName(id, [corner_id], "points");
163
+ const coloringName = "vertex";
164
+ const result = dataStyleStore.setModelComponentColorMode(id, corner_id, coloringName);
165
+ expect(result).toBeInstanceOf(Promise);
166
+ await result;
167
+ expect(dataStyleStore.modelCornerColorMode(id, corner_id)).toBe(coloringName);
168
+ expect(viewerStore.status).toBe(Status.CONNECTED);
169
+ });
170
+ });
107
171
  });
@@ -94,6 +94,72 @@ describe("model lines", () => {
94
94
  expect(viewerStore.status).toBe(Status.CONNECTED);
95
95
  });
96
96
  });
97
+ describe("lines vertex attribute", () => {
98
+ test("coloring vertex attribute", async () => {
99
+ const dataStyleStore = useDataStyleStore();
100
+ const viewerStore = useViewerStore();
101
+ const dataStore = useDataStore();
102
+ const line_ids = await dataStore.getLinesGeodeIds(id);
103
+ const lines_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, line_ids);
104
+ const spy = vi.spyOn(viewerStore, "request");
105
+ spy.mockClear();
106
+ const result = dataStyleStore.setModelLinesVertexAttributeName(id, line_ids, "points");
107
+ expect(result).toBeInstanceOf(Promise);
108
+ await result;
109
+ await sleep(SLEEP_MS);
110
+ expect(spy).toHaveBeenCalledWith(
111
+ {
112
+ schema: model_lines_schemas.attribute.vertex.name,
113
+ params: {
114
+ id,
115
+ block_ids: lines_viewer_ids,
116
+ name: "points",
117
+ },
118
+ },
119
+ {
120
+ response_function: expect.any(Function),
121
+ },
122
+ );
123
+ for (const line_id of line_ids) {
124
+ expect(dataStyleStore.modelLinesVertexAttributeName(id, line_id)).toBe("points");
125
+ }
126
+ expect(viewerStore.status).toBe(Status.CONNECTED);
127
+ });
128
+ });
129
+
130
+ describe("lines edge attribute", () => {
131
+ test("coloring edge attribute", async () => {
132
+ const dataStyleStore = useDataStyleStore();
133
+ const viewerStore = useViewerStore();
134
+ const dataStore = useDataStore();
135
+ const line_ids = await dataStore.getLinesGeodeIds(id);
136
+ const lines_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, line_ids);
137
+ const spy = vi.spyOn(viewerStore, "request");
138
+ spy.mockClear();
139
+ const result = dataStyleStore.setModelLinesEdgeAttributeName(id, line_ids, "test_attribute");
140
+ expect(result).toBeInstanceOf(Promise);
141
+ await result;
142
+ await sleep(SLEEP_MS);
143
+ expect(spy).toHaveBeenCalledWith(
144
+ {
145
+ schema: model_lines_schemas.attribute.edge.name,
146
+ params: {
147
+ id,
148
+ block_ids: lines_viewer_ids,
149
+ name: "test_attribute",
150
+ },
151
+ },
152
+ {
153
+ response_function: expect.any(Function),
154
+ },
155
+ );
156
+ for (const line_id of line_ids) {
157
+ expect(dataStyleStore.modelLinesEdgeAttributeName(id, line_id)).toBe("test_attribute");
158
+ }
159
+ expect(viewerStore.status).toBe(Status.CONNECTED);
160
+ });
161
+ });
162
+
97
163
  describe("lines style", () => {
98
164
  test("lines apply style", async () => {
99
165
  const dataStyleStore = useDataStyleStore();
@@ -104,4 +170,50 @@ describe("model lines", () => {
104
170
  expect(viewerStore.status).toBe(Status.CONNECTED);
105
171
  });
106
172
  });
173
+
174
+ describe("line component active coloring", () => {
175
+ test("coloring color", async () => {
176
+ const dataStyleStore = useDataStyleStore();
177
+ const viewerStore = useViewerStore();
178
+ const dataStore = useDataStore();
179
+ const line_ids = await dataStore.getLinesGeodeIds(id);
180
+ const [line_id] = line_ids;
181
+ const coloringName = "color";
182
+ const result = dataStyleStore.setModelComponentColorMode(id, line_id, coloringName);
183
+ expect(result).toBeInstanceOf(Promise);
184
+ await result;
185
+ expect(dataStyleStore.modelLineColorMode(id, line_id)).toBe(coloringName);
186
+ expect(viewerStore.status).toBe(Status.CONNECTED);
187
+ });
188
+
189
+ test("coloring vertex", async () => {
190
+ const dataStyleStore = useDataStyleStore();
191
+ const viewerStore = useViewerStore();
192
+ const dataStore = useDataStore();
193
+ const line_ids = await dataStore.getLinesGeodeIds(id);
194
+ const [line_id] = line_ids;
195
+ await dataStyleStore.setModelLinesVertexAttributeName(id, [line_id], "points");
196
+ const coloringName = "vertex";
197
+ const result = dataStyleStore.setModelComponentColorMode(id, line_id, coloringName);
198
+ expect(result).toBeInstanceOf(Promise);
199
+ await result;
200
+ expect(dataStyleStore.modelLineColorMode(id, line_id)).toBe(coloringName);
201
+ expect(viewerStore.status).toBe(Status.CONNECTED);
202
+ });
203
+
204
+ test("coloring edge", async () => {
205
+ const dataStyleStore = useDataStyleStore();
206
+ const viewerStore = useViewerStore();
207
+ const dataStore = useDataStore();
208
+ const line_ids = await dataStore.getLinesGeodeIds(id);
209
+ const [line_id] = line_ids;
210
+ await dataStyleStore.setModelLinesEdgeAttributeName(id, [line_id], "test_attribute");
211
+ const coloringName = "edge";
212
+ const result = dataStyleStore.setModelComponentColorMode(id, line_id, coloringName);
213
+ expect(result).toBeInstanceOf(Promise);
214
+ await result;
215
+ expect(dataStyleStore.modelLineColorMode(id, line_id)).toBe(coloringName);
216
+ expect(viewerStore.status).toBe(Status.CONNECTED);
217
+ });
218
+ });
107
219
  });
@@ -92,6 +92,78 @@ describe("model surfaces", () => {
92
92
  expect(viewerStore.status).toBe(Status.CONNECTED);
93
93
  });
94
94
  });
95
+ describe("surfaces vertex attribute", () => {
96
+ test("coloring vertex attribute", async () => {
97
+ const dataStyleStore = useDataStyleStore();
98
+ const viewerStore = useViewerStore();
99
+ const dataStore = useDataStore();
100
+ const surface_ids = await dataStore.getSurfacesGeodeIds(id);
101
+ const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, surface_ids);
102
+ const spy = vi.spyOn(viewerStore, "request");
103
+ spy.mockClear();
104
+ const result = dataStyleStore.setModelSurfacesVertexAttributeName(id, surface_ids, "points");
105
+ expect(result).toBeInstanceOf(Promise);
106
+ await result;
107
+ await sleep(SLEEP_MS);
108
+ expect(spy).toHaveBeenCalledWith(
109
+ {
110
+ schema: model_surfaces_schemas.attribute.vertex.name,
111
+ params: {
112
+ id,
113
+ block_ids: surface_viewer_ids,
114
+ name: "points",
115
+ },
116
+ },
117
+ {
118
+ response_function: expect.any(Function),
119
+ },
120
+ );
121
+ for (const surface_id of surface_ids) {
122
+ expect(dataStyleStore.modelSurfacesVertexAttributeName(id, surface_id)).toBe("points");
123
+ }
124
+ expect(viewerStore.status).toBe(Status.CONNECTED);
125
+ });
126
+ });
127
+
128
+ describe("surfaces polygon attribute", () => {
129
+ test("coloring polygon attribute", async () => {
130
+ const dataStyleStore = useDataStyleStore();
131
+ const viewerStore = useViewerStore();
132
+ const dataStore = useDataStore();
133
+ const surface_ids = await dataStore.getSurfacesGeodeIds(id);
134
+ const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(id, surface_ids);
135
+ const spy = vi.spyOn(viewerStore, "request");
136
+ spy.mockClear();
137
+ const result = dataStyleStore.setModelSurfacesPolygonAttributeName(
138
+ id,
139
+ surface_ids,
140
+ "test_attribute",
141
+ );
142
+ expect(result).toBeInstanceOf(Promise);
143
+ await result;
144
+ await sleep(SLEEP_MS);
145
+ expect(spy).toHaveBeenCalledWith(
146
+ {
147
+ schema: model_surfaces_schemas.attribute.polygon.name,
148
+ params: {
149
+ id,
150
+ block_ids: surface_viewer_ids,
151
+ name: "test_attribute",
152
+ },
153
+ },
154
+ {
155
+ response_function: expect.any(Function),
156
+ },
157
+ );
158
+ for (const surface_id of surface_ids) {
159
+ expect(dataStyleStore.modelSurfacesPolygonAttributeName(id, surface_id)).toBe(
160
+ "test_attribute",
161
+ );
162
+ }
163
+ expect(viewerStore.status).toBe(Status.CONNECTED);
164
+ });
165
+ });
166
+
95
167
  describe("surfaces style", () => {
96
168
  test("surfaces apply style", async () => {
97
169
  const dataStyleStore = useDataStyleStore();
@@ -102,4 +174,50 @@ describe("model surfaces", () => {
102
174
  expect(viewerStore.status).toBe(Status.CONNECTED);
103
175
  });
104
176
  });
177
+
178
+ describe("surface component active coloring", () => {
179
+ test("coloring color", async () => {
180
+ const dataStyleStore = useDataStyleStore();
181
+ const viewerStore = useViewerStore();
182
+ const dataStore = useDataStore();
183
+ const surface_ids = await dataStore.getSurfacesGeodeIds(id);
184
+ const [surface_id] = surface_ids;
185
+ const coloringName = "color";
186
+ const result = dataStyleStore.setModelComponentColorMode(id, surface_id, coloringName);
187
+ expect(result).toBeInstanceOf(Promise);
188
+ await result;
189
+ expect(dataStyleStore.modelSurfaceColorMode(id, surface_id)).toBe(coloringName);
190
+ expect(viewerStore.status).toBe(Status.CONNECTED);
191
+ });
192
+
193
+ test("coloring vertex", async () => {
194
+ const dataStyleStore = useDataStyleStore();
195
+ const viewerStore = useViewerStore();
196
+ const dataStore = useDataStore();
197
+ const surface_ids = await dataStore.getSurfacesGeodeIds(id);
198
+ const [surface_id] = surface_ids;
199
+ await dataStyleStore.setModelSurfacesVertexAttributeName(id, [surface_id], "points");
200
+ const coloringName = "vertex";
201
+ const result = dataStyleStore.setModelComponentColorMode(id, surface_id, coloringName);
202
+ expect(result).toBeInstanceOf(Promise);
203
+ await result;
204
+ expect(dataStyleStore.modelSurfaceColorMode(id, surface_id)).toBe(coloringName);
205
+ expect(viewerStore.status).toBe(Status.CONNECTED);
206
+ });
207
+
208
+ test("coloring polygon", async () => {
209
+ const dataStyleStore = useDataStyleStore();
210
+ const viewerStore = useViewerStore();
211
+ const dataStore = useDataStore();
212
+ const surface_ids = await dataStore.getSurfacesGeodeIds(id);
213
+ const [surface_id] = surface_ids;
214
+ await dataStyleStore.setModelSurfacesPolygonAttributeName(id, [surface_id], "test_attribute");
215
+ const coloringName = "polygon";
216
+ const result = dataStyleStore.setModelComponentColorMode(id, surface_id, coloringName);
217
+ expect(result).toBeInstanceOf(Promise);
218
+ await result;
219
+ expect(dataStyleStore.modelSurfaceColorMode(id, surface_id)).toBe(coloringName);
220
+ expect(viewerStore.status).toBe(Status.CONNECTED);
221
+ });
222
+ });
105
223
  });