sctj-components 1.1.2 → 1.1.3

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,105 @@ 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
+ let config = new Glodon.Bimface.Earth.Plugins.Drawable.CustomItemConfig({});
12270
+ let html = document.createElement("div");
12271
+ html.style = handleObj2style(options2.style);
12272
+ html.style.width = "fit-content";
12273
+ html.style.whiteSpace = "nowrap";
12274
+ html.innerHTML = options2.text;
12275
+ config.content = html;
12276
+ config.location = options2.location;
12277
+ const { width, height } = getElementSizeOffscreen(html);
12278
+ console.log("width", width);
12279
+ console.log("height", height);
12280
+ config.offsetX = -(width / 2);
12281
+ config.offsetY = -height;
12282
+ const customItem = new Glodon.Bimface.Earth.Plugins.Drawable.CustomItem(config);
12283
+ drawableMng.value.addItem(customItem);
12284
+ return customItem;
12285
+ };
12286
+ const drawLeadLabel = (options2) => {
12287
+ let config = new Glodon.Bimface.Earth.Plugins.Drawable.LeadLabelConfig({});
12288
+ config.text = options2.text;
12289
+ config.height = options2.style.height;
12290
+ config.width = options2.style.width;
12291
+ config.style = options2.style;
12292
+ config.style.backgroundColor = new Glodon.Web.Graphics.Color(
12293
+ options2.style.backgroundColor.red,
12294
+ options2.style.backgroundColor.green,
12295
+ options2.style.backgroundColor.blue,
12296
+ options2.style.backgroundColor.alpha
12297
+ );
12298
+ config.style.lineColor = new Glodon.Web.Graphics.Color(
12299
+ options2.style.lineColor.red,
12300
+ options2.style.lineColor.green,
12301
+ options2.style.lineColor.blue,
12302
+ options2.style.lineColor.alpha
12303
+ );
12304
+ config.worldPosition = options2.worldPosition;
12305
+ const customItem = new Glodon.Bimface.Earth.Plugins.Drawable.LeadLabel(config);
12306
+ drawableMng.value.addItem(customItem);
12307
+ return customItem;
12308
+ };
12309
+ const drawMarker = (options2) => {
12310
+ let config = new Glodon.Bimface.Earth.Plugins.Marker3D.Marker3DConfig();
12311
+ config.src = options2.src;
12312
+ config.location = options2.location;
12313
+ config.size = options2.size;
12314
+ config.tooltip = options2.text;
12315
+ let marker3d = new Glodon.Bimface.Earth.Plugins.Marker3D.Marker3D(config);
12316
+ markerMng.value.addItem(marker3d);
12317
+ return marker3d;
12318
+ };
12206
12319
  return {
12207
12320
  viewer,
12208
12321
  app,
@@ -12210,6 +12323,8 @@ function useBimfaceGIS(options = {}) {
12210
12323
  isLoaded,
12211
12324
  isLoading,
12212
12325
  error,
12326
+ drawableMng,
12327
+ markerMng,
12213
12328
  initViewer,
12214
12329
  getLayer,
12215
12330
  getAllLayers,
@@ -12267,6 +12382,14 @@ function useBimfaceGIS(options = {}) {
12267
12382
  openModelEditor,
12268
12383
  closeModelEditor,
12269
12384
  clearAllEffects,
12385
+ drawTextLabel,
12386
+ drawLeadLabel,
12387
+ drawMarker,
12388
+ deleteLabelById,
12389
+ deleteLabelByIds,
12390
+ deleteMarkerById,
12391
+ deleteMarkerByIds,
12392
+ clearAllDraws,
12270
12393
  swipe,
12271
12394
  isSwipeAdded,
12272
12395
  openSwipe,
@@ -12277,8 +12400,8 @@ function useBimfaceGIS(options = {}) {
12277
12400
  dispose
12278
12401
  };
12279
12402
  }
12280
- const index_vue_vue_type_style_index_0_scoped_b3b0eda5_lang = "";
12281
- const _withScopeId = (n) => (pushScopeId("data-v-b3b0eda5"), n = n(), popScopeId(), n);
12403
+ const index_vue_vue_type_style_index_0_scoped_9656d353_lang = "";
12404
+ const _withScopeId = (n) => (pushScopeId("data-v-9656d353"), n = n(), popScopeId(), n);
12282
12405
  const _hoisted_1 = {
12283
12406
  key: 0,
12284
12407
  class: "loading-mask"
@@ -12341,13 +12464,15 @@ const _sfc_main = {
12341
12464
  setup(__props, { expose, emit }) {
12342
12465
  const props = __props;
12343
12466
  useCssVars((_ctx) => ({
12344
- "7cf1f39e": __props.width,
12345
- "077d864f": __props.height
12467
+ "5d362dc5": __props.width,
12468
+ "2fc09108": __props.height
12346
12469
  }));
12347
12470
  const containerRef = ref$1(null);
12348
12471
  const {
12349
12472
  viewer,
12350
12473
  app,
12474
+ drawableMng,
12475
+ markerMng,
12351
12476
  layerManager,
12352
12477
  isLoaded,
12353
12478
  isLoading,
@@ -12416,6 +12541,14 @@ const _sfc_main = {
12416
12541
  showSwipe,
12417
12542
  toggleSwipe,
12418
12543
  destroySwipe,
12544
+ drawTextLabel,
12545
+ drawLeadLabel,
12546
+ drawMarker,
12547
+ deleteLabelById,
12548
+ deleteLabelByIds,
12549
+ deleteMarkerById,
12550
+ deleteMarkerByIds,
12551
+ clearAllDraws,
12419
12552
  dispose
12420
12553
  } = useBimfaceGIS({
12421
12554
  onModelTransformEnd: (data) => emit("model-transform-end", data)
@@ -12655,6 +12788,8 @@ const _sfc_main = {
12655
12788
  expose({
12656
12789
  viewer,
12657
12790
  app,
12791
+ drawableMng,
12792
+ markerMng,
12658
12793
  layerManager,
12659
12794
  isLoaded,
12660
12795
  isLoading,
@@ -12723,6 +12858,14 @@ const _sfc_main = {
12723
12858
  showSwipe,
12724
12859
  toggleSwipe,
12725
12860
  destroySwipe,
12861
+ drawTextLabel,
12862
+ drawLeadLabel,
12863
+ drawMarker,
12864
+ deleteLabelById,
12865
+ deleteLabelByIds,
12866
+ deleteMarkerById,
12867
+ deleteMarkerByIds,
12868
+ clearAllDraws,
12726
12869
  dispose
12727
12870
  });
12728
12871
  return (_ctx, _cache) => {
@@ -12754,7 +12897,7 @@ const _sfc_main = {
12754
12897
  };
12755
12898
  }
12756
12899
  };
12757
- const SCTJGISViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b3b0eda5"]]);
12900
+ const SCTJGISViewer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9656d353"]]);
12758
12901
  const components = [
12759
12902
  { component: SCTJDictTag, name: "SCTJDictTag" },
12760
12903
  { component: SCTJTreeSelect, name: "SCTJTreeSelect" },