@eturnity/eturnity_3d 6.34.0 → 6.34.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/.editorconfig +5 -0
- package/package.json +8 -4
- package/src/App.vue +16 -16
- package/src/assets/theme.js +4 -4
- package/src/components/ThreeCanvasViewer.vue +56 -43
- package/src/config.js +139 -65
- package/src/helper/MapView.js +214 -241
- package/src/helper/UpdateRoofModuleFieldRelations.js +17 -23
- package/src/helper/UpdateRoofObstacleRelations.js +48 -41
- package/src/helper/cameraMixin.js +97 -93
- package/src/helper/customProvider.js +28 -28
- package/src/helper/materialMixin.js +86 -70
- package/src/helper/materials.js +64 -49
- package/src/helper/render/background.js +2 -5
- package/src/helper/render/base.js +43 -40
- package/src/helper/render/clear.js +96 -84
- package/src/helper/render/edge.js +59 -65
- package/src/helper/render/geometryHandler.js +166 -128
- package/src/helper/render/imageOverlay.js +157 -106
- package/src/helper/render/index.js +21 -3
- package/src/helper/render/loader.js +34 -34
- package/src/helper/render/mapProjection.js +88 -74
- package/src/helper/render/margin.js +46 -50
- package/src/helper/render/moduleField.js +26 -24
- package/src/helper/render/node.js +43 -43
- package/src/helper/render/obstacle.js +50 -48
- package/src/helper/render/panel.js +85 -79
- package/src/helper/render/projectionMaterial.js +58 -50
- package/src/helper/render/roof.js +136 -133
- package/src/helper/render/texture.js +17 -17
- package/src/helper/render/tile.js +291 -0
- package/src/helper/renderMixin.js +30 -37
- package/src/helper/threeMixin.js +40 -101
- package/src/main.js +22 -18
- package/src/store/AddMargin.js +87 -83
- package/src/store/hydrateData.js +40 -30
- package/src/store/nodesEdgesCreation.js +177 -160
- package/src/store/three-d-module.js +41 -27
- package/src/utils/cancellablePromise.js +23 -0
- package/.eslintrc.json +0 -18
- package/src/helper/geo-three.module.js +0 -1903
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
|
-
import {mapGetters} from 'vuex'
|
|
2
|
+
import { mapGetters } from 'vuex'
|
|
3
3
|
import ProjectedMaterial from 'three-projected-material'
|
|
4
4
|
import {
|
|
5
5
|
substractVector,
|
|
@@ -8,119 +8,170 @@ import {
|
|
|
8
8
|
getDistanceBetweenPoints,
|
|
9
9
|
getAngleInDegFromCanvasVector
|
|
10
10
|
} from '@eturnity/eturnity_maths'
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getBufferImageOverlayGeometry,
|
|
13
|
+
updateBufferRoofGeometry
|
|
14
|
+
} from './geometryHandler'
|
|
12
15
|
|
|
13
16
|
export default {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
imageOverlayProjectionCamera: new THREE.PerspectiveCamera(
|
|
20
|
+
1,
|
|
21
|
+
300 / 300,
|
|
22
|
+
100,
|
|
23
|
+
1000
|
|
24
|
+
),
|
|
25
|
+
imageOverlayTexture: null,
|
|
26
|
+
imageOverlayMaterial: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
computed: {
|
|
30
|
+
...mapGetters({
|
|
31
|
+
imageOverlay: 'getImageOverlay'
|
|
32
|
+
})
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
renderImageOverlayOnBackground() {
|
|
36
|
+
if (!this.imageOverlay || !this.imageOverlayMaterial) {
|
|
37
|
+
this.clearMesh(this.meshes.backgroundMesh)
|
|
38
|
+
this.meshes.backgroundMesh = null
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
let corners = this.imageOverlay.corners.map((p) => {
|
|
42
|
+
return { ...p, z: 100 }
|
|
43
|
+
})
|
|
44
|
+
if (this.meshes.backgroundMesh && this.meshes.backgroundMesh.geometry) {
|
|
45
|
+
let geometry = this.meshes.backgroundMesh.geometry
|
|
46
|
+
geometry = updateBufferRoofGeometry(corners, [], geometry)
|
|
47
|
+
//updateBufferRoofGeometry(corners,[],geometry)
|
|
48
|
+
this.meshes.backgroundMesh.geometry = geometry
|
|
49
|
+
} else {
|
|
50
|
+
let planeGeometry = getBufferImageOverlayGeometry(corners)
|
|
51
|
+
let planeMaterial = this.imageOverlayMaterial
|
|
52
|
+
|
|
53
|
+
this.meshes.backgroundMesh = new THREE.Mesh(
|
|
54
|
+
planeGeometry,
|
|
55
|
+
planeMaterial
|
|
56
|
+
)
|
|
57
|
+
this.scene.add(this.meshes.backgroundMesh)
|
|
58
|
+
}
|
|
59
|
+
this.meshes.backgroundMesh.position.z = 0.15
|
|
60
|
+
if (this.imageOverlayMaterial) {
|
|
61
|
+
this.applyTextureOnMesh(
|
|
62
|
+
[this.imageOverlayMaterial],
|
|
63
|
+
this.meshes.backgroundMesh
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
this.meshes.backgroundMesh.visible = true
|
|
20
67
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
68
|
+
async changeImageOverlay() {
|
|
69
|
+
if (this.imageOverlayMaterial) {
|
|
70
|
+
this.imageOverlayMaterial.dispose()
|
|
71
|
+
this.imageOverlayMaterial = null
|
|
72
|
+
}
|
|
73
|
+
await this.updateProjectionMaterials()
|
|
25
74
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if(
|
|
29
|
-
this.clearMesh(this.meshes.backgroundMesh)
|
|
30
|
-
this.meshes.backgroundMesh=null
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
let corners=this.imageOverlay.corners.map(p=>{return {...p,z:100}})
|
|
34
|
-
if(this.meshes.backgroundMesh && this.meshes.backgroundMesh.geometry){
|
|
35
|
-
let geometry=this.meshes.backgroundMesh.geometry
|
|
36
|
-
geometry=updateBufferRoofGeometry(corners,[],geometry)
|
|
37
|
-
//updateBufferRoofGeometry(corners,[],geometry)
|
|
38
|
-
this.meshes.backgroundMesh.geometry=geometry
|
|
39
|
-
|
|
40
|
-
}else{
|
|
41
|
-
let planeGeometry = getBufferImageOverlayGeometry(corners)
|
|
42
|
-
let planeMaterial = this.imageOverlayMaterial
|
|
43
|
-
|
|
44
|
-
this.meshes.backgroundMesh = new THREE.Mesh(planeGeometry, planeMaterial)
|
|
45
|
-
this.scene.add(this.meshes.backgroundMesh)
|
|
46
|
-
}
|
|
47
|
-
this.meshes.backgroundMesh.position.z=0.15
|
|
48
|
-
if(this.imageOverlayMaterial){
|
|
49
|
-
this.applyTextureOnMesh([this.imageOverlayMaterial],this.meshes.backgroundMesh)
|
|
50
|
-
}
|
|
51
|
-
this.meshes.backgroundMesh.visible=true
|
|
52
|
-
},
|
|
53
|
-
async changeImageOverlay(){
|
|
54
|
-
if(this.imageOverlayMaterial){
|
|
75
|
+
async getImageOverlayMaterial() {
|
|
76
|
+
if (!this.imageOverlay || !this.imageOverlay.url) {
|
|
77
|
+
if (this.imageOverlayMaterial) {
|
|
55
78
|
this.imageOverlayMaterial.dispose()
|
|
56
|
-
this.imageOverlayMaterial=null
|
|
57
|
-
}
|
|
58
|
-
await this.updateProjectionMaterials()
|
|
59
|
-
},
|
|
60
|
-
async getImageOverlayMaterial(){
|
|
61
|
-
if(!this.imageOverlay || !this.imageOverlay.url){
|
|
62
|
-
if(this.imageOverlayMaterial){
|
|
63
|
-
this.imageOverlayMaterial.dispose()
|
|
64
|
-
}
|
|
65
|
-
this.imageOverlayMaterial=null
|
|
66
|
-
return null
|
|
67
79
|
}
|
|
80
|
+
this.imageOverlayMaterial = null
|
|
81
|
+
return null
|
|
82
|
+
}
|
|
68
83
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
if (
|
|
85
|
+
!this.imageOverlayMaterial ||
|
|
86
|
+
this.imageOverlay.url != this.imageOverlayMaterial.userData.url
|
|
87
|
+
) {
|
|
88
|
+
this.imageOverlayMaterial = await this.newImageOverlayMaterial()
|
|
89
|
+
} else {
|
|
90
|
+
this.setImageOverlayCameraPosition()
|
|
91
|
+
}
|
|
92
|
+
return this.imageOverlayMaterial
|
|
93
|
+
},
|
|
94
|
+
removeImageOverlay() {
|
|
95
|
+
if (this.imageOverlayMaterial && this.imageOverlayMaterial.dispose)
|
|
96
|
+
this.imageOverlayMaterial.dispose()
|
|
97
|
+
this.imageOverlayMaterial = null
|
|
98
|
+
this.material.roof = this.material.roof.filter(
|
|
99
|
+
(material) => material.userData.type != 'imageOverlayMaterial'
|
|
100
|
+
)
|
|
101
|
+
},
|
|
102
|
+
async newImageOverlayMaterial() {
|
|
103
|
+
return new Promise((resolve) => {
|
|
104
|
+
this.loader.load(this.imageOverlay.url, (texture) => {
|
|
105
|
+
this.imageOverlayTexture = texture
|
|
72
106
|
this.setImageOverlayCameraPosition()
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
let imageOverlayProjectionMaterial = new ProjectedMaterial({
|
|
108
|
+
camera: this.imageOverlayProjectionCamera,
|
|
109
|
+
texture: this.imageOverlayTexture,
|
|
110
|
+
transparent: true,
|
|
111
|
+
side: THREE.DoubleSide,
|
|
112
|
+
depthWrite: false
|
|
113
|
+
})
|
|
114
|
+
imageOverlayProjectionMaterial.userData = {}
|
|
115
|
+
imageOverlayProjectionMaterial.userData.type = 'imageOverlayMaterial'
|
|
116
|
+
imageOverlayProjectionMaterial.userData.priority = 2
|
|
117
|
+
imageOverlayProjectionMaterial.userData.url = this.imageOverlay.url
|
|
118
|
+
resolve(imageOverlayProjectionMaterial)
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
},
|
|
122
|
+
setImageOverlayCameraPosition() {
|
|
123
|
+
if (!this.imageOverlay || !this.imageOverlay.url) return
|
|
124
|
+
let height = getDistanceBetweenPoints(
|
|
125
|
+
this.imageOverlay.corners[1],
|
|
126
|
+
this.imageOverlay.corners[2]
|
|
127
|
+
)
|
|
128
|
+
let width = getDistanceBetweenPoints(
|
|
129
|
+
this.imageOverlay.corners[0],
|
|
130
|
+
this.imageOverlay.corners[1]
|
|
131
|
+
)
|
|
132
|
+
this.imageOverlayProjectionCamera.aspect = width / height
|
|
133
|
+
let projectionAltitude =
|
|
134
|
+
height /
|
|
135
|
+
(2 * Math.tan((this.imageOverlayProjectionCamera.fov * Math.PI) / 360))
|
|
136
|
+
|
|
137
|
+
//set projection camera over background_map_center
|
|
138
|
+
let imageOverlayProjectionCameraPosition = {
|
|
139
|
+
x: 0,
|
|
140
|
+
y: 0,
|
|
141
|
+
z: projectionAltitude / 1000
|
|
142
|
+
}
|
|
108
143
|
|
|
144
|
+
let positionInMm = multiplyVector(
|
|
145
|
+
0.5,
|
|
146
|
+
addVector(this.imageOverlay.corners[0], this.imageOverlay.corners[2])
|
|
147
|
+
)
|
|
148
|
+
imageOverlayProjectionCameraPosition.x = positionInMm.x / 1000
|
|
149
|
+
imageOverlayProjectionCameraPosition.y = positionInMm.y / 1000
|
|
109
150
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.
|
|
123
|
-
this.
|
|
124
|
-
|
|
151
|
+
this.imageOverlayProjectionCamera.position.set(
|
|
152
|
+
imageOverlayProjectionCameraPosition.x,
|
|
153
|
+
imageOverlayProjectionCameraPosition.y,
|
|
154
|
+
projectionAltitude / 1000
|
|
155
|
+
)
|
|
156
|
+
this.imageOverlayProjectionCamera.lookAt(
|
|
157
|
+
imageOverlayProjectionCameraPosition.x,
|
|
158
|
+
imageOverlayProjectionCameraPosition.y,
|
|
159
|
+
0
|
|
160
|
+
)
|
|
161
|
+
let zAngle = getAngleInDegFromCanvasVector(
|
|
162
|
+
substractVector(
|
|
163
|
+
this.imageOverlay.corners[3],
|
|
164
|
+
this.imageOverlay.corners[0]
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
this.imageOverlayProjectionCamera.rotation.set(
|
|
168
|
+
0,
|
|
169
|
+
0,
|
|
170
|
+
(zAngle * Math.PI) / 180
|
|
171
|
+
)
|
|
172
|
+
this.imageOverlayProjectionCamera.far = projectionAltitude * 1.5
|
|
173
|
+
this.imageOverlayProjectionCamera.near = projectionAltitude * 0.8
|
|
174
|
+
this.imageOverlayProjectionCamera.updateProjectionMatrix()
|
|
125
175
|
}
|
|
126
|
-
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -13,8 +13,26 @@ import imageOverlay from './imageOverlay'
|
|
|
13
13
|
import mapProjection from './mapProjection'
|
|
14
14
|
import texture from './texture'
|
|
15
15
|
import projectionMaterial from './projectionMaterial'
|
|
16
|
+
import tile from './tile'
|
|
16
17
|
|
|
17
18
|
export default {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
//mixins:[node,background,clear,edge,loader,margin,moduleField,obstacle,panel,roof,base]
|
|
20
|
+
mixins: [
|
|
21
|
+
margin,
|
|
22
|
+
node,
|
|
23
|
+
background,
|
|
24
|
+
base,
|
|
25
|
+
roof,
|
|
26
|
+
edge,
|
|
27
|
+
obstacle,
|
|
28
|
+
moduleField,
|
|
29
|
+
panel,
|
|
30
|
+
clear,
|
|
31
|
+
loader,
|
|
32
|
+
imageOverlay,
|
|
33
|
+
texture,
|
|
34
|
+
mapProjection,
|
|
35
|
+
projectionMaterial,
|
|
36
|
+
tile
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -2,41 +2,41 @@ import * as THREE from 'three'
|
|
|
2
2
|
import ProjectedMaterial from 'three-projected-material'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
5
|
+
methods: {
|
|
6
|
+
loadNewPanelTextures() {
|
|
7
|
+
Object.values(this.pvDataMemo).forEach((component) => {
|
|
8
|
+
const pvId = component.id
|
|
9
|
+
if (!this.material.panel[pvId]) {
|
|
10
|
+
if (!component.texture_img_url) {
|
|
11
|
+
this.material.panel[pvId] = this.material.panel.default
|
|
12
|
+
} else {
|
|
13
|
+
let texture = this.loader.load(component.texture_img_url)
|
|
14
|
+
this.material.panel[pvId] = new THREE.MeshBasicMaterial({
|
|
15
|
+
map: texture,
|
|
16
|
+
side: THREE.DoubleSide,
|
|
17
|
+
transparent: true
|
|
18
|
+
})
|
|
20
19
|
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
async loadPanelsTexture() {
|
|
24
|
+
for (let k = 0; k < this.moduleFields.length; k++) {
|
|
25
|
+
let mf = this.moduleFields[k]
|
|
26
|
+
const pvId = mf.data.component_id_pv_module
|
|
27
|
+
if (!this.material.panel[pvId]) {
|
|
28
|
+
if (!mf.data.texture_img_url) {
|
|
29
|
+
this.material.panel[pvId] = this.material.panel.default
|
|
30
|
+
} else {
|
|
31
|
+
let texture = await this.loader.load(mf.data.texture_img_url)
|
|
32
|
+
this.material.panel[pvId] = new THREE.MeshBasicMaterial({
|
|
33
|
+
map: texture,
|
|
34
|
+
side: THREE.DoubleSide,
|
|
35
|
+
transparent: true
|
|
36
|
+
})
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
}
|
|
39
|
+
}
|
|
41
40
|
}
|
|
42
|
-
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -2,85 +2,99 @@ import * as THREE from 'three'
|
|
|
2
2
|
import ProjectedMaterial from 'three-projected-material'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
data() {
|
|
6
|
+
return {
|
|
7
|
+
mapProjectionTexture: null,
|
|
8
|
+
mapProjectionMaterial: null
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
methods: {
|
|
12
|
+
async changeMapProjection() {
|
|
13
|
+
if (this.mapProjectionMaterial) {
|
|
14
|
+
this.mapProjectionMaterial.dispose()
|
|
15
|
+
this.mapProjectionMaterial = null
|
|
9
16
|
}
|
|
17
|
+
await this.updateProjectionMaterials()
|
|
10
18
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
async getMapProjectionMaterial(){
|
|
20
|
-
if(!this.layoutSettings.base64_image_url){
|
|
21
|
-
return null
|
|
22
|
-
}else{
|
|
23
|
-
if(!this.mapProjectionMaterial){
|
|
24
|
-
this.mapProjectionMaterial = await this.newMapProjectionMaterial()
|
|
25
|
-
}else{
|
|
26
|
-
this.setMapProjectionCameraPosition()
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return this.mapProjectionMaterial
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
async newMapProjectionMaterial() {
|
|
33
|
-
return new Promise((resolve,reject) => {
|
|
34
|
-
this.loader.load(this.layoutSettings.base64_image_url,(texture)=>{
|
|
35
|
-
this.mapProjectionTexture=texture
|
|
36
|
-
this.setMapProjectionCameraPosition()
|
|
37
|
-
let mapProjectionMaterial = new ProjectedMaterial({
|
|
38
|
-
camera: this.cameraprojection,
|
|
39
|
-
texture: texture,
|
|
40
|
-
transparent: true,
|
|
41
|
-
side: THREE.DoubleSide,
|
|
42
|
-
})
|
|
43
|
-
mapProjectionMaterial.userData={}
|
|
44
|
-
mapProjectionMaterial.userData.type="mapProjectionMaterial"
|
|
45
|
-
mapProjectionMaterial.userData.priority=1
|
|
46
|
-
mapProjectionMaterial.userData.url=this.layoutSettings.base64_image_url
|
|
47
|
-
resolve(mapProjectionMaterial)
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
setMapProjectionCameraPosition(){
|
|
52
|
-
let backgroundImageCenter={
|
|
53
|
-
lat:this.layoutSettings.layout_latitude,
|
|
54
|
-
lng:this.layoutSettings.layout_longitude
|
|
19
|
+
async getMapProjectionMaterial() {
|
|
20
|
+
if (!this.layoutSettings.base64_image_url) {
|
|
21
|
+
return null
|
|
22
|
+
} else {
|
|
23
|
+
if (!this.mapProjectionMaterial) {
|
|
24
|
+
this.mapProjectionMaterial = await this.newMapProjectionMaterial()
|
|
25
|
+
} else {
|
|
26
|
+
this.setMapProjectionCameraPosition()
|
|
55
27
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
28
|
+
}
|
|
29
|
+
return this.mapProjectionMaterial
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
async newMapProjectionMaterial() {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
this.loader.load(this.layoutSettings.base64_image_url, (texture) => {
|
|
35
|
+
this.mapProjectionTexture = texture
|
|
36
|
+
this.setMapProjectionCameraPosition()
|
|
37
|
+
let mapProjectionMaterial = new ProjectedMaterial({
|
|
38
|
+
camera: this.cameraprojection,
|
|
39
|
+
texture: texture,
|
|
40
|
+
transparent: true,
|
|
41
|
+
side: THREE.DoubleSide
|
|
42
|
+
})
|
|
43
|
+
mapProjectionMaterial.userData = {}
|
|
44
|
+
mapProjectionMaterial.userData.type = 'mapProjectionMaterial'
|
|
45
|
+
mapProjectionMaterial.userData.priority = 1
|
|
46
|
+
mapProjectionMaterial.userData.url =
|
|
47
|
+
this.layoutSettings.base64_image_url
|
|
48
|
+
resolve(mapProjectionMaterial)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
setMapProjectionCameraPosition() {
|
|
53
|
+
let backgroundImageCenter = {
|
|
54
|
+
lat: this.layoutSettings.layout_latitude,
|
|
55
|
+
lng: this.layoutSettings.layout_longitude
|
|
56
|
+
}
|
|
57
|
+
if (this.layoutSettings.background_map_settings) {
|
|
58
|
+
backgroundImageCenter = {
|
|
59
|
+
lat: this.layoutSettings.background_map_settings.lat,
|
|
60
|
+
lng: this.layoutSettings.background_map_settings.lng
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
}
|
|
63
|
+
this.backgroundImagesizeInMm =
|
|
64
|
+
this.layoutSettings.background_map_settings.sizeInMm
|
|
65
|
+
if (this.backgroundImagesizeInMm) {
|
|
66
|
+
this.cameraprojection.aspect =
|
|
67
|
+
this.backgroundImagesizeInMm.width /
|
|
68
|
+
this.backgroundImagesizeInMm.height
|
|
69
|
+
let projectionAltitude =
|
|
67
70
|
this.backgroundImagesizeInMm.height /
|
|
68
|
-
|
|
71
|
+
(2 * Math.tan((this.cameraprojection.fov * Math.PI) / 360))
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
cameraProjectionPosition.y=positionInMm.y/1000
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
this.cameraprojection.position.set(cameraProjectionPosition.x, cameraProjectionPosition.y, projectionAltitude / 1000)
|
|
79
|
-
this.cameraprojection.far = projectionAltitude * 1.5
|
|
80
|
-
this.cameraprojection.near = projectionAltitude * 0.5
|
|
81
|
-
this.cameraprojection.updateProjectionMatrix()
|
|
73
|
+
//set projection camera over background_map_center
|
|
74
|
+
let cameraProjectionPosition = {
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0,
|
|
77
|
+
z: projectionAltitude / 1000
|
|
82
78
|
}
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
if (
|
|
80
|
+
this.layoutSettings.background_map_settings &&
|
|
81
|
+
this.layoutSettings.background_map_settings.positionInMm
|
|
82
|
+
) {
|
|
83
|
+
let positionInMm =
|
|
84
|
+
this.layoutSettings.background_map_settings.positionInMm
|
|
85
|
+
cameraProjectionPosition.x = positionInMm.x / 1000
|
|
86
|
+
cameraProjectionPosition.y = positionInMm.y / 1000
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.cameraprojection.position.set(
|
|
90
|
+
cameraProjectionPosition.x,
|
|
91
|
+
cameraProjectionPosition.y,
|
|
92
|
+
projectionAltitude / 1000
|
|
93
|
+
)
|
|
94
|
+
this.cameraprojection.far = projectionAltitude * 1.5
|
|
95
|
+
this.cameraprojection.near = projectionAltitude * 0.5
|
|
96
|
+
this.cameraprojection.updateProjectionMatrix()
|
|
97
|
+
}
|
|
85
98
|
}
|
|
86
|
-
}
|
|
99
|
+
}
|
|
100
|
+
}
|