architwin 1.10.19 → 1.10.20
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/lib/architwin.js +25 -7
- package/lib/atwinui/components/toolbar/actionSettingsPane.d.ts +9 -9
- package/lib/atwinui/components/toolbar/actionSettingsPane.js +50 -39
- package/lib/atwinui/components/toolbar/card.js +7 -3
- package/lib/atwinui/components/toolbar/i18n.js +5 -1
- package/lib/atwinui/components/toolbar/menuBar.js +4 -0
- package/lib/atwinui/components/toolbar/modelControlsPane.d.ts +1 -1
- package/lib/atwinui/components/toolbar/modelControlsPane.js +166 -155
- package/lib/atwinui/components/toolbar/objectListPane.js +3 -6
- package/lib/atwinui/events.js +18 -9
- package/lib/utils.js +22 -2
- package/lib/worldConversion.d.ts +5 -4
- package/lib/worldConversion.js +15 -11
- package/package.json +1 -1
- package/static/atwinui.css +1 -3
package/lib/architwin.js
CHANGED
|
@@ -671,12 +671,24 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
|
|
|
671
671
|
_atwin.Mode.current.subscribe((mode) => {
|
|
672
672
|
_currentViewMode = mode;
|
|
673
673
|
if (mode == 'mode.floorplan') {
|
|
674
|
-
|
|
675
|
-
|
|
674
|
+
if (_transformComponent) {
|
|
675
|
+
_transformComponent.inputs.size = 0.01;
|
|
676
|
+
}
|
|
677
|
+
//Feature specific code
|
|
678
|
+
if (isToolbarFeatureEnabled('roomCreation')) {
|
|
679
|
+
log.info("_verticeComponentsCollection ", _verticeComponentsCollection);
|
|
680
|
+
toggleVerticeRingVisibility(true);
|
|
681
|
+
}
|
|
676
682
|
}
|
|
677
683
|
else {
|
|
678
|
-
if (
|
|
679
|
-
|
|
684
|
+
if (_transformComponent) {
|
|
685
|
+
_transformComponent.inputs.size = 1;
|
|
686
|
+
}
|
|
687
|
+
//Feature specific code
|
|
688
|
+
if (isToolbarFeatureEnabled('roomCreation')) {
|
|
689
|
+
if (_verticeComponentsCollection && _verticeComponentsCollection.length > 0) {
|
|
690
|
+
toggleVerticeRingVisibility();
|
|
691
|
+
}
|
|
680
692
|
}
|
|
681
693
|
}
|
|
682
694
|
});
|
|
@@ -1620,13 +1632,13 @@ function getIframeSrc(config, url) {
|
|
|
1620
1632
|
src += `architwin/bundle/showcase.html?m=${modelId}&applicationKey=${_appKey}&newtags=1`;
|
|
1621
1633
|
}
|
|
1622
1634
|
}
|
|
1623
|
-
log.info('__src', src);
|
|
1624
1635
|
for (let param of urlParams) {
|
|
1625
|
-
if (param
|
|
1636
|
+
if (config[param] != undefined) {
|
|
1626
1637
|
// @ts-ignore
|
|
1627
1638
|
src += `&${param}=${config[param]}`;
|
|
1628
1639
|
}
|
|
1629
1640
|
}
|
|
1641
|
+
log.info('__src', src);
|
|
1630
1642
|
return src;
|
|
1631
1643
|
}
|
|
1632
1644
|
// login user to fix cors error
|
|
@@ -2143,6 +2155,12 @@ function setTransformControls(selectedObject, mode = "translate" /* TRANSFORM_TY
|
|
|
2143
2155
|
userNavigationEnabled: true,
|
|
2144
2156
|
});
|
|
2145
2157
|
_transformComponent = transformComponent;
|
|
2158
|
+
if (_currentViewMode && _currentViewMode == "mode.floorplan") {
|
|
2159
|
+
_transformComponent.inputs.size = 0.01;
|
|
2160
|
+
}
|
|
2161
|
+
else {
|
|
2162
|
+
_transformComponent.inputs.size = 1;
|
|
2163
|
+
}
|
|
2146
2164
|
//_inputControlComponent = inputComponent.spyOnEvent(new DragSpy(selectedObject.object,selectedObject.node,selectedObject.component))
|
|
2147
2165
|
if (selectedObject.object.object_data.object_type == 'GLB') {
|
|
2148
2166
|
const eventPath = _sceneObject.addEmitPath(selectedObject.component, 'gltfevents');
|
|
@@ -5039,7 +5057,7 @@ function goToPosition(pos) {
|
|
|
5039
5057
|
}).then((newSid) => {
|
|
5040
5058
|
log.info("tags list", _tags);
|
|
5041
5059
|
log.info("tag new SID", newSid);
|
|
5042
|
-
_atwin.Mattertag.navigateToTag(newSid[0], _atwin.Mattertag.Transition.
|
|
5060
|
+
_atwin.Mattertag.navigateToTag(newSid[0], _atwin.Mattertag.Transition.INSTANT).then(() => __awaiter(this, void 0, void 0, function* () {
|
|
5043
5061
|
yield _atwin.Tag.remove(newSid[0]);
|
|
5044
5062
|
yield _atwin.Camera.rotate(-10, 10);
|
|
5045
5063
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IShowcaseObject } from "../../../types";
|
|
1
|
+
import { IShowcaseObject, UNITS } from "../../../types";
|
|
2
2
|
import { Vector3 } from "../../../../bundle/sdk";
|
|
3
3
|
export declare let isAdjust: boolean;
|
|
4
4
|
export declare function renderActionSettingsPane(): HTMLDivElement;
|
|
@@ -12,18 +12,18 @@ export declare function getCoordinateSystem(): string;
|
|
|
12
12
|
export declare function setCoordinateSystem(value: string): void;
|
|
13
13
|
export declare function getScaleFactor(): string;
|
|
14
14
|
export declare function setScaleFactor(value: string): void;
|
|
15
|
-
export declare function getMeasurementUnit():
|
|
16
|
-
export declare function setMeasurementUnit(value:
|
|
17
|
-
export declare function getRotationUnit():
|
|
18
|
-
export declare function setRotationUnit(value:
|
|
15
|
+
export declare function getMeasurementUnit(): UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH;
|
|
16
|
+
export declare function setMeasurementUnit(value: UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH): void;
|
|
17
|
+
export declare function getRotationUnit(): UNITS.DEGREE | UNITS.RADIAN;
|
|
18
|
+
export declare function setRotationUnit(value: UNITS.DEGREE | UNITS.RADIAN): void;
|
|
19
19
|
export declare function setTempCoordinateSystem(value: string): void;
|
|
20
20
|
export declare function getTempCoordinateSystem(): string;
|
|
21
21
|
export declare function setTempScaleFactor(value: string): void;
|
|
22
22
|
export declare function getTempScaleFactor(): string;
|
|
23
|
-
export declare function setTempMeasurementUnit(value:
|
|
24
|
-
export declare function getTempMeasurementUnit():
|
|
25
|
-
export declare function setTempRotationUnit(value:
|
|
26
|
-
export declare function getTempRotationUnit():
|
|
23
|
+
export declare function setTempMeasurementUnit(value: UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH): void;
|
|
24
|
+
export declare function getTempMeasurementUnit(): UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH;
|
|
25
|
+
export declare function setTempRotationUnit(value: UNITS.DEGREE | UNITS.RADIAN): void;
|
|
26
|
+
export declare function getTempRotationUnit(): UNITS.DEGREE | UNITS.RADIAN;
|
|
27
27
|
export declare function setBasepoint(value: Vector3): void;
|
|
28
28
|
export declare function getBasepoint(): Vector3;
|
|
29
29
|
export declare function getMPBasepoint(): Vector3;
|
|
@@ -16,12 +16,12 @@ import { toggleBasepointCalibratePane } from "./basepointCalibratePane";
|
|
|
16
16
|
let actionSettingsPane;
|
|
17
17
|
let coordinateSystem = COORDINATE_SYSTEM.MATTERPORT;
|
|
18
18
|
let scaleFactor = "1";
|
|
19
|
-
let measurementUnit =
|
|
20
|
-
let rotationUnit =
|
|
19
|
+
let measurementUnit = UNITS.METER;
|
|
20
|
+
let rotationUnit = UNITS.DEGREE;
|
|
21
21
|
let tempCoordinateSystem = COORDINATE_SYSTEM.MATTERPORT;
|
|
22
22
|
let tempScaleFactor = "1";
|
|
23
|
-
let tempMeasurementUnit =
|
|
24
|
-
let tempRotationUnit =
|
|
23
|
+
let tempMeasurementUnit = UNITS.METER;
|
|
24
|
+
let tempRotationUnit = UNITS.DEGREE;
|
|
25
25
|
let tempBasepoint = undefined;
|
|
26
26
|
let basepoint = undefined;
|
|
27
27
|
let basepointObjectPayload = undefined;
|
|
@@ -56,11 +56,13 @@ export function renderActionSettingsPane() {
|
|
|
56
56
|
<label class="at_text_xs">${i18n.t("MeasurementUnit")}</label>
|
|
57
57
|
<div id="" data-cy="">
|
|
58
58
|
<div class="at_dropdown at_flex at_flex_row at_space_between" id="at-selected-measurement-unit">
|
|
59
|
-
<div class="at_dropdown_toggle
|
|
59
|
+
<div class="at_dropdown_toggle" id="at-selected-measurement-unit-text">${i18n.t('Meter')}</div>
|
|
60
60
|
<span class="mdi mdi-triangle-down at_chevron"></span>
|
|
61
61
|
</div>
|
|
62
62
|
<div class="at_options_container">
|
|
63
63
|
<div class="at_dropdown_options" id="at-measurement-unit-options" data-cy="at-measurement-unit-options">
|
|
64
|
+
<div class="at_option" data-value="${UNITS.MILLIMETER}">${i18n.t("Millimeter")}</div>
|
|
65
|
+
<div class="at_option" data-value="${UNITS.CENTIMETER}">${i18n.t("Centimeter")}</div>
|
|
64
66
|
<div class="at_option" data-value="${UNITS.METER}">${i18n.t("Meter")}</div>
|
|
65
67
|
<div class="at_option" data-value="${UNITS.FOOT}">${i18n.t("Foot")}</div>
|
|
66
68
|
<div class="at_option" data-value="${UNITS.INCH}">${i18n.t("Inch")}</div>
|
|
@@ -73,7 +75,7 @@ export function renderActionSettingsPane() {
|
|
|
73
75
|
<label class="at_text_xs">${i18n.t("RotationUnit")}</label>
|
|
74
76
|
<div id="" data-cy="">
|
|
75
77
|
<div class="at_dropdown at_flex at_flex_row at_space_between" id="at-selected-rotation-unit">
|
|
76
|
-
<div class="at_dropdown_toggle
|
|
78
|
+
<div class="at_dropdown_toggle" id="at-selected-rotation-unit-text">${i18n.t('Degree')}</div>
|
|
77
79
|
<span class="mdi mdi-triangle-down at_chevron"></span>
|
|
78
80
|
</div>
|
|
79
81
|
<div class="at_options_container">
|
|
@@ -137,24 +139,26 @@ export function actionSettingsSelectOption(element, id) {
|
|
|
137
139
|
let mpXInputValue;
|
|
138
140
|
let mpYInputValue;
|
|
139
141
|
let mpZInputValue;
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
if (id == 'measurement-unit') {
|
|
143
|
+
if (tempMeasurementUnit != UNITS.METER) {
|
|
144
|
+
mpXInputValue = convertMeasurement(basepointObjectPayload.object_position.x, UNITS.METER, tempMeasurementUnit);
|
|
145
|
+
mpYInputValue = convertMeasurement(basepointObjectPayload.object_position.y, UNITS.METER, tempMeasurementUnit);
|
|
146
|
+
mpZInputValue = convertMeasurement(basepointObjectPayload.object_position.z, UNITS.METER, tempMeasurementUnit);
|
|
147
|
+
const truncatedCoordinate = {
|
|
148
|
+
x: truncateToThreeDecimals(mpXInputValue),
|
|
149
|
+
y: truncateToThreeDecimals(mpYInputValue),
|
|
150
|
+
z: truncateToThreeDecimals(mpZInputValue),
|
|
151
|
+
};
|
|
152
|
+
displayConvertedCoordinates(truncatedCoordinate);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const truncatedCoordinate = {
|
|
156
|
+
x: truncateToThreeDecimals(basepointObjectPayload.object_position.x),
|
|
157
|
+
y: truncateToThreeDecimals(basepointObjectPayload.object_position.y),
|
|
158
|
+
z: truncateToThreeDecimals(basepointObjectPayload.object_position.z),
|
|
159
|
+
};
|
|
160
|
+
displayConvertedCoordinates(truncatedCoordinate);
|
|
161
|
+
}
|
|
158
162
|
}
|
|
159
163
|
// start of initializing units
|
|
160
164
|
document.querySelectorAll('.at_action_settings_pane_unit').forEach(el => {
|
|
@@ -194,16 +198,23 @@ export function initSettingsValues() {
|
|
|
194
198
|
else if (measurementUnit == UNITS.INCH) {
|
|
195
199
|
measurementUnitValue = `${i18n.t('Inch')}`;
|
|
196
200
|
}
|
|
201
|
+
else if (measurementUnit == UNITS.MILLIMETER) {
|
|
202
|
+
measurementUnitValue = `${i18n.t('Millimeter')}`;
|
|
203
|
+
}
|
|
204
|
+
else if (measurementUnit == UNITS.CENTIMETER) {
|
|
205
|
+
measurementUnitValue = `${i18n.t('Centimeter')}`;
|
|
206
|
+
}
|
|
197
207
|
measurementUnitElement.innerText = i18n.t(measurementUnitValue);
|
|
198
208
|
// set rotation unit
|
|
199
209
|
const rotationUnitElement = document.getElementById(`at-selected-rotation-unit-text`);
|
|
200
210
|
let rotationUnitValue = `${i18n.t('Degree')}`;
|
|
201
211
|
// do not erase
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
212
|
+
if (rotationUnit == UNITS.RADIAN) {
|
|
213
|
+
rotationUnitValue = `${i18n.t('Radian')}`;
|
|
214
|
+
}
|
|
215
|
+
else if (rotationUnit == UNITS.DEGREE) {
|
|
216
|
+
rotationUnitValue = `${i18n.t('Degree')}`;
|
|
217
|
+
}
|
|
207
218
|
rotationUnitElement.innerText = i18n.t(rotationUnitValue);
|
|
208
219
|
// set basepoint calibration
|
|
209
220
|
const element = document.getElementById(`at-calibrate-basepoint-btn`);
|
|
@@ -583,19 +594,19 @@ export function getMeasurementUnit() {
|
|
|
583
594
|
return measurementUnit;
|
|
584
595
|
}
|
|
585
596
|
export function setMeasurementUnit(value) {
|
|
586
|
-
if (value ==
|
|
597
|
+
if (value == UNITS.METER) {
|
|
587
598
|
measurementUnit = UNITS.METER;
|
|
588
599
|
}
|
|
589
|
-
else if (value ==
|
|
600
|
+
else if (value == UNITS.MILLIMETER) {
|
|
590
601
|
measurementUnit = UNITS.MILLIMETER;
|
|
591
602
|
}
|
|
592
|
-
else if (value ==
|
|
603
|
+
else if (value == UNITS.CENTIMETER) {
|
|
593
604
|
measurementUnit = UNITS.CENTIMETER;
|
|
594
605
|
}
|
|
595
|
-
else if (value ==
|
|
606
|
+
else if (value == UNITS.FOOT) {
|
|
596
607
|
measurementUnit = UNITS.FOOT;
|
|
597
608
|
}
|
|
598
|
-
else if (value ==
|
|
609
|
+
else if (value == UNITS.INCH) {
|
|
599
610
|
measurementUnit = UNITS.INCH;
|
|
600
611
|
}
|
|
601
612
|
console.log("Measurement Unit set to:", value);
|
|
@@ -620,19 +631,19 @@ export function getTempScaleFactor() {
|
|
|
620
631
|
return tempScaleFactor;
|
|
621
632
|
}
|
|
622
633
|
export function setTempMeasurementUnit(value) {
|
|
623
|
-
if (value ==
|
|
634
|
+
if (value == UNITS.METER) {
|
|
624
635
|
tempMeasurementUnit = UNITS.METER;
|
|
625
636
|
}
|
|
626
|
-
else if (value ==
|
|
637
|
+
else if (value == UNITS.MILLIMETER) {
|
|
627
638
|
tempMeasurementUnit = UNITS.MILLIMETER;
|
|
628
639
|
}
|
|
629
|
-
else if (value ==
|
|
640
|
+
else if (value == UNITS.CENTIMETER) {
|
|
630
641
|
tempMeasurementUnit = UNITS.CENTIMETER;
|
|
631
642
|
}
|
|
632
|
-
else if (value ==
|
|
643
|
+
else if (value == UNITS.FOOT) {
|
|
633
644
|
tempMeasurementUnit = UNITS.FOOT;
|
|
634
645
|
}
|
|
635
|
-
else if (value ==
|
|
646
|
+
else if (value == UNITS.INCH) {
|
|
636
647
|
tempMeasurementUnit = UNITS.INCH;
|
|
637
648
|
}
|
|
638
649
|
console.log("Temp Measurement Unit set to:", value);
|
|
@@ -7,7 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { UNITS } from "../../../types";
|
|
11
|
+
import { goToModel, setSelectedObject, get3DXObjects, getLibrary, getTargetPosition, addObjectToSpace, _mpConfig, dispatchSpaceEvent, removeTransformControls, _onMouseClickInstance, cancelModelPlacement, isToolbarFeatureEnabled, convertYupToZup, getViewMode } from "../../../architwin";
|
|
11
12
|
import { SPACE_EVENTS } from "../../../types";
|
|
12
13
|
import { toggleDisplayPane, cancelModelPlacementPrompt } from "../../events";
|
|
13
14
|
import { clearActiveActionBtn } from "./actionBar";
|
|
@@ -149,7 +150,10 @@ export function setActiveCard(cardId) {
|
|
|
149
150
|
console.error("Could not find target object", objId);
|
|
150
151
|
}
|
|
151
152
|
// await goTo3dx(Number.parseInt(objId))
|
|
152
|
-
|
|
153
|
+
const viewMode = getViewMode();
|
|
154
|
+
if (viewMode && viewMode != "mode.floorplan") {
|
|
155
|
+
yield goToModel(Number.parseInt(objId));
|
|
156
|
+
}
|
|
153
157
|
const parent = target.parentElement;
|
|
154
158
|
activeCard = parent;
|
|
155
159
|
parent.classList.add('at_card_active');
|
|
@@ -256,7 +260,7 @@ export function setActiveLibraryCard(cardId) {
|
|
|
256
260
|
payload.coordinate_system = getCoordinateSystem();
|
|
257
261
|
const thisObjBimPosition = convertYupToZup(payload.object_position, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor()));
|
|
258
262
|
console.log("====== caroline thisObjBimPosition: ", thisObjBimPosition);
|
|
259
|
-
const thisObjBimScale = convertYupScaleToZupScale(payload.object_scale,
|
|
263
|
+
const thisObjBimScale = convertYupScaleToZupScale(payload.object_scale, UNITS.METER, parseInt(getScaleFactor()));
|
|
260
264
|
console.log("====== caroline thisObjBimScale: ", thisObjBimScale);
|
|
261
265
|
const coordPayload = {
|
|
262
266
|
coord_system: getCoordinateSystem(),
|
|
@@ -161,6 +161,8 @@ i18n
|
|
|
161
161
|
"PhysicalBasePointNote": "You should have already set the project's base point in your physical space, which is typically a fixed location like a specific corner or marked spot.",
|
|
162
162
|
"BasepointNote": "Note: You can modify the MP value manually to achieve precise positioning.",
|
|
163
163
|
"Default": "Default",
|
|
164
|
+
"Millimeter": "Millimeter",
|
|
165
|
+
"Centimeter": "Centimeter",
|
|
164
166
|
}
|
|
165
167
|
},
|
|
166
168
|
ja: {
|
|
@@ -226,7 +228,7 @@ i18n
|
|
|
226
228
|
"Meeting": "打ち合わせ",
|
|
227
229
|
"Screenshot": "スクリーンショット",
|
|
228
230
|
"Close": "閉じる",
|
|
229
|
-
"Translate": "
|
|
231
|
+
"Translate": "移動",
|
|
230
232
|
"Rotate": "回転",
|
|
231
233
|
"Scale": "拡大",
|
|
232
234
|
"Copy": "複写",
|
|
@@ -316,6 +318,8 @@ i18n
|
|
|
316
318
|
"PhysicalBasePointNote": "MPに配置された基準点にBIM上でのXYZを入力することでBIMのXYZ値を入力によりMPのXYZに変換することができます。",
|
|
317
319
|
"BasepointNote": "※MPの位置は数値入力で微調整が可能です。",
|
|
318
320
|
"Default": "デフォルト",
|
|
321
|
+
"Millimeter": "ミリメートル",
|
|
322
|
+
"Centimeter": "センチメートル",
|
|
319
323
|
}
|
|
320
324
|
}
|
|
321
325
|
},
|
|
@@ -3,6 +3,8 @@ import log from 'loglevel';
|
|
|
3
3
|
import i18n from "./i18n";
|
|
4
4
|
import { toggleActionBar } from "../../events";
|
|
5
5
|
import { getAssetUrl } from "../../../utils";
|
|
6
|
+
import { toggleBasepointCalibratePane } from "./basepointCalibratePane";
|
|
7
|
+
import { toggleModelControl } from "./modelControlsPane";
|
|
6
8
|
export let activeMenu;
|
|
7
9
|
export let isObjectListEnabled = true;
|
|
8
10
|
export let isMeetingEnabled = false;
|
|
@@ -116,6 +118,8 @@ export function setActiveMenu(id) {
|
|
|
116
118
|
parent.classList.remove('at_sidebar_button_icon_active');
|
|
117
119
|
// Close action bar
|
|
118
120
|
toggleActionBar('hide');
|
|
121
|
+
toggleModelControl(false);
|
|
122
|
+
toggleBasepointCalibratePane(false);
|
|
119
123
|
}
|
|
120
124
|
else {
|
|
121
125
|
// activate
|
|
@@ -24,7 +24,7 @@ export declare function getTransformValues(): {
|
|
|
24
24
|
z: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
export declare function showCurrentCoordinateValue(payload?: IShowcaseObject
|
|
27
|
+
export declare function showCurrentCoordinateValue(payload?: IShowcaseObject): void;
|
|
28
28
|
/**
|
|
29
29
|
* This function gets the rotate XYZ values from the input field of the rotate screen.
|
|
30
30
|
* @returns {Vector3} rotate values
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { degreesToRadians, radiansToDegrees, useCapitalizeFirstLetter } from "../../../utils";
|
|
1
|
+
import { convertMeasurement, degreesToRadians, radiansToDegrees, useCapitalizeFirstLetter } from "../../../utils";
|
|
2
2
|
import { getSelectedObject, setObjectTransformation, get3DXObjects, _3DXObjects, isToolbarFeatureEnabled } from "../../../architwin";
|
|
3
|
-
import { COORDINATE_SYSTEM } from "../../../types";
|
|
3
|
+
import { COORDINATE_SYSTEM, UNITS } from "../../../types";
|
|
4
4
|
import { convertZupToYup, convertYupToZup, getOffsetPositionFromBasepoint, convertYupScaleToZupScale, convertZupScaleToYupScale } from "../../../worldConversion";
|
|
5
|
-
import { getScaleFactor, getMeasurementUnit, getBasepoint, getCoordinateSystem, isAdjust, getMPBasepoint } from "./actionSettingsPane";
|
|
5
|
+
import { getScaleFactor, getMeasurementUnit, getBasepoint, getCoordinateSystem, isAdjust, getMPBasepoint, getRotationUnit } from "./actionSettingsPane";
|
|
6
6
|
import { Notyf } from 'notyf';
|
|
7
7
|
import log from 'loglevel';
|
|
8
8
|
import i18n from "./i18n";
|
|
9
|
-
import { getBasepointObjectPayload } from "./actionSettingsPane";
|
|
10
9
|
let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500 });
|
|
11
10
|
export let activeModelControlPane = false;
|
|
12
11
|
export let modelControlPane;
|
|
@@ -43,7 +42,8 @@ const transformValues = {
|
|
|
43
42
|
let isInputEventListenerSet = false;
|
|
44
43
|
let basepointCoord;
|
|
45
44
|
let coordSystem = '';
|
|
46
|
-
let measurementUnit =
|
|
45
|
+
let measurementUnit = UNITS.METER;
|
|
46
|
+
let rotationUnit = UNITS.DEGREE;
|
|
47
47
|
let scaleFactor = '';
|
|
48
48
|
let selectedObjectCoordinateSystem;
|
|
49
49
|
let basepointObject;
|
|
@@ -64,7 +64,6 @@ export function renderModelControlPane(type = 'Translate') {
|
|
|
64
64
|
<span class="at_bolder at_text_base" id="at-transform-type-title">${i18n.t(type)}</span>
|
|
65
65
|
<span class="mdi mdi-close at_text_base" style="cursor:pointer" id="at-close-model-controls" data-cy="at-close-model-controls"></span>
|
|
66
66
|
</div>
|
|
67
|
-
<span style="display:${isToolbarFeatureEnabled('bim') ? 'block' : 'none'}" id="at-coordinate-system-text" class="at_text_xs">${i18n.t("CoordinateSystem")}: ${i18n.t("Matterport")}</span>
|
|
68
67
|
<div style="display:${isToolbarFeatureEnabled('bim') ? 'block' : 'none'}" class="at_flex at_flex_column at_gap_2" id="at-coordinate-container">
|
|
69
68
|
<label class="at_text_xs">${i18n.t("CoordinateSystem")}</label>
|
|
70
69
|
<div class="at_flex at_justify_center at_gap_4">
|
|
@@ -119,9 +118,12 @@ export function toggleModelControl(visible = true, type = 'translate') {
|
|
|
119
118
|
}
|
|
120
119
|
if (visible) {
|
|
121
120
|
modelControlPane.style.display = 'block';
|
|
121
|
+
if (isToolbarFeatureEnabled('bim')) {
|
|
122
|
+
getBimDefaultSettings();
|
|
123
|
+
setCoordinateSystemType();
|
|
124
|
+
}
|
|
122
125
|
setTransformType(type);
|
|
123
126
|
showCurrentCoordinateValue();
|
|
124
|
-
setCoordinateSystemType();
|
|
125
127
|
initCurrentTransformationValue();
|
|
126
128
|
if (isToolbarFeatureEnabled('bim')) {
|
|
127
129
|
if (type == 'rotate') {
|
|
@@ -135,7 +137,17 @@ export function toggleModelControl(visible = true, type = 'translate') {
|
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
modelControlPane.style.display = 'none';
|
|
138
|
-
|
|
140
|
+
if (currentPositionValues && currentRotationValues && currentScaleValues) {
|
|
141
|
+
const selectedObject = getSelectedObject();
|
|
142
|
+
const transform = {
|
|
143
|
+
object_position: currentPositionValues,
|
|
144
|
+
object_rotation: currentRotationValues,
|
|
145
|
+
object_scale: currentScaleValues
|
|
146
|
+
};
|
|
147
|
+
console.log('transform', transform);
|
|
148
|
+
setObjectTransformation(selectedObject.node, transform);
|
|
149
|
+
clearCurrentTransformationValues();
|
|
150
|
+
}
|
|
139
151
|
return;
|
|
140
152
|
}
|
|
141
153
|
function showCoordinatesUI(visible = true) {
|
|
@@ -194,60 +206,90 @@ export function getCoordinateValues() {
|
|
|
194
206
|
if (!inputZ) {
|
|
195
207
|
inputZ = document.getElementById('at-input-z');
|
|
196
208
|
}
|
|
209
|
+
const selectedObject = getSelectedObject();
|
|
210
|
+
let formCoords;
|
|
211
|
+
formCoords = {
|
|
212
|
+
x: parseFloat(inputX.value),
|
|
213
|
+
y: parseFloat(inputY.value),
|
|
214
|
+
z: parseFloat(inputZ.value)
|
|
215
|
+
};
|
|
216
|
+
log.info("___caroline formcoords xyz: ", formCoords);
|
|
217
|
+
let mpPosition;
|
|
218
|
+
let mpRotation;
|
|
219
|
+
let mpScale;
|
|
197
220
|
if (isToolbarFeatureEnabled('bim')) {
|
|
198
|
-
|
|
199
|
-
let formCoords;
|
|
200
|
-
const basePointObj = _3DXObjects.find(obj => obj.type == 'BASEPOINT');
|
|
201
|
-
formCoords = {
|
|
202
|
-
x: parseFloat(inputX.value),
|
|
203
|
-
y: parseFloat(inputY.value),
|
|
204
|
-
z: parseFloat(inputZ.value)
|
|
205
|
-
};
|
|
206
|
-
log.info("___caroline formcoords xyz: ", formCoords);
|
|
207
|
-
let mpPosition;
|
|
208
|
-
let mpScale;
|
|
209
|
-
if (isToolbarFeatureEnabled('bim') && selectedObjectCoordinateSystem == COORDINATE_SYSTEM.BIM) {
|
|
221
|
+
if (selectedObjectCoordinateSystem == COORDINATE_SYSTEM.BIM) {
|
|
210
222
|
setConvertedBimPosition(formCoords);
|
|
211
223
|
if (transformType == 'translate') {
|
|
212
|
-
mpPosition = convertZupToYup(formCoords, getMPBasepoint(), getBasepoint(),
|
|
224
|
+
mpPosition = convertZupToYup(formCoords, getMPBasepoint(), getBasepoint(), measurementUnit, parseInt(getScaleFactor()));
|
|
225
|
+
}
|
|
226
|
+
else if (transformType == 'rotate') {
|
|
227
|
+
if (rotationUnit == UNITS.RADIAN) {
|
|
228
|
+
mpRotation = formCoords;
|
|
229
|
+
}
|
|
230
|
+
else if (rotationUnit == UNITS.DEGREE) {
|
|
231
|
+
mpRotation = degreesToRadians(formCoords);
|
|
232
|
+
}
|
|
213
233
|
}
|
|
214
234
|
else if (transformType == 'scale') {
|
|
215
|
-
mpScale = convertZupScaleToYupScale(formCoords,
|
|
235
|
+
mpScale = convertZupScaleToYupScale(formCoords, UNITS.METER, parseInt(getScaleFactor()));
|
|
216
236
|
}
|
|
217
237
|
}
|
|
218
|
-
else {
|
|
238
|
+
else if (selectedObjectCoordinateSystem == COORDINATE_SYSTEM.MATTERPORT) {
|
|
239
|
+
if (measurementUnit != UNITS.METER && transformType == 'translate') {
|
|
240
|
+
formCoords.x = convertMeasurement(formCoords.x, measurementUnit, UNITS.METER);
|
|
241
|
+
formCoords.y = convertMeasurement(formCoords.y, measurementUnit, UNITS.METER);
|
|
242
|
+
formCoords.z = convertMeasurement(formCoords.z, measurementUnit, UNITS.METER);
|
|
243
|
+
}
|
|
219
244
|
mpPosition = formCoords;
|
|
245
|
+
if (rotationUnit == UNITS.RADIAN) {
|
|
246
|
+
mpRotation = formCoords;
|
|
247
|
+
}
|
|
248
|
+
else if (rotationUnit == UNITS.DEGREE) {
|
|
249
|
+
mpRotation = degreesToRadians(formCoords);
|
|
250
|
+
}
|
|
220
251
|
mpScale = formCoords;
|
|
221
252
|
if (isToolbarFeatureEnabled('bim')) {
|
|
222
253
|
setConvertedBimPosition(convertYupToZup(mpPosition, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor())));
|
|
223
254
|
}
|
|
224
255
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
mpPosition = formCoords;
|
|
259
|
+
if (rotationUnit == UNITS.RADIAN) {
|
|
260
|
+
mpRotation = formCoords;
|
|
230
261
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (selectedObject && selectedObject.type == "BASEPOINT") {
|
|
234
|
-
newRotationValue = { x: Math.PI / 2, y: 0, z: 0 };
|
|
262
|
+
else if (rotationUnit == UNITS.DEGREE) {
|
|
263
|
+
mpRotation = degreesToRadians(formCoords);
|
|
235
264
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
newRotationValue = transformType === 'rotate' ? degreesToRadians(formCoords) : selectedObject.node.quaternion;
|
|
242
|
-
}
|
|
265
|
+
mpScale = formCoords;
|
|
266
|
+
if (isToolbarFeatureEnabled('bim')) {
|
|
267
|
+
setConvertedBimPosition(convertYupToZup(mpPosition, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor())));
|
|
243
268
|
}
|
|
244
|
-
log.info("degreeToRadianRotation ", newRotationValue);
|
|
245
|
-
transform.object_position = transformType === 'translate' ? mpPosition : selectedObject.node.position;
|
|
246
|
-
transform.object_scale = transformType === 'scale' ? mpScale : selectedObject.node.scale;
|
|
247
|
-
transform.object_rotation = newRotationValue;
|
|
248
|
-
console.log("getCoordinateValues rotation quaternion values", selectedObject.node.quaternion);
|
|
249
|
-
return transform;
|
|
250
269
|
}
|
|
270
|
+
console.log("getCoordinateValues parsed values", formCoords);
|
|
271
|
+
if (formCoords.x === undefined || formCoords.y === undefined || formCoords.z === undefined) {
|
|
272
|
+
console.error("One of the coordinates in the form is undefined ", formCoords);
|
|
273
|
+
notyf.error("One of the coordinates in the form is undefined");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const transform = {};
|
|
277
|
+
// let newRotationValue: Vector3
|
|
278
|
+
// if(selectedObject && selectedObject.type == "BASEPOINT"){
|
|
279
|
+
// newRotationValue = { x: Math.PI/2, y: 0, z: 0 }
|
|
280
|
+
// } else {
|
|
281
|
+
// if (isToolbarFeatureEnabled('bim')) {
|
|
282
|
+
// newRotationValue =
|
|
283
|
+
// } else {
|
|
284
|
+
// newRotationValue = transformType === 'rotate' ? degreesToRadians(formCoords) : selectedObject.node.quaternion
|
|
285
|
+
// }
|
|
286
|
+
// }
|
|
287
|
+
// log.info("degreeToRadianRotation ", newRotationValue)
|
|
288
|
+
transform.object_position = transformType === 'translate' ? mpPosition : selectedObject.node.position;
|
|
289
|
+
transform.object_scale = transformType === 'scale' ? mpScale : selectedObject.node.scale;
|
|
290
|
+
transform.object_rotation = transformType === 'rotate' ? mpRotation : selectedObject.object.object_rotation;
|
|
291
|
+
console.log("getCoordinateValues rotation quaternion values", selectedObject.node.quaternion);
|
|
292
|
+
return transform;
|
|
251
293
|
}
|
|
252
294
|
export function clearCoordinateInputs() {
|
|
253
295
|
console.log("clearCoordinateInputs()");
|
|
@@ -307,8 +349,7 @@ export function clearCoordinateInputs() {
|
|
|
307
349
|
export function getTransformValues() {
|
|
308
350
|
return transformValues;
|
|
309
351
|
}
|
|
310
|
-
export function showCurrentCoordinateValue(payload
|
|
311
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
352
|
+
export function showCurrentCoordinateValue(payload) {
|
|
312
353
|
console.log("showCurrentCoordinateValue()");
|
|
313
354
|
if (!inputX) {
|
|
314
355
|
inputX = document.getElementById('at-input-x');
|
|
@@ -325,57 +366,38 @@ export function showCurrentCoordinateValue(payload, isFromApi = true) {
|
|
|
325
366
|
console.error("selectedObject is undefined");
|
|
326
367
|
return;
|
|
327
368
|
}
|
|
328
|
-
if (isToolbarFeatureEnabled('bim')) {
|
|
329
|
-
getCoordinateSetup();
|
|
330
|
-
initObjectCoordinateSystem();
|
|
331
|
-
}
|
|
332
369
|
if (transformType == 'translate') {
|
|
333
370
|
log.info("___caroline SHOW TRANSLATE");
|
|
334
371
|
const currentPos = selectedObject.node.position;
|
|
335
372
|
console.log("======translate: ", currentPos);
|
|
373
|
+
const convertedMpPosition = {
|
|
374
|
+
x: convertMeasurement(currentPos.x, UNITS.METER, measurementUnit),
|
|
375
|
+
y: convertMeasurement(currentPos.y, UNITS.METER, measurementUnit),
|
|
376
|
+
z: convertMeasurement(currentPos.z, UNITS.METER, measurementUnit)
|
|
377
|
+
};
|
|
336
378
|
if (isToolbarFeatureEnabled('bim')) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (thisCoordSystem == COORDINATE_SYSTEM.BIM) {
|
|
349
|
-
const thisBimPosition = (_d = (_c = parsedBimJson === null || parsedBimJson === void 0 ? void 0 : parsedBimJson["coordSystemCalibration"]) === null || _c === void 0 ? void 0 : _c.bim_coordinates) === null || _d === void 0 ? void 0 : _d.position;
|
|
350
|
-
console.log("caroline thisBimPosition", thisBimPosition);
|
|
351
|
-
inputX.value = thisBimPosition.x.toFixed(3).toString();
|
|
352
|
-
inputY.value = thisBimPosition.y.toFixed(3).toString();
|
|
353
|
-
inputZ.value = thisBimPosition.z.toFixed(3).toString();
|
|
354
|
-
}
|
|
355
|
-
else if (thisCoordSystem == COORDINATE_SYSTEM.MATTERPORT) {
|
|
356
|
-
console.log("caroline MP coords", currentPos);
|
|
357
|
-
inputX.value = currentPos.x.toFixed(3).toString();
|
|
358
|
-
inputY.value = currentPos.y.toFixed(3).toString();
|
|
359
|
-
inputZ.value = currentPos.z.toFixed(3).toString();
|
|
360
|
-
}
|
|
379
|
+
if (getSelectedObjectCoordinateSystem() == COORDINATE_SYSTEM.BIM) {
|
|
380
|
+
const bimPos = convertYupToZup(currentPos, getMPBasepoint(), getBasepoint(), UNITS.METER, parseInt(scaleFactor));
|
|
381
|
+
const convertBimPosition = {
|
|
382
|
+
x: convertMeasurement(bimPos.x, UNITS.METER, measurementUnit),
|
|
383
|
+
y: convertMeasurement(bimPos.y, UNITS.METER, measurementUnit),
|
|
384
|
+
z: convertMeasurement(bimPos.z, UNITS.METER, measurementUnit)
|
|
385
|
+
};
|
|
386
|
+
console.log("__@ caroline bimPos: ", bimPos);
|
|
387
|
+
inputX.value = convertBimPosition.x.toFixed(3).toString();
|
|
388
|
+
inputY.value = convertBimPosition.y.toFixed(3).toString();
|
|
389
|
+
inputZ.value = convertBimPosition.z.toFixed(3).toString();
|
|
361
390
|
}
|
|
362
391
|
else {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
console.log("__@ caroline mpPos: ", currentPos);
|
|
373
|
-
inputX.value = currentPos.x.toFixed(3).toString();
|
|
374
|
-
inputY.value = currentPos.y.toFixed(3).toString();
|
|
375
|
-
inputZ.value = currentPos.z.toFixed(3).toString();
|
|
376
|
-
}
|
|
392
|
+
console.log("__@ caroline mpPos: ", currentPos);
|
|
393
|
+
inputX.value = convertedMpPosition.x.toFixed(3).toString();
|
|
394
|
+
inputY.value = convertedMpPosition.y.toFixed(3).toString();
|
|
395
|
+
inputZ.value = convertedMpPosition.z.toFixed(3).toString();
|
|
396
|
+
// inputX.value = currentPos.x.toFixed(3).toString()
|
|
397
|
+
// inputY.value = currentPos.y.toFixed(3).toString()
|
|
398
|
+
// inputZ.value = currentPos.z.toFixed(3).toString()
|
|
377
399
|
}
|
|
378
|
-
displayMPPosCoordinates(
|
|
400
|
+
displayMPPosCoordinates(convertedMpPosition);
|
|
379
401
|
}
|
|
380
402
|
else {
|
|
381
403
|
console.log("__@ caroline mpPos: ", currentPos);
|
|
@@ -397,7 +419,13 @@ export function showCurrentCoordinateValue(payload, isFromApi = true) {
|
|
|
397
419
|
log.info("currentRotation quaternion", currentRotation);
|
|
398
420
|
//@ts-expect-error
|
|
399
421
|
log.info("currentRotation rotation", selectedObject.node.obj3D.rotation);
|
|
400
|
-
|
|
422
|
+
let rotationDegreeFormat;
|
|
423
|
+
if (rotationUnit == UNITS.DEGREE) {
|
|
424
|
+
rotationDegreeFormat = radiansToDegrees(currentRotation);
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
rotationDegreeFormat = currentRotation;
|
|
428
|
+
}
|
|
401
429
|
log.info("rotationDegreeFormat ", rotationDegreeFormat);
|
|
402
430
|
inputX.value = rotationDegreeFormat.x.toFixed(3).toString();
|
|
403
431
|
inputY.value = rotationDegreeFormat.y.toFixed(3).toString();
|
|
@@ -425,42 +453,18 @@ export function showCurrentCoordinateValue(payload, isFromApi = true) {
|
|
|
425
453
|
}
|
|
426
454
|
const currentScale = selectedObject.node.scale;
|
|
427
455
|
if (isToolbarFeatureEnabled('bim')) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
console.log("caroline thisCoordSystem: ", thisCoordSystem);
|
|
435
|
-
if (thisCoordSystem == COORDINATE_SYSTEM.BIM) {
|
|
436
|
-
const thisBimScale = (_h = (_g = parsedBimJson === null || parsedBimJson === void 0 ? void 0 : parsedBimJson["coordSystemCalibration"]) === null || _g === void 0 ? void 0 : _g.bim_coordinates) === null || _h === void 0 ? void 0 : _h.scale;
|
|
437
|
-
console.log("caroline thisBimScale", thisBimScale);
|
|
438
|
-
inputX.value = thisBimScale.x.toFixed(3).toString();
|
|
439
|
-
inputY.value = thisBimScale.y.toFixed(3).toString();
|
|
440
|
-
inputZ.value = thisBimScale.z.toFixed(3).toString();
|
|
441
|
-
}
|
|
442
|
-
else if (thisCoordSystem == COORDINATE_SYSTEM.MATTERPORT) {
|
|
443
|
-
console.log("caroline mPScale", currentScale);
|
|
444
|
-
inputX.value = currentScale.x.toFixed(3).toString();
|
|
445
|
-
inputY.value = currentScale.y.toFixed(3).toString();
|
|
446
|
-
inputZ.value = currentScale.z.toFixed(3).toString();
|
|
447
|
-
}
|
|
456
|
+
if (isToolbarFeatureEnabled('bim') && getSelectedObjectCoordinateSystem() == COORDINATE_SYSTEM.BIM) {
|
|
457
|
+
const bimScale = convertYupScaleToZupScale(currentScale, UNITS.METER, parseInt(scaleFactor));
|
|
458
|
+
console.log("__@ caroline bimScale: ", bimScale);
|
|
459
|
+
inputX.value = bimScale.x.toFixed(3).toString();
|
|
460
|
+
inputY.value = bimScale.y.toFixed(3).toString();
|
|
461
|
+
inputZ.value = bimScale.z.toFixed(3).toString();
|
|
448
462
|
}
|
|
449
463
|
else {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
inputX.value = bimScale.x.toFixed(3).toString();
|
|
455
|
-
inputY.value = bimScale.y.toFixed(3).toString();
|
|
456
|
-
inputZ.value = bimScale.z.toFixed(3).toString();
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
console.log("__@ caroline mpScale: ", currentScale);
|
|
460
|
-
inputX.value = currentScale.x.toFixed(3).toString();
|
|
461
|
-
inputY.value = currentScale.y.toFixed(3).toString();
|
|
462
|
-
inputZ.value = currentScale.z.toFixed(3).toString();
|
|
463
|
-
}
|
|
464
|
+
console.log("__@ caroline mpScale: ", currentScale);
|
|
465
|
+
inputX.value = currentScale.x.toFixed(3).toString();
|
|
466
|
+
inputY.value = currentScale.y.toFixed(3).toString();
|
|
467
|
+
inputZ.value = currentScale.z.toFixed(3).toString();
|
|
464
468
|
}
|
|
465
469
|
displayMPScaleCoordinates(currentScale);
|
|
466
470
|
}
|
|
@@ -559,10 +563,10 @@ function setModelInputUnit(type) {
|
|
|
559
563
|
if (elements && elements.length > 0) {
|
|
560
564
|
elements.forEach((element) => {
|
|
561
565
|
if (type === 'translate') {
|
|
562
|
-
element.textContent =
|
|
566
|
+
element.textContent = measurementUnit;
|
|
563
567
|
}
|
|
564
568
|
else if (type === 'rotate') {
|
|
565
|
-
element.textContent =
|
|
569
|
+
element.textContent = rotationUnit;
|
|
566
570
|
}
|
|
567
571
|
else if (type === 'scale') {
|
|
568
572
|
element.textContent = '%';
|
|
@@ -668,11 +672,11 @@ export function handleModelControlInputs() {
|
|
|
668
672
|
// inputY.addEventListener('input',onModelControlInput)
|
|
669
673
|
// inputZ.addEventListener('input', onModelControlInput)
|
|
670
674
|
if (isToolbarFeatureEnabled('bim')) {
|
|
671
|
-
displayConvertedObjectCoordinates()
|
|
675
|
+
// displayConvertedObjectCoordinates()
|
|
672
676
|
}
|
|
673
677
|
}
|
|
674
|
-
function
|
|
675
|
-
log.info("
|
|
678
|
+
function getBimDefaultSettings() {
|
|
679
|
+
log.info("getBimDefaultSettings()");
|
|
676
680
|
if (isToolbarFeatureEnabled('bim')) {
|
|
677
681
|
// gets basepoint value
|
|
678
682
|
if (getBasepoint()) {
|
|
@@ -689,6 +693,9 @@ function getCoordinateSetup() {
|
|
|
689
693
|
if (getMeasurementUnit()) {
|
|
690
694
|
measurementUnit = getMeasurementUnit();
|
|
691
695
|
}
|
|
696
|
+
if (getRotationUnit()) {
|
|
697
|
+
rotationUnit = getRotationUnit();
|
|
698
|
+
}
|
|
692
699
|
// get the scale factor
|
|
693
700
|
if (getScaleFactor()) {
|
|
694
701
|
scaleFactor = getScaleFactor();
|
|
@@ -716,7 +723,7 @@ export function updateSelectedObject() {
|
|
|
716
723
|
const mpBP = basePointObj.object.object_position;
|
|
717
724
|
console.log("__@@ Basepoints: bim, mp", bimBP, mpBP);
|
|
718
725
|
if (selectedObject.object.coordinate_system == COORDINATE_SYSTEM.BIM || basepointObject) {
|
|
719
|
-
convert = convertZupToYup(object, mpBP, bimBP,
|
|
726
|
+
convert = convertZupToYup(object, mpBP, bimBP, UNITS.METER, parseInt(rotationUnit));
|
|
720
727
|
}
|
|
721
728
|
// basepoint exists and is adjusting its coordinates
|
|
722
729
|
if (basepointObject && isAdjust == true) {
|
|
@@ -735,7 +742,7 @@ export function updateSelectedObject() {
|
|
|
735
742
|
console.log("__@@ Basepoints: bim, mp", bimBP, mpBP);
|
|
736
743
|
for (let i = 0; i < filteredObjects.length; i++) {
|
|
737
744
|
if (filteredObjects[i].object.coordinate_system == COORDINATE_SYSTEM.BIM) {
|
|
738
|
-
const convertedPosition = convertYupToZup(filteredObjects[i].object.object_position, mpBP, bimBP,
|
|
745
|
+
const convertedPosition = convertYupToZup(filteredObjects[i].object.object_position, mpBP, bimBP, measurementUnit, parseInt(scaleFactor));
|
|
739
746
|
const offsettedPosition = getOffsetPositionFromBasepoint(convertedPosition, basepointCoords.object_position);
|
|
740
747
|
setObjectTransformation(filteredObjects[i].node, {
|
|
741
748
|
object_position: offsettedPosition,
|
|
@@ -802,27 +809,19 @@ function initObjectCoordinateSystem() {
|
|
|
802
809
|
}
|
|
803
810
|
}
|
|
804
811
|
export function setCoordinateSystemType() {
|
|
812
|
+
var _a;
|
|
805
813
|
if (isToolbarFeatureEnabled('bim')) {
|
|
806
|
-
const
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
}
|
|
815
|
-
else if (basepointPayload.coordinate_system === COORDINATE_SYSTEM.BIM) {
|
|
816
|
-
coordinateText.innerText = `${i18n.t("CoordinateSystem")}: ${i18n.t('Bim')}`;
|
|
817
|
-
}
|
|
818
|
-
coordinateCont.style.display = 'none';
|
|
819
|
-
coordinateText.style.display = 'block';
|
|
820
|
-
mtStaticText.classList.add('hidden');
|
|
814
|
+
const selectedObject = getSelectedObject();
|
|
815
|
+
const bimJsondata = selectedObject.object.json_data;
|
|
816
|
+
let parsedBimJson;
|
|
817
|
+
parsedBimJson = bimJsondata ? JSON.parse(bimJsondata) : null;
|
|
818
|
+
// let coordClass
|
|
819
|
+
if (parsedBimJson) {
|
|
820
|
+
const thisCoordSystem = (_a = parsedBimJson === null || parsedBimJson === void 0 ? void 0 : parsedBimJson["coordSystemCalibration"]) === null || _a === void 0 ? void 0 : _a.coord_system;
|
|
821
|
+
setSelectedObjectCoordinateSystem(thisCoordSystem);
|
|
821
822
|
}
|
|
822
823
|
else {
|
|
823
|
-
|
|
824
|
-
// coordinateCont.style.display = 'block'
|
|
825
|
-
coordinateText.style.display = 'none';
|
|
824
|
+
setSelectedObjectCoordinateSystem(coordSystem);
|
|
826
825
|
}
|
|
827
826
|
}
|
|
828
827
|
}
|
|
@@ -853,7 +852,7 @@ export function displayConvertedObjectCoordinates() {
|
|
|
853
852
|
if (selectedObjectCoordinateSystem == COORDINATE_SYSTEM.BIM && basePointObj) {
|
|
854
853
|
if (transformType == 'translate') {
|
|
855
854
|
// Convert input position from MP to BIM
|
|
856
|
-
const bimPosition = convertYupToZup(inputPosition, getMPBasepoint(), getBasepoint(),
|
|
855
|
+
const bimPosition = convertYupToZup(inputPosition, getMPBasepoint(), getBasepoint(), measurementUnit, parseInt(scaleFactor));
|
|
857
856
|
inputX.value = Number(bimPosition.x).toFixed(3);
|
|
858
857
|
inputY.value = Number(bimPosition.y).toFixed(3);
|
|
859
858
|
inputZ.value = Number(bimPosition.z).toFixed(3);
|
|
@@ -861,7 +860,7 @@ export function displayConvertedObjectCoordinates() {
|
|
|
861
860
|
}
|
|
862
861
|
else if (transformType == 'scale') {
|
|
863
862
|
// Convert input position from MP to BIM
|
|
864
|
-
const bimScale = convertYupScaleToZupScale(inputScale,
|
|
863
|
+
const bimScale = convertYupScaleToZupScale(inputScale, UNITS.METER, parseInt(scaleFactor));
|
|
865
864
|
inputX.value = Number(bimScale.x).toFixed(3);
|
|
866
865
|
inputY.value = Number(bimScale.y).toFixed(3);
|
|
867
866
|
inputZ.value = Number(bimScale.z).toFixed(3);
|
|
@@ -870,14 +869,14 @@ export function displayConvertedObjectCoordinates() {
|
|
|
870
869
|
}
|
|
871
870
|
else if (selectedObject && selectedObjectCoordinateSystem == COORDINATE_SYSTEM.MATTERPORT && basePointObj) {
|
|
872
871
|
if (transformType == 'translate') {
|
|
873
|
-
const mpPosition = convertZupToYup(inputPosition, getMPBasepoint(), getBasepoint(),
|
|
872
|
+
const mpPosition = convertZupToYup(inputPosition, getMPBasepoint(), getBasepoint(), UNITS.METER, parseInt(scaleFactor));
|
|
874
873
|
inputX.value = Number(mpPosition.x).toFixed(3);
|
|
875
874
|
inputY.value = Number(mpPosition.y).toFixed(3);
|
|
876
875
|
inputZ.value = Number(mpPosition.z).toFixed(3);
|
|
877
876
|
console.log("[MP SEL] POSITION inputPos, mp: ", inputPosition, mpPosition);
|
|
878
877
|
}
|
|
879
878
|
else if (transformType == 'scale') {
|
|
880
|
-
const mpScale = convertZupScaleToYupScale(inputScale,
|
|
879
|
+
const mpScale = convertZupScaleToYupScale(inputScale, UNITS.METER, parseInt(scaleFactor));
|
|
881
880
|
inputX.value = Number(mpScale.x).toFixed(3);
|
|
882
881
|
inputY.value = Number(mpScale.y).toFixed(3);
|
|
883
882
|
inputZ.value = Number(mpScale.z).toFixed(3);
|
|
@@ -925,9 +924,21 @@ function updateObjectViaInput() {
|
|
|
925
924
|
// }
|
|
926
925
|
if ((inputX && inputY && inputZ)) {
|
|
927
926
|
const transform = getCoordinateValues();
|
|
927
|
+
console.log("JAMES transform", transform);
|
|
928
928
|
const selectedObject = getSelectedObject();
|
|
929
929
|
setObjectTransformation(selectedObject.node, transform);
|
|
930
|
-
|
|
930
|
+
if (transformType == 'translate') {
|
|
931
|
+
let convertedPosition = transform.object_position;
|
|
932
|
+
if (measurementUnit != UNITS.METER) {
|
|
933
|
+
convertedPosition.x = convertMeasurement(transform.object_position.x, UNITS.METER, measurementUnit);
|
|
934
|
+
convertedPosition.y = convertMeasurement(transform.object_position.y, UNITS.METER, measurementUnit);
|
|
935
|
+
convertedPosition.z = convertMeasurement(transform.object_position.z, UNITS.METER, measurementUnit);
|
|
936
|
+
}
|
|
937
|
+
displayMPPosCoordinates(convertedPosition);
|
|
938
|
+
}
|
|
939
|
+
else if (transformType == 'scale') {
|
|
940
|
+
displayMPPosCoordinates(transform.object_scale);
|
|
941
|
+
}
|
|
931
942
|
}
|
|
932
943
|
}
|
|
933
944
|
export function setConvertedBimPosition(bimPos) {
|
|
@@ -72,30 +72,27 @@ export function renderObjectCards(cardList, objectComponents) {
|
|
|
72
72
|
//@ts-ignore
|
|
73
73
|
console.log('Event', event.target.id);
|
|
74
74
|
toggleActionBar('show');
|
|
75
|
+
toggleModelControl(false);
|
|
75
76
|
//@ts-ignore
|
|
76
77
|
yield setActiveCard(event.target.id);
|
|
77
|
-
toggleModelControl(false);
|
|
78
|
-
// clearCurrentTransformationValues()
|
|
79
78
|
}));
|
|
80
79
|
batchAddEventListenerByClassName('at_card-body', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
81
80
|
//@ts-ignore
|
|
82
81
|
console.log('Event', event.target.id);
|
|
83
82
|
toggleActionBar('show');
|
|
83
|
+
toggleModelControl(false);
|
|
84
84
|
//@ts-ignore
|
|
85
85
|
yield setActiveCard(event.target.id);
|
|
86
|
-
toggleModelControl(false);
|
|
87
|
-
// clearCurrentTransformationValues()
|
|
88
86
|
}));
|
|
89
87
|
batchAddEventListenerByClassName('at_card-footer', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
90
88
|
//@ts-ignore
|
|
91
89
|
console.log('Event', event.target.id);
|
|
92
90
|
toggleActionBar('show');
|
|
91
|
+
toggleModelControl(false);
|
|
93
92
|
if (event.target === event.currentTarget) {
|
|
94
93
|
//@ts-ignore
|
|
95
94
|
yield setActiveCard(event.target.id);
|
|
96
95
|
}
|
|
97
|
-
toggleModelControl(false);
|
|
98
|
-
// clearCurrentTransformationValues()
|
|
99
96
|
}));
|
|
100
97
|
batchAddEventListenerByClassName('at_model_visibility_btn', (event) => {
|
|
101
98
|
//@ts-ignore
|
package/lib/atwinui/events.js
CHANGED
|
@@ -16,7 +16,7 @@ import { initFormData } from "./components/toolbar/tagFormPane";
|
|
|
16
16
|
import { renderObjectList } from "./components/toolbar/objectListPane";
|
|
17
17
|
import { renderLibraryList } from "./components/toolbar/libraryPane";
|
|
18
18
|
import { renderObjectCard } from "./components/toolbar/card";
|
|
19
|
-
import { toggleModelControl, getCoordinateValues, showCurrentCoordinateValue, handleModelControlInputs, setSelectedObjectCoordinateSystem, getSelectedObjectCoordinateSystem, getCurrentTransformationValues, getTransformValues, clearCurrentTransformationValues } from "./components/toolbar/modelControlsPane";
|
|
19
|
+
import { toggleModelControl, getCoordinateValues, showCurrentCoordinateValue, handleModelControlInputs, setSelectedObjectCoordinateSystem, getSelectedObjectCoordinateSystem, getCurrentTransformationValues, setCurrentTransformationValues, getTransformValues, clearCurrentTransformationValues } from "./components/toolbar/modelControlsPane";
|
|
20
20
|
import { attachTagMedia, handleTagPlacerCreated, cancelMoveTag } from "../tag";
|
|
21
21
|
import i18n from './components/toolbar/i18n';
|
|
22
22
|
import { isValidUrl, debounce, isElementVisible, extractUUID } from "../utils";
|
|
@@ -25,8 +25,7 @@ import * as minimap from '../minimap';
|
|
|
25
25
|
import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
|
|
26
26
|
import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI } from "./components/toolbar/spacePartition/roomTreePane";
|
|
27
27
|
import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon } from "./components/toolbar/spacePartition/roomFormPane";
|
|
28
|
-
import { actionSettingsSelectOption, getTempCoordinateSystem, getTempMeasurementUnit, getTempRotationUnit, setCoordinateSystem, setMeasurementUnit, setRotationUnit, initSettingsValues, setTempCoordinateSystem, setTempMeasurementUnit, setTempRotationUnit, toggleCalibrateBasepoint, setScaleFactor, getTempScaleFactor, setTempScaleFactor, setBasepoint, getTempBasepoint, setTempBasepoint, getBasepoint, toggleActionSettings, getBasepointObjectPayload, displayConvertedCoordinates, getCoordinateSystem, getScaleFactor, getMeasurementUnit, getRotationUnit, setBasepointObjectPayload } from "./components/toolbar/actionSettingsPane";
|
|
29
|
-
import { displayConvertedObjectCoordinates } from './components/toolbar/modelControlsPane';
|
|
28
|
+
import { actionSettingsSelectOption, getTempCoordinateSystem, getTempMeasurementUnit, getTempRotationUnit, setCoordinateSystem, setMeasurementUnit, setRotationUnit, initSettingsValues, setTempCoordinateSystem, setTempMeasurementUnit, setTempRotationUnit, toggleActionSettingsDropdown, toggleCalibrateBasepoint, setScaleFactor, getTempScaleFactor, setTempScaleFactor, setBasepoint, getTempBasepoint, setTempBasepoint, getBasepoint, toggleActionSettings, getBasepointObjectPayload, displayConvertedCoordinates, getCoordinateSystem, getScaleFactor, getMeasurementUnit, getRotationUnit, setBasepointObjectPayload } from "./components/toolbar/actionSettingsPane";
|
|
30
29
|
import { getBasepointCalibrateBpCoordinateValues, getBasepointCalibrateMpCoordinateValues, initBsepointCalibratePane, toggleBasepointCalibratePane } from "./components/toolbar/basepointCalibratePane";
|
|
31
30
|
let activeToolbarItem, activeActionItem, activePane, activeActionPane, cancelTagPlacementPrompt, cancelModelPlacementPrompt;
|
|
32
31
|
let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, types: [
|
|
@@ -1192,6 +1191,7 @@ function handleConfirmTransform() {
|
|
|
1192
1191
|
payload.object_scale = transform.object_scale;
|
|
1193
1192
|
console.log("caroline payload to confirm: ", payload);
|
|
1194
1193
|
dispatchSpaceEvent(SPACE_EVENTS.DRAG_END, payload);
|
|
1194
|
+
clearCurrentTransformationValues();
|
|
1195
1195
|
const activeElement = document.querySelector('.at_sidebar_button_icon_active');
|
|
1196
1196
|
activeElement.classList.remove("at_sidebar_button_icon_active");
|
|
1197
1197
|
removeTransformControls();
|
|
@@ -1250,13 +1250,19 @@ function handleDragEnd(payload) {
|
|
|
1250
1250
|
mpCoordValues.y = mpInputY.value;
|
|
1251
1251
|
mpCoordValues.z = mpInputZ.value;
|
|
1252
1252
|
displayConvertedCoordinates(mpCoordValues);
|
|
1253
|
+
return;
|
|
1253
1254
|
}
|
|
1254
1255
|
displayConvertedCoordinates(mpCoordValues);
|
|
1255
1256
|
return;
|
|
1256
1257
|
}
|
|
1257
1258
|
}
|
|
1258
|
-
showCurrentCoordinateValue(
|
|
1259
|
-
|
|
1259
|
+
showCurrentCoordinateValue();
|
|
1260
|
+
const transformValues = {
|
|
1261
|
+
object_position: payload.object_position,
|
|
1262
|
+
object_rotation: payload.object_rotation,
|
|
1263
|
+
object_scale: payload.object_scale,
|
|
1264
|
+
};
|
|
1265
|
+
setCurrentTransformationValues(transformValues);
|
|
1260
1266
|
}
|
|
1261
1267
|
function handleDrawHistory(payload) {
|
|
1262
1268
|
console.log("payload", payload);
|
|
@@ -1341,9 +1347,11 @@ function handleMouseClickObject(object) {
|
|
|
1341
1347
|
toggleDisplayPane('at-object-list-btn');
|
|
1342
1348
|
setActiveMenu('at-object-list-btn');
|
|
1343
1349
|
}
|
|
1350
|
+
toggleActionBar('show');
|
|
1351
|
+
toggleModelControl(false);
|
|
1344
1352
|
setActiveCard(`at-card-image-${objectId}`);
|
|
1345
1353
|
handleScrollToView('at-object-cards', `at-card-${objectId}`);
|
|
1346
|
-
|
|
1354
|
+
// clearActiveActionBtn()
|
|
1347
1355
|
//setActiveActionBtn('at-translate-action-btn')
|
|
1348
1356
|
}
|
|
1349
1357
|
}
|
|
@@ -2223,7 +2231,7 @@ function handleMeasurementUnitDropdown() {
|
|
|
2223
2231
|
const dropdownBtn = document.getElementById('at-selected-measurement-unit');
|
|
2224
2232
|
const optionsContainer = document.getElementById('at-measurement-unit-options');
|
|
2225
2233
|
dropdownBtn === null || dropdownBtn === void 0 ? void 0 : dropdownBtn.addEventListener('click', () => {
|
|
2226
|
-
|
|
2234
|
+
toggleActionSettingsDropdown('at-measurement-unit-options');
|
|
2227
2235
|
});
|
|
2228
2236
|
optionsContainer === null || optionsContainer === void 0 ? void 0 : optionsContainer.addEventListener('click', (event) => {
|
|
2229
2237
|
const target = event.target;
|
|
@@ -2237,7 +2245,7 @@ function handleRotationUnitDropdown() {
|
|
|
2237
2245
|
const dropdownBtn = document.getElementById('at-selected-rotation-unit');
|
|
2238
2246
|
const optionsContainer = document.getElementById('at-rotation-unit-options');
|
|
2239
2247
|
dropdownBtn === null || dropdownBtn === void 0 ? void 0 : dropdownBtn.addEventListener('click', () => {
|
|
2240
|
-
|
|
2248
|
+
toggleActionSettingsDropdown('at-rotation-unit-options');
|
|
2241
2249
|
});
|
|
2242
2250
|
optionsContainer === null || optionsContainer === void 0 ? void 0 : optionsContainer.addEventListener('click', (event) => {
|
|
2243
2251
|
const target = event.target;
|
|
@@ -2358,7 +2366,8 @@ function handleObjectCoordinateSystem() {
|
|
|
2358
2366
|
const target = event.target;
|
|
2359
2367
|
if (target.value) {
|
|
2360
2368
|
setSelectedObjectCoordinateSystem(target.value);
|
|
2361
|
-
|
|
2369
|
+
showCurrentCoordinateValue();
|
|
2370
|
+
// displayConvertedObjectCoordinates()
|
|
2362
2371
|
// getObjectCoordinateSystem(target.value)
|
|
2363
2372
|
}
|
|
2364
2373
|
});
|
package/lib/utils.js
CHANGED
|
@@ -375,22 +375,42 @@ export function convertMeasurement(value, fromUnit, toUnit) {
|
|
|
375
375
|
const conversionFactors = {
|
|
376
376
|
m: {
|
|
377
377
|
m: 1,
|
|
378
|
+
cm: 100,
|
|
379
|
+
mm: 1000,
|
|
378
380
|
in: 39.3701,
|
|
379
381
|
ft: 3.28084
|
|
380
382
|
},
|
|
383
|
+
cm: {
|
|
384
|
+
m: 0.01,
|
|
385
|
+
cm: 1,
|
|
386
|
+
mm: 10,
|
|
387
|
+
in: 0.393701,
|
|
388
|
+
ft: 0.0328084
|
|
389
|
+
},
|
|
390
|
+
mm: {
|
|
391
|
+
m: 0.001,
|
|
392
|
+
cm: 0.1,
|
|
393
|
+
mm: 1,
|
|
394
|
+
in: 0.0393701,
|
|
395
|
+
ft: 0.00328084
|
|
396
|
+
},
|
|
381
397
|
in: {
|
|
382
398
|
m: 0.0254,
|
|
399
|
+
cm: 2.54,
|
|
400
|
+
mm: 25.4,
|
|
383
401
|
in: 1,
|
|
384
402
|
ft: 1 / 12
|
|
385
403
|
},
|
|
386
404
|
ft: {
|
|
387
405
|
m: 0.3048,
|
|
406
|
+
cm: 30.48,
|
|
407
|
+
mm: 304.8,
|
|
388
408
|
in: 12,
|
|
389
409
|
ft: 1
|
|
390
410
|
}
|
|
391
411
|
};
|
|
392
|
-
if (!conversionFactors[fromUnit] || !conversionFactors[toUnit]) {
|
|
393
|
-
throw new Error("Invalid unit type. Please use 'm', 'in', or 'ft'.");
|
|
412
|
+
if (!conversionFactors[fromUnit] || !conversionFactors[fromUnit][toUnit]) {
|
|
413
|
+
throw new Error("Invalid unit type. Please use 'm', 'cm', 'mm', 'in', or 'ft'.");
|
|
394
414
|
}
|
|
395
415
|
return value * conversionFactors[fromUnit][toUnit];
|
|
396
416
|
}
|
package/lib/worldConversion.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Vector3 } from "../bundle/sdk";
|
|
2
|
+
import { UNITS } from "./types";
|
|
2
3
|
/**
|
|
3
4
|
* Convert BIM (Z-up) to Matterport (Y-up)
|
|
4
5
|
* Converts a coordinate from a right handed Z-up coordinates system to a right handed Y-up coordinate system
|
|
@@ -21,7 +22,7 @@ export declare function convertZupToYup(revitCoords: {
|
|
|
21
22
|
x: number;
|
|
22
23
|
y: number;
|
|
23
24
|
z: number;
|
|
24
|
-
}, unit?:
|
|
25
|
+
}, unit?: UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH, scaleFactor?: number): Vector3;
|
|
25
26
|
/**
|
|
26
27
|
* Converts degress to quaternions
|
|
27
28
|
* @param revitRotX
|
|
@@ -41,7 +42,7 @@ export declare function convertZupScaleToYupScale(scale: {
|
|
|
41
42
|
x: number;
|
|
42
43
|
y: number;
|
|
43
44
|
z: number;
|
|
44
|
-
}, unit?:
|
|
45
|
+
}, unit?: UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH, scaleFactor?: number): {
|
|
45
46
|
x: number;
|
|
46
47
|
y: number;
|
|
47
48
|
z: number;
|
|
@@ -64,7 +65,7 @@ export declare function convertYupToZup(objectPosition: Vector3, mpBasePoint?: {
|
|
|
64
65
|
x: number;
|
|
65
66
|
y: number;
|
|
66
67
|
z: number;
|
|
67
|
-
}, unit?:
|
|
68
|
+
}, unit?: UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH, scaleFactor?: number): {
|
|
68
69
|
x: number;
|
|
69
70
|
y: number;
|
|
70
71
|
z: number;
|
|
@@ -85,7 +86,7 @@ export declare function convertYupScaleToZupScale(scale: {
|
|
|
85
86
|
x: number;
|
|
86
87
|
y: number;
|
|
87
88
|
z: number;
|
|
88
|
-
}, unit?:
|
|
89
|
+
}, unit?: UNITS.MILLIMETER | UNITS.CENTIMETER | UNITS.METER | UNITS.FOOT | UNITS.INCH, scaleFactor?: number): {
|
|
89
90
|
x: number;
|
|
90
91
|
y: number;
|
|
91
92
|
z: number;
|
package/lib/worldConversion.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _3DXObjects } from "./architwin";
|
|
2
|
+
import { UNITS } from "./types";
|
|
2
3
|
import { getUnitConverter } from "./utils";
|
|
3
4
|
import log from "loglevel";
|
|
4
5
|
/**
|
|
@@ -11,17 +12,22 @@ import log from "loglevel";
|
|
|
11
12
|
* @param scaleFactor - (optional) - default is 1 (1:1 scale). Applied after conversion to meters
|
|
12
13
|
* @returns coordinates in meters
|
|
13
14
|
*/
|
|
14
|
-
export function convertZupToYup(revitCoords, mpBasePoint = { x: 0, y: 0, z: 0 }, bimBasepoint = { x: 0, y: 0, z: 0 }, unit =
|
|
15
|
+
export function convertZupToYup(revitCoords, mpBasePoint = { x: 0, y: 0, z: 0 }, bimBasepoint = { x: 0, y: 0, z: 0 }, unit = UNITS.METER, scaleFactor = 1) {
|
|
15
16
|
const unitConverter = getUnitConverter(unit);
|
|
17
|
+
const bimObjPos = {
|
|
18
|
+
x: unitConverter(revitCoords.x) * scaleFactor,
|
|
19
|
+
y: unitConverter(revitCoords.z) * scaleFactor,
|
|
20
|
+
z: unitConverter(revitCoords.y) * scaleFactor
|
|
21
|
+
};
|
|
16
22
|
const THREE = _3DXObjects.find(obj => obj.type == 'BASEPOINT').component.context.three;
|
|
17
23
|
const _mpBP = new THREE.Vector3(mpBasePoint.x, mpBasePoint.y, mpBasePoint.z);
|
|
18
24
|
const _bimBP = new THREE.Vector3(bimBasepoint.x, bimBasepoint.y, bimBasepoint.z);
|
|
19
|
-
const _bimObjPos = new THREE.Vector3(
|
|
25
|
+
const _bimObjPos = new THREE.Vector3(bimObjPos.x, bimObjPos.y, bimObjPos.z); // swap yz for revit/bim
|
|
20
26
|
_bimBP.addVectors(_mpBP, _bimObjPos);
|
|
21
27
|
return {
|
|
22
|
-
x:
|
|
23
|
-
y:
|
|
24
|
-
z:
|
|
28
|
+
x: (_bimBP.x - bimBasepoint.x),
|
|
29
|
+
y: (_bimBP.y - bimBasepoint.z),
|
|
30
|
+
z: (_bimBP.z - bimBasepoint.y)
|
|
25
31
|
};
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
@@ -56,7 +62,7 @@ export function convertDegreeToQuarternion(revitRotX, revitRotY, revitRotZ) {
|
|
|
56
62
|
* @param scaleFactor - (optional) - default is 1 (1:1 scale). Applied after conversion to meters
|
|
57
63
|
* @returns
|
|
58
64
|
*/
|
|
59
|
-
export function convertZupScaleToYupScale(scale, unit =
|
|
65
|
+
export function convertZupScaleToYupScale(scale, unit = UNITS.METER, scaleFactor = 1) {
|
|
60
66
|
const unitConverter = getUnitConverter(unit);
|
|
61
67
|
const revitX = unitConverter(scale.x) * scaleFactor;
|
|
62
68
|
const revitY = unitConverter(scale.y) * scaleFactor;
|
|
@@ -77,7 +83,8 @@ export function convertZupScaleToYupScale(scale, unit = 'm', scaleFactor = 1) {
|
|
|
77
83
|
* @param scaleFactor - (optional) - default is 1 (1:1 scale). Applied to coordinates in meters
|
|
78
84
|
* @returns coordinates in the specified unit
|
|
79
85
|
*/
|
|
80
|
-
export function convertYupToZup(objectPosition, mpBasePoint = { x: 0, y: 0, z: 0 }, bimBasepoint = { x: 0, y: 0, z: 0 }, unit =
|
|
86
|
+
export function convertYupToZup(objectPosition, mpBasePoint = { x: 0, y: 0, z: 0 }, bimBasepoint = { x: 0, y: 0, z: 0 }, unit = UNITS.METER, scaleFactor = 1) {
|
|
87
|
+
log.info("convertYupToZup()", objectPosition, mpBasePoint, bimBasepoint, unit, scaleFactor);
|
|
81
88
|
const unitConverter = getUnitConverter(unit);
|
|
82
89
|
const THREE = _3DXObjects.find(obj => obj.type == 'BASEPOINT').component.context.three;
|
|
83
90
|
const _bimBP = new THREE.Vector3(bimBasepoint.x, bimBasepoint.y, bimBasepoint.z);
|
|
@@ -113,11 +120,8 @@ export function convertQuaternionToDegree(quaternion) {
|
|
|
113
120
|
* @param scaleFactor - (optional) - default is 1 (1:1 scale).
|
|
114
121
|
* @returns
|
|
115
122
|
*/
|
|
116
|
-
export function convertYupScaleToZupScale(scale, unit =
|
|
123
|
+
export function convertYupScaleToZupScale(scale, unit = UNITS.METER, scaleFactor = 1) {
|
|
117
124
|
const unitConverter = getUnitConverter(unit);
|
|
118
|
-
// const scaleX = unitConverter(scale.x) * scaleFactor;
|
|
119
|
-
// const scaleY = unitConverter(scale.y) * scaleFactor;
|
|
120
|
-
// const scaleZ = unitConverter(scale.z) * scaleFactor;
|
|
121
125
|
const scaleX = unitConverter(scale.x) / scaleFactor;
|
|
122
126
|
const scaleY = unitConverter(scale.y) / scaleFactor;
|
|
123
127
|
const scaleZ = unitConverter(scale.z) / scaleFactor;
|
package/package.json
CHANGED
package/static/atwinui.css
CHANGED
|
@@ -1595,8 +1595,6 @@
|
|
|
1595
1595
|
text-align: center;
|
|
1596
1596
|
background: var(--bg-secondary-azusa);
|
|
1597
1597
|
padding-bottom: 5px;
|
|
1598
|
-
margin-right: 25px;
|
|
1599
|
-
margin-left: 25px;
|
|
1600
1598
|
}
|
|
1601
1599
|
|
|
1602
1600
|
.at_mt_static_text_container.hidden{
|
|
@@ -1712,7 +1710,7 @@
|
|
|
1712
1710
|
}
|
|
1713
1711
|
|
|
1714
1712
|
.at_bim_icon_right {
|
|
1715
|
-
width:
|
|
1713
|
+
width: auto;
|
|
1716
1714
|
height: 20px;
|
|
1717
1715
|
line-height: 1;
|
|
1718
1716
|
/* background-color:hsla(0,0%,100%,0.8) ; */
|