@geode/opengeodeweb-front 9.9.0 → 9.10.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.
- package/assets/viewer_svgs/edged_curve_edges.svg +67 -0
- package/assets/viewer_svgs/edged_curve_points.svg +95 -0
- package/assets/viewer_svgs/grid_2d_cells.svg +78 -0
- package/assets/viewer_svgs/grid_2d_edges.svg +71 -0
- package/assets/viewer_svgs/grid_2d_points.svg +108 -0
- package/assets/viewer_svgs/grid_3d_cells.svg +76 -0
- package/assets/viewer_svgs/grid_3d_edges.svg +72 -0
- package/assets/viewer_svgs/grid_3d_facets.svg +102 -0
- package/assets/viewer_svgs/grid_3d_points.svg +172 -0
- package/assets/viewer_svgs/point_set_points.svg +86 -0
- package/assets/viewer_svgs/solid_edges.svg +96 -0
- package/assets/viewer_svgs/solid_facets.svg +119 -0
- package/assets/viewer_svgs/solid_points.svg +134 -0
- package/assets/viewer_svgs/solid_polyhedra.svg +103 -0
- package/assets/viewer_svgs/surface_edges.svg +73 -0
- package/assets/viewer_svgs/surface_points.svg +115 -0
- package/assets/viewer_svgs/surface_triangles.svg +92 -0
- package/components/ContextMenu.vue +123 -0
- package/components/ContextMenuItem.vue +90 -0
- package/components/HybridRenderingView.vue +41 -0
- package/components/VeaseViewToolbar.vue +107 -0
- package/components/Viewer/BreadCrumb.vue +61 -0
- package/components/Viewer/EdgedCurve/EdgesOptions.vue +14 -0
- package/components/Viewer/EdgedCurve/PointsOptions.vue +14 -0
- package/components/Viewer/Generic/Mesh/EdgesOptions.vue +48 -0
- package/components/Viewer/Generic/Mesh/PointsOptions.vue +73 -0
- package/components/Viewer/Generic/Mesh/PolygonsOptions.vue +65 -0
- package/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +58 -0
- package/components/Viewer/Generic/Model/EdgesOptions.vue +29 -0
- package/components/Viewer/Generic/Model/PointsOptions.vue +53 -0
- package/components/Viewer/Grid/2D/CellsOptions.vue +15 -0
- package/components/Viewer/Grid/2D/EdgesOptions.vue +14 -0
- package/components/Viewer/Grid/2D/PointsOptions.vue +14 -0
- package/components/Viewer/Grid/3D/CellsOptions.vue +15 -0
- package/components/Viewer/Grid/3D/EdgesOptions.vue +14 -0
- package/components/Viewer/Grid/3D/FacetsOptions.vue +15 -0
- package/components/Viewer/Grid/3D/PointsOptions.vue +14 -0
- package/components/Viewer/HybridSolid/EdgesOptions.vue +14 -0
- package/components/Viewer/HybridSolid/PointsOptions.vue +14 -0
- package/components/Viewer/HybridSolid/PolygonsOptions.vue +14 -0
- package/components/Viewer/HybridSolid/PolyhedraOptions.vue +14 -0
- package/components/Viewer/Options/ColorPicker.vue +25 -0
- package/components/Viewer/Options/ColoringTypeSelector.vue +125 -0
- package/components/Viewer/Options/PolygonAttributeSelector.vue +59 -0
- package/components/Viewer/Options/PolyhedronAttributeSelector.vue +63 -0
- package/components/Viewer/Options/TextureItem.vue +116 -0
- package/components/Viewer/Options/TexturesSelector.vue +67 -0
- package/components/Viewer/Options/VertexAttributeSelector.vue +60 -0
- package/components/Viewer/Options/VisibilitySwitch.vue +14 -0
- package/components/Viewer/PointSet/PointsOptions.vue +14 -0
- package/components/Viewer/PointSet/SpecificPointsOptions.vue +74 -0
- package/components/Viewer/PolygonalSurface/EdgesOptions.vue +14 -0
- package/components/Viewer/PolygonalSurface/PointsOptions.vue +14 -0
- package/components/Viewer/PolygonalSurface/PolygonsOptions.vue +14 -0
- package/components/Viewer/Solid/EdgesOptions.vue +14 -0
- package/components/Viewer/Solid/PointsOptions.vue +14 -0
- package/components/Viewer/Solid/PolygonsOptions.vue +14 -0
- package/components/Viewer/Solid/PolyhedraOptions.vue +14 -0
- package/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +15 -0
- package/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +15 -0
- package/components/Viewer/Tree/ObjectTree.vue +170 -0
- package/components/Viewer/TreeComponent.vue +93 -0
- package/components/Viewer/TreeObject.vue +100 -0
- package/components/Viewer/TriangulatedSurface/EdgesOptions.vue +14 -0
- package/components/Viewer/TriangulatedSurface/PointsOptions.vue +14 -0
- package/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +15 -0
- package/internal_stores/data_style_state.js +18 -0
- package/internal_stores/mesh/edges.js +106 -0
- package/internal_stores/mesh/index.js +50 -0
- package/internal_stores/mesh/points.js +131 -0
- package/internal_stores/mesh/polygons.js +159 -0
- package/internal_stores/mesh/polyhedra.js +136 -0
- package/internal_stores/model/blocks.js +60 -0
- package/internal_stores/model/corners.js +63 -0
- package/internal_stores/model/edges.js +47 -0
- package/internal_stores/model/index.js +154 -0
- package/internal_stores/model/lines.js +81 -0
- package/internal_stores/model/points.js +61 -0
- package/internal_stores/model/surfaces.js +60 -0
- package/package.json +1 -1
- package/stores/data_base.js +148 -0
- package/stores/data_style.js +57 -0
- package/stores/hybrid_viewer.js +193 -0
- package/stores/menu.js +182 -0
- package/stores/treeview.js +64 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import "@kitware/vtk.js/Rendering/Profiles/Geometry"
|
|
2
|
+
import vtkGenericRenderWindow from "@kitware/vtk.js/Rendering/Misc/GenericRenderWindow"
|
|
3
|
+
import vtkXMLPolyDataReader from "@kitware/vtk.js/IO/XML/XMLPolyDataReader"
|
|
4
|
+
import vtkMapper from "@kitware/vtk.js/Rendering/Core/Mapper"
|
|
5
|
+
import vtkActor from "@kitware/vtk.js/Rendering/Core/Actor"
|
|
6
|
+
|
|
7
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
8
|
+
import Status from "@ogw_f/utils/status.js"
|
|
9
|
+
|
|
10
|
+
export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
11
|
+
const viewer_store = use_viewer_store()
|
|
12
|
+
const db = reactive({})
|
|
13
|
+
const status = ref(Status.NOT_CREATED)
|
|
14
|
+
const camera_options = reactive({})
|
|
15
|
+
const genericRenderWindow = reactive({})
|
|
16
|
+
const is_moving = ref(false)
|
|
17
|
+
const zScale = ref(1.0)
|
|
18
|
+
let viewStream
|
|
19
|
+
let gridActor = null
|
|
20
|
+
|
|
21
|
+
async function initHybridViewer() {
|
|
22
|
+
if (status.value !== Status.NOT_CREATED) return
|
|
23
|
+
status.value = Status.CREATING
|
|
24
|
+
genericRenderWindow.value = vtkGenericRenderWindow.newInstance({
|
|
25
|
+
background: [180 / 255, 180 / 255, 180 / 255],
|
|
26
|
+
listenWindowResize: false,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const webGLRenderWindow =
|
|
30
|
+
genericRenderWindow.value.getApiSpecificRenderWindow()
|
|
31
|
+
const imageStyle = webGLRenderWindow.getReferenceByName("bgImage").style
|
|
32
|
+
imageStyle.transition = "opacity 0.1s ease-in"
|
|
33
|
+
imageStyle.zIndex = 1
|
|
34
|
+
|
|
35
|
+
await viewer_store.ws_connect()
|
|
36
|
+
viewStream = viewer_store.client.getImageStream().createViewStream("-1")
|
|
37
|
+
viewStream.onImageReady((e) => {
|
|
38
|
+
if (is_moving.value) return
|
|
39
|
+
const webGLRenderWindow =
|
|
40
|
+
genericRenderWindow.value.getApiSpecificRenderWindow()
|
|
41
|
+
const imageStyle = webGLRenderWindow.getReferenceByName("bgImage").style
|
|
42
|
+
webGLRenderWindow.setBackgroundImage(e.image)
|
|
43
|
+
imageStyle.opacity = 1
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
status.value = Status.CREATED
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function addItem(id, value) {
|
|
50
|
+
const reader = vtkXMLPolyDataReader.newInstance()
|
|
51
|
+
const textEncoder = new TextEncoder()
|
|
52
|
+
await reader.parseAsArrayBuffer(
|
|
53
|
+
textEncoder.encode(value.binary_light_viewable),
|
|
54
|
+
)
|
|
55
|
+
const polydata = reader.getOutputData(0)
|
|
56
|
+
const mapper = vtkMapper.newInstance()
|
|
57
|
+
mapper.setInputData(polydata)
|
|
58
|
+
const actor = vtkActor.newInstance()
|
|
59
|
+
actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)
|
|
60
|
+
actor.setMapper(mapper)
|
|
61
|
+
const renderer = genericRenderWindow.value.getRenderer()
|
|
62
|
+
const renderWindow = genericRenderWindow.value.getRenderWindow()
|
|
63
|
+
renderer.addActor(actor)
|
|
64
|
+
renderer.resetCamera()
|
|
65
|
+
renderWindow.render()
|
|
66
|
+
db[id] = { actor, polydata, mapper }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function setZScaling(z_scale) {
|
|
70
|
+
zScale.value = z_scale
|
|
71
|
+
const renderer = genericRenderWindow.value.getRenderer()
|
|
72
|
+
const actors = renderer.getActors()
|
|
73
|
+
actors.forEach((actor) => {
|
|
74
|
+
if (actor !== gridActor) {
|
|
75
|
+
const scale = actor.getScale()
|
|
76
|
+
actor.setScale(scale[0], scale[1], z_scale)
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
renderer.resetCamera()
|
|
80
|
+
genericRenderWindow.value.getRenderWindow().render()
|
|
81
|
+
const schema = viewer_schemas?.opengeodeweb_viewer?.viewer?.set_z_scaling
|
|
82
|
+
if (!schema) return
|
|
83
|
+
await viewer_call({
|
|
84
|
+
schema,
|
|
85
|
+
params: {
|
|
86
|
+
z_scale: z_scale,
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function syncRemoteCamera() {
|
|
92
|
+
const renderer = genericRenderWindow.value.getRenderer()
|
|
93
|
+
const camera = renderer.getActiveCamera()
|
|
94
|
+
const params = {
|
|
95
|
+
camera_options: {
|
|
96
|
+
focal_point: camera.getFocalPoint(),
|
|
97
|
+
view_up: camera.getViewUp(),
|
|
98
|
+
position: camera.getPosition(),
|
|
99
|
+
view_angle: camera.getViewAngle(),
|
|
100
|
+
clipping_range: camera.getClippingRange(),
|
|
101
|
+
distance: camera.getDistance(),
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
viewer_call(
|
|
105
|
+
{
|
|
106
|
+
schema: viewer_schemas.opengeodeweb_viewer.viewer.update_camera,
|
|
107
|
+
params,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
response_fonction: () => {
|
|
111
|
+
for (const key in params.camera_options) {
|
|
112
|
+
camera_options[key] = params.camera_options[key]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function remoteRender() {
|
|
120
|
+
viewer_call({
|
|
121
|
+
schema: viewer_schemas.opengeodeweb_viewer.viewer.render_now,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function setContainer(container) {
|
|
126
|
+
genericRenderWindow.value.setContainer(container.value.$el)
|
|
127
|
+
const webGLRenderWindow =
|
|
128
|
+
genericRenderWindow.value.getApiSpecificRenderWindow()
|
|
129
|
+
webGLRenderWindow.setUseBackgroundImage(true)
|
|
130
|
+
const imageStyle = webGLRenderWindow.getReferenceByName("bgImage").style
|
|
131
|
+
imageStyle.transition = "opacity 0.1s ease-in"
|
|
132
|
+
imageStyle.zIndex = 1
|
|
133
|
+
resize(container.value.$el.offsetWidth, container.value.$el.offsetHeight)
|
|
134
|
+
|
|
135
|
+
useMousePressed({
|
|
136
|
+
target: container,
|
|
137
|
+
onPressed: (event) => {
|
|
138
|
+
if (event.button == 0) {
|
|
139
|
+
is_moving.value = true
|
|
140
|
+
event.stopPropagation()
|
|
141
|
+
imageStyle.opacity = 0
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
onReleased: () => {
|
|
145
|
+
is_moving.value = false
|
|
146
|
+
syncRemoteCamera()
|
|
147
|
+
},
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
let wheelEventEndTimeout = null
|
|
151
|
+
useEventListener(container, "wheel", () => {
|
|
152
|
+
is_moving.value = true
|
|
153
|
+
imageStyle.opacity = 0
|
|
154
|
+
clearTimeout(wheelEventEndTimeout)
|
|
155
|
+
wheelEventEndTimeout = setTimeout(() => {
|
|
156
|
+
is_moving.value = false
|
|
157
|
+
syncRemoteCamera()
|
|
158
|
+
}, 600)
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function resize(width, height) {
|
|
163
|
+
if (
|
|
164
|
+
viewer_store.status !== Status.CONNECTED ||
|
|
165
|
+
status.value !== Status.CREATED
|
|
166
|
+
) {
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
const webGLRenderWindow =
|
|
170
|
+
genericRenderWindow.value.getApiSpecificRenderWindow()
|
|
171
|
+
const canvas = webGLRenderWindow.getCanvas()
|
|
172
|
+
canvas.width = width
|
|
173
|
+
canvas.height = height
|
|
174
|
+
await nextTick()
|
|
175
|
+
webGLRenderWindow.setSize(width, height)
|
|
176
|
+
viewStream.setSize(width, height)
|
|
177
|
+
const renderWindow = genericRenderWindow.value.getRenderWindow()
|
|
178
|
+
renderWindow.render()
|
|
179
|
+
remoteRender()
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
db,
|
|
184
|
+
genericRenderWindow,
|
|
185
|
+
addItem,
|
|
186
|
+
setZScaling,
|
|
187
|
+
syncRemoteCamera,
|
|
188
|
+
initHybridViewer,
|
|
189
|
+
resize,
|
|
190
|
+
setContainer,
|
|
191
|
+
zScale,
|
|
192
|
+
}
|
|
193
|
+
})
|
package/stores/menu.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// PointSet components
|
|
2
|
+
import PointSetPointsOptions from "@ogw_f/components/Viewer/PointSet/PointsOptions.vue"
|
|
3
|
+
|
|
4
|
+
// EdgedCurve components
|
|
5
|
+
import EdgedCurvePointsOptions from "@ogw_f/components/Viewer/EdgedCurve/PointsOptions.vue"
|
|
6
|
+
import EdgedCurveEdgesOptions from "@ogw_f/components/Viewer/EdgedCurve/EdgesOptions.vue"
|
|
7
|
+
|
|
8
|
+
// PolygonalSurface components
|
|
9
|
+
import PolygonalSurfacePointsOptions from "@ogw_f/components/Viewer/PolygonalSurface/PointsOptions.vue"
|
|
10
|
+
import PolygonalSurfaceEdgesOptions from "@ogw_f/components/Viewer/PolygonalSurface/EdgesOptions.vue"
|
|
11
|
+
import PolygonalSurfacePolygonsOptions from "@ogw_f/components/Viewer/PolygonalSurface/PolygonsOptions.vue"
|
|
12
|
+
|
|
13
|
+
// TriangulatedSurface components
|
|
14
|
+
import TriangulatedSurfacePointsOptions from "@ogw_f/components/Viewer/TriangulatedSurface/PointsOptions.vue"
|
|
15
|
+
import TriangulatedSurfaceEdgesOptions from "@ogw_f/components/Viewer/TriangulatedSurface/EdgesOptions.vue"
|
|
16
|
+
import TriangulatedSurfaceTrianglesOptions from "@ogw_f/components/Viewer/TriangulatedSurface/TrianglesOptions.vue"
|
|
17
|
+
|
|
18
|
+
// Grid 2D components
|
|
19
|
+
import Grid2DPointsOptions from "@ogw_f/components/Viewer/Grid/2D/PointsOptions.vue"
|
|
20
|
+
import Grid2DEdgesOptions from "@ogw_f/components/Viewer/Grid/2D/EdgesOptions.vue"
|
|
21
|
+
import Grid2DCellsOptions from "@ogw_f/components/Viewer/Grid/2D/CellsOptions.vue"
|
|
22
|
+
|
|
23
|
+
// Grid 3D components
|
|
24
|
+
import Grid3DPointsOptions from "@ogw_f/components/Viewer/Grid/3D/PointsOptions.vue"
|
|
25
|
+
import Grid3DEdgesOptions from "@ogw_f/components/Viewer/Grid/3D/EdgesOptions.vue"
|
|
26
|
+
import Grid3DFacetsOptions from "@ogw_f/components/Viewer/Grid/3D/FacetsOptions.vue"
|
|
27
|
+
import Grid3DCellsOptions from "@ogw_f/components/Viewer/Grid/3D/CellsOptions.vue"
|
|
28
|
+
|
|
29
|
+
// Solid components
|
|
30
|
+
import SolidPointsOptions from "@ogw_f/components/Viewer/Solid/PointsOptions.vue"
|
|
31
|
+
import SolidEdgesOptions from "@ogw_f/components/Viewer/Solid/EdgesOptions.vue"
|
|
32
|
+
import SolidPolygonsOptions from "@ogw_f/components/Viewer/Solid/PolygonsOptions.vue"
|
|
33
|
+
import SolidPolyhedraOptions from "@ogw_f/components/Viewer/Solid/PolyhedraOptions.vue"
|
|
34
|
+
|
|
35
|
+
// TetrahedralSolid components
|
|
36
|
+
import TetrahedralSolidTrianglesOptions from "@ogw_f/components/Viewer/TetrahedralSolid/TrianglesOptions.vue"
|
|
37
|
+
import TetrahedralSolidTetrahedraOptions from "@ogw_f/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue"
|
|
38
|
+
|
|
39
|
+
// Model components
|
|
40
|
+
import ModelEdgesOptions from "@ogw_f/components/Viewer/Generic/Model/EdgesOptions.vue"
|
|
41
|
+
import ModelPointsOptions from "@ogw_f/components/Viewer/Generic/Model/PointsOptions.vue"
|
|
42
|
+
|
|
43
|
+
const PointSet_menu = [PointSetPointsOptions]
|
|
44
|
+
|
|
45
|
+
const EdgedCurve_menu = [EdgedCurvePointsOptions, EdgedCurveEdgesOptions]
|
|
46
|
+
|
|
47
|
+
const PolygonalSurface_menu = [
|
|
48
|
+
PolygonalSurfacePointsOptions,
|
|
49
|
+
PolygonalSurfaceEdgesOptions,
|
|
50
|
+
PolygonalSurfacePolygonsOptions,
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
const TriangulatedSurface_menu = [
|
|
54
|
+
TriangulatedSurfacePointsOptions,
|
|
55
|
+
TriangulatedSurfaceEdgesOptions,
|
|
56
|
+
TriangulatedSurfaceTrianglesOptions,
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
const Grid2D_menu = [
|
|
60
|
+
Grid2DPointsOptions,
|
|
61
|
+
Grid2DEdgesOptions,
|
|
62
|
+
Grid2DCellsOptions,
|
|
63
|
+
]
|
|
64
|
+
const Grid3D_menu = [
|
|
65
|
+
Grid3DPointsOptions,
|
|
66
|
+
Grid3DEdgesOptions,
|
|
67
|
+
Grid3DFacetsOptions,
|
|
68
|
+
Grid3DCellsOptions,
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const Solid_menu = [
|
|
72
|
+
SolidPointsOptions,
|
|
73
|
+
SolidEdgesOptions,
|
|
74
|
+
SolidPolygonsOptions,
|
|
75
|
+
SolidPolyhedraOptions,
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
const TetrahedralSolid_menu = [
|
|
79
|
+
SolidPointsOptions,
|
|
80
|
+
SolidEdgesOptions,
|
|
81
|
+
TetrahedralSolidTrianglesOptions,
|
|
82
|
+
TetrahedralSolidTetrahedraOptions,
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
const BRep_menu = [ModelEdgesOptions, ModelPointsOptions]
|
|
86
|
+
|
|
87
|
+
const CrossSection_menu = [ModelEdgesOptions, ModelPointsOptions]
|
|
88
|
+
|
|
89
|
+
const ImplicitCrossSection_menu = [ModelEdgesOptions, ModelPointsOptions]
|
|
90
|
+
const ImplicitStructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions]
|
|
91
|
+
|
|
92
|
+
const Section_menu = [ModelEdgesOptions, ModelPointsOptions]
|
|
93
|
+
|
|
94
|
+
const StructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions]
|
|
95
|
+
|
|
96
|
+
const menusData = {
|
|
97
|
+
mesh: {
|
|
98
|
+
EdgedCurve2D: EdgedCurve_menu,
|
|
99
|
+
EdgedCurve3D: EdgedCurve_menu,
|
|
100
|
+
HybridSolid3D: Solid_menu,
|
|
101
|
+
LightRegularGrid2D: Grid2D_menu,
|
|
102
|
+
LightRegularGrid3D: Grid3D_menu,
|
|
103
|
+
PointSet2D: PointSet_menu,
|
|
104
|
+
PointSet3D: PointSet_menu,
|
|
105
|
+
PolygonalSurface2D: PolygonalSurface_menu,
|
|
106
|
+
PolygonalSurface3D: PolygonalSurface_menu,
|
|
107
|
+
PolyhedralSolid3D: Solid_menu,
|
|
108
|
+
RegularGrid2D: Grid2D_menu,
|
|
109
|
+
RegularGrid3D: Grid3D_menu,
|
|
110
|
+
TetrahedralSolid3D: TetrahedralSolid_menu,
|
|
111
|
+
TriangulatedSurface2D: TriangulatedSurface_menu,
|
|
112
|
+
TriangulatedSurface3D: TriangulatedSurface_menu,
|
|
113
|
+
},
|
|
114
|
+
model: {
|
|
115
|
+
BRep: BRep_menu,
|
|
116
|
+
CrossSection: CrossSection_menu,
|
|
117
|
+
ImplicitCrossSection: ImplicitCrossSection_menu,
|
|
118
|
+
ImplicitStructuralModel: ImplicitStructuralModel_menu,
|
|
119
|
+
Section: Section_menu,
|
|
120
|
+
StructuralModel: StructuralModel_menu,
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const useMenuStore = defineStore("menu", () => {
|
|
125
|
+
const menus = ref(menusData)
|
|
126
|
+
const display_menu = ref(false)
|
|
127
|
+
const current_id = ref(null)
|
|
128
|
+
const menuX = ref(0)
|
|
129
|
+
const menuY = ref(0)
|
|
130
|
+
const containerWidth = ref(window.innerWidth)
|
|
131
|
+
const containerHeight = ref(window.innerHeight)
|
|
132
|
+
|
|
133
|
+
function getMenuItems(objectType, geodeObject) {
|
|
134
|
+
if (!objectType || !geodeObject || !menus.value[objectType]) {
|
|
135
|
+
return []
|
|
136
|
+
}
|
|
137
|
+
return menus.value[objectType][geodeObject] || []
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function closeMenu() {
|
|
141
|
+
display_menu.value = false
|
|
142
|
+
current_id.value = null
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function openMenu(id, x, y, containerWidth, containerHeight) {
|
|
146
|
+
await closeMenu()
|
|
147
|
+
current_id.value = id
|
|
148
|
+
|
|
149
|
+
if (x !== undefined && y !== undefined) {
|
|
150
|
+
menuX.value = x
|
|
151
|
+
menuY.value = y
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (containerWidth) containerWidth.value = containerWidth
|
|
155
|
+
if (containerHeight) containerHeight.value = containerHeight
|
|
156
|
+
|
|
157
|
+
display_menu.value = true
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function showItemsWithDelay() {
|
|
161
|
+
const DELAY = 50
|
|
162
|
+
const items = getMenuItems()
|
|
163
|
+
items.forEach((item, index) => {
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
item.visible = true
|
|
166
|
+
}, index * DELAY)
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
display_menu,
|
|
172
|
+
current_id,
|
|
173
|
+
menuX,
|
|
174
|
+
menuY,
|
|
175
|
+
containerWidth,
|
|
176
|
+
containerHeight,
|
|
177
|
+
getMenuItems,
|
|
178
|
+
closeMenu,
|
|
179
|
+
openMenu,
|
|
180
|
+
showItemsWithDelay,
|
|
181
|
+
}
|
|
182
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const use_treeview_store = defineStore("treeview", () => {
|
|
2
|
+
const dataStyleStore = useDataStyleStore()
|
|
3
|
+
|
|
4
|
+
/** State **/
|
|
5
|
+
const items = ref([])
|
|
6
|
+
const selection = ref([])
|
|
7
|
+
const components_selection = ref([])
|
|
8
|
+
const isAdditionnalTreeDisplayed = ref(false)
|
|
9
|
+
const panelWidth = ref(300)
|
|
10
|
+
const model_id = ref("")
|
|
11
|
+
const isTreeCollection = ref(false)
|
|
12
|
+
const selectedTree = ref(null)
|
|
13
|
+
|
|
14
|
+
/** Functions **/
|
|
15
|
+
function addItem(geodeObject, displayed_name, id, object_type) {
|
|
16
|
+
dataStyleStore.addDataStyle(id, geodeObject, object_type)
|
|
17
|
+
const child = { title: displayed_name, id, object_type }
|
|
18
|
+
for (let i = 0; i < items.value.length; i++) {
|
|
19
|
+
if (items.value[i].title === geodeObject) {
|
|
20
|
+
items.value[i].children.push(child)
|
|
21
|
+
selection.value.push(child)
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
items.value.push({ title: geodeObject, children: [child] })
|
|
26
|
+
selection.value.push(child)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function displayAdditionalTree(id) {
|
|
30
|
+
isAdditionnalTreeDisplayed.value = true
|
|
31
|
+
model_id.value = id
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function displayFileTree() {
|
|
35
|
+
isAdditionnalTreeDisplayed.value = false
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function toggleTreeView() {
|
|
39
|
+
isTreeCollection.value = !isTreeCollection.value
|
|
40
|
+
console.log(
|
|
41
|
+
"Switched to",
|
|
42
|
+
isTreeCollection.value ? "TreeCollection" : "TreeComponent",
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function setPanelWidth(width) {
|
|
47
|
+
panelWidth.value = width
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
items,
|
|
52
|
+
selection,
|
|
53
|
+
components_selection,
|
|
54
|
+
isAdditionnalTreeDisplayed,
|
|
55
|
+
panelWidth,
|
|
56
|
+
model_id,
|
|
57
|
+
selectedTree,
|
|
58
|
+
addItem,
|
|
59
|
+
displayAdditionalTree,
|
|
60
|
+
displayFileTree,
|
|
61
|
+
toggleTreeView,
|
|
62
|
+
setPanelWidth,
|
|
63
|
+
}
|
|
64
|
+
})
|