@eturnity/eturnity_3d 8.34.1 → 8.34.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 -2
- package/src/store/hydrateData.js +58 -45
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "8.34.
|
|
4
|
+
"version": "8.34.2",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"merge-remote-master": "node scripts/merge-remote-master.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@eturnity/eturnity_maths": "8.
|
|
19
|
+
"@eturnity/eturnity_maths": "8.34.0",
|
|
20
20
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
|
21
21
|
"core-js": "3.30.2",
|
|
22
22
|
"cors": "2.8.5",
|
package/src/store/hydrateData.js
CHANGED
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
Polygon,
|
|
4
4
|
updateComputedGeometryPolygon,
|
|
5
5
|
getObstacleMarginOutline,
|
|
6
|
+
multiplyVector,
|
|
7
|
+
addVector,
|
|
8
|
+
Vector,
|
|
6
9
|
} from '@eturnity/eturnity_maths'
|
|
7
10
|
import OverlayLayer from '../Overlay/OverlayLayer'
|
|
8
11
|
import getLayers from '../utils/layers'
|
|
@@ -26,6 +29,25 @@ function sanitizedOutline(outline) {
|
|
|
26
29
|
return accumulator
|
|
27
30
|
}, [])
|
|
28
31
|
}
|
|
32
|
+
export function getModuleOutline({ module, grid }) {
|
|
33
|
+
const rowIndex = module.row_index
|
|
34
|
+
const colIndex = module.col_index
|
|
35
|
+
const gridRowVector = new Vector(grid.grid_row_vector)
|
|
36
|
+
const gridColVector = new Vector(grid.grid_column_vector)
|
|
37
|
+
const panelHeightVector = new Vector(grid.panel_height_vector)
|
|
38
|
+
const panelWidthVector = new Vector(grid.panel_width_vector)
|
|
39
|
+
const gridOrigin = new Vector(grid.grid_origin)
|
|
40
|
+
const localA = addVector(
|
|
41
|
+
multiplyVector(rowIndex, gridRowVector),
|
|
42
|
+
multiplyVector(colIndex, gridColVector)
|
|
43
|
+
)
|
|
44
|
+
const A = addVector(gridOrigin, localA)
|
|
45
|
+
const B = addVector(A, panelHeightVector)
|
|
46
|
+
const C = addVector(A, addVector(panelHeightVector, panelWidthVector))
|
|
47
|
+
const D = addVector(A, panelWidthVector)
|
|
48
|
+
return [A, B, C, D]
|
|
49
|
+
}
|
|
50
|
+
|
|
29
51
|
export async function hydratePolygons({
|
|
30
52
|
roofsResponse = [],
|
|
31
53
|
obstaclesResponse = [],
|
|
@@ -170,56 +192,47 @@ export async function hydratePolygons({
|
|
|
170
192
|
moduleField.pvModuleId = moduleFieldResp.pv_module_id
|
|
171
193
|
moduleField.mountingSystemId = moduleFieldResp.mounting_system_id
|
|
172
194
|
|
|
195
|
+
moduleField.data.moduleGrids = moduleFieldResp.module_grids
|
|
196
|
+
moduleField.needsOptimisation = false
|
|
197
|
+
|
|
173
198
|
const modules = []
|
|
174
|
-
moduleFieldResp.
|
|
175
|
-
modules.
|
|
176
|
-
...module,
|
|
177
|
-
status: module.status || 'active',
|
|
178
|
-
clipped: module.clipped === undefined ? false : module.clipped,
|
|
179
|
-
})
|
|
180
|
-
})
|
|
181
|
-
if (moduleFieldResp.user_deactivated_modules) {
|
|
182
|
-
moduleFieldResp.user_deactivated_modules.forEach((module) => {
|
|
199
|
+
moduleFieldResp.module_grids.forEach((grid, gridIndex) => {
|
|
200
|
+
grid.modules.forEach((module) => {
|
|
183
201
|
modules.push({
|
|
184
202
|
...module,
|
|
185
|
-
|
|
186
|
-
|
|
203
|
+
outline: getModuleOutline({
|
|
204
|
+
module,
|
|
205
|
+
grid,
|
|
206
|
+
offset: moduleFieldResp.offset_percent,
|
|
207
|
+
}),
|
|
208
|
+
gridIndex: gridIndex,
|
|
187
209
|
})
|
|
188
210
|
})
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
modules
|
|
192
|
-
|
|
193
|
-
.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
panel.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
break
|
|
215
|
-
case 'user_deactivated':
|
|
216
|
-
panel.layer = 'user_deactivated_panel'
|
|
217
|
-
MFuserDeactivatedPanels.push(panel)
|
|
218
|
-
userDeactivatedPanels.push(panel)
|
|
219
|
-
break
|
|
220
|
-
}
|
|
221
|
-
panel = updateComputedGeometryPolygon(panel)
|
|
222
|
-
})
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
modules.forEach((module) => {
|
|
214
|
+
const panel = new Polygon(module.outline, '')
|
|
215
|
+
panel.id = module.module_uuid
|
|
216
|
+
panel.gridIndex = module.gridIndex
|
|
217
|
+
panel.row_index = module.row_index
|
|
218
|
+
panel.col_index = module.col_index
|
|
219
|
+
panel.is_active = module.is_active
|
|
220
|
+
panel.moduleField = moduleField
|
|
221
|
+
panel.poolGroupUuid = module.project_variant_pool_group_uuid
|
|
222
|
+
if (panel.poolGroupUuid) {
|
|
223
|
+
panel.poolGroupUuidColor = `#${panel.poolGroupUuid.slice(0, 6)}`
|
|
224
|
+
}
|
|
225
|
+
panel.available = true
|
|
226
|
+
if (module.is_active) {
|
|
227
|
+
panel.layer = 'panel'
|
|
228
|
+
MFpanels.push(panel)
|
|
229
|
+
panels.push(panel)
|
|
230
|
+
} else {
|
|
231
|
+
panel.layer = 'user_deactivated_panel'
|
|
232
|
+
MFuserDeactivatedPanels.push(panel)
|
|
233
|
+
userDeactivatedPanels.push(panel)
|
|
234
|
+
}
|
|
235
|
+
})
|
|
223
236
|
|
|
224
237
|
const roof = roofs.find((r) => r.id == moduleFieldResp.roof_uuid)
|
|
225
238
|
if (roof) {
|