@eturnity/eturnity_3d 9.31.0 → 9.31.1-EXP-24.0
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 +8 -2
- package/src/config.js +1 -0
- package/src/helper/cameraMixin.js +13 -5
- package/src/store/hydrateData.js +8 -5
- package/src/store/hydratePolygons.spec.js +111 -0
- package/dist/assets/images/panels/longiSolarLR4_60HPH_350M.png +0 -0
- package/dist/assets/images/panels/longiSolarLR4_60HPH_370M.png +0 -0
- package/dist/assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw copy.png +0 -0
- package/dist/assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw.png +0 -0
- package/dist/assets/images/panels/uv.png +0 -0
- package/dist/assets/panels/longiSolarLR4_60HPH_350M.png +0 -0
- package/dist/assets/panels/longiSolarLR4_60HPH_370M.png +0 -0
- package/dist/assets/panels/reneSola_Virtus_2_JC320S_24_Bbw.png +0 -0
- package/dist/assets/panels/uv.png +0 -0
- package/dist/assets/theme.js +0 -43
- package/dist/assets/vue.svg +0 -1
- package/dist/main.es.js +0 -43662
- package/dist/main.umd.js +0 -3542
- package/dist/style.css +0 -1
- package/dist/vite.svg +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "9.31.0",
|
|
4
|
+
"version": "9.31.1-EXP-24.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src"
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "vite",
|
|
13
13
|
"build": "vite build",
|
|
14
|
+
"test": "jest",
|
|
14
15
|
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src`",
|
|
15
16
|
"prettier": "prettier --write \"**/*.{js,vue}\"",
|
|
16
17
|
"merge-remote-master": "node scripts/merge-remote-master.js"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@eturnity/eturnity_maths": "9.31.0",
|
|
20
|
+
"@eturnity/eturnity_maths": "9.31.0-EXP-24.0",
|
|
20
21
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
|
21
22
|
"core-js": "3.30.2",
|
|
22
23
|
"cors": "2.8.5",
|
|
@@ -35,14 +36,19 @@
|
|
|
35
36
|
"vuex": "4.1.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
39
|
+
"@babel/core": "7.22.0",
|
|
40
|
+
"@babel/preset-env": "7.22.0",
|
|
38
41
|
"@vitejs/plugin-vue": "2.0.1",
|
|
39
42
|
"@vue/compiler-sfc": "3.3.4",
|
|
40
43
|
"@vue/eslint-config-standard": "8.0.1",
|
|
44
|
+
"babel-jest": "29.7.0",
|
|
41
45
|
"eslint": "8.0.1",
|
|
42
46
|
"eslint-config-prettier": "8.8.0",
|
|
43
47
|
"eslint-plugin-prettier": "4.2.1",
|
|
44
48
|
"eslint-plugin-vue": "9.14.1",
|
|
45
49
|
"html-webpack-plugin": "3.2.0",
|
|
50
|
+
"jest": "29.7.0",
|
|
51
|
+
"jest-environment-jsdom": "29.7.0",
|
|
46
52
|
"prettier": "2.8.4",
|
|
47
53
|
"prettier-plugin-vue": "1.1.6",
|
|
48
54
|
"vite": "2.7.2",
|
package/src/config.js
CHANGED
|
@@ -8,6 +8,7 @@ export const mmTolerance = 5
|
|
|
8
8
|
export const mmTolerance3dNode = 50
|
|
9
9
|
export const earthRadius = 6371008
|
|
10
10
|
export const marginAroundBuildingForCameraViewInMeter = 5
|
|
11
|
+
export const DEFAULT_FOV = 50
|
|
11
12
|
export const layerColors = {
|
|
12
13
|
construction: {
|
|
13
14
|
fillColor: 'transparent',
|
|
@@ -6,13 +6,21 @@ import {
|
|
|
6
6
|
multiplyVector,
|
|
7
7
|
substractVector,
|
|
8
8
|
} from '@eturnity/eturnity_maths'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_FOV,
|
|
11
|
+
marginAroundBuildingForCameraViewInMeter,
|
|
12
|
+
} from '../config'
|
|
10
13
|
import OverlayLayer from '../Overlay/OverlayLayer'
|
|
11
14
|
export default {
|
|
12
15
|
data() {
|
|
13
16
|
return {
|
|
14
17
|
animationFrameId: null,
|
|
15
|
-
perspectiveCamera: new THREE.PerspectiveCamera(
|
|
18
|
+
perspectiveCamera: new THREE.PerspectiveCamera(
|
|
19
|
+
DEFAULT_FOV,
|
|
20
|
+
300 / 300,
|
|
21
|
+
1,
|
|
22
|
+
50000
|
|
23
|
+
),
|
|
16
24
|
orthographicCamera: new THREE.OrthographicCamera(
|
|
17
25
|
-50,
|
|
18
26
|
50,
|
|
@@ -398,7 +406,7 @@ export default {
|
|
|
398
406
|
},
|
|
399
407
|
setCameraInitialPosition() {
|
|
400
408
|
if (this.roofs.length == 0) return
|
|
401
|
-
let newFov =
|
|
409
|
+
let newFov = DEFAULT_FOV
|
|
402
410
|
if (
|
|
403
411
|
this.roofsBounds.xMax === Infinity ||
|
|
404
412
|
this.roofsBounds.xMin === -Infinity ||
|
|
@@ -462,7 +470,7 @@ export default {
|
|
|
462
470
|
if (this.camera.isOrthographicCamera) {
|
|
463
471
|
this.setOrthographicCameraGlobalPosition()
|
|
464
472
|
} else {
|
|
465
|
-
let newFov =
|
|
473
|
+
let newFov = DEFAULT_FOV
|
|
466
474
|
let bounds = this.roofsBounds
|
|
467
475
|
if (
|
|
468
476
|
bounds.xMax === Infinity ||
|
|
@@ -618,7 +626,7 @@ export default {
|
|
|
618
626
|
const {
|
|
619
627
|
position,
|
|
620
628
|
target,
|
|
621
|
-
fov =
|
|
629
|
+
fov = DEFAULT_FOV,
|
|
622
630
|
duration = 1500,
|
|
623
631
|
callback = () => {},
|
|
624
632
|
} = payload
|
package/src/store/hydrateData.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
//Synchronisation with BE:
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
Roof,
|
|
4
|
+
Obstacle,
|
|
5
|
+
ModuleField,
|
|
6
|
+
Panel,
|
|
4
7
|
updateComputedGeometryPolygon,
|
|
5
8
|
getObstacleMarginOutline,
|
|
6
9
|
multiplyVector,
|
|
@@ -90,7 +93,7 @@ export async function hydratePolygons({
|
|
|
90
93
|
const roof_outline = roofResp.roof_outline.map((p) => {
|
|
91
94
|
return { x: p[0], y: p[1], z: p[2] }
|
|
92
95
|
})
|
|
93
|
-
let roof = new
|
|
96
|
+
let roof = new Roof(roof_outline)
|
|
94
97
|
roof.id = roofResp.roof_uuid
|
|
95
98
|
roof.version = roofResp.version
|
|
96
99
|
roof.name = roofResp.roof_name
|
|
@@ -116,7 +119,7 @@ export async function hydratePolygons({
|
|
|
116
119
|
const obstacle_outline = obstacleResp.obstacle_outline.map((p) => {
|
|
117
120
|
return { x: p[0], y: p[1], z: p[2] }
|
|
118
121
|
})
|
|
119
|
-
let obstacle = new
|
|
122
|
+
let obstacle = new Obstacle(obstacle_outline)
|
|
120
123
|
obstacle.id = obstacleResp.obstacle_uuid
|
|
121
124
|
obstacle.version = obstacleResp.version
|
|
122
125
|
obstacle.height = obstacleResp.obstacle_height_above_ground_mm
|
|
@@ -145,7 +148,7 @@ export async function hydratePolygons({
|
|
|
145
148
|
return { x: p[0], y: p[1], z: p[2] }
|
|
146
149
|
})
|
|
147
150
|
|
|
148
|
-
let moduleField = new
|
|
151
|
+
let moduleField = new ModuleField(module_field_outline)
|
|
149
152
|
moduleField.id = moduleFieldResp.module_field_uuid
|
|
150
153
|
moduleField.version = moduleFieldResp.version
|
|
151
154
|
|
|
@@ -212,7 +215,7 @@ export async function hydratePolygons({
|
|
|
212
215
|
})
|
|
213
216
|
|
|
214
217
|
modules.forEach((module) => {
|
|
215
|
-
let panel = new
|
|
218
|
+
let panel = new Panel(module.outline)
|
|
216
219
|
panel.id = module.module_uuid
|
|
217
220
|
panel.gridIndex = module.gridIndex
|
|
218
221
|
panel.row_index = module.row_index
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { hydratePolygons } from './hydrateData'
|
|
2
|
+
import { Roof, Obstacle, ModuleField, Panel } from '@eturnity/eturnity_maths'
|
|
3
|
+
|
|
4
|
+
const square = (size) => [
|
|
5
|
+
[0, 0, 0],
|
|
6
|
+
[size, 0, 0],
|
|
7
|
+
[size, size, 0],
|
|
8
|
+
[0, size, 0],
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
const moduleGrid = {
|
|
12
|
+
grid_origin: [0, 0, 0],
|
|
13
|
+
grid_row_vector: [1100, 0, 0],
|
|
14
|
+
grid_column_vector: [0, 1900, 0],
|
|
15
|
+
panel_height_vector: [0, 1800, 0],
|
|
16
|
+
panel_width_vector: [1000, 0, 0],
|
|
17
|
+
modules: [
|
|
18
|
+
{
|
|
19
|
+
module_uuid: 'module-active',
|
|
20
|
+
row_index: 0,
|
|
21
|
+
col_index: 0,
|
|
22
|
+
is_active: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
module_uuid: 'module-inactive',
|
|
26
|
+
row_index: 0,
|
|
27
|
+
col_index: 1,
|
|
28
|
+
is_active: false,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function hydrateFixture() {
|
|
34
|
+
return hydratePolygons({
|
|
35
|
+
roofsResponse: [
|
|
36
|
+
{
|
|
37
|
+
roof_uuid: 'roof-1',
|
|
38
|
+
version: 3,
|
|
39
|
+
roof_outline: square(10000),
|
|
40
|
+
roof_margins_mm: [200, 200, 200, 200],
|
|
41
|
+
roof_slope_degrees: 0,
|
|
42
|
+
roof_orientation_degrees: 180,
|
|
43
|
+
roof_name: 'test roof',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
obstaclesResponse: [
|
|
47
|
+
{
|
|
48
|
+
obstacle_uuid: 'obstacle-1',
|
|
49
|
+
version: 1,
|
|
50
|
+
obstacle_outline: square(1000),
|
|
51
|
+
obstacle_margins_mm: [100, 100, 100, 100],
|
|
52
|
+
obstacle_height_above_ground_mm: 500,
|
|
53
|
+
obstacle_slope_is_parallel_to_roof: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
moduleFieldsResponse: [
|
|
57
|
+
{
|
|
58
|
+
module_field_uuid: 'mf-1',
|
|
59
|
+
version: 2,
|
|
60
|
+
module_field_outline: square(5000),
|
|
61
|
+
col_spacing_mm: 20,
|
|
62
|
+
row_spacing_mm: 20,
|
|
63
|
+
is_row_spacing_automatic: false,
|
|
64
|
+
offset_percent: 0,
|
|
65
|
+
panel_orientation: 'portrait',
|
|
66
|
+
panel_direction_degrees: 0,
|
|
67
|
+
module_grids: [moduleGrid],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const byLayer = (polygons, layer) => polygons.filter((p) => p.layer == layer)
|
|
74
|
+
|
|
75
|
+
describe('hydratePolygons builds typed polygon instances', () => {
|
|
76
|
+
it('hydrates roofs, obstacles and module fields to their subclasses', async () => {
|
|
77
|
+
const { polygons } = await hydrateFixture()
|
|
78
|
+
const [roof] = byLayer(polygons, 'roof')
|
|
79
|
+
const [obstacle] = byLayer(polygons, 'obstacle')
|
|
80
|
+
const [moduleField] = byLayer(polygons, 'moduleField')
|
|
81
|
+
expect(roof).toBeInstanceOf(Roof)
|
|
82
|
+
expect(obstacle).toBeInstanceOf(Obstacle)
|
|
83
|
+
expect(moduleField).toBeInstanceOf(ModuleField)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('hydrates every grid module as a Panel, with activeness as the layer', async () => {
|
|
87
|
+
const { polygons } = await hydrateFixture()
|
|
88
|
+
const panels = byLayer(polygons, 'panel')
|
|
89
|
+
const userDeactivatedPanels = byLayer(polygons, 'user_deactivated_panel')
|
|
90
|
+
expect(panels).toHaveLength(1)
|
|
91
|
+
expect(panels[0]).toBeInstanceOf(Panel)
|
|
92
|
+
expect(panels[0].id).toBe('module-active')
|
|
93
|
+
expect(userDeactivatedPanels).toHaveLength(1)
|
|
94
|
+
expect(userDeactivatedPanels[0]).toBeInstanceOf(Panel)
|
|
95
|
+
expect(userDeactivatedPanels[0].id).toBe('module-inactive')
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('round-trips hydrated polygons through serializeForBEStorage', async () => {
|
|
99
|
+
const { polygons } = await hydrateFixture()
|
|
100
|
+
const [roof] = byLayer(polygons, 'roof')
|
|
101
|
+
const [obstacle] = byLayer(polygons, 'obstacle')
|
|
102
|
+
const roofPayload = roof.serializeForBEStorage()
|
|
103
|
+
expect(roofPayload.roof_uuid).toBe('roof-1')
|
|
104
|
+
expect(roofPayload.roof_outline).toEqual(square(10000))
|
|
105
|
+
expect(roofPayload.roof_margins_mm).toEqual([200, 200, 200, 200])
|
|
106
|
+
const obstaclePayload = obstacle.serializeForBEStorage()
|
|
107
|
+
expect(obstaclePayload.obstacle_uuid).toBe('obstacle-1')
|
|
108
|
+
expect(obstaclePayload.obstacle_height_above_ground_mm).toBe(500)
|
|
109
|
+
expect(obstaclePayload.obstacle_slope_is_parallel_to_roof).toBe(true)
|
|
110
|
+
})
|
|
111
|
+
})
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/assets/theme.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const theme = {
|
|
2
|
-
colors: {
|
|
3
|
-
primary: '#282387',
|
|
4
|
-
secondary: '#818181',
|
|
5
|
-
tertiary: '#d5d5d5',
|
|
6
|
-
black: '#263238',
|
|
7
|
-
yellow: '#fdb813',
|
|
8
|
-
darkGray: '#818181',
|
|
9
|
-
mediumGray: '#d5d5d5',
|
|
10
|
-
lightGray: '#f2f2f2',
|
|
11
|
-
white: '#fff',
|
|
12
|
-
blue: '#48a2d0',
|
|
13
|
-
red: '#FF5656',
|
|
14
|
-
blue1: '#e4efff',
|
|
15
|
-
blue2: '#F6FAFF',
|
|
16
|
-
grey1: '#666',
|
|
17
|
-
grey2: '#c4c4c4',
|
|
18
|
-
grey3: '#b2b9c5',
|
|
19
|
-
grey4: '#dee2eb',
|
|
20
|
-
grey5: '#fafafa',
|
|
21
|
-
grey6: '#555d61',
|
|
22
|
-
turquoise: '#20A4CA',
|
|
23
|
-
green: '#99db0c',
|
|
24
|
-
purple: '#505ca6',
|
|
25
|
-
disabled: '#dfe1e1',
|
|
26
|
-
transparentWhite1: '#ffffff32',
|
|
27
|
-
transparentBlack1: '#263238e6',
|
|
28
|
-
transparentBlue1: '#20a4cae6',
|
|
29
|
-
blueElectric: '#66dffa',
|
|
30
|
-
eturnityGrey: '#263238'
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
screen: {
|
|
34
|
-
mobileSmall: '345px',
|
|
35
|
-
mobile: '425px',
|
|
36
|
-
mobileLarge: '530px',
|
|
37
|
-
tablet: '768px',
|
|
38
|
-
tabletLarge: '950px'
|
|
39
|
-
},
|
|
40
|
-
borderRadius: '4px'
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default theme
|
package/dist/assets/vue.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|