@eturnity/eturnity_3d 8.31.1 → 8.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "8.31.1",
4
+ "version": "8.34.1",
5
5
  "files": [
6
6
  "dist",
7
7
  "src"
package/src/config.js CHANGED
@@ -293,3 +293,9 @@ export const fittingPanelsColorMap = {
293
293
  white: '#ffffff',
294
294
  default: '#0068DE',
295
295
  }
296
+
297
+ export const defaultTextureColorMap = {
298
+ 0: 'blue',
299
+ 1: 'black',
300
+ 2: 'black',
301
+ }
@@ -7,7 +7,7 @@ import {
7
7
  isPolygonInsidePolygon,
8
8
  getConcaveOutlines,
9
9
  } from '@eturnity/eturnity_maths'
10
- import { fittingPanelsColorMap } from '../config'
10
+ import { defaultTextureColorMap, fittingPanelsColorMap } from '../config'
11
11
  //this function just update the "roof" and "moduleField(s)" properties of panels,moduleFields and roofs
12
12
  export function UpdateRoofModuleFieldRelations(state) {
13
13
  let moduleFields = state.polygons.filter(
@@ -106,9 +106,12 @@ export function updateModuleFieldFittingPanels(moduleField) {
106
106
  })
107
107
  })
108
108
 
109
- // map backsheet color to hex color
110
- const backSheetColor = moduleField.pvData?.backsheet_color || 'default'
111
- const mappedColor = fittingPanelsColorMap[backSheetColor]
109
+ const hasCustomTexture = moduleField.pvData?.texture_img_url
110
+ const defaultTextureIndex = moduleField.pvData?.module_texture_version_id || 0
111
+ const color = hasCustomTexture
112
+ ? moduleField.pvData?.backsheet_color
113
+ : defaultTextureColorMap[defaultTextureIndex]
114
+ const mappedColor = fittingPanelsColorMap[color || 'default']
112
115
 
113
116
  moduleField.fittingPanels = {
114
117
  polygons,
@@ -1,15 +1,13 @@
1
+ import * as L from 'leaflet'
1
2
  import { MapProvider } from 'geo-three'
2
- import getLayers from '../utils/layers'
3
3
  import ImageHelper from './ImageHelper'
4
4
  import { MAP_LAYER_TYPE } from '../utils/constants'
5
5
 
6
6
  export class CustomProvider extends MapProvider {
7
- constructor(address, map_layer) {
7
+ constructor(address, layer) {
8
8
  super()
9
-
10
- const layer = getLayers().find((layer) => layer.key == map_layer)
11
9
  this.layer = layer
12
- this.mapLayer = map_layer
10
+ this.mapLayer = layer.key
13
11
  this.maxZoom = this.layer.layerData.options.maxNativeZoom || 20
14
12
  this.minZoom = this.layer.layerData.options.minZoom || 17
15
13
  const imgSrc = require('../assets/images/white_tile.png')
@@ -23,7 +21,7 @@ export class CustomProvider extends MapProvider {
23
21
  getImageSrc(layerKey, layer, position) {
24
22
  const { x, y, zoom } = position
25
23
  let imageSrc = layer._url
26
- if (layerKey == 'bkgHexagonGermanyLayer') {
24
+ if (layerKey == MAP_LAYER_TYPE.HEXAGON_SATELLITE) {
27
25
  const numTiles = Math.pow(2, zoom)
28
26
  const tileX = x
29
27
  const tileY = numTiles - 1 - y
@@ -48,7 +46,7 @@ export class CustomProvider extends MapProvider {
48
46
  '&height=256' +
49
47
  '&crs=EPSG%3A3857' +
50
48
  `&bbox=${xMin},${yMin},${xMax},${yMax}`
51
- } else if (layerKey == 'azureSatelliteLayer') {
49
+ } else if (layerKey == MAP_LAYER_TYPE.AZURE_SATELLITE) {
52
50
  const { apiVersion, tilesetId, subscriptionKey } = layer.options
53
51
  imageSrc = imageSrc
54
52
  .replace('{x}', x)
@@ -83,9 +81,10 @@ export class CustomProvider extends MapProvider {
83
81
  y,
84
82
  zoom,
85
83
  }
84
+ const isLayerGroup = this.layer.layerData instanceof L.LayerGroup
86
85
  if (zoom < minZoomLayer) {
87
86
  return this.defaultImage
88
- } else if (this.layer.key === MAP_LAYER_TYPE.HEXAGON_SATELLITE) {
87
+ } else if (isLayerGroup) {
89
88
  const layerGroup = this.layer.layerData
90
89
  const layers = layerGroup
91
90
  .getLayers()
@@ -1,4 +1,5 @@
1
1
  import * as THREE from 'three'
2
+ import { mapState } from 'vuex'
2
3
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
3
4
  import { Sky } from 'three/examples/jsm/objects/Sky.js'
4
5
  import { CustomProvider } from './customProvider'
@@ -33,6 +34,11 @@ export default {
33
34
  DOMElement: null,
34
35
  }
35
36
  },
37
+ computed: {
38
+ ...mapState({
39
+ buildingLocation: (state) => state.threeDModule.buildingLocation,
40
+ }),
41
+ },
36
42
  mixins: [initializeThree, renderMixin, materialMixin],
37
43
  methods: {
38
44
  initialiseThree({
@@ -206,12 +212,12 @@ export default {
206
212
  if (!this.selectedMapLayer) {
207
213
  this.initialiseMapLayer()
208
214
  }
209
- this.provider = new CustomProvider('', this.selectedMapLayer.key)
215
+ this.provider = new CustomProvider('', this.selectedMapLayer)
210
216
  this.renderTiles()
211
217
  },
212
218
  initialiseMapLayer(layerKey = null) {
213
219
  if (!this.layers || this.layers.length == 0) {
214
- this.layers = getLayers()
220
+ this.layers = getLayers(this.buildingLocation)
215
221
  }
216
222
  this.setSelectedMapLayer(null)
217
223
 
@@ -13,4 +13,5 @@ export const MAP_LAYER_TYPE = {
13
13
  IGN_ROAD: 'ignSpainLayer_map',
14
14
  HEXAGON_SATELLITE: 'bkgHexagonGermanyLayer',
15
15
  GEOPORTAL_SATELLITE: 'geoportail_fr_wmts_ortho_layer',
16
+ AZURE_SATELLITE: 'azureSatelliteLayer',
16
17
  }
@@ -158,7 +158,7 @@ const ignLayerMap = L.tileLayer(
158
158
  }
159
159
  )
160
160
 
161
- const getHexagonLayer = (url, params) => {
161
+ const createHexagonLayer = (url, params) => {
162
162
  const options = {
163
163
  kid: params.kid,
164
164
  format: 'image/png',
@@ -177,7 +177,7 @@ const getHexagonLayer = (url, params) => {
177
177
  return L.tileLayer.wms(url, options)
178
178
  }
179
179
 
180
- const hexagonImageDop20 = getHexagonLayer(
180
+ const hexagonLayerDop20 = createHexagonLayer(
181
181
  'https://geodaten-vertrieb.de/Proxy/DOP20/wms',
182
182
  {
183
183
  layers: 'DOP20',
@@ -186,7 +186,7 @@ const hexagonImageDop20 = getHexagonLayer(
186
186
  }
187
187
  )
188
188
 
189
- const hexagonImageDop10 = getHexagonLayer(
189
+ const hexagonLayerDop10 = createHexagonLayer(
190
190
  'https://geodaten-vertrieb.de/Proxy/DOP10/wms',
191
191
  {
192
192
  layers: 'DOP10',
@@ -195,7 +195,7 @@ const hexagonImageDop10 = getHexagonLayer(
195
195
  }
196
196
  )
197
197
 
198
- const hexagonLayerGroup = L.layerGroup([hexagonImageDop20, hexagonImageDop10], {
198
+ const hexagonLayerGroup = L.layerGroup([hexagonLayerDop20, hexagonLayerDop10], {
199
199
  attribution: `© GeoBasis-DE/BKG ${new Date().getFullYear()}, powered by HxGN`,
200
200
  maxZoom: leafletMapLayersConfig['bkgHexagonGermanyLayer']['maxZoom'],
201
201
  maxNativeZoom:
@@ -203,6 +203,15 @@ const hexagonLayerGroup = L.layerGroup([hexagonImageDop20, hexagonImageDop10], {
203
203
  layerTypeAPI: 'bkgHexagonGermanyLayer',
204
204
  })
205
205
 
206
+ const getHexagonLayer = (location = {}) => {
207
+ const {
208
+ country_short: country,
209
+ administrative_area_level_1: administrativeAreaLevel,
210
+ } = location
211
+ const supportsDop10 = country === 'DE' && administrativeAreaLevel === 'NRW'
212
+ return supportsDop10 ? hexagonLayerGroup : hexagonLayerDop20
213
+ }
214
+
206
215
  const GeoLayer_HR = L.tileLayer(
207
216
  'https://data.geopf.fr/wmts?' +
208
217
  '&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0' +
@@ -290,7 +299,7 @@ const azureSatelliteLayer = L.tileLayer(
290
299
  }
291
300
  )
292
301
 
293
- function getLayers() {
302
+ function getLayers(location) {
294
303
  return [
295
304
  {
296
305
  name: 'SwissTopo (satellite)',
@@ -375,7 +384,7 @@ function getLayers() {
375
384
  {
376
385
  name: 'BKG (satellite)',
377
386
  key: 'bkgHexagonGermanyLayer',
378
- layerData: hexagonLayerGroup,
387
+ layerData: getHexagonLayer(location),
379
388
  },
380
389
  ]
381
390
  }