@eturnity/eturnity_3d 7.16.0-qa-dev03.0 → 7.16.0-qa03-7.16.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.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+ log() {
3
+ timestamp=$(date +"%Y-%m-%d %H:%M:%S")
4
+ echo "$timestamp $1"
5
+ }
6
+
7
+ log "Building customization for image ..."
8
+
9
+ rm -f .env && cp .env.bitbucket .env
10
+
11
+ Customize API keys
12
+ if [[ $NAMESPACE = 'eturnity-prod'* ]]; then
13
+ sed -i "s|{{VUE_APP_GOOGLE_MAP_API_KEY}}|$BB_VUE_APP_GOOGLE_MAP_API_KEY_PROD|g" .env
14
+ sed -i "s|{{VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY}}|$BB_VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY_PROD|g" .env
15
+ else
16
+ sed -i "s|{{VUE_APP_GOOGLE_MAP_API_KEY}}|$BB_VUE_APP_GOOGLE_MAP_API_KEY_DEV|g" .env
17
+ sed -i "s|{{VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY}}|$BB_VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY_DEV|g" .env
18
+ fi
19
+
20
+ log "Building customization for image done"
package/.env CHANGED
@@ -1 +1,2 @@
1
- VUE_APP_GOOGLE_MAP_API_KEY=AIzaSyAxqgQ_iRKAQ6AMvZ0a6Z0vkBwYTM-pnHM
1
+ VUE_APP_GOOGLE_MAP_API_KEY={{API_KEY_FOR_LOCAL_DEVELOPMENT}}
2
+ VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY={{API_KEY_FOR_LOCAL_DEVELOPMENT}}
package/.env.bitbucket ADDED
@@ -0,0 +1,2 @@
1
+ VUE_APP_GOOGLE_MAP_API_KEY={{VUE_APP_GOOGLE_MAP_API_KEY}}
2
+ VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY={{VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY}}
@@ -22,6 +22,7 @@ definitions:
22
22
  script:
23
23
  - ./.bitbucket/ci/build_image_config.sh
24
24
  - export $(cat .env.image | xargs)
25
+ - ./.bitbucket/ci/build_customization_config.sh
25
26
  - echo "{\"version\":\"${BB_ETURNITY_VERSION}\",\"full_version\":\"${TAG}\"}" > ./src/assets/version.json
26
27
  - docker build -t $IMAGE_NAME .
27
28
  - docker login --username $BB_PIPELINE_REGISTRY_TOKEN --password $BB_PIPELINE_REGISTRY_TOKEN $BB_CONTAINER_REGISTRY
@@ -65,6 +66,7 @@ definitions:
65
66
  script:
66
67
  - ./.bitbucket/ci/build_image_config.sh
67
68
  - export $(cat .env.image | xargs)
69
+ - ./.bitbucket/ci/build_customization_config.sh
68
70
  - echo "{\"version\":\"${BB_ETURNITY_VERSION}\",\"full_version\":\"${TAG}\"}" > ./src/assets/version.json
69
71
  - export RELEASE_TAG=latest
70
72
  - export RELEASE_IMAGE_NAME=$BB_CONTAINER_REGISTRY/$BB_ETURNITY_HUB/$APPLICATION_NAME:$RELEASE_TAG
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "7.16.0-qa-dev03.0",
4
+ "version": "7.16.0-qa03-7.16.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": "7.16.0-qa-dev03.0",
13
+ "@eturnity/eturnity_maths": "7.16.0-qa03-7.16.0",
14
14
  "core-js": "^2.6.12",
15
15
  "cors": "^2.8.5",
16
16
  "earcut": "^2.2.4",
@@ -26,7 +26,8 @@ export class CustomProvider extends MapProvider {
26
26
  resolve(this.defaultImage)
27
27
  } else if (zoom > maxZoomLayer) {
28
28
  } else {
29
- var image = document.createElement('img')
29
+ const image = document.createElement('img')
30
+
30
31
  image.onload = function () {
31
32
  image.style.backgroundColor = 'red'
32
33
  resolve(image)
@@ -50,6 +51,17 @@ export class CustomProvider extends MapProvider {
50
51
  const yMax = yMin + resolution_mPerTile
51
52
 
52
53
  imageSrc += `&service=WMS&request=GetMap&layers=rgb&styles=&format=image%2Fjpeg&transparent=false&version=1.1.1&id=bkg_image&layerTypeAPI=bkgHexagonGermanyLayer&width=256&height=256&srs=EPSG%3A3857&bbox=${xMin},${yMin},${xMax},${yMax}`
54
+ } else if (this.layer.key == 'azureSatelliteLayer') {
55
+ const { apiVersion, tilesetId, subscriptionKey } =
56
+ this.layer.layerData.options
57
+ imageSrc = imageSrc
58
+ .replace('{x}', x)
59
+ .replace('{y}', y)
60
+ .replace('{z}', zoom)
61
+ .replace('{apiVersion}', apiVersion)
62
+ .replace('{tilesetId}', tilesetId)
63
+ .replace('{subscriptionKey}', subscriptionKey)
64
+ imageSrc = imageSrc + `&no-cache=${Date.now()}`
53
65
  } else {
54
66
  imageSrc = imageSrc.replace('{x}', x)
55
67
  imageSrc = imageSrc.replace('{y}', y)
@@ -25,6 +25,23 @@ export default {
25
25
  if (obj.material.dispose) obj.material.dispose()
26
26
  }
27
27
  },
28
+ clearPanelsFromChangingRoofs(roofIds) {
29
+ const roofs = this.polygons.filter((polygon) =>
30
+ roofIds.includes(polygon.id)
31
+ )
32
+ roofs.forEach((roof) =>
33
+ roof.moduleFields.forEach((mf) =>
34
+ mf.panels.forEach((panel) => {
35
+ let meshTop = this.meshes.panelsMeshes[panel.id + '_top']
36
+ let meshSide = this.meshes.panelsMeshes[panel.id + '_side']
37
+ if (meshTop || meshSide) {
38
+ this.clearMeshFromScene(meshTop, this.scene)
39
+ this.clearMeshFromScene(meshSide, this.scene)
40
+ }
41
+ })
42
+ )
43
+ )
44
+ },
28
45
  clearMeshFromScene(mesh, scene) {
29
46
  if (!mesh || !scene) {
30
47
  return
@@ -87,8 +87,6 @@ export default {
87
87
  cylinder.userData.edgeId = edge.id
88
88
  cylinder.userData.type = 'edgeMeshes'
89
89
  cylinder.userData.layer = edge.layer
90
- cylinder.frustumCulled = false
91
- cylinder.renderOrder = 10
92
90
 
93
91
  cylinder.frustumCulled = false
94
92
  cylinder.renderOrder = 10
@@ -8,8 +8,7 @@ import {
8
8
  getNormalVectorFrom3Points,
9
9
  hasNaN,
10
10
  getDistanceBetweenPoints,
11
- intersectOutlines,
12
- isSameSegment2D
11
+ intersectOutlines
13
12
  } from '@eturnity/eturnity_maths'
14
13
 
15
14
  export function getTriangleVerticesFromOutline(
@@ -153,7 +152,7 @@ export function getWallVertices(polygon) {
153
152
  )
154
153
  })
155
154
 
156
- polygon.holes.forEach((hole, holeIndex) => {
155
+ polygon.holes.forEach((hole) => {
157
156
  let obstacleWallOutline =
158
157
  intersectOutlines(hole.outline, polygon.outline)[0] || []
159
158
  obstacleWallOutline = obstacleWallOutline.map((p) => {
@@ -166,47 +165,34 @@ export function getWallVertices(polygon) {
166
165
  ).z
167
166
  }
168
167
  })
169
-
170
168
  const lengthHole = obstacleWallOutline.length
171
169
  obstacleWallOutline.forEach((p_up_0, index) => {
172
170
  const p_up_1 = obstacleWallOutline[(index + 1) % lengthHole]
173
171
  const p_bottom_0 = { ...p_up_0, z: 0 }
174
172
  const p_bottom_1 = { ...p_up_1, z: 0 }
175
173
 
176
- const isEdgeConnectedToRoof = !polygon.holes.some((hole, i) => {
177
- return (
178
- holeIndex != i &&
179
- hole.outline.some((p, p_index, outline) => {
180
- let p_next_index = (p_index + 1) % outline.length
181
- return isSameSegment2D([p_up_0, p_up_1], [p, outline[p_next_index]])
182
- })
183
- )
184
- })
185
-
186
- if (isEdgeConnectedToRoof) {
187
- trianglesVertices.push(
188
- ...[
189
- p_up_0.x / 1000,
190
- p_up_0.y / 1000,
191
- p_up_0.z / 1000,
192
- p_up_1.x / 1000,
193
- p_up_1.y / 1000,
194
- p_up_1.z / 1000,
195
- p_bottom_0.x / 1000,
196
- p_bottom_0.y / 1000,
197
- p_bottom_0.z / 1000,
198
- p_up_1.x / 1000,
199
- p_up_1.y / 1000,
200
- p_up_1.z / 1000,
201
- p_bottom_0.x / 1000,
202
- p_bottom_0.y / 1000,
203
- p_bottom_0.z / 1000,
204
- p_bottom_1.x / 1000,
205
- p_bottom_1.y / 1000,
206
- p_bottom_1.z / 1000
207
- ]
208
- )
209
- }
174
+ trianglesVertices.push(
175
+ ...[
176
+ p_up_0.x / 1000,
177
+ p_up_0.y / 1000,
178
+ p_up_0.z / 1000,
179
+ p_up_1.x / 1000,
180
+ p_up_1.y / 1000,
181
+ p_up_1.z / 1000,
182
+ p_bottom_0.x / 1000,
183
+ p_bottom_0.y / 1000,
184
+ p_bottom_0.z / 1000,
185
+ p_up_1.x / 1000,
186
+ p_up_1.y / 1000,
187
+ p_up_1.z / 1000,
188
+ p_bottom_0.x / 1000,
189
+ p_bottom_0.y / 1000,
190
+ p_bottom_0.z / 1000,
191
+ p_bottom_1.x / 1000,
192
+ p_bottom_1.y / 1000,
193
+ p_bottom_1.z / 1000
194
+ ]
195
+ )
210
196
  })
211
197
  })
212
198
  if (hasNaN(trianglesVertices)) {
@@ -578,7 +564,7 @@ export function updateBufferPanelSideGeometry(panelPolygon, geometry) {
578
564
  panelPolygon.outline,
579
565
  panelOutlineTop
580
566
  )
581
-
567
+
582
568
  if (hasNaN(triangleVertices)) {
583
569
  return null
584
570
  }
@@ -601,7 +587,7 @@ export function updateBufferPanelSideGeometry(panelPolygon, geometry) {
601
587
  geometry.attributes.position.needsUpdate = true
602
588
  geometry.computeVertexNormals()
603
589
  geometry.needsUpdate = true
604
-
590
+
605
591
  return geometry
606
592
  }
607
593
  export function getBufferPanelSideGeometry(panelPolygon) {
@@ -18,23 +18,25 @@ export default {
18
18
  methods: {
19
19
  updateRoofGeometry(geometry, roofPolygon) {
20
20
  const roofOutline = roofPolygon.outline
21
- let cropedHolesOutline = roofPolygon.holes.map((h) => {
22
- //let's crop obstacle with roof outline
23
- const cropedHoleOutline =
24
- intersectOutlines(h.outline, roofPolygon.outline)[0] || []
25
- const outline = cropedHoleOutline.map((p) => {
26
- return {
27
- x: p.x,
28
- y: p.y,
29
- z: verticalProjectionOnPlane(
30
- p,
31
- roofPolygon.normalVector,
32
- roofPolygon.flatOutline[0]
33
- ).z
34
- }
21
+ let cropedHolesOutline = roofPolygon.holes
22
+ .filter((h) => h.layer == 'obstacle')
23
+ .map((h) => {
24
+ //let's crop obstacle with roof outline
25
+ const cropedHoleOutline =
26
+ intersectOutlines(h.outline, roofPolygon.outline)[0] || []
27
+ const outline = cropedHoleOutline.map((p) => {
28
+ return {
29
+ x: p.x,
30
+ y: p.y,
31
+ z: verticalProjectionOnPlane(
32
+ p,
33
+ roofPolygon.normalVector,
34
+ roofPolygon.flatOutline[0]
35
+ ).z
36
+ }
37
+ })
38
+ return outline
35
39
  })
36
- return outline
37
- })
38
40
 
39
41
  cropedHolesOutline = cropedHolesOutline.filter((outline) => !!outline)
40
42
  geometry = updateBufferRoofGeometry(
@@ -47,23 +49,25 @@ export default {
47
49
  },
48
50
  createRoofGeometry(roofPolygon) {
49
51
  const roofOutline = roofPolygon.outline
50
- let cropedHolesOutline = roofPolygon.holes.map((h) => {
51
- //let's crop obstacle with roof outline
52
- const cropedHoleOutline =
53
- intersectOutlines(h.outline, roofPolygon.outline)[0] || []
54
- const outline = cropedHoleOutline.map((p) => {
55
- return {
56
- x: p.x,
57
- y: p.y,
58
- z: verticalProjectionOnPlane(
59
- p,
60
- roofPolygon.normalVector,
61
- roofPolygon.flatOutline[0]
62
- ).z
63
- }
52
+ let cropedHolesOutline = roofPolygon.holes
53
+ .filter((h) => h.layer == 'obstacle')
54
+ .map((h) => {
55
+ //let's crop obstacle with roof outline
56
+ const cropedHoleOutline =
57
+ intersectOutlines(h.outline, roofPolygon.outline)[0] || []
58
+ const outline = cropedHoleOutline.map((p) => {
59
+ return {
60
+ x: p.x,
61
+ y: p.y,
62
+ z: verticalProjectionOnPlane(
63
+ p,
64
+ roofPolygon.normalVector,
65
+ roofPolygon.flatOutline[0]
66
+ ).z
67
+ }
68
+ })
69
+ return outline
64
70
  })
65
- return outline
66
- })
67
71
 
68
72
  cropedHolesOutline = cropedHolesOutline.filter((outline) => !!outline)
69
73
  let geometry = getBufferRoofGeometry(roofOutline, cropedHolesOutline)
@@ -296,6 +296,7 @@ export default {
296
296
  method: this.renderRoofsMargin,
297
297
  arg: []
298
298
  })
299
+ break
299
300
  case 'selectedModuleFieldChange':
300
301
  methodList.push({
301
302
  name: 'renderEdges',
@@ -379,6 +380,13 @@ export default {
379
380
  arg: []
380
381
  })
381
382
  break
383
+ case 'clearPanelFromChangingRoofs':
384
+ methodList.push({
385
+ name: 'clearPanelsFromChangingRoofs',
386
+ method: this.clearPanelsFromChangingRoofs,
387
+ arg: [params.roofIds]
388
+ })
389
+ break
382
390
  case 'selectedPanelChange':
383
391
  methodList.push({
384
392
  name: 'renderModuleFields',
@@ -4,8 +4,7 @@ import {
4
4
  isAlmostSamePoint3D,
5
5
  isAlmostSameSegment2D,
6
6
  isAlmostSameSegment3D,
7
- isAlmostSamePoint2D,
8
- verticalProjectionOnPlane
7
+ isAlmostSamePoint2D
9
8
  } from '@eturnity/eturnity_maths'
10
9
 
11
10
  export function generateNodes2D(polygons) {
@@ -57,15 +56,14 @@ export function generateNodes2D(polygons) {
57
56
  if (node2D.masterHandle) {
58
57
  node2D.masterHandle.open = node2D.belongsTo.some(
59
58
  (item) =>
60
- item.index == null ||
61
59
  item.polygon.outline[item.index].open ||
62
60
  item.polygon.outline[item.index].hasWarning
63
61
  )
64
62
  node2D.masterHandle.hasWarning = node2D.belongsTo.some(
65
- (item) => item.index == null || item.polygon.outline[item.index].hasWarning
63
+ (item) => item.polygon.outline[item.index].hasWarning
66
64
  )
67
65
  node2D.masterHandle.selected = node2D.belongsTo.every(
68
- (item) => item.index == null || item.polygon.outline[item.index].selected
66
+ (item) => item.polygon.outline[item.index].selected
69
67
  )
70
68
  }
71
69
  })
@@ -121,8 +119,7 @@ export function generateNodes3D(polygons) {
121
119
  return nodes3D
122
120
  }
123
121
 
124
- export function generateEdges2D(polygons, splitEdgesIds = []) {
125
- console.log("generateEdges2D")
122
+ export function generateEdges2D(polygons) {
126
123
  let edges2D = []
127
124
  polygons
128
125
  .filter((poly) =>
@@ -162,72 +159,9 @@ export function generateEdges2D(polygons, splitEdgesIds = []) {
162
159
  index: i,
163
160
  polygon
164
161
  })
165
- if (polygon.roofs && polygon.roofs.length > 0) {
166
- polygon.roofs.forEach((supportRoof) => {
167
- edge2D.belongsTo.push({
168
- polygonId: supportRoof.id,
169
- index: null,
170
- polygon: supportRoof
171
- })
172
- })
173
- }
174
162
  edge2D.id += '_' + polygon.id + '_' + i
175
163
  })
176
164
  })
177
- edges2D.forEach((edge2D) => {
178
- edge2D.isSplit = splitEdgesIds.includes(edge2D.id)
179
- if (edge2D.belongsTo.length > 2) {
180
- edge2D.belongsTo = edge2D.belongsTo.filter((i) => i.index !== null)
181
- }
182
- })
183
- edges2D.forEach((edge2D) => {
184
- const isNotSplit = edge2D.belongsTo.every((item, index, array) => {
185
- if (index == 0) {
186
- return true
187
- }
188
- const outline0 = array[0].polygon.outline
189
- const outline1 = item.polygon.outline
190
- let point0, point1, nextPoint0, nextPoint1
191
- if (array[0].index !== null) {
192
- point0 = outline0[array[0].index]
193
- nextPoint0 = outline0[(array[0].index + 1) % outline0.length]
194
- } else {
195
- point0 = verticalProjectionOnPlane(
196
- outline1[item.index],
197
- array[0].polygon.normalVector,
198
- array[0].polygon.flatOutline[0]
199
- )
200
- nextPoint0 = verticalProjectionOnPlane(
201
- outline1[(item.index + 1) % outline1.length],
202
- array[0].polygon.normalVector,
203
- array[0].polygon.flatOutline[0]
204
- )
205
- }
206
- if (item.index !== null) {
207
- point1 = outline1[item.index]
208
- nextPoint1 = outline1[(item.index + 1) % outline1.length]
209
- } else {
210
- point1 = verticalProjectionOnPlane(
211
- outline0[array[0].index],
212
- item.polygon.normalVector,
213
- item.polygon.flatOutline[0]
214
- )
215
- nextPoint1 = verticalProjectionOnPlane(
216
- outline0[(array[0].index + 1) % outline0.length],
217
- item.polygon.normalVector,
218
- item.polygon.flatOutline[0]
219
- )
220
- }
221
- return isAlmostSameSegment3D(
222
- [point0, nextPoint0],
223
- [point1, nextPoint1],
224
- mmTolerance
225
- )
226
- })
227
- if (!isNotSplit && edge2D.belongsTo.length == 2 && edge2D.layer == 'roof') {
228
- edge2D.isSplit = true
229
- }
230
- })
231
165
  return edges2D
232
166
  }
233
167
 
@@ -8,7 +8,7 @@ import { hydrateData } from './hydrateData.js'
8
8
 
9
9
  const init_state = {
10
10
  isLoading: false,
11
-
11
+
12
12
  polygons: [],
13
13
  nodes: [],
14
14
  edges: [],
@@ -189,6 +189,29 @@ function getLayers() {
189
189
  }
190
190
  )
191
191
 
192
+ const azureSatelliteLayer = L.tileLayer(
193
+ 'https://atlas.microsoft.com/map/tile?' +
194
+ 'api-version={apiVersion}' +
195
+ '&tilesetId={tilesetId}' +
196
+ '&subscription-key={subscriptionKey}' +
197
+ '&zoom={z}' +
198
+ '&x={x}' +
199
+ '&y={y}',
200
+ {
201
+ layerTypeAPI: 'azureSatelliteLayer',
202
+ id: 'azure_satellite',
203
+ attribution: `\u00A9 ${new Date().getFullYear()} EarthStar Geographics, Microsoft`,
204
+ minZoom: leafletMapLayersConfig['azureSatelliteLayer']['minZoom'],
205
+ maxZoom: leafletMapLayersConfig['azureSatelliteLayer']['maxZoom'],
206
+ maxNativeZoom:
207
+ leafletMapLayersConfig['azureSatelliteLayer']['maxNativeZoom'],
208
+ // query parameters
209
+ apiVersion: '2022-08-01',
210
+ tilesetId: 'microsoft.imagery',
211
+ subscriptionKey: process.env.VUE_APP_AZURE_MAP_SUBSCRIPTION_KEY
212
+ }
213
+ )
214
+
192
215
  return [
193
216
  {
194
217
  name: 'SwissTopo (satellite)',
@@ -259,6 +282,11 @@ function getLayers() {
259
282
  name: 'GeoPortal France (satellite)',
260
283
  key: 'geoportail_fr_wmts_ortho_layer',
261
284
  layerData: GeoLayer_HR
285
+ },
286
+ {
287
+ name: 'Bing (satellite)',
288
+ key: 'azureSatelliteLayer',
289
+ layerData: azureSatelliteLayer
262
290
  }
263
291
  ]
264
292
  }
@@ -63,5 +63,10 @@ export const leafletMapLayersConfig = {
63
63
  maxZoom: 22,
64
64
  maxNativeZoom: 19,
65
65
  minZoom: 6
66
+ },
67
+ azureSatelliteLayer: {
68
+ maxZoom: 25,
69
+ maxNativeZoom: 19,
70
+ minZoom: 1
66
71
  }
67
72
  }