@eturnity/eturnity_3d 6.43.0 → 6.46.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/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "6.43.0",
4
+ "version": "6.46.0",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -10,7 +10,7 @@
10
10
  "prettier": "prettier --write \"**/*.{js,vue}\""
11
11
  },
12
12
  "dependencies": {
13
- "@eturnity/eturnity_maths": "6.43.0",
13
+ "@eturnity/eturnity_maths": "6.44.1",
14
14
  "axios": "^1.3.2",
15
15
  "core-js": "^2.6.12",
16
16
  "cors": "^2.8.5",
@@ -34,7 +34,7 @@ export default {
34
34
  1,
35
35
  1000
36
36
  ),
37
- layers:null,
37
+ layers: null,
38
38
  provider: null,
39
39
  cameraProjection: null,
40
40
  texture: null,
@@ -60,11 +60,16 @@ export default {
60
60
  camera: false
61
61
  },
62
62
  screenshotable: false,
63
- areModuleFieldsVisible: false
63
+ areModuleFieldsVisible: false,
64
+ intervalId: null
64
65
  }
65
66
  },
67
+ beforeDestroy() {
68
+ clearInterval(this.intervalId)
69
+ },
66
70
  mixins: [renderMixin, threeMixin, materialMixin],
67
71
  async mounted() {
72
+ console.info('6.43.0-EPDM-8438.4')
68
73
  await this.hydrateData(this.geometryData)
69
74
  this.renderer.domElement.style.width = '100%'
70
75
  this.renderer.domElement.style.height = '100%'
@@ -73,33 +78,45 @@ export default {
73
78
  this.initialiseThreeMap()
74
79
  await this.loadPanelsTexture()
75
80
  this.renderGeometry()
76
- if(!this.isBuildingVisible){
77
- Object.values(this.meshes.roofMeshes).forEach(mesh=>mesh.visible=false)
78
- Object.values(this.meshes.baseMeshes).forEach(mesh=>mesh.visible=false)
79
- Object.values(this.meshes.obstacleMeshes).forEach(mesh=>mesh.visible=false)
80
- Object.values(this.meshes.edgeMeshes).forEach(mesh=>mesh.visible=false)
81
- Object.values(this.meshes.panelsMeshes).forEach(mesh=>mesh.visible=false)
81
+ if (!this.isBuildingVisible) {
82
+ Object.values(this.meshes.roofMeshes).forEach(
83
+ (mesh) => (mesh.visible = false)
84
+ )
85
+ Object.values(this.meshes.baseMeshes).forEach(
86
+ (mesh) => (mesh.visible = false)
87
+ )
88
+ Object.values(this.meshes.obstacleMeshes).forEach(
89
+ (mesh) => (mesh.visible = false)
90
+ )
91
+ Object.values(this.meshes.edgeMeshes).forEach(
92
+ (mesh) => (mesh.visible = false)
93
+ )
94
+ Object.values(this.meshes.panelsMeshes).forEach(
95
+ (mesh) => (mesh.visible = false)
96
+ )
82
97
  this.hideMesh(this.mergedBaseMesh)
83
98
  this.hideMesh(this.mergedRoofMesh)
84
99
  this.hideMesh(this.mergedObstacleMesh)
85
100
  this.hideMesh(this.mergedObstacleSideMesh)
86
101
  this.hidePanels()
87
-
88
102
  }
89
- Object.values(this.meshes.flatRoofMeshes).forEach(mesh=>mesh.visible=false)
90
- Object.values(this.meshes.edgeMeshes).forEach(mesh=>mesh.visible=false)
103
+ Object.values(this.meshes.flatRoofMeshes).forEach(
104
+ (mesh) => (mesh.visible = false)
105
+ )
106
+ Object.values(this.meshes.edgeMeshes).forEach(
107
+ (mesh) => (mesh.visible = false)
108
+ )
91
109
  this.onWindowResize()
92
- this.updateProjectionMaterials()
93
110
  this.$root.$on('on-roofSelected', (polygon) =>
94
111
  this.setCameraOrthogonalTo(polygon)
95
112
  )
96
- this.initializeProjectionMaterial()
113
+ await this.updateProjectionMaterials()
97
114
 
98
115
  const polygon = this.polygons.find((p) => p.id == this.uuid)
99
116
  this.setCamera(polygon, this.view_mode)
100
117
  this.isReady.geometry = true
101
118
  this.render()
102
- //this.animate()
119
+ this.intervalId = setInterval(() => this.render(), 500)
103
120
  },
104
121
  computed: {
105
122
  ...mapState({
@@ -108,7 +125,7 @@ export default {
108
125
  view_mode: (state) => state.threeDModule.view_mode,
109
126
  isInteractive: (state) => state.threeDModule.isInteractive,
110
127
  isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
111
- imageOverlay: (state) => state.threeDModule.imageOverlay,
128
+ imageOverlay: (state) => state.threeDModule.imageOverlay
112
129
  }),
113
130
  ...mapGetters({
114
131
  polygons: 'getPolygons',
@@ -129,11 +146,10 @@ export default {
129
146
  hydrateData: 'hydrateData'
130
147
  }),
131
148
  ...mapMutations({
132
- setModuleTextureVersionId: 'mutate_moduleTextureVersionId',
133
149
  setSelectedMapLayer: 'mutate_selectedMapLayer'
134
150
  }),
135
- hideMesh(mesh){
136
- if(mesh){
151
+ hideMesh(mesh) {
152
+ if (mesh) {
137
153
  mesh.visible = false
138
154
  }
139
155
  },
@@ -223,7 +239,7 @@ export default {
223
239
  horizontalVector.y = 1
224
240
  }
225
241
  horizontalVector = normalizeVector(horizontalVector)
226
-
242
+
227
243
  cameraMoveVector = multiplyVector(distance * 1000, horizontalVector)
228
244
  }
229
245
 
@@ -30,15 +30,14 @@ export function UpdateRoofModuleFieldRelations(state) {
30
30
 
31
31
  for (let k in moduleFieldPolygons) {
32
32
  const moduleField = moduleFieldPolygons[k]
33
- const moduleFieldArea = calculateArea(moduleField.outline)
34
33
  //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
35
34
  let roofPolygonCandidates = roofPolygons.filter((roof) => {
36
35
  const intersection = intersectOutlines(moduleField.outline, roof.outline)
37
36
  if (intersection.length == 0) return false
38
37
  const intersectionArea = calculateArea(intersection[0])
39
- return intersectionArea > 0.9 * moduleFieldArea
38
+ return intersectionArea > 100
40
39
  })
41
- //roofs on roof can lead to multiple roof under a point. moduleField is in the smallest
40
+ //roofs on roof can lead to multiple roof under a point. moduleField is on the smallest
42
41
  let smallestRoof = null
43
42
  for (let roof of roofPolygonCandidates) {
44
43
  if (!smallestRoof || smallestRoof.area > roof.area) {
@@ -58,7 +57,6 @@ export function UpdateRoofModuleFieldRelations(state) {
58
57
  p.roof = roofPolygon
59
58
  }
60
59
  })
61
- //}
62
60
  }
63
61
 
64
62
  let newPolygons = state.polygons.map((p) => {
@@ -44,11 +44,14 @@ export default {
44
44
  opacity: node3dOpacity,
45
45
  transparent: true
46
46
  })
47
-
47
+
48
48
  this.material.panel = {}
49
49
 
50
50
  for (let k = 0; k < defaultTextureUrls.length; k++) {
51
- let texture = this.loader.load(defaultTextureUrls[k], function (texture) {})
51
+ const texture = this.loader.load(
52
+ defaultTextureUrls[k],
53
+ function (texture) {}
54
+ )
52
55
  this.material.panel['default_' + k] = new THREE.MeshBasicMaterial({
53
56
  map: texture,
54
57
  side: THREE.DoubleSide
@@ -10,11 +10,11 @@ export default {
10
10
  if (!component.texture_img_url) {
11
11
  this.material.panel[pvId] = this.material.panel.default
12
12
  } else {
13
- let texture = this.loader.load(component.texture_img_url)
13
+ const texture = this.loader.load(component.texture_img_url)
14
14
  this.material.panel[pvId] = new THREE.MeshBasicMaterial({
15
15
  map: texture,
16
16
  side: THREE.FrontSide,
17
- transparent: false,
17
+ transparent: false
18
18
  })
19
19
  }
20
20
  }
@@ -26,13 +26,18 @@ export default {
26
26
  const pvId = mf.data.component_id_pv_module
27
27
  if (!this.material.panel[pvId]) {
28
28
  if (!mf.data.texture_img_url) {
29
- this.material.panel[pvId] = this.material.panel.default
29
+ this.material.panel[pvId] =
30
+ this.material.panel[`default_${this.moduleTextureVersionId}`]
30
31
  } 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.FrontSide,
35
- transparent: false,
32
+ await new Promise((resolve) => {
33
+ this.loader.load(mf.data.texture_img_url, (texture) => {
34
+ this.material.panel[pvId] = new THREE.MeshBasicMaterial({
35
+ map: texture,
36
+ side: THREE.FrontSide,
37
+ transparent: false
38
+ })
39
+ resolve(texture)
40
+ })
36
41
  })
37
42
  }
38
43
  }
@@ -61,16 +61,16 @@ export default {
61
61
  if (panelPolygon.moduleField.data.number_of_panels_override) {
62
62
  return
63
63
  }
64
- let materialId = 'default_' + this.moduleTextureVersionId
64
+ const moduleTextureId = panelPolygon.moduleField.pvData.hasOwnProperty(
65
+ 'module_texture_version_id'
66
+ )
67
+ ? panelPolygon.moduleField.pvData.module_texture_version_id
68
+ : 0
69
+ let materialId = 'default_' + moduleTextureId
65
70
  let material = this.material.panel[materialId]
66
71
  material.transparent = true
67
72
  material.opacity = this.panelOpacity
68
- if (panelPolygon.moduleField.pvData) {
69
- if (this.material.panel[panelPolygon.moduleField.pvData.id]) {
70
- materialId = panelPolygon.moduleField.pvData.id
71
- material = this.material.panel[materialId]
72
- }
73
- } else if (panelPolygon.moduleField.data) {
73
+ if (panelPolygon.moduleField.data) {
74
74
  if (
75
75
  this.material.panel[
76
76
  panelPolygon.moduleField.data.component_id_pv_module
@@ -79,8 +79,12 @@ export default {
79
79
  materialId = panelPolygon.moduleField.data.component_id_pv_module
80
80
  material = this.material.panel[materialId]
81
81
  }
82
+ } else if (panelPolygon.moduleField.pvData) {
83
+ if (this.material.panel[panelPolygon.moduleField.pvData.id]) {
84
+ materialId = panelPolygon.moduleField.pvData.id
85
+ material = this.material.panel[materialId]
86
+ }
82
87
  }
83
-
84
88
  if (
85
89
  !this.meshes.panelsMeshes[panelPolygon.id + '_top'] ||
86
90
  !this.meshes.panelsMeshes[panelPolygon.id + '_side']
@@ -75,8 +75,8 @@ export default {
75
75
  return geometry
76
76
  },
77
77
 
78
- applyTextureOnRoofs(){
79
- const material=this.material.roof
78
+ applyTextureOnRoofs() {
79
+ const material = this.material.roof
80
80
  this.reorderRoofMaterials()
81
81
  if (this.mergedRoofMesh) {
82
82
  this.applyTextureOnMesh(material, this.mergedRoofMesh)
@@ -11,7 +11,7 @@ export default {
11
11
  //lastTic:(new Date()).getTime()
12
12
  lastGeometryEventIdDone: -1,
13
13
  backgroundImagesizeInMm: null,
14
- meshes : {
14
+ meshes: {
15
15
  baseMeshes: {},
16
16
  roofMeshes: {},
17
17
  flatRoofMeshes: {},
@@ -25,12 +25,9 @@ export default {
25
25
  }
26
26
  }
27
27
  },
28
- created() {
29
- },
28
+ created() {},
30
29
  computed: {
31
30
  ...mapState({
32
- moduleTextureVersionId: (state) =>
33
- state.threeDModule.moduleTextureVersionId,
34
31
  wallColor: (state) => state.threeDModule.wallColor,
35
32
  selectedMapLayer: (state) => state.threeDModule.selectedMapLayer,
36
33
  panelOpacity: (state) => state.threeDModule.panelOpacity,
@@ -317,7 +314,6 @@ export default {
317
314
  this.renderModuleFields()
318
315
  this.renderPanels()
319
316
  this.renderRoofsMargin()
320
- this.updateProjectionMaterials()
321
317
  },
322
318
  renderBuilding() {
323
319
  this.renderBase()
@@ -328,10 +324,6 @@ export default {
328
324
  this.renderFlatRoofs()
329
325
  },
330
326
 
331
- async initializeProjectionMaterial() {
332
- await this.updateProjectionMaterials()
333
- },
334
-
335
327
  getCanvasOffset() {
336
328
  if (!this.$refs.canvas3DContainer) return { top: 0, left: 0 }
337
329
  var box = this.$refs.canvas3DContainer.getBoundingClientRect()
@@ -383,7 +375,7 @@ export default {
383
375
  },
384
376
  watch: {
385
377
  pvDataMemo: {
386
- handler(val) {
378
+ handler() {
387
379
  this.loadNewPanelTextures()
388
380
  }
389
381
  },
package/src/main.js CHANGED
@@ -9,8 +9,8 @@ Vue.use(Vuex)
9
9
  const Renderer = class {
10
10
  constructor() {}
11
11
  mount(identifier, geometryData, specificData, isInteractive = false) {
12
- if(specificData.isBuildingVisible===undefined){
13
- specificData.isBuildingVisible=true
12
+ if (specificData.isBuildingVisible === undefined) {
13
+ specificData.isBuildingVisible = true
14
14
  }
15
15
  const myStore = new Vuex.Store({
16
16
  modules: {
@@ -50,9 +50,7 @@ export async function hydrateData({ state, commit }, data) {
50
50
 
51
51
  if (!!layoutSettingResponse) {
52
52
  const layoutSetting = layoutSettingResponse
53
- const moduleTextureVersionId = layoutSetting.module_texture_version_id || 0
54
53
  commit('mutate_layoutSettings', layoutSetting)
55
- commit('mutate_moduleTextureVersionId', moduleTextureVersionId)
56
54
  commit('mutate_wallColor', layoutSetting.wall_color)
57
55
 
58
56
  //end of layoutSetting correction
@@ -120,6 +118,10 @@ export async function hydrateData({ state, commit }, data) {
120
118
 
121
119
  let moduleField = new Polygon(module_field_outline, 'moduleField')
122
120
  moduleField.id = moduleFieldResp.module_field_uuid
121
+ // add moduleField pvData
122
+ moduleField.pvData = {}
123
+ moduleField.pvData.module_texture_version_id =
124
+ moduleFieldResp.module_texture_version_id
123
125
  moduleField.data = {}
124
126
  moduleField.data.texture_img_url = moduleFieldResp.texture_img_url
125
127
  moduleField.data.col_spacing_mm = moduleFieldResp.col_spacing_mm
@@ -17,9 +17,7 @@ const init_state = {
17
17
 
18
18
  //for Panels
19
19
  cancelTokenGlobal: '',
20
- globalProjectProperties: [],
21
20
  buildingLocation: null,
22
- imageOverlay: null,
23
21
  layoutSettings: {
24
22
  layout_latitude: null,
25
23
  layout_longitude: null,
@@ -30,7 +28,6 @@ const init_state = {
30
28
  //useless state for viewer
31
29
  pvDataMemo: [],
32
30
  mountingDataMemo: [],
33
- moduleTextureVersionId: 0,
34
31
  wallColor: '#454545',
35
32
  panelOpacity: 1,
36
33
  selectedMapLayer: null,
@@ -151,9 +148,6 @@ const mutations = {
151
148
  mutate_buildingLocation(state, value) {
152
149
  state.buildingLocation = value
153
150
  },
154
- mutate_moduleTextureVersionId(state, value) {
155
- state.moduleTextureVersionId = value
156
- },
157
151
  mutate_wallColor(state, value) {
158
152
  state.wallColor = value
159
153
  },
package/vue.config.js CHANGED
@@ -32,7 +32,7 @@ module.exports = {
32
32
  test: /\.(js)$/,
33
33
  // exclude: /\node_modules/,
34
34
  use: 'babel-loader'
35
- },
35
+ }
36
36
  ]
37
37
  },
38
38
  plugins: [