@eturnity/eturnity_3d 7.6.0-EPDM-7953.7 → 7.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "7.6.0-EPDM-7953.7",
4
+ "version": "7.8.0",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -10,40 +10,39 @@
10
10
  "prettier": "prettier --write \"**/*.{js,vue}\""
11
11
  },
12
12
  "dependencies": {
13
- "@eturnity/eturnity_maths": "7.4.0-EPDM-9710",
14
- "core-js": "2.6.12",
15
- "cors": "2.8.5",
16
- "earcut": "2.2.4",
17
- "express": "4.18.2",
18
- "geo-three": "0.1.11",
19
- "leaflet": "1.8.0",
20
- "leaflet.gridlayer.googlemutant": "0.14.0",
13
+ "@eturnity/eturnity_maths": "7.4.0",
14
+ "core-js": "^2.6.12",
15
+ "cors": "^2.8.5",
16
+ "earcut": "^2.2.4",
17
+ "express": "^4.18.2",
18
+ "geo-three": "^0.1.11",
19
+ "leaflet": "^1.8.0",
20
+ "leaflet.gridlayer.googlemutant": "^0.14.0",
21
21
  "lodash": "4.17.21",
22
- "svd-js": "1.1.1",
23
- "three": "0.149.0",
22
+ "svd-js": "^1.1.1",
23
+ "three": "^0.149.0",
24
24
  "three-projected-material": "2.2.1",
25
25
  "tween": "0.9.0",
26
- "uuid": "9.0.0",
27
- "vue": "3.3.4",
28
- "vuex": "4.1.0"
26
+ "uuid": "^9.0.0",
27
+ "vue": "^2.7.14",
28
+ "vue-template-compiler": "^2.7.14",
29
+ "vuex": "^3.0.1"
29
30
  },
30
31
  "devDependencies": {
31
- "@babel/core": "7.12.16",
32
- "@babel/eslint-parser": "7.12.16",
33
- "@vue/cli-plugin-babel": "5.0.8",
34
- "@vue/cli-plugin-eslint": "5.0.8",
35
- "@vue/cli-service": "5.0.8",
36
- "@vue/compiler-sfc": "3.3.4",
37
- "eslint": "7.32.0",
38
- "eslint-plugin-vue": "8.0.3",
39
- "@babel/preset-env": "7.20.2",
40
- "babel-eslint": "10.1.0",
41
- "babel-loader": "8.3.0",
32
+ "@babel/core": "^7.21.0",
33
+ "@babel/preset-env": "^7.20.2",
34
+ "@vue/cli-plugin-babel": "^3.12.1",
35
+ "@vue/cli-plugin-eslint": "^3.12.1",
36
+ "@vue/cli-service": "^3.12.1",
37
+ "babel-eslint": "^10.1.0",
38
+ "babel-loader": "^8.3.0",
39
+ "eslint": "5.16.0",
42
40
  "eslint-config-prettier": "6.15.0",
43
41
  "eslint-plugin-prettier": "3.4.1",
44
- "html-webpack-plugin": "3.2.0",
45
- "webpack": "4.46.0",
46
- "webpack-cli": "4.10.0",
42
+ "eslint-plugin-vue": "5.2.3",
43
+ "html-webpack-plugin": "^3.2.0",
44
+ "webpack": "^4.46.0",
45
+ "webpack-cli": "^4.10.0",
47
46
  "prettier": "2.8.4"
48
47
  },
49
48
  "eslintConfig": {
@@ -74,4 +73,4 @@
74
73
  "> 1%",
75
74
  "last 2 versions"
76
75
  ]
77
- }
76
+ }
package/src/App.vue CHANGED
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div class="frame" :style="{ height: '100%' }">
2
+ <div
3
+ class="frame"
4
+ :style="{ height: '100%', width: '100%', display: 'flex' }"
5
+ >
3
6
  <ThreeCanvas />
4
7
  </div>
5
8
  </template>
@@ -19,10 +22,3 @@ export default {
19
22
  }
20
23
  }
21
24
  </script>
22
-
23
- <style scoped>
24
- .frame {
25
- width: 100%;
26
- height: 100%;
27
- }
28
- </style>
@@ -2,14 +2,13 @@
2
2
  <div
3
3
  class="canvas3DContainer"
4
4
  ref="canvas3DContainer"
5
- :style="{ height: '100%' }"
5
+ :style="{ height: '100%', width: '100%', display: 'flex' }"
6
6
  crossorigin
7
7
  />
8
8
  </template>
9
9
 
10
10
  <script>
11
11
  import { mapActions, mapState, mapGetters, mapMutations } from 'vuex'
12
- import * as THREE from 'three'
13
12
  import {
14
13
  addVector,
15
14
  multiplyVector,
@@ -18,39 +17,14 @@ import {
18
17
  } from '@eturnity/eturnity_maths'
19
18
 
20
19
  import threeMixin from '../helper/threeMixin'
21
- import materialMixin from '../helper/materialMixin'
22
- import renderMixin from '../helper/renderMixin'
20
+
23
21
  export default {
24
22
  name: 'ThreeCanvas',
25
23
  data() {
26
24
  return {
27
- scene: new THREE.Scene(),
28
25
  layers: null,
29
26
  provider: null,
30
- cameraProjection: null,
31
- texture: null,
32
- renderer: new THREE.WebGLRenderer({
33
- antialias: true,
34
- preserveDrawingBuffer: true
35
- }),
36
- orbitControl: null,
37
- raycaster: new THREE.Raycaster(),
38
- loader: new THREE.TextureLoader(),
39
27
  pointer: { x: 0, y: 0 },
40
- canvasHeight: null,
41
- canvasWidth: null,
42
- canvasOffset: { x: 0, y: 0 },
43
- tweenCamera: null,
44
- tweenOrbit: null,
45
- three_map: null,
46
- isReady: {
47
- texturesLoaded: 0,
48
- texturesToLoad: 0,
49
- threeMap: false,
50
- geometry: false,
51
- camera: false
52
- },
53
- screenshotable: false,
54
28
  areModuleFieldsVisible: false,
55
29
  areUserDeactivatedPanelsVisible: false,
56
30
  animationFrameId: null,
@@ -61,52 +35,45 @@ export default {
61
35
  clearInterval(this.intervalId)
62
36
  cancelAnimationFrame(this.animationFrameId)
63
37
  },
64
- mixins: [renderMixin, threeMixin, materialMixin],
38
+ mixins: [threeMixin],
65
39
  async mounted() {
66
40
  await this.hydrateData(this.geometryData)
67
- this.renderer.domElement.style.width = '100%'
68
- this.renderer.domElement.style.height = '100%'
41
+ let isPerspectiveCamera = true
42
+ if (this.useCustomCamera && this.cameraPerspectiveSettings) {
43
+ isPerspectiveCamera = this.cameraPerspectiveSettings.viewType == 'perspective'
44
+ }
45
+ this.initialiseThree({
46
+ isInteractive: this.isInteractive,
47
+ isPerspectiveCamera,
48
+ DOMElement: this.$refs.canvas3DContainer
49
+ })
69
50
 
70
- this.initialiseThree(this.isInteractive)
71
- this.initialiseThreeMap()
72
51
  await this.loadPanelsTexture()
73
- this.renderGeometry()
52
+ this.renderRealisticGeometry()
74
53
  if (!this.isBuildingVisible) {
75
- Object.values(this.meshes.roofMeshes).forEach(
76
- (mesh) => (mesh.visible = false)
77
- )
78
- Object.values(this.meshes.baseMeshes).forEach(
79
- (mesh) => (mesh.visible = false)
80
- )
81
- Object.values(this.meshes.obstacleMeshes).forEach(
82
- (mesh) => (mesh.visible = false)
83
- )
84
- Object.values(this.meshes.edgeMeshes).forEach(
85
- (mesh) => (mesh.visible = false)
86
- )
87
- Object.values(this.meshes.panelsMeshes).forEach(
88
- (mesh) => (mesh.visible = false)
89
- )
90
- this.hideMesh(this.mergedBaseMesh)
91
- this.hideMesh(this.mergedRoofMesh)
92
- this.hideMesh(this.mergedObstacleMesh)
93
- this.hideMesh(this.mergedObstacleSideMesh)
94
- this.hidePanels()
54
+ this.hideBuildings()
95
55
  }
96
- Object.values(this.meshes.flatRoofMeshes).forEach(
97
- (mesh) => (mesh.visible = false)
98
- )
99
- Object.values(this.meshes.edgeMeshes).forEach(
100
- (mesh) => (mesh.visible = false)
101
- )
102
- this.onWindowResize()
56
+
103
57
  this.$root.$on('on-roofSelected', (polygon) =>
104
58
  this.setCameraOrthogonalTo(polygon)
105
59
  )
106
60
  await this.updateProjectionMaterials()
107
61
 
108
- const polygon = this.polygons.find((p) => p.id == this.uuid)
109
- this.setCamera(polygon, this.view_mode)
62
+ if (this.useCustomCamera) {
63
+ if (isPerspectiveCamera) {
64
+ this.setPerspectiveCameraPositionTo(
65
+ this.cameraPerspectiveSettings.position,
66
+ this.cameraPerspectiveSettings.target
67
+ )
68
+ } else {
69
+ this.setOrthographicCameraPositionFromCameraParameters(
70
+ this.cameraPerspectiveSettings.cameraParameters
71
+ )
72
+ }
73
+ } else {
74
+ const polygon = this.polygons.find((p) => p.id == this.uuid)
75
+ this.setCamera(polygon, this.view_mode)
76
+ }
110
77
  this.isReady.geometry = true
111
78
  this.render()
112
79
  this.intervalId = setInterval(() => this.render(), 500)
@@ -116,6 +83,8 @@ export default {
116
83
  geometryData: (state) => state.threeDModule.geometryData,
117
84
  uuid: (state) => state.threeDModule.uuid,
118
85
  view_mode: (state) => state.threeDModule.view_mode,
86
+ useCustomCamera: (state) => state.threeDModule.useCustomCamera,
87
+ cameraPerspectiveSettings: (state) => state.threeDModule.cameraPerspectiveSettings,
119
88
  isInteractive: (state) => state.threeDModule.isInteractive,
120
89
  isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
121
90
  imageOverlay: (state) => state.threeDModule.imageOverlay
@@ -141,6 +110,38 @@ export default {
141
110
  ...mapMutations({
142
111
  setSelectedMapLayer: 'mutate_selectedMapLayer'
143
112
  }),
113
+ hideEdges() {
114
+ Object.values(this.meshes.edgeMeshes).forEach(
115
+ (mesh) => (mesh.visible = false)
116
+ )
117
+ },
118
+ hideWarningRoofs() {
119
+ Object.values(this.meshes.flatRoofMeshes).forEach(
120
+ (mesh) => (mesh.visible = false)
121
+ )
122
+ },
123
+ hideBuildings() {
124
+ Object.values(this.meshes.roofMeshes).forEach(
125
+ (mesh) => (mesh.visible = false)
126
+ )
127
+ Object.values(this.meshes.baseMeshes).forEach(
128
+ (mesh) => (mesh.visible = false)
129
+ )
130
+ Object.values(this.meshes.obstacleMeshes).forEach(
131
+ (mesh) => (mesh.visible = false)
132
+ )
133
+ Object.values(this.meshes.edgeMeshes).forEach(
134
+ (mesh) => (mesh.visible = false)
135
+ )
136
+ Object.values(this.meshes.panelsMeshes).forEach(
137
+ (mesh) => (mesh.visible = false)
138
+ )
139
+ this.hideMesh(this.mergedBaseMesh)
140
+ this.hideMesh(this.mergedRoofMesh)
141
+ this.hideMesh(this.mergedObstacleMesh)
142
+ this.hideMesh(this.mergedObstacleSideMesh)
143
+ this.hidePanels()
144
+ },
144
145
  hideMesh(mesh) {
145
146
  if (mesh) {
146
147
  mesh.visible = false
@@ -284,7 +285,7 @@ export default {
284
285
  },
285
286
  render() {
286
287
  this.renderer.clear()
287
- if (['top', 'global'].includes(this.view_mode)) {
288
+ if (['top', 'global'].includes(this.view_mode) && !this.useCustomCamera) {
288
289
  this.renderer.render(this.scene, this.orthographicCamera)
289
290
  } else {
290
291
  this.renderer.render(this.scene, this.camera)
@@ -316,10 +317,12 @@ export default {
316
317
  .canvas3DContainer {
317
318
  width: 100%;
318
319
  height: 100%;
320
+ width: 100%;
319
321
  }
320
322
 
321
323
  .canvas3DContainer > canvas {
322
324
  width: 100%;
323
325
  height: 100%;
326
+ width: 100%;
324
327
  }
325
328
  </style>
package/src/config.js CHANGED
@@ -6,7 +6,7 @@ export const snapToLineTolerance = 10
6
6
  export const distanceToCloseNode = 70
7
7
  export const mmTolerance = 1
8
8
  export const earthRadius = 6371008
9
-
9
+ export const marginAroundBuildingForCameraViewInMeter = 5
10
10
  export const layerColors = {
11
11
  construction: {
12
12
  fillColor: 'transparent',