@eturnity/eturnity_maths 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 +1 -1
- package/src/objects/Polygon.js +22 -17
package/package.json
CHANGED
package/src/objects/Polygon.js
CHANGED
|
@@ -121,9 +121,9 @@ export class Polygon {
|
|
|
121
121
|
name: this.name,
|
|
122
122
|
type: this.type,
|
|
123
123
|
outline: this.outline.map(p=>{return {
|
|
124
|
-
x:
|
|
125
|
-
y:
|
|
126
|
-
z:
|
|
124
|
+
x: p.x,
|
|
125
|
+
y: p.y,
|
|
126
|
+
z: p.z,
|
|
127
127
|
}}),
|
|
128
128
|
holes: this.holes.map((p) => p.id),
|
|
129
129
|
layer: this.layer,
|
|
@@ -149,21 +149,18 @@ export class Polygon {
|
|
|
149
149
|
return { id: roof.id }
|
|
150
150
|
})
|
|
151
151
|
} else if (this.layer == 'moduleField') {
|
|
152
|
+
const modules=[]
|
|
153
|
+
this.panels.forEach((p) => {
|
|
154
|
+
modules.push({ id: p.id, index: p.index, outline: p.outline, status: p.status || "active" })
|
|
155
|
+
})
|
|
156
|
+
this.userDeactivatedPanels.forEach((p) => {
|
|
157
|
+
modules.push({ id: p.id, index: p.index, outline: p.outline, status: p.status || "user_deactivated" })
|
|
158
|
+
})
|
|
152
159
|
extraSerialization.data = {...this.data,modules:[]}
|
|
153
160
|
extraSerialization.roof = { id: this.roof.id }
|
|
154
161
|
extraSerialization.pvData = this.pvData?{...this.pvData}:null
|
|
155
162
|
extraSerialization.mountingData = this.mountingData?{...this.mountingData}:null
|
|
156
|
-
extraSerialization.
|
|
157
|
-
// this.panels
|
|
158
|
-
// ? this.panels.map((p) => {
|
|
159
|
-
// return { id: p.id, index: p.index, outline: p.outline }
|
|
160
|
-
// })
|
|
161
|
-
// : []
|
|
162
|
-
extraSerialization.userDeactivatedPanels = this.userDeactivatedPanels
|
|
163
|
-
? this.userDeactivatedPanels.map((p) => {
|
|
164
|
-
return { id: p.id, index: p.index, outline: p.outline }
|
|
165
|
-
})
|
|
166
|
-
: []
|
|
163
|
+
extraSerialization.modules = modules
|
|
167
164
|
} else if (this.layer == 'panel') {
|
|
168
165
|
extraSerialization.index = this.index
|
|
169
166
|
extraSerialization.moduleField = { id: this.moduleField.id }
|
|
@@ -209,15 +206,24 @@ export class Polygon {
|
|
|
209
206
|
const modules = this.panels.map((p) => {
|
|
210
207
|
return {
|
|
211
208
|
index: p.index,
|
|
212
|
-
outline: p.outline.map((v) => [v.x, v.y, v.z])
|
|
209
|
+
outline: p.outline.map((v) => [v.x, v.y, v.z]),
|
|
210
|
+
status: p.status || "active",
|
|
211
|
+
clipped: p.clipped === undefined ? false : p.clipped
|
|
213
212
|
}
|
|
214
213
|
})
|
|
215
214
|
const user_deactivated_modules = this.userDeactivatedPanels.map((p) => {
|
|
216
215
|
return {
|
|
217
216
|
index: p.index,
|
|
218
|
-
outline: p.outline.map((v) => [v.x, v.y, v.z])
|
|
217
|
+
outline: p.outline.map((v) => [v.x, v.y, v.z]),
|
|
219
218
|
}
|
|
220
219
|
})
|
|
220
|
+
user_deactivated_modules.forEach(p=>{
|
|
221
|
+
modules.push({
|
|
222
|
+
...p,
|
|
223
|
+
status: p.status || "user_deactivated",
|
|
224
|
+
clipped: p.clipped === undefined ? false : p.clipped
|
|
225
|
+
})
|
|
226
|
+
})
|
|
221
227
|
return {
|
|
222
228
|
module_field_uuid: this.id,
|
|
223
229
|
roof_uuid: this.roof.id,
|
|
@@ -232,7 +238,6 @@ export class Polygon {
|
|
|
232
238
|
component_id_mounting_system: this.data.component_id_mounting_system,
|
|
233
239
|
modules: modules,
|
|
234
240
|
module_tilt_degrees: this.data.module_tilt_degrees,
|
|
235
|
-
user_deactivated_modules: user_deactivated_modules,
|
|
236
241
|
base_line_index: this.data.base_line_index,
|
|
237
242
|
justify_percent: this.data.justify_percent,
|
|
238
243
|
|