@eturnity/eturnity_3d 8.31.0 → 8.31.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/package.json +1 -1
- package/src/components/ThreeCanvasViewer.vue +70 -62
- package/src/helper/cameraMixin.js +51 -34
- package/src/helper/render/base.js +6 -0
- package/src/helper/render/building.js +23 -0
- package/src/helper/render/edge.js +11 -0
- package/src/helper/render/imageOverlay.js +10 -0
- package/src/helper/render/index.js +6 -1
- package/src/helper/render/marker.js +71 -0
- package/src/helper/render/moduleField.js +6 -0
- package/src/helper/render/obstacle.js +8 -0
- package/src/helper/render/overlay.js +19 -2
- package/src/helper/render/panel.js +2 -0
- package/src/helper/render/roof.js +10 -0
- package/src/helper/render/scene.js +79 -0
- package/src/helper/render/tile.js +16 -4
- package/src/helper/renderMixin.js +67 -1
- package/src/helper/threeMixin.js +5 -2
- package/src/store/three-d-module.js +36 -16
- package/src/utils/layers.js +52 -0
- package/src/utils/leaflet-config.service.js +1 -1
package/package.json
CHANGED
|
@@ -32,14 +32,56 @@
|
|
|
32
32
|
intervalEventId: null,
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
computed: {
|
|
36
|
+
...mapState({
|
|
37
|
+
geometryData: (state) => state.threeDModule.geometryData,
|
|
38
|
+
uuid: (state) => state.threeDModule.uuid,
|
|
39
|
+
view_mode: (state) => state.threeDModule.view_mode,
|
|
40
|
+
useCustomCamera: (state) => state.threeDModule.useCustomCamera,
|
|
41
|
+
cameraPerspectiveSettings: (state) =>
|
|
42
|
+
state.threeDModule.cameraPerspectiveSettings,
|
|
43
|
+
isInteractive: (state) => state.threeDModule.isInteractive,
|
|
44
|
+
isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
|
|
45
|
+
imageOverlay: (state) => state.threeDModule.imageOverlay,
|
|
46
|
+
}),
|
|
47
|
+
...mapGetters({
|
|
48
|
+
polygons: 'getPolygons',
|
|
49
|
+
edges: 'getEdges3D',
|
|
50
|
+
nodes: 'getNodes3D',
|
|
51
|
+
mapConfig: 'getMapConfig',
|
|
52
|
+
roofsBounds: 'getRoofsBounds',
|
|
53
|
+
layoutSettings: 'getLayoutSettings',
|
|
54
|
+
roofs: 'getRoofs',
|
|
55
|
+
obstacles: 'getObstacles',
|
|
56
|
+
moduleFields: 'getModuleFields',
|
|
57
|
+
panels: 'getPanels',
|
|
58
|
+
userDeactivatedPanels: 'getUserDeactivatedPanels',
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
watch: {
|
|
62
|
+
isReady: {
|
|
63
|
+
handler() {
|
|
64
|
+
if (this.screenshotable) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
const overlayReady =
|
|
68
|
+
OverlayLayer.getItems().length == 0 || this.isReady.overlay
|
|
69
|
+
if (
|
|
70
|
+
this.isReady.texturesToLoad == this.isReady.texturesLoaded &&
|
|
71
|
+
this.isReady.geometry &&
|
|
72
|
+
overlayReady
|
|
73
|
+
) {
|
|
74
|
+
var event = new CustomEvent('screenshotable')
|
|
75
|
+
document.dispatchEvent(event)
|
|
76
|
+
this.intervalEventId = setInterval(() => {
|
|
77
|
+
document.dispatchEvent(event)
|
|
78
|
+
}, 500)
|
|
79
|
+
// dispatch the custom event
|
|
80
|
+
this.screenshotable = true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
deep: true,
|
|
84
|
+
},
|
|
43
85
|
},
|
|
44
86
|
async mounted() {
|
|
45
87
|
await this.hydrateData(this.geometryData)
|
|
@@ -76,7 +118,10 @@
|
|
|
76
118
|
const polygon = this.polygons.find((p) => p.id == this.uuid)
|
|
77
119
|
this.setCamera(polygon, this.view_mode)
|
|
78
120
|
}
|
|
79
|
-
this.isReady
|
|
121
|
+
this.isReady = {
|
|
122
|
+
...this.isReady,
|
|
123
|
+
geometry: true,
|
|
124
|
+
}
|
|
80
125
|
this.intervalId = setInterval(() => this.render(), 500)
|
|
81
126
|
OverlayLayer.addEventListener(
|
|
82
127
|
'overlay-is-ready',
|
|
@@ -84,31 +129,14 @@
|
|
|
84
129
|
)
|
|
85
130
|
this.render()
|
|
86
131
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
isInteractive: (state) => state.threeDModule.isInteractive,
|
|
96
|
-
isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
|
|
97
|
-
imageOverlay: (state) => state.threeDModule.imageOverlay,
|
|
98
|
-
}),
|
|
99
|
-
...mapGetters({
|
|
100
|
-
polygons: 'getPolygons',
|
|
101
|
-
edges: 'getEdges3D',
|
|
102
|
-
nodes: 'getNodes3D',
|
|
103
|
-
mapConfig: 'getMapConfig',
|
|
104
|
-
roofsBounds: 'getRoofsBounds',
|
|
105
|
-
layoutSettings: 'getLayoutSettings',
|
|
106
|
-
roofs: 'getRoofs',
|
|
107
|
-
obstacles: 'getObstacles',
|
|
108
|
-
moduleFields: 'getModuleFields',
|
|
109
|
-
panels: 'getPanels',
|
|
110
|
-
userDeactivatedPanels: 'getUserDeactivatedPanels',
|
|
111
|
-
}),
|
|
132
|
+
beforeUnmount() {
|
|
133
|
+
clearInterval(this.intervalId)
|
|
134
|
+
clearInterval(this.intervalEventId)
|
|
135
|
+
cancelAnimationFrame(this.animationFrameId)
|
|
136
|
+
OverlayLayer.removeEventListener(
|
|
137
|
+
'overlay-is-ready',
|
|
138
|
+
this.updateOverlayRendering
|
|
139
|
+
)
|
|
112
140
|
},
|
|
113
141
|
methods: {
|
|
114
142
|
...mapActions({
|
|
@@ -162,8 +190,10 @@
|
|
|
162
190
|
const target = [0, 0, 0]
|
|
163
191
|
this.orthographicCamera.position.set(...position)
|
|
164
192
|
this.orthographicCamera.lookAt(...target)
|
|
165
|
-
this.isReady
|
|
166
|
-
|
|
193
|
+
this.isReady = {
|
|
194
|
+
...this.isReady,
|
|
195
|
+
camera: true,
|
|
196
|
+
}
|
|
167
197
|
let { xMin, xMax, yMin, yMax } = this.orthographicBounds(
|
|
168
198
|
roofsBounds,
|
|
169
199
|
margin
|
|
@@ -263,7 +293,10 @@
|
|
|
263
293
|
this.camera.lookAt(...target)
|
|
264
294
|
this.camera.updateProjectionMatrix()
|
|
265
295
|
|
|
266
|
-
this.isReady
|
|
296
|
+
this.isReady = {
|
|
297
|
+
...this.isReady,
|
|
298
|
+
camera: true,
|
|
299
|
+
}
|
|
267
300
|
}
|
|
268
301
|
},
|
|
269
302
|
orthographicBounds(bounds, margin) {
|
|
@@ -309,31 +342,6 @@
|
|
|
309
342
|
}
|
|
310
343
|
},
|
|
311
344
|
},
|
|
312
|
-
watch: {
|
|
313
|
-
isReady: {
|
|
314
|
-
handler() {
|
|
315
|
-
if (this.screenshotable) {
|
|
316
|
-
return
|
|
317
|
-
}
|
|
318
|
-
const overlayReady =
|
|
319
|
-
OverlayLayer.getItems().length == 0 || this.isReady.overlay
|
|
320
|
-
if (
|
|
321
|
-
this.isReady.texturesToLoad == this.isReady.texturesLoaded &&
|
|
322
|
-
this.isReady.geometry &&
|
|
323
|
-
overlayReady
|
|
324
|
-
) {
|
|
325
|
-
var event = new CustomEvent('screenshotable')
|
|
326
|
-
document.dispatchEvent(event)
|
|
327
|
-
this.intervalEventId = setInterval(() => {
|
|
328
|
-
document.dispatchEvent(event)
|
|
329
|
-
}, 500)
|
|
330
|
-
// dispatch the custom event
|
|
331
|
-
this.screenshotable = true
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
deep: true,
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
345
|
}
|
|
338
346
|
</script>
|
|
339
347
|
|
|
@@ -13,24 +13,18 @@ export default {
|
|
|
13
13
|
data() {
|
|
14
14
|
return {
|
|
15
15
|
animationFrameId: null,
|
|
16
|
+
perspectiveCamera: new THREE.PerspectiveCamera(80, 300 / 300, 1, 50000),
|
|
17
|
+
orthographicCamera: new THREE.OrthographicCamera(
|
|
18
|
+
-50,
|
|
19
|
+
50,
|
|
20
|
+
50,
|
|
21
|
+
-50,
|
|
22
|
+
1,
|
|
23
|
+
1000
|
|
24
|
+
),
|
|
16
25
|
}
|
|
17
26
|
},
|
|
18
|
-
created() {
|
|
19
|
-
this.perspectiveCamera = new THREE.PerspectiveCamera(
|
|
20
|
-
80,
|
|
21
|
-
300 / 300,
|
|
22
|
-
1,
|
|
23
|
-
50000
|
|
24
|
-
)
|
|
25
|
-
this.orthographicCamera = new THREE.OrthographicCamera(
|
|
26
|
-
-50,
|
|
27
|
-
50,
|
|
28
|
-
50,
|
|
29
|
-
-50,
|
|
30
|
-
1,
|
|
31
|
-
1000
|
|
32
|
-
)
|
|
33
|
-
},
|
|
27
|
+
created() {},
|
|
34
28
|
methods: {
|
|
35
29
|
initialiseCameras(isPerspectiveCamera) {
|
|
36
30
|
if (isPerspectiveCamera) {
|
|
@@ -53,6 +47,11 @@ export default {
|
|
|
53
47
|
this.cameraProjection.up.set(0, 0, 1)
|
|
54
48
|
this.scene.add(this.camera)
|
|
55
49
|
},
|
|
50
|
+
setCameraZoomOffset(zoomOffset) {
|
|
51
|
+
this.camera.zoom = zoomOffset
|
|
52
|
+
this.camera.updateProjectionMatrix()
|
|
53
|
+
this.render()
|
|
54
|
+
},
|
|
56
55
|
setCameraAspectRatio() {
|
|
57
56
|
const canvasRatio =
|
|
58
57
|
this.DOMElement.clientWidth / this.DOMElement.clientHeight
|
|
@@ -74,9 +73,12 @@ export default {
|
|
|
74
73
|
this.camera.updateProjectionMatrix()
|
|
75
74
|
},
|
|
76
75
|
turnPerspectiveCameraToOrthogonal() {
|
|
76
|
+
if (this.orthographicCamera.id == this.camera.id) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
77
79
|
const cameraPosition = new THREE.Vector3(
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
80
|
+
this.orbitControl.target.x,
|
|
81
|
+
this.orbitControl.target.y,
|
|
80
82
|
this.camera.position.z
|
|
81
83
|
)
|
|
82
84
|
var halfHeightDistance =
|
|
@@ -105,12 +107,13 @@ export default {
|
|
|
105
107
|
)
|
|
106
108
|
this.camera.updateProjectionMatrix()
|
|
107
109
|
this.renderer.camera = this.camera
|
|
108
|
-
this.composer
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (this.composer) {
|
|
111
|
+
this.composer.renderCamera = this.camera
|
|
112
|
+
this.renderPass.camera = this.camera
|
|
113
|
+
this.overlayRenderPass.camera = this.camera
|
|
114
|
+
this.outlinePassHighlight.renderCamera = this.camera
|
|
115
|
+
this.outlinePassSelected.renderCamera = this.camera
|
|
116
|
+
}
|
|
114
117
|
this.orbitControl.screenSpacePanning = true
|
|
115
118
|
this.orbitControl.object = this.camera
|
|
116
119
|
this.orbitControl.target.set(cameraPosition.x, cameraPosition.y, 0)
|
|
@@ -132,9 +135,14 @@ export default {
|
|
|
132
135
|
this.camera.updateProjectionMatrix()
|
|
133
136
|
this.nodesVisible = true
|
|
134
137
|
this.renderNodes()
|
|
135
|
-
this.composer
|
|
138
|
+
if (this.composer) {
|
|
139
|
+
this.composer.render()
|
|
140
|
+
}
|
|
136
141
|
},
|
|
137
142
|
turnOrthogonalCameraToPerspective() {
|
|
143
|
+
if (this.perspectiveCamera.id == this.camera.id) {
|
|
144
|
+
return
|
|
145
|
+
}
|
|
138
146
|
this.camera = this.perspectiveCamera
|
|
139
147
|
let altitude =
|
|
140
148
|
(this.orthographicCamera.right - this.orthographicCamera.left) /
|
|
@@ -151,14 +159,16 @@ export default {
|
|
|
151
159
|
this.camera.updateProjectionMatrix()
|
|
152
160
|
|
|
153
161
|
this.renderer.camera = this.camera
|
|
154
|
-
this.composer
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
if (this.composer) {
|
|
163
|
+
this.composer.renderer.camera = this.camera
|
|
164
|
+
this.composer.renderCamera = this.camera
|
|
165
|
+
this.renderPass.camera = this.camera
|
|
166
|
+
this.overlayRenderPass.camera = this.camera
|
|
167
|
+
this.outlinePassHighlight.camera = this.camera
|
|
168
|
+
this.outlinePassHighlight.renderCamera = this.camera
|
|
169
|
+
this.outlinePassSelected.camera = this.camera
|
|
170
|
+
this.outlinePassSelected.renderCamera = this.camera
|
|
171
|
+
}
|
|
162
172
|
this.orbitControl.camera = this.camera
|
|
163
173
|
this.orbitControl.object = this.camera
|
|
164
174
|
this.orbitControl.target.set(
|
|
@@ -166,6 +176,11 @@ export default {
|
|
|
166
176
|
this.camera.position.y,
|
|
167
177
|
0
|
|
168
178
|
)
|
|
179
|
+
this.camera.position.set(
|
|
180
|
+
this.orthographicCamera.position.x,
|
|
181
|
+
this.orthographicCamera.position.y - 20,
|
|
182
|
+
altitude
|
|
183
|
+
)
|
|
169
184
|
this.orbitControl.screenSpacePanning = false
|
|
170
185
|
this.orbitControl.enableRotate = true
|
|
171
186
|
this.orbitControl.mouseButtons = {
|
|
@@ -175,7 +190,9 @@ export default {
|
|
|
175
190
|
}
|
|
176
191
|
this.orbitControl.update()
|
|
177
192
|
|
|
178
|
-
this.composer
|
|
193
|
+
if (this.composer) {
|
|
194
|
+
this.composer.render()
|
|
195
|
+
}
|
|
179
196
|
},
|
|
180
197
|
zoomIn3D() {
|
|
181
198
|
if (this.camera.isOrthographicCamera) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
created() {},
|
|
5
|
+
methods: {
|
|
6
|
+
showBuildings() {
|
|
7
|
+
this.showRoofs()
|
|
8
|
+
this.showBases()
|
|
9
|
+
this.showObstacles()
|
|
10
|
+
this.showModuleFields()
|
|
11
|
+
this.showEdges()
|
|
12
|
+
this.render()
|
|
13
|
+
},
|
|
14
|
+
hideBuildings() {
|
|
15
|
+
this.hideRoofs()
|
|
16
|
+
this.hideBases()
|
|
17
|
+
this.hideObstacles()
|
|
18
|
+
this.hideModuleFields()
|
|
19
|
+
this.hideEdges()
|
|
20
|
+
this.render()
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -36,6 +36,7 @@ export default {
|
|
|
36
36
|
return cylinder
|
|
37
37
|
},
|
|
38
38
|
renderEdges() {
|
|
39
|
+
if (this.selectedTool == 'screenshot') return
|
|
39
40
|
this.clearEdgesRemovedOnes('edgeMeshes')
|
|
40
41
|
if (this.renderLineEdges) {
|
|
41
42
|
this.renderLineEdges()
|
|
@@ -96,5 +97,15 @@ export default {
|
|
|
96
97
|
}
|
|
97
98
|
})
|
|
98
99
|
},
|
|
100
|
+
hideEdges() {
|
|
101
|
+
Object.values(this.meshes.edgeMeshes).forEach((mesh) => {
|
|
102
|
+
mesh.visible = false
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
showEdges() {
|
|
106
|
+
Object.values(this.meshes.edgeMeshes).forEach((mesh) => {
|
|
107
|
+
mesh.visible = true
|
|
108
|
+
})
|
|
109
|
+
},
|
|
99
110
|
},
|
|
100
111
|
}
|
|
@@ -54,6 +54,16 @@ export default {
|
|
|
54
54
|
this.meshes.backgroundMesh.visible = true
|
|
55
55
|
return
|
|
56
56
|
},
|
|
57
|
+
hideImageOverlays() {
|
|
58
|
+
OverlayLayer.dispatchActionToAllItems('setOpacity', 0)
|
|
59
|
+
this.updateProjectionMaterials()
|
|
60
|
+
this.renderImageOverlayOnBackground()
|
|
61
|
+
},
|
|
62
|
+
showImageOverlays() {
|
|
63
|
+
OverlayLayer.dispatchActionToAllItems('setOpacity', 1)
|
|
64
|
+
this.updateProjectionMaterials()
|
|
65
|
+
this.renderImageOverlayOnBackground()
|
|
66
|
+
},
|
|
57
67
|
async getOverlaysMaterials() {
|
|
58
68
|
let overlayMaterialsPromises = []
|
|
59
69
|
OverlayLayer.getReadyItems()
|
|
@@ -15,7 +15,9 @@ import projectionMaterial from './projectionMaterial'
|
|
|
15
15
|
import tile from './tile'
|
|
16
16
|
import tileProjection from './tileProjection'
|
|
17
17
|
import mergedGeometry from './mergedGeometry'
|
|
18
|
-
|
|
18
|
+
import building from './building'
|
|
19
|
+
import marker from './marker'
|
|
20
|
+
import scene from './scene'
|
|
19
21
|
export default {
|
|
20
22
|
mixins: [
|
|
21
23
|
margin,
|
|
@@ -35,5 +37,8 @@ export default {
|
|
|
35
37
|
tile,
|
|
36
38
|
tileProjection,
|
|
37
39
|
mergedGeometry,
|
|
40
|
+
building,
|
|
41
|
+
marker,
|
|
42
|
+
scene,
|
|
38
43
|
],
|
|
39
44
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
created() {},
|
|
5
|
+
methods: {
|
|
6
|
+
renderMarker() {
|
|
7
|
+
if (this.selectedTool != 'screenshot') {
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
if (this.meshes.markerMesh) {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
//const lod = new THREE.LOD()
|
|
14
|
+
const sphereGeometry = new THREE.SphereGeometry(1, 32, 32) // Initial radius of 5
|
|
15
|
+
const coneGeometry = new THREE.ConeGeometry(0.98, 2, 32)
|
|
16
|
+
|
|
17
|
+
const opacity = 1
|
|
18
|
+
const material = new THREE.MeshPhongMaterial({
|
|
19
|
+
color: 0xff0000, // red color
|
|
20
|
+
transparent: true,
|
|
21
|
+
opacity,
|
|
22
|
+
})
|
|
23
|
+
let roofCenter = {
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0,
|
|
26
|
+
z: 0,
|
|
27
|
+
}
|
|
28
|
+
if (this.roofs.length > 0) {
|
|
29
|
+
roofCenter = {
|
|
30
|
+
x: (this.roofsBounds.xMin + this.roofsBounds.xMax) / 2000,
|
|
31
|
+
y: (this.roofsBounds.yMin + this.roofsBounds.yMax) / 2000,
|
|
32
|
+
z: this.roofsBounds.zMax / 2000,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const sphereMesh = new THREE.Mesh(sphereGeometry, material)
|
|
36
|
+
const coneMesh = new THREE.Mesh(coneGeometry, material)
|
|
37
|
+
coneMesh.rotateX(-Math.PI / 2)
|
|
38
|
+
coneMesh.position.set(0, 0, -1.2)
|
|
39
|
+
const markerMesh = new THREE.Group()
|
|
40
|
+
markerMesh.add(coneMesh)
|
|
41
|
+
|
|
42
|
+
markerMesh.add(sphereMesh)
|
|
43
|
+
markerMesh.userData = { id: 'marker' }
|
|
44
|
+
markerMesh.position.set(roofCenter.x, roofCenter.y, roofCenter.z + 10)
|
|
45
|
+
markerMesh.scale.set(3, 3, 3)
|
|
46
|
+
// for (let i = 1; i < 10; i++) {
|
|
47
|
+
// const mesh = markerMesh.clone()
|
|
48
|
+
// mesh.scale.set(i * 3, i * 3, i * 3)
|
|
49
|
+
// mesh.position.set(0, 0, 12 * i)
|
|
50
|
+
// lod.addLevel(mesh, (i - 1) * 100)
|
|
51
|
+
// }
|
|
52
|
+
// const lastMesh = markerMesh.clone()
|
|
53
|
+
// lastMesh.scale.set(150, 150, 150)
|
|
54
|
+
// lastMesh.position.set(0, 0, 600)
|
|
55
|
+
// lod.addLevel(lastMesh, 1000)
|
|
56
|
+
// this.scene.add(lod)
|
|
57
|
+
this.scene.add(markerMesh)
|
|
58
|
+
this.meshes.markerMesh = markerMesh
|
|
59
|
+
},
|
|
60
|
+
showMarker() {
|
|
61
|
+
if (this.meshes.markerMesh) {
|
|
62
|
+
this.meshes.markerMesh.visible = true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
hideMarker() {
|
|
66
|
+
if (this.meshes.markerMesh) {
|
|
67
|
+
this.meshes.markerMesh.visible = false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
@@ -102,5 +102,11 @@ export default {
|
|
|
102
102
|
this.areModuleFieldsVisible && this.panelOpacity === 1)
|
|
103
103
|
)
|
|
104
104
|
},
|
|
105
|
+
hideModuleFields() {
|
|
106
|
+
this.updateModuleFieldsVisibility(false)
|
|
107
|
+
},
|
|
108
|
+
showModuleFields() {
|
|
109
|
+
this.updateModuleFieldsVisibility(true)
|
|
110
|
+
},
|
|
105
111
|
},
|
|
106
112
|
}
|
|
@@ -90,5 +90,13 @@ export default {
|
|
|
90
90
|
this.mergedObstacleMesh.receiveShadow = true
|
|
91
91
|
this.mergedObstacleMesh.castShadow = true
|
|
92
92
|
},
|
|
93
|
+
hideObstacles() {
|
|
94
|
+
this.mergedObstacleSideMesh.visible = false
|
|
95
|
+
this.mergedObstacleMesh.visible = false
|
|
96
|
+
},
|
|
97
|
+
showObstacles() {
|
|
98
|
+
this.mergedObstacleSideMesh.visible = true
|
|
99
|
+
this.mergedObstacleMesh.visible = true
|
|
100
|
+
},
|
|
93
101
|
},
|
|
94
102
|
}
|
|
@@ -83,12 +83,29 @@ export default {
|
|
|
83
83
|
})
|
|
84
84
|
},
|
|
85
85
|
updateOverlayRendering() {
|
|
86
|
+
this.renderOverlays()
|
|
87
|
+
this.updateProjectionMaterials()
|
|
88
|
+
this.render()
|
|
86
89
|
if (this.isReady) {
|
|
87
|
-
this.isReady
|
|
90
|
+
this.isReady = {
|
|
91
|
+
...this.isReady,
|
|
92
|
+
overlay: true,
|
|
93
|
+
}
|
|
88
94
|
}
|
|
95
|
+
},
|
|
96
|
+
hideOverlays() {
|
|
97
|
+
OverlayLayer.getItems().forEach((overlay) => {
|
|
98
|
+
overlay.setOpacity = 0
|
|
99
|
+
})
|
|
100
|
+
this.updateProjectionMaterials()
|
|
89
101
|
this.renderOverlays()
|
|
102
|
+
},
|
|
103
|
+
showOverlays() {
|
|
104
|
+
OverlayLayer.getItems().forEach((overlay) => {
|
|
105
|
+
overlay.setOpacity = 1
|
|
106
|
+
})
|
|
90
107
|
this.updateProjectionMaterials()
|
|
91
|
-
this.
|
|
108
|
+
this.renderOverlays()
|
|
92
109
|
},
|
|
93
110
|
},
|
|
94
111
|
}
|
|
@@ -111,6 +111,8 @@ export default {
|
|
|
111
111
|
const meshSide = existingSideMesh ? existingSideMesh : new THREE.Mesh()
|
|
112
112
|
meshSide.geometry = geometrySide
|
|
113
113
|
meshSide.material = this.material.panelSide
|
|
114
|
+
meshSide.material.opacity = this.panelOpacity
|
|
115
|
+
meshSide.material.transparent = true
|
|
114
116
|
meshSide.userData.version = panel.version
|
|
115
117
|
meshSide.userData.type = 'panelsMeshes'
|
|
116
118
|
meshSide.userData.meshId = panel.id + '_side'
|
|
@@ -158,5 +158,15 @@ export default {
|
|
|
158
158
|
}
|
|
159
159
|
})
|
|
160
160
|
},
|
|
161
|
+
hideRoofs() {
|
|
162
|
+
Object.values(this.meshes.roofMeshes).forEach((mesh) => {
|
|
163
|
+
mesh.visible = false
|
|
164
|
+
})
|
|
165
|
+
},
|
|
166
|
+
showRoofs() {
|
|
167
|
+
Object.values(this.meshes.roofMeshes).forEach((mesh) => {
|
|
168
|
+
mesh.visible = true
|
|
169
|
+
})
|
|
170
|
+
},
|
|
161
171
|
},
|
|
162
172
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
created() {},
|
|
5
|
+
methods: {
|
|
6
|
+
setSceneFromMetaData(params) {
|
|
7
|
+
const sunLight = this.scene.getObjectByName('sunLight')
|
|
8
|
+
if (sunLight) {
|
|
9
|
+
sunLight.castShadow = false
|
|
10
|
+
}
|
|
11
|
+
params.is_building_visible || params.is_building_visible == undefined
|
|
12
|
+
? this.showBuildings()
|
|
13
|
+
: this.hideBuildings()
|
|
14
|
+
params.is_overlay_visible || params.is_overlay_visible == undefined
|
|
15
|
+
? this.showImageOverlays()
|
|
16
|
+
: this.hideImageOverlays()
|
|
17
|
+
params.is_panel_visible || params.is_panel_visible == undefined
|
|
18
|
+
? this.showPanels()
|
|
19
|
+
: this.hidePanels()
|
|
20
|
+
params.is_marker_visible || params.is_marker_visible == undefined
|
|
21
|
+
? this.showMarker()
|
|
22
|
+
: this.hideMarker()
|
|
23
|
+
params.view_mode == '3d' || params.is_panel_visible == undefined
|
|
24
|
+
? this.turnOrthogonalCameraToPerspective()
|
|
25
|
+
: this.turnPerspectiveCameraToOrthogonal()
|
|
26
|
+
if (params.map_layer != undefined) {
|
|
27
|
+
this.initialiseMapLayer(params.map_layer)
|
|
28
|
+
}
|
|
29
|
+
if (params.zoom_level_offset && params.view_mode == '2d') {
|
|
30
|
+
this.setCameraZoomOffset(params.zoom_level_offset)
|
|
31
|
+
}
|
|
32
|
+
if (params.camera) {
|
|
33
|
+
this.setCameraFromMetaData(params.camera)
|
|
34
|
+
} else if (params.camera_offset) {
|
|
35
|
+
this.setCameraOffsetFromMetaData(params.camera_offset)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
setCameraOffsetFromMetaData(cameraOffset) {
|
|
39
|
+
this.camera.position.set(
|
|
40
|
+
this.orbitControl.target.x + cameraOffset.x_m,
|
|
41
|
+
this.orbitControl.target.y + cameraOffset.y_m,
|
|
42
|
+
this.orbitControl.target.z + cameraOffset.z_m
|
|
43
|
+
)
|
|
44
|
+
this.camera.updateProjectionMatrix()
|
|
45
|
+
this.orbitControl.update()
|
|
46
|
+
this.render()
|
|
47
|
+
},
|
|
48
|
+
setCameraFromMetaData(cameraMetaData) {
|
|
49
|
+
if (cameraMetaData.type != this.camera.type) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
this.camera.zoom = cameraMetaData.zoom
|
|
53
|
+
if (cameraMetaData.type == 'OrthographicCamera') {
|
|
54
|
+
this.camera.left = cameraMetaData.left
|
|
55
|
+
this.camera.right = cameraMetaData.right
|
|
56
|
+
this.camera.top = cameraMetaData.top
|
|
57
|
+
this.camera.bottom = cameraMetaData.bottom
|
|
58
|
+
} else {
|
|
59
|
+
if (cameraMetaData.position) {
|
|
60
|
+
this.camera.position.set(
|
|
61
|
+
cameraMetaData.position.x,
|
|
62
|
+
cameraMetaData.position.y,
|
|
63
|
+
cameraMetaData.position.z
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
if (cameraMetaData.target) {
|
|
67
|
+
this.orbitControl.target.set(
|
|
68
|
+
cameraMetaData.target.x,
|
|
69
|
+
cameraMetaData.target.y,
|
|
70
|
+
cameraMetaData.target.z
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this.camera.updateProjectionMatrix()
|
|
75
|
+
this.orbitControl.update()
|
|
76
|
+
this.render()
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}
|
|
@@ -257,10 +257,16 @@ export default {
|
|
|
257
257
|
meshId,
|
|
258
258
|
imagePromise,
|
|
259
259
|
})
|
|
260
|
-
this.isReady
|
|
260
|
+
this.isReady = {
|
|
261
|
+
...this.isReady,
|
|
262
|
+
texturesToLoad: this.isReady.texturesToLoad + 1,
|
|
263
|
+
}
|
|
261
264
|
imagePromise
|
|
262
265
|
.then((image) => {
|
|
263
|
-
this.isReady
|
|
266
|
+
this.isReady = {
|
|
267
|
+
...this.isReady,
|
|
268
|
+
texturesLoaded: this.isReady.texturesLoaded + 1,
|
|
269
|
+
}
|
|
264
270
|
if (!image) {
|
|
265
271
|
this.removeTileFromPending(meshId, mapLayer)
|
|
266
272
|
resolve()
|
|
@@ -433,9 +439,11 @@ export default {
|
|
|
433
439
|
let googleBackgroundUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${
|
|
434
440
|
roofsBoundCenterLatLng.lat + ',' + roofsBoundCenterLatLng.lng
|
|
435
441
|
}&maptype=${googleMapType}&zoom=${zoomLevel}&size=${size}x${size}&key=${apiKey}`
|
|
436
|
-
this.isReady
|
|
442
|
+
this.isReady = {
|
|
443
|
+
...this.isReady,
|
|
444
|
+
texturesToLoad: this.isReady.texturesToLoad + 1,
|
|
445
|
+
}
|
|
437
446
|
this.loader.load(googleBackgroundUrl, (texture) => {
|
|
438
|
-
this.isReady.texturesLoaded++
|
|
439
447
|
texture.encoding = THREE.sRGBEncoding
|
|
440
448
|
texture.colorSpace = THREE.SRGBColorSpace
|
|
441
449
|
planeTexture[indexGoogleBackground] = texture
|
|
@@ -486,6 +494,10 @@ export default {
|
|
|
486
494
|
this.googleBackgroundMap.castShadow = false
|
|
487
495
|
this.render()
|
|
488
496
|
}
|
|
497
|
+
this.isReady = {
|
|
498
|
+
...this.isReady,
|
|
499
|
+
texturesLoaded: this.isReady.texturesLoaded + 1,
|
|
500
|
+
}
|
|
489
501
|
})
|
|
490
502
|
}
|
|
491
503
|
|
|
@@ -26,6 +26,7 @@ export default {
|
|
|
26
26
|
moduleFieldsMeshes: {},
|
|
27
27
|
tileMeshes: {},
|
|
28
28
|
overlayMeshes: {},
|
|
29
|
+
markerMesh: null,
|
|
29
30
|
}
|
|
30
31
|
},
|
|
31
32
|
mounted() {
|
|
@@ -91,6 +92,12 @@ export default {
|
|
|
91
92
|
},
|
|
92
93
|
methods: {
|
|
93
94
|
refreshRendering(e) {
|
|
95
|
+
if (this.isReady) {
|
|
96
|
+
this.isReady = {
|
|
97
|
+
...this.isReady,
|
|
98
|
+
geometry: false,
|
|
99
|
+
}
|
|
100
|
+
}
|
|
94
101
|
let methodList = []
|
|
95
102
|
if (this.fullRenderNeeded) {
|
|
96
103
|
methodList = this.renderingMethodsByEvent({ name: 'full' })
|
|
@@ -111,6 +118,12 @@ export default {
|
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
this.lastGeometryEventIdDone = this.lastGeometryEventId
|
|
121
|
+
if (this.isReady) {
|
|
122
|
+
this.isReady = {
|
|
123
|
+
...this.isReady,
|
|
124
|
+
geometry: true,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
114
127
|
},
|
|
115
128
|
renderingMethodsByEvent(geometryEvent) {
|
|
116
129
|
const name = geometryEvent.name
|
|
@@ -181,6 +194,11 @@ export default {
|
|
|
181
194
|
case 'full':
|
|
182
195
|
case 'reset':
|
|
183
196
|
case 'changeOverlays':
|
|
197
|
+
methodList.push({
|
|
198
|
+
name: 'renderMarker',
|
|
199
|
+
method: this.renderMarker,
|
|
200
|
+
arg: [],
|
|
201
|
+
})
|
|
184
202
|
methodList.push({
|
|
185
203
|
name: 'renderOverlays',
|
|
186
204
|
method: this.renderOverlays,
|
|
@@ -445,6 +463,55 @@ export default {
|
|
|
445
463
|
arg: [],
|
|
446
464
|
})
|
|
447
465
|
break
|
|
466
|
+
case 'hideBuildings':
|
|
467
|
+
methodList.push({
|
|
468
|
+
name: 'hideBuilding',
|
|
469
|
+
method: this.hideBuildings,
|
|
470
|
+
arg: [],
|
|
471
|
+
})
|
|
472
|
+
break
|
|
473
|
+
case 'showBuildings':
|
|
474
|
+
methodList.push({
|
|
475
|
+
name: 'showBuilding',
|
|
476
|
+
method: this.showBuildings,
|
|
477
|
+
arg: [],
|
|
478
|
+
})
|
|
479
|
+
break
|
|
480
|
+
case 'hideMarker':
|
|
481
|
+
methodList.push({
|
|
482
|
+
name: 'hideMarker',
|
|
483
|
+
method: this.hideMarker,
|
|
484
|
+
arg: [],
|
|
485
|
+
})
|
|
486
|
+
break
|
|
487
|
+
case 'showMarker':
|
|
488
|
+
methodList.push({
|
|
489
|
+
name: 'showMarker',
|
|
490
|
+
method: this.showMarker,
|
|
491
|
+
arg: [],
|
|
492
|
+
})
|
|
493
|
+
break
|
|
494
|
+
case 'turnOrthogonalCameraToPerspective':
|
|
495
|
+
methodList.push({
|
|
496
|
+
name: 'turnOrthogonalCameraToPerspective',
|
|
497
|
+
method: this.turnOrthogonalCameraToPerspective,
|
|
498
|
+
arg: [],
|
|
499
|
+
})
|
|
500
|
+
break
|
|
501
|
+
case 'turnPerspectiveCameraToOrthogonal':
|
|
502
|
+
methodList.push({
|
|
503
|
+
name: 'turnPerspectiveCameraToOrthogonal',
|
|
504
|
+
method: this.turnPerspectiveCameraToOrthogonal,
|
|
505
|
+
arg: [],
|
|
506
|
+
})
|
|
507
|
+
break
|
|
508
|
+
case 'setSceneFromMetaData':
|
|
509
|
+
methodList.push({
|
|
510
|
+
name: 'setSceneFromMetaData',
|
|
511
|
+
method: this.setSceneFromMetaData,
|
|
512
|
+
arg: [params],
|
|
513
|
+
})
|
|
514
|
+
break
|
|
448
515
|
}
|
|
449
516
|
return methodList
|
|
450
517
|
},
|
|
@@ -478,7 +545,6 @@ export default {
|
|
|
478
545
|
this.renderObstacles()
|
|
479
546
|
this.updateProjectionMaterials()
|
|
480
547
|
},
|
|
481
|
-
|
|
482
548
|
getCanvasOffset() {
|
|
483
549
|
if (!this.$refs.canvas3DContainer) return { top: 0, left: 0 }
|
|
484
550
|
var box = this.$refs.canvas3DContainer.getBoundingClientRect()
|
package/src/helper/threeMixin.js
CHANGED
|
@@ -209,7 +209,7 @@ export default {
|
|
|
209
209
|
this.provider = new CustomProvider('', this.selectedMapLayer.key)
|
|
210
210
|
this.renderTiles()
|
|
211
211
|
},
|
|
212
|
-
initialiseMapLayer() {
|
|
212
|
+
initialiseMapLayer(layerKey = null) {
|
|
213
213
|
if (!this.layers || this.layers.length == 0) {
|
|
214
214
|
this.layers = getLayers()
|
|
215
215
|
}
|
|
@@ -219,7 +219,10 @@ export default {
|
|
|
219
219
|
let selectedLayer = null
|
|
220
220
|
for (let i = 0; i < this.layers.length; i++) {
|
|
221
221
|
const layer = this.layers[i]
|
|
222
|
-
if (
|
|
222
|
+
if (layerKey && layer.key == layerKey) {
|
|
223
|
+
selectedLayer = layer
|
|
224
|
+
break
|
|
225
|
+
} else if (
|
|
223
226
|
this.globalProjectProperties &&
|
|
224
227
|
layer.key === this.globalProjectProperties.map_type
|
|
225
228
|
) {
|
|
@@ -102,23 +102,43 @@ const getters = {
|
|
|
102
102
|
xMax: -Infinity,
|
|
103
103
|
yMin: Infinity,
|
|
104
104
|
yMax: -Infinity,
|
|
105
|
+
zMin: Infinity,
|
|
106
|
+
zMax: -Infinity,
|
|
107
|
+
}
|
|
108
|
+
const roofs = getters.getRoofs
|
|
109
|
+
if (roofs.length) {
|
|
110
|
+
roofs.forEach((polygon) =>
|
|
111
|
+
polygon.outline.forEach((p) => {
|
|
112
|
+
if (bounds.xMin > p.x) {
|
|
113
|
+
bounds.xMin = p.x
|
|
114
|
+
}
|
|
115
|
+
if (bounds.xMax < p.x) {
|
|
116
|
+
bounds.xMax = p.x
|
|
117
|
+
}
|
|
118
|
+
if (bounds.yMin > p.y) {
|
|
119
|
+
bounds.yMin = p.y
|
|
120
|
+
}
|
|
121
|
+
if (bounds.yMax < p.y) {
|
|
122
|
+
bounds.yMax = p.y
|
|
123
|
+
}
|
|
124
|
+
if (bounds.zMin > p.z) {
|
|
125
|
+
bounds.zMin = p.z
|
|
126
|
+
}
|
|
127
|
+
if (bounds.zMax < p.z) {
|
|
128
|
+
bounds.zMax = p.z
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
)
|
|
132
|
+
} else {
|
|
133
|
+
bounds = {
|
|
134
|
+
xMin: -1000,
|
|
135
|
+
xMax: 1000,
|
|
136
|
+
yMin: -1000,
|
|
137
|
+
yMax: 1000,
|
|
138
|
+
zMin: 0,
|
|
139
|
+
zMax: 0,
|
|
140
|
+
}
|
|
105
141
|
}
|
|
106
|
-
getters.getRoofs.forEach((polygon) =>
|
|
107
|
-
polygon.outline.forEach((p) => {
|
|
108
|
-
if (bounds.xMin > p.x) {
|
|
109
|
-
bounds.xMin = p.x
|
|
110
|
-
}
|
|
111
|
-
if (bounds.xMax < p.x) {
|
|
112
|
-
bounds.xMax = p.x
|
|
113
|
-
}
|
|
114
|
-
if (bounds.yMin > p.y) {
|
|
115
|
-
bounds.yMin = p.y
|
|
116
|
-
}
|
|
117
|
-
if (bounds.yMax < p.y) {
|
|
118
|
-
bounds.yMax = p.y
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
)
|
|
122
142
|
return bounds
|
|
123
143
|
},
|
|
124
144
|
}
|
package/src/utils/layers.js
CHANGED
|
@@ -224,7 +224,49 @@ const GeoLayer_HR = L.tileLayer(
|
|
|
224
224
|
layerTypeAPI: 'geoportail_fr_wmts_ortho_layer',
|
|
225
225
|
}
|
|
226
226
|
)
|
|
227
|
+
const GeoLayerCadastral = L.tileLayer(
|
|
228
|
+
'https://data.geopf.fr/wmts?' +
|
|
229
|
+
'&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0' +
|
|
230
|
+
'&STYLE=normal' +
|
|
231
|
+
'&TILEMATRIXSET=PM' +
|
|
232
|
+
'&FORMAT=image/png' +
|
|
233
|
+
'&LAYER=CADASTRALPARCELS.PARCELLAIRE_EXPRESS' +
|
|
234
|
+
'&TILEMATRIX={z}' +
|
|
235
|
+
'&TILEROW={y}' +
|
|
236
|
+
'&TILECOL={x}',
|
|
237
|
+
{
|
|
238
|
+
layers: 'CADASTRALPARCELS.PARCELLAIRE_EXPRESS',
|
|
239
|
+
id: 'CADASTRALPARCELS.PARCELLAIRE_EXPRESS',
|
|
240
|
+
attribution: '© IGN-F/Geoportail France',
|
|
241
|
+
minZoom: leafletMapLayersConfig['GeoPortal']['minZoom'],
|
|
242
|
+
maxZoom: leafletMapLayersConfig['GeoPortal']['maxZoom'],
|
|
243
|
+
maxNativeZoom: leafletMapLayersConfig['GeoPortal']['maxNativeZoom'],
|
|
244
|
+
tileSize: 256,
|
|
245
|
+
layerTypeAPI: 'geoportail_fr_wmts_cadastral_parcel_parcellaire_express',
|
|
246
|
+
}
|
|
247
|
+
)
|
|
227
248
|
|
|
249
|
+
const GeoLayerGridSystem = L.tileLayer(
|
|
250
|
+
'https://data.geopf.fr/wmts?' +
|
|
251
|
+
'&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0' +
|
|
252
|
+
'&STYLE=normal' +
|
|
253
|
+
'&TILEMATRIXSET=PM' +
|
|
254
|
+
'&FORMAT=image/png' +
|
|
255
|
+
'&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' +
|
|
256
|
+
'&TILEMATRIX={z}' +
|
|
257
|
+
'&TILEROW={y}' +
|
|
258
|
+
'&TILECOL={x}',
|
|
259
|
+
{
|
|
260
|
+
layers: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2',
|
|
261
|
+
id: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2',
|
|
262
|
+
attribution: '© IGN-F/Geoportail France',
|
|
263
|
+
minZoom: leafletMapLayersConfig['GeoPortal']['minZoom'],
|
|
264
|
+
maxZoom: leafletMapLayersConfig['GeoPortal']['maxZoom'],
|
|
265
|
+
maxNativeZoom: leafletMapLayersConfig['GeoPortal']['maxNativeZoom'],
|
|
266
|
+
tileSize: 256,
|
|
267
|
+
layerTypeAPI: 'geoportail_fr_wmts_geographical_grid_systems_plan_ign_v2',
|
|
268
|
+
}
|
|
269
|
+
)
|
|
228
270
|
const azureSatelliteLayer = L.tileLayer(
|
|
229
271
|
'https://atlas.microsoft.com/map/tile?' +
|
|
230
272
|
'api-version={apiVersion}' +
|
|
@@ -315,6 +357,16 @@ function getLayers() {
|
|
|
315
357
|
key: 'geoportail_fr_wmts_ortho_layer',
|
|
316
358
|
layerData: GeoLayer_HR,
|
|
317
359
|
},
|
|
360
|
+
{
|
|
361
|
+
name: 'GeoPortal France (Parcelles Cadastrales)',
|
|
362
|
+
key: 'geoportail_fr_wmts_cadastral_parcel_parcellaire_express',
|
|
363
|
+
layerData: GeoLayerCadastral,
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
name: 'GeoPortal France (Grille IGN)',
|
|
367
|
+
key: 'geoportail_fr_wmts_geographical_grid_systems_plan_ign_v2',
|
|
368
|
+
layerData: GeoLayerGridSystem,
|
|
369
|
+
},
|
|
318
370
|
{
|
|
319
371
|
name: 'Bing (satellite)',
|
|
320
372
|
key: 'azureSatelliteLayer',
|