@eturnity/eturnity_3d 7.16.0 → 7.18.0-qa-elisee.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": "7.16.0",
4
+ "version": "7.18.0-qa-elisee.1",
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.10.0",
13
+ "@eturnity/eturnity_maths": "7.18.0-qa-elisee.1",
14
14
  "core-js": "^2.6.12",
15
15
  "cors": "^2.8.5",
16
16
  "earcut": "^2.2.4",
@@ -41,9 +41,9 @@
41
41
  "eslint-plugin-prettier": "3.4.1",
42
42
  "eslint-plugin-vue": "5.2.3",
43
43
  "html-webpack-plugin": "^3.2.0",
44
+ "prettier": "2.8.4",
44
45
  "webpack": "^4.46.0",
45
- "webpack-cli": "^4.10.0",
46
- "prettier": "2.8.4"
46
+ "webpack-cli": "^4.10.0"
47
47
  },
48
48
  "eslintConfig": {
49
49
  "root": true,
@@ -13,42 +13,80 @@ export function UpdateRoofModuleFieldRelations(state) {
13
13
  const panelPolygons = state.polygons.filter((poly) =>
14
14
  ['panel', 'user_deactivated_panel'].includes(poly.layer)
15
15
  )
16
+ panelPolygons.forEach((panel) => {
17
+ panel.roof = null
18
+ })
16
19
  //let's remove all moduleFields from roofs
20
+
17
21
  roofPolygons.forEach((roofPolygon) => {
18
- //breaking circular reference for memory management
19
- for (let k in roofPolygon.moduleFields) {
20
- roofPolygon.moduleFields[k] = null
22
+ if (!roofPolygon.moduleFields) {
23
+ roofPolygon.moduleFields = []
21
24
  }
22
- roofPolygon.moduleFields = []
25
+ roofPolygon.moduleFields.filter((mf) => {
26
+ moduleFieldPolygons.some((p) => p.id == mf.id)
27
+ })
23
28
  })
24
29
  moduleFieldPolygons.forEach((moduleFieldPolygon) => {
25
- moduleFieldPolygon.roof = null
26
- })
27
- panelPolygons.forEach((panelPolygon) => {
28
- panelPolygon.roof = null
30
+ if (
31
+ moduleFieldPolygon.roof &&
32
+ !roofPolygons.some((r) => r.id == moduleFieldPolygon.roof.id)
33
+ ) {
34
+ moduleFieldPolygon.roof = null
35
+ }
29
36
  })
30
37
 
31
38
  for (let k in moduleFieldPolygons) {
32
39
  const moduleField = moduleFieldPolygons[k]
33
- //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
34
- let roofPolygonCandidates = roofPolygons.filter((roof) => {
35
- const intersection = intersectOutlines(moduleField.outline, roof.outline)
36
- if (intersection.length == 0) return false
37
- const intersectionArea = calculateArea(intersection[0])
38
- return intersectionArea > 100 && moduleField.area <= roof.area + 0.1
39
- })
40
- //roofs on roof can lead to multiple roof under a point. moduleField is on the smallest
41
- let smallestRoof = null
42
- for (let roof of roofPolygonCandidates) {
43
- if (!smallestRoof || smallestRoof.area > roof.area) {
44
- smallestRoof = roof
45
- }
46
- }
47
- let roofPolygon = smallestRoof
40
+ let roofPolygon = moduleField.roof
48
41
  if (!roofPolygon) {
49
- continue
42
+ //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
43
+ let roofPolygonCandidates = roofPolygons.map((roof) => {
44
+ const intersection = intersectOutlines(
45
+ moduleField.outline,
46
+ roof.outline
47
+ )
48
+ if (intersection.length == 0) {
49
+ return {
50
+ roof,
51
+ intersectionArea: 0,
52
+ intersectionRatio: 0,
53
+ areaRatio: 0,
54
+ roofBiggerThanModuleField: 1
55
+ }
56
+ }
57
+ const intersectionArea_m2 = calculateArea(intersection[0]) / 1e6
58
+ return {
59
+ roof,
60
+ intersectionArea: intersectionArea_m2,
61
+ intersectionRatio: (intersectionArea_m2 / roof.area).toFixed(3),
62
+ areaRatio: (moduleField.area / roof.area).toFixed(3),
63
+ roofBiggerThanModuleField: roof.area >= moduleField.area ? 1 : -1
64
+ }
65
+ })
66
+ //roofs on roof can lead to multiple roof under a point. moduleField is on the smallest
67
+
68
+ roofPolygonCandidates
69
+ .sort((a, b) => b.roof.area - a.roof.area)
70
+ .sort((a, b) => a.intersectionArea - b.intersectionArea)
71
+ .sort(
72
+ (a, b) => a.roofBiggerThanModuleField - b.roofBiggerThanModuleField
73
+ )
74
+ let polygonCandidate = roofPolygonCandidates.pop()
75
+ if (!polygonCandidate) {
76
+ continue
77
+ }
78
+ roofPolygon = polygonCandidate.roof
79
+ if (!roofPolygon) {
80
+ continue
81
+ }
82
+
83
+ roofPolygon.moduleFields.push(moduleField)
50
84
  }
51
- roofPolygon.moduleFields.push(moduleField)
85
+ roofPolygon = roofPolygons.find((r) => r.id == roofPolygon.id)
86
+ roofPolygon.moduleFields = [
87
+ ...roofPolygon.moduleFields.filter((mf) => mf.id != moduleField.id),
88
+ moduleField
89
+ ]
52
90
  moduleField.roof = roofPolygon
53
91
  moduleField.panels.forEach((panel) => (panel.roof = roofPolygon))
54
92
  panelPolygons.forEach((p) => {
@@ -72,7 +110,9 @@ export function UpdateRoofModuleFieldRelations(state) {
72
110
  return panelPolygons.find((panel) => panel.id == p.id)
73
111
  })
74
112
  state = { ...state, polygons: newPolygons }
113
+
75
114
  state = removeModuleFieldAndPanelsOnNoOrMultipleRoofs(state)
115
+
76
116
  return state
77
117
  }
78
118
 
package/jsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "paths": {
4
- "@/*": ["./src/*"]
5
- }
6
- },
7
- "exclude": ["node_modules", "dist"]
8
- }