@eturnity/eturnity_3d 6.48.0 → 6.48.2
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 +2 -3
- package/src/functions.js +1 -0
- package/src/main.js +0 -1
- package/src/store/hydrateData.js +127 -81
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.48.
|
|
4
|
+
"version": "6.48.2",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"prettier": "prettier --write \"**/*.{js,vue}\""
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@eturnity/eturnity_maths": "6.48.0",
|
|
14
|
-
"axios": "^1.3.2",
|
|
13
|
+
"@eturnity/eturnity_maths": "6.48.0-EPDM-9282.3",
|
|
15
14
|
"core-js": "^2.6.12",
|
|
16
15
|
"cors": "^2.8.5",
|
|
17
16
|
"earcut": "^2.2.4",
|
package/src/functions.js
CHANGED
package/src/main.js
CHANGED
package/src/store/hydrateData.js
CHANGED
|
@@ -7,18 +7,13 @@ import {
|
|
|
7
7
|
} from '@eturnity/eturnity_maths'
|
|
8
8
|
import getLayers from '../utils/layers'
|
|
9
9
|
import { UpdateRoofObstacleRelations } from '../helper/UpdateRoofObstacleRelations'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const mapType = data.mapType
|
|
18
|
-
let layers = getLayers()
|
|
19
|
-
let selectedLayer = layers.find((layer) => layer.key == mapType)
|
|
20
|
-
commit('mutate_selectedMapLayer', selectedLayer)
|
|
21
|
-
|
|
10
|
+
export async function hydratePolygons({
|
|
11
|
+
roofsResponse,
|
|
12
|
+
obstaclesResponse,
|
|
13
|
+
moduleFieldsResponse,
|
|
14
|
+
projectId,
|
|
15
|
+
projectVariantId
|
|
16
|
+
}) {
|
|
22
17
|
//removing empty roof,obstacle and modulefield generated by BE on variant creation
|
|
23
18
|
roofsResponse = roofsResponse.reduce((acc, cur) => {
|
|
24
19
|
if (cur.roof_outline.length > 0) {
|
|
@@ -39,31 +34,6 @@ export async function hydrateData({ state, commit }, data) {
|
|
|
39
34
|
return acc
|
|
40
35
|
}, [])
|
|
41
36
|
|
|
42
|
-
if (imageOverlayResponse && imageOverlayResponse.image_overlay_url) {
|
|
43
|
-
let imageOverlay = {
|
|
44
|
-
url: imageOverlayResponse.image_overlay_url,
|
|
45
|
-
uuid: imageOverlayResponse.image_overlay_uuid,
|
|
46
|
-
corners: imageOverlayResponse.image_overlay_settings.corners
|
|
47
|
-
}
|
|
48
|
-
commit('mutate_imageOverlay', imageOverlay)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!!layoutSettingResponse) {
|
|
52
|
-
const layoutSetting = layoutSettingResponse
|
|
53
|
-
commit('mutate_layoutSettings', layoutSetting)
|
|
54
|
-
commit('mutate_wallColor', layoutSetting.wall_color)
|
|
55
|
-
|
|
56
|
-
//end of layoutSetting correction
|
|
57
|
-
const newMapConfig = state.mapConfig
|
|
58
|
-
newMapConfig.center = {
|
|
59
|
-
lat: layoutSetting.layout_latitude,
|
|
60
|
-
lng: layoutSetting.layout_longitude
|
|
61
|
-
}
|
|
62
|
-
newMapConfig.layer = selectedLayer
|
|
63
|
-
newMapConfig.zoom = layoutSetting.map_zoom
|
|
64
|
-
commit('mutate_mapConfig', newMapConfig)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
37
|
const roofs = []
|
|
68
38
|
const obstacles = []
|
|
69
39
|
const moduleFields = []
|
|
@@ -78,7 +48,6 @@ export async function hydrateData({ state, commit }, data) {
|
|
|
78
48
|
let roof = new Polygon(roof_outline, 'roof')
|
|
79
49
|
roof.id = roofResp.roof_uuid
|
|
80
50
|
roof.name = roofResp.roof_name
|
|
81
|
-
roof = updateComputedGeometryPolygon(roof)
|
|
82
51
|
roof.margins.distances = roofResp.roof_margins_mm
|
|
83
52
|
roof.margins.isSameMargin = roofResp.roof_margins_mm.every(
|
|
84
53
|
(val) => val == roofResp.roof_margins_mm[0]
|
|
@@ -87,7 +56,7 @@ export async function hydrateData({ state, commit }, data) {
|
|
|
87
56
|
? roofResp.roof_margins_mm[0]
|
|
88
57
|
: 200
|
|
89
58
|
roof.moduleFields = []
|
|
90
|
-
roof =
|
|
59
|
+
roof = updateComputedGeometryPolygon(roof)
|
|
91
60
|
roofs.push(roof)
|
|
92
61
|
})
|
|
93
62
|
obstaclesResponse.forEach((obstacleResp) => {
|
|
@@ -110,23 +79,28 @@ export async function hydrateData({ state, commit }, data) {
|
|
|
110
79
|
obstacles.push(obstacle)
|
|
111
80
|
})
|
|
112
81
|
moduleFieldsResponse.forEach((moduleFieldResp) => {
|
|
113
|
-
const
|
|
114
|
-
|
|
82
|
+
const MFpanels = []
|
|
83
|
+
const MFuserDeactivatedPanels = []
|
|
84
|
+
const module_field_outline = moduleFieldResp.module_field_outline
|
|
85
|
+
.filter((p) => !!p)
|
|
86
|
+
.map((p) => {
|
|
115
87
|
return { x: p[0], y: p[1], z: p[2] }
|
|
116
|
-
}
|
|
117
|
-
)
|
|
88
|
+
})
|
|
118
89
|
|
|
119
90
|
let moduleField = new Polygon(module_field_outline, 'moduleField')
|
|
120
91
|
moduleField.id = moduleFieldResp.module_field_uuid
|
|
121
|
-
|
|
92
|
+
moduleField.version = moduleFieldResp.version
|
|
93
|
+
|
|
122
94
|
moduleField.pvData = {}
|
|
123
95
|
moduleField.pvData.module_texture_version_id =
|
|
124
96
|
moduleFieldResp.module_texture_version_id
|
|
125
97
|
moduleField.data = {}
|
|
126
|
-
moduleField.data.texture_img_url = moduleFieldResp.texture_img_url
|
|
127
98
|
moduleField.data.col_spacing_mm = moduleFieldResp.col_spacing_mm
|
|
128
99
|
moduleField.data.row_spacing_mm = moduleFieldResp.row_spacing_mm
|
|
129
|
-
moduleField.data.
|
|
100
|
+
moduleField.data.row_spacing_hill_mm = moduleFieldResp.row_spacing_hill_mm
|
|
101
|
+
moduleField.data.row_spacing_valley_mm =
|
|
102
|
+
moduleFieldResp.row_spacing_valley_mm
|
|
103
|
+
moduleField.data.offset_percent = moduleFieldResp.offset_percent
|
|
130
104
|
moduleField.data.panel_orientation = moduleFieldResp.panel_orientation
|
|
131
105
|
moduleField.data.panel_direction_degrees =
|
|
132
106
|
moduleFieldResp.panel_direction_degrees
|
|
@@ -136,8 +110,7 @@ export async function hydrateData({ state, commit }, data) {
|
|
|
136
110
|
moduleFieldResp.component_id_mounting_system
|
|
137
111
|
moduleField.data.module_tilt_degrees = moduleFieldResp.module_tilt_degrees
|
|
138
112
|
moduleField.data.base_line_index = moduleFieldResp.base_line_index
|
|
139
|
-
|
|
140
|
-
mounting_system_ids.push(moduleFieldResp.component_id_mounting_system)
|
|
113
|
+
moduleField.data.justify_percent = moduleFieldResp.justify_percent
|
|
141
114
|
|
|
142
115
|
moduleField.data.number_of_panels_override =
|
|
143
116
|
moduleFieldResp.number_of_panels_override
|
|
@@ -148,52 +121,125 @@ export async function hydrateData({ state, commit }, data) {
|
|
|
148
121
|
moduleField.data.yearly_yield_kwh_kwp_2 =
|
|
149
122
|
moduleFieldResp.yearly_yield_kwh_kwp_2
|
|
150
123
|
|
|
151
|
-
|
|
152
|
-
moduleFieldResp.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
124
|
+
pv_module_ids.push(moduleFieldResp.component_id_pv_module)
|
|
125
|
+
mounting_system_ids.push(moduleFieldResp.component_id_mounting_system)
|
|
126
|
+
|
|
127
|
+
moduleField.pvModuleId = moduleFieldResp.pv_module_id
|
|
128
|
+
moduleField.mountingSystemId = moduleFieldResp.mounting_system_id
|
|
129
|
+
|
|
130
|
+
const modules = []
|
|
131
|
+
moduleFieldResp.modules.forEach((module) => {
|
|
132
|
+
modules.push({
|
|
133
|
+
...module,
|
|
134
|
+
status: module.status || 'active',
|
|
135
|
+
clipped: module.clipped === undefined ? false : module.clipped
|
|
136
|
+
})
|
|
162
137
|
})
|
|
163
|
-
|
|
164
|
-
moduleFieldResp.user_deactivated_modules
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
138
|
+
if (moduleFieldResp.user_deactivated_modules) {
|
|
139
|
+
moduleFieldResp.user_deactivated_modules.forEach((module) => {
|
|
140
|
+
modules.push({
|
|
141
|
+
...module,
|
|
142
|
+
status: 'user_deactivated',
|
|
143
|
+
clipped: module.clipped === undefined ? false : module.clipped
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
moduleField.data.modules = modules
|
|
148
|
+
modules
|
|
149
|
+
.filter((m) => !m.clipped)
|
|
150
|
+
.forEach((module) => {
|
|
151
|
+
const outline = module.outline.map((p) => {
|
|
168
152
|
return { x: p[0], y: p[1], z: p[2] }
|
|
169
|
-
})
|
|
170
|
-
'
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
153
|
+
})
|
|
154
|
+
const panel = new Polygon(outline, '')
|
|
155
|
+
panel.index = module.index
|
|
156
|
+
panel.status = module.status
|
|
157
|
+
panel.clipped = module.clipped
|
|
158
|
+
panel.moduleField = moduleField
|
|
159
|
+
switch (module.status) {
|
|
160
|
+
case 'active':
|
|
161
|
+
panel.layer = 'panel'
|
|
162
|
+
MFpanels.push(panel)
|
|
163
|
+
panels.push(panel)
|
|
164
|
+
break
|
|
165
|
+
case 'user_deactivated':
|
|
166
|
+
panel.layer = 'user_deactivated_panel'
|
|
167
|
+
MFuserDeactivatedPanels.push(panel)
|
|
168
|
+
userDeactivatedPanels.push(panel)
|
|
169
|
+
break
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
|
|
176
173
|
const roof = roofs.find((r) => r.id == moduleFieldResp.roof_uuid)
|
|
177
174
|
if (!roof.moduleFields) {
|
|
178
175
|
roof.moduleFields = []
|
|
179
176
|
}
|
|
180
177
|
roof.moduleFields.push(moduleField)
|
|
181
178
|
moduleField.roof = roof
|
|
182
|
-
moduleField.panels =
|
|
183
|
-
moduleField.userDeactivatedPanels =
|
|
179
|
+
moduleField.panels = MFpanels
|
|
180
|
+
moduleField.userDeactivatedPanels = MFuserDeactivatedPanels
|
|
184
181
|
moduleField = updateComputedGeometryPolygon(moduleField)
|
|
185
182
|
moduleFields.push(moduleField)
|
|
186
183
|
})
|
|
187
|
-
//Get PV & Mounting system component Data
|
|
184
|
+
//Get PV & Mounting system component Data:
|
|
188
185
|
pv_module_ids = [...new Set(pv_module_ids)]
|
|
189
186
|
mounting_system_ids = [...new Set(mounting_system_ids)]
|
|
190
187
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
188
|
+
return {
|
|
189
|
+
polygons: [
|
|
190
|
+
...roofs,
|
|
191
|
+
...obstacles,
|
|
192
|
+
...moduleFields,
|
|
193
|
+
...panels,
|
|
194
|
+
...userDeactivatedPanels
|
|
195
|
+
],
|
|
196
|
+
pv_module_ids,
|
|
197
|
+
mounting_system_ids
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export async function hydrateData({ state, commit }, data) {
|
|
202
|
+
let roofsResponse = data.roofs
|
|
203
|
+
let obstaclesResponse = data.obstacles
|
|
204
|
+
let moduleFieldsResponse = data.moduleFields
|
|
205
|
+
const layoutSettingResponse = data.layoutSettings
|
|
206
|
+
const imageOverlayResponse = data.imageOverlay
|
|
207
|
+
const mapType = data.mapType
|
|
208
|
+
let layers = getLayers()
|
|
209
|
+
let selectedLayer = layers.find((layer) => layer.key == mapType)
|
|
210
|
+
commit('mutate_selectedMapLayer', selectedLayer)
|
|
211
|
+
|
|
212
|
+
if (imageOverlayResponse && imageOverlayResponse.image_overlay_url) {
|
|
213
|
+
let imageOverlay = {
|
|
214
|
+
url: imageOverlayResponse.image_overlay_url,
|
|
215
|
+
uuid: imageOverlayResponse.image_overlay_uuid,
|
|
216
|
+
corners: imageOverlayResponse.image_overlay_settings.corners
|
|
217
|
+
}
|
|
218
|
+
commit('mutate_imageOverlay', imageOverlay)
|
|
219
|
+
}
|
|
220
|
+
if (!!layoutSettingResponse) {
|
|
221
|
+
const layoutSetting = layoutSettingResponse
|
|
222
|
+
commit('mutate_layoutSettings', layoutSetting)
|
|
223
|
+
commit('mutate_wallColor', layoutSetting.wall_color)
|
|
224
|
+
|
|
225
|
+
//end of layoutSetting correction
|
|
226
|
+
const newMapConfig = state.mapConfig
|
|
227
|
+
newMapConfig.center = {
|
|
228
|
+
lat: layoutSetting.layout_latitude,
|
|
229
|
+
lng: layoutSetting.layout_longitude
|
|
230
|
+
}
|
|
231
|
+
newMapConfig.layer = selectedLayer
|
|
232
|
+
newMapConfig.zoom = layoutSetting.map_zoom
|
|
233
|
+
commit('mutate_mapConfig', newMapConfig)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const hydratationResult = await hydratePolygons({
|
|
237
|
+
roofsResponse,
|
|
238
|
+
obstaclesResponse,
|
|
239
|
+
moduleFieldsResponse
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
state.polygons = hydratationResult.polygons
|
|
243
|
+
|
|
198
244
|
state = UpdateRoofObstacleRelations(state)
|
|
199
245
|
}
|