sctj-components 1.1.2 → 1.1.4

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.
@@ -11230,6 +11230,8 @@ function useBimfaceGIS(options = {}) {
11230
11230
  const swipe = ref$1(null);
11231
11231
  const isSwipeAdded = ref$1(false);
11232
11232
  let registeredEvents = [];
11233
+ const drawableMng = ref$1(null);
11234
+ const markerMng = ref$1(null);
11233
11235
  const initViewer = async (domElement, viewToken, config = {}) => {
11234
11236
  return new Promise(async (resolve, reject) => {
11235
11237
  if (!domElement) {
@@ -11285,6 +11287,16 @@ function useBimfaceGIS(options = {}) {
11285
11287
  );
11286
11288
  });
11287
11289
  };
11290
+ const initDrawableMng = () => {
11291
+ let drawableConfig = new Glodon.Bimface.Earth.Plugins.Drawable.DrawableContainerConfig();
11292
+ drawableConfig.viewer = viewer.value;
11293
+ drawableMng.value = new Glodon.Bimface.Earth.Plugins.Drawable.DrawableContainer(drawableConfig);
11294
+ };
11295
+ const initMarkerMng = () => {
11296
+ let markerConfig = new Glodon.Bimface.Earth.Plugins.Marker3D.Marker3DContainerConfig();
11297
+ markerConfig.viewer = viewer.value;
11298
+ markerMng.value = new Glodon.Bimface.Earth.Plugins.Marker3D.Marker3DContainer(markerConfig);
11299
+ };
11288
11300
  const handleResize = () => {
11289
11301
  if (viewer.value) {
11290
11302
  viewer.value.resize(
@@ -11299,6 +11311,8 @@ function useBimfaceGIS(options = {}) {
11299
11311
  return;
11300
11312
  resizeHandler.value = handleResize;
11301
11313
  window.addEventListener("resize", resizeHandler.value);
11314
+ initDrawableMng();
11315
+ initMarkerMng();
11302
11316
  };
11303
11317
  const getLayer = (layerId) => {
11304
11318
  if (!layerManager.value) {
@@ -12203,6 +12217,109 @@ function useBimfaceGIS(options = {}) {
12203
12217
  clearSelection(layerId);
12204
12218
  }
12205
12219
  };
12220
+ const handleObj2style = (styleObj) => {
12221
+ return Object.entries(styleObj).map(([key, value]) => {
12222
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
12223
+ return `${cssKey}: ${value}`;
12224
+ }).join("; ");
12225
+ };
12226
+ const deleteLabelById = (id) => {
12227
+ drawableMng.value.removeItemById(id);
12228
+ };
12229
+ const deleteLabelByIds = (ids) => {
12230
+ ids.forEach((id) => {
12231
+ drawableMng.value.removeItemById(id);
12232
+ });
12233
+ };
12234
+ const deleteMarkerById = (id) => {
12235
+ markerMng.value.removeItemById(id);
12236
+ };
12237
+ const deleteMarkerByIds = (ids) => {
12238
+ ids.forEach((id) => {
12239
+ markerMng.value.removeItemById(id);
12240
+ });
12241
+ };
12242
+ const clearAllDraws = () => {
12243
+ drawableMng.value.clear();
12244
+ markerMng.value.clear();
12245
+ };
12246
+ function getElementSizeOffscreen(el) {
12247
+ const originalDisplay = el.style.display;
12248
+ const originalVisibility = el.style.visibility;
12249
+ const originalPosition = el.style.position;
12250
+ const originalLeft = el.style.left;
12251
+ const originalTop = el.style.top;
12252
+ el.style.position = "absolute";
12253
+ el.style.visibility = "hidden";
12254
+ el.style.left = "-9999px";
12255
+ el.style.top = "-9999px";
12256
+ el.style.display = "block";
12257
+ document.body.appendChild(el);
12258
+ const width = el.clientWidth;
12259
+ const height = el.clientHeight;
12260
+ document.body.removeChild(el);
12261
+ el.style.display = originalDisplay;
12262
+ el.style.visibility = originalVisibility;
12263
+ el.style.position = originalPosition;
12264
+ el.style.left = originalLeft;
12265
+ el.style.top = originalTop;
12266
+ return { width, height };
12267
+ }
12268
+ const drawTextLabel = (options2) => {
12269
+ var _a;
12270
+ let config = new Glodon.Bimface.Earth.Plugins.Drawable.CustomItemConfig({});
12271
+ let html = document.createElement("div");
12272
+ html.style = handleObj2style(options2.style);
12273
+ html.style.width = "fit-content";
12274
+ html.style.whiteSpace = "nowrap";
12275
+ html.innerHTML = options2.text;
12276
+ config.content = html;
12277
+ config.visibleDistance = (_a = options2.visibleDistance) != null ? _a : 501;
12278
+ config.location = options2.location;
12279
+ const { width, height } = getElementSizeOffscreen(html);
12280
+ console.log("width", width);
12281
+ console.log("height", height);
12282
+ config.offsetX = -(width / 2);
12283
+ config.offsetY = -height;
12284
+ const customItem = new Glodon.Bimface.Earth.Plugins.Drawable.CustomItem(config);
12285
+ drawableMng.value.addItem(customItem);
12286
+ return customItem;
12287
+ };
12288
+ const drawLeadLabel = (options2) => {
12289
+ var _a;
12290
+ let config = new Glodon.Bimface.Earth.Plugins.Drawable.LeadLabelConfig({});
12291
+ config.text = options2.text;
12292
+ config.height = options2.style.height;
12293
+ config.width = options2.style.width;
12294
+ config.style = options2.style;
12295
+ config.style.backgroundColor = new Glodon.Web.Graphics.Color(
12296
+ options2.style.backgroundColor.red,
12297
+ options2.style.backgroundColor.green,
12298
+ options2.style.backgroundColor.blue,
12299
+ options2.style.backgroundColor.alpha
12300
+ );
12301
+ config.style.lineColor = new Glodon.Web.Graphics.Color(
12302
+ options2.style.lineColor.red,
12303
+ options2.style.lineColor.green,
12304
+ options2.style.lineColor.blue,
12305
+ options2.style.lineColor.alpha
12306
+ );
12307
+ config.visibleDistance = (_a = options2.visibleDistance) != null ? _a : 501;
12308
+ config.worldPosition = options2.worldPosition;
12309
+ const customItem = new Glodon.Bimface.Earth.Plugins.Drawable.LeadLabel(config);
12310
+ drawableMng.value.addItem(customItem);
12311
+ return customItem;
12312
+ };
12313
+ const drawMarker = (options2) => {
12314
+ let config = new Glodon.Bimface.Earth.Plugins.Marker3D.Marker3DConfig();
12315
+ config.src = options2.src;
12316
+ config.location = options2.location;
12317
+ config.size = options2.size;
12318
+ config.tooltip = options2.text;
12319
+ let marker3d = new Glodon.Bimface.Earth.Plugins.Marker3D.Marker3D(config);
12320
+ markerMng.value.addItem(marker3d);
12321
+ return marker3d;
12322
+ };
12206
12323
  return {
12207
12324
  viewer,
12208
12325
  app,
@@ -12210,6 +12327,8 @@ function useBimfaceGIS(options = {}) {
12210
12327
  isLoaded,
12211
12328
  isLoading,
12212
12329
  error,
12330
+ drawableMng,
12331
+ markerMng,
12213
12332
  initViewer,
12214
12333
  getLayer,
12215
12334
  getAllLayers,
@@ -12267,6 +12386,14 @@ function useBimfaceGIS(options = {}) {
12267
12386
  openModelEditor,
12268
12387
  closeModelEditor,
12269
12388
  clearAllEffects,
12389
+ drawTextLabel,
12390
+ drawLeadLabel,
12391
+ drawMarker,
12392
+ deleteLabelById,
12393
+ deleteLabelByIds,
12394
+ deleteMarkerById,
12395
+ deleteMarkerByIds,
12396
+ clearAllDraws,
12270
12397
  swipe,
12271
12398
  isSwipeAdded,
12272
12399
  openSwipe,
@@ -12277,8 +12404,8 @@ function useBimfaceGIS(options = {}) {
12277
12404
  dispose
12278
12405
  };
12279
12406
  }
12280
- const index_vue_vue_type_style_index_0_scoped_b3b0eda5_lang = "";
12281
- const _withScopeId = (n) => (pushScopeId("data-v-b3b0eda5"), n = n(), popScopeId(), n);
12407
+ const index_vue_vue_type_style_index_0_scoped_9656d353_lang = "";
12408
+ const _withScopeId = (n) => (pushScopeId("data-v-9656d353"), n = n(), popScopeId(), n);
12282
12409
  const _hoisted_1 = {
12283
12410
  key: 0,
12284
12411
  class: "loading-mask"
@@ -12341,13 +12468,15 @@ const _sfc_main = {
12341
12468
  setup(__props, { expose, emit }) {
12342
12469
  const props = __props;
12343
12470
  useCssVars((_ctx) => ({
12344
- "7cf1f39e": __props.width,
12345
- "077d864f": __props.height
12471
+ "5d362dc5": __props.width,
12472
+ "2fc09108": __props.height
12346
12473
  }));
12347
12474
  const containerRef = ref$1(null);
12348
12475
  const {
12349
12476
  viewer,
12350
12477
  app,
12478
+ drawableMng,
12479
+ markerMng,
12351
12480
  layerManager,
12352
12481
  isLoaded,
12353
12482
  isLoading,
@@ -12416,6 +12545,14 @@ const _sfc_main = {
12416
12545
  showSwipe,
12417
12546
  toggleSwipe,
12418
12547
  destroySwipe,
12548
+ drawTextLabel,
12549
+ drawLeadLabel,
12550
+ drawMarker,
12551
+ deleteLabelById,
12552
+ deleteLabelByIds,
12553
+ deleteMarkerById,
12554
+ deleteMarkerByIds,
12555
+ clearAllDraws,
12419
12556
  dispose
12420
12557
  } = useBimfaceGIS({
12421
12558
  onModelTransformEnd: (data) => emit("model-transform-end", data)
@@ -12655,6 +12792,8 @@ const _sfc_main = {
12655
12792
  expose({
12656
12793
  viewer,
12657
12794
  app,
12795
+ drawableMng,
12796
+ markerMng,
12658
12797
  layerManager,
12659
12798
  isLoaded,
12660
12799
  isLoading,
@@ -12723,6 +12862,14 @@ const _sfc_main = {
12723
12862
  showSwipe,
12724
12863
  toggleSwipe,
12725
12864
  destroySwipe,
12865
+ drawTextLabel,
12866
+ drawLeadLabel,
12867
+ drawMarker,
12868
+ deleteLabelById,
12869
+ deleteLabelByIds,
12870
+ deleteMarkerById,
12871
+ deleteMarkerByIds,
12872
+ clearAllDraws,
12726
12873
  dispose
12727
12874
  });
12728
12875
  return (_ctx, _cache) => {
@@ -12754,7 +12901,7 @@ const _sfc_main = {
12754
12901
  };
12755
12902
  }
12756
12903
  };
12757
- const SCTJGISViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b3b0eda5"]]);
12904
+ const SCTJGISViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9656d353"]]);
12758
12905
  const components = [
12759
12906
  { component: SCTJDictTag, name: "SCTJDictTag" },
12760
12907
  { component: SCTJTreeSelect, name: "SCTJTreeSelect" },