diff --git a/src/index.js b/src/index.js index e97d32c2667d29b71a9e7f995ebb97bbe1a92c68..fe3ba4f9238fa9c45ed326ac37943f318ce3a0f7 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ import { ToolboxType, WindowSlot, NotificationType } from '@vcmap/ui'; -import { Cesium3DTileStyle, Math as CMath, Cartesian3, ConstantProperty, Transforms, HeadingPitchRoll, Cesium3DTileset, Matrix4 } from '@vcmap-cesium/engine'; +import { Cesium3DTileStyle, Math as CMath, Ellipsoid, Cartesian3, ConstantProperty, Transforms, HeadingPitchRoll, Cesium3DTileset, Matrix4 } from '@vcmap-cesium/engine'; import { AbstractInteraction, EventType } from '@vcmap/core'; import { name, version, mapVersion } from '../package.json'; import BIMOptions, { bimOptionsId } from './upload.vue'; @@ -90,9 +90,13 @@ function saveObjects() { if (tempRoll !== undefined) { heading = tempRoll.heading; } + const ellipPos = Ellipsoid.WGS84.cartesianToCartographic(m.model.position.getValue()); + const wgs84X = CMath.toDegrees(ellipPos.longitude); + const wgs84Y = CMath.toDegrees(ellipPos.latitude); + const height = ellipPos.height; outputArray.push({ name: m.name, - position: m.model.position.getValue(), + position: [wgs84X, wgs84Y, height], heading: heading, scale: m.model.model.scale.getValue(), }); @@ -314,10 +318,11 @@ export default function smartVillagesPlugin(config, baseUrl) { // abort return; } + const cartPos = Cartesian3.fromDegrees(loadingObject.position[0], loadingObject.position[1], loadingObject.position[2]); // Add the model to the viewer model = vcMap.getEntities().add({ name: loadingObject.name, - position: loadingObject.position, + position: cartPos, model: { uri: objectUrl, scale: loadingObject.scale,