@kq_npm/client3d_webgl_vue 3.6.9-beta → 3.7.1-beta

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.
@@ -7964,6 +7964,7 @@ const __default__ = {
7964
7964
  dataList = JSON.parse(JSON.stringify(dataList));
7965
7965
  dataList.forEach(path => {
7966
7966
  path.isPlaying = false;
7967
+ path.isRepeat = false;
7967
7968
  pathList.push(path);
7968
7969
  });
7969
7970
  });
@@ -8049,7 +8050,9 @@ const __default__ = {
8049
8050
  }
8050
8051
 
8051
8052
  viewModel.play();
8052
- item.isPlaying = true;
8053
+ item.isPlaying = true; // 设置循环播放
8054
+
8055
+ viewModel.setAutoRepeat(item.isRepeat);
8053
8056
  } //路径播放暂停
8054
8057
 
8055
8058
 
@@ -8065,9 +8068,12 @@ const __default__ = {
8065
8068
  } //循环播放
8066
8069
 
8067
8070
 
8068
- function repeat() {
8069
- var isRepeat = viewModel.getAutoRepeat();
8070
- viewModel.setAutoRepeat(!isRepeat);
8071
+ function repeat(item) {
8072
+ item.isRepeat = !item.isRepeat;
8073
+
8074
+ if (item.isPlaying) {
8075
+ viewModel.setAutoRepeat(item.isRepeat);
8076
+ }
8071
8077
  } //显示更多功能菜单
8072
8078
 
8073
8079
 
@@ -8414,17 +8420,17 @@ const __default__ = {
8414
8420
  /* PROPS, DYNAMIC_SLOTS */
8415
8421
  , ["onClick", "title"]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_icon, {
8416
8422
  size: 16,
8417
- class: "menuIcon",
8418
- onClick: repeat,
8423
+ class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeClass)(item.isRepeat ? 'kq-icon-light' : ''),
8424
+ onClick: $event => repeat(item),
8419
8425
  title: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).repeat
8420
8426
  }, {
8421
8427
  default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(client_icons_vue_.IconVideoRepeat))]),
8422
- _: 1
8423
- /* STABLE */
8428
+ _: 2
8429
+ /* DYNAMIC */
8424
8430
 
8425
- }, 8
8426
- /* PROPS */
8427
- , ["title"]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_icon, {
8431
+ }, 1032
8432
+ /* PROPS, DYNAMIC_SLOTS */
8433
+ , ["class", "onClick", "title"]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_icon, {
8428
8434
  size: 16,
8429
8435
  class: "menuIcon",
8430
8436
  onClick: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withModifiers)($event => showDropDownMenu(item, index), ["prevent", "stop"]),
@@ -13964,7 +13970,7 @@ const __default__ = {
13964
13970
 
13965
13971
  if (res.measureResult && res.measureResult.labels && res.measureResult.labels.length > 0) {
13966
13972
  res.measureResult.labels._labels.forEach(label => {
13967
- label.text = label.text.replace('X', language.value.longitude).replace('Y', language.value.latitude).replace('Z', language.value.height);
13973
+ label.text = label.text.replace('X', language.value.longitude).replace('Y', language.value.latitude).replace('Z', language.value.elevation);
13968
13974
  });
13969
13975
  }
13970
13976
  }
@@ -14337,7 +14343,7 @@ const __default__ = {
14337
14343
  /* TEXT */
14338
14344
  ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("p", _hoisted_28, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(result).latitude), 1
14339
14345
  /* TEXT */
14340
- ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("p", _hoisted_29, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).height), 1
14346
+ ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("p", _hoisted_29, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).elevation), 1
14341
14347
  /* TEXT */
14342
14348
  ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("p", _hoisted_30, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(result).height) + " m", 1
14343
14349
  /* TEXT */
@@ -25948,13 +25954,12 @@ class DrawManager {
25948
25954
  text: {
25949
25955
  text: "文字标注",
25950
25956
  //文字内容
25951
- fontSize: 30,
25957
+ fontSize: 25,
25952
25958
  //文字大小
25953
- color: "#ff0000",
25954
- //文字颜色
25955
- opacity: 0.5,
25956
- //文字颜色透明度
25957
- clampToGround: false //是否贴地
25959
+ fontFamily: 'Microsoft YaHei',
25960
+ color: "#ff0000" //文字颜色
25961
+ // opacity: 0.5, //文字颜色透明度
25962
+ // clampToGround: false //是否贴地
25958
25963
 
25959
25964
  },
25960
25965
  //点-图标样式
@@ -25965,8 +25970,9 @@ class DrawManager {
25965
25970
  //图标宽度
25966
25971
  height: 32,
25967
25972
  //图标高度
25968
- clampToGround: true //是否贴地
25969
-
25973
+ clampToGround: true,
25974
+ //是否贴地
25975
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
25970
25976
  },
25971
25977
  //折线样式
25972
25978
  polyline: {
@@ -26107,22 +26113,65 @@ class DrawManager {
26107
26113
  transparent: true
26108
26114
  });
26109
26115
  return material;
26116
+ }
26117
+
26118
+ getImageWithColor(imgUrl, color, width = 32, height = 32) {
26119
+ if (color) {
26120
+ var svgStr = window.atob(imgUrl.split(',')[1]);
26121
+ var regex = /#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/g; // 修改svg颜色
26122
+
26123
+ svgStr = svgStr.replace(regex, color); // 修改svg大小
26124
+
26125
+ svgStr = svgStr.replace('width="16"', 'width="' + width + '"').replace('height="16"', 'height="' + height + '"');
26126
+ imgUrl = "data:image/svg+xml;base64," + window.btoa(svgStr);
26127
+ }
26128
+
26129
+ return imgUrl;
26110
26130
  } //开始绘制
26111
26131
 
26112
26132
 
26113
26133
  startDraw(type, options, callback, groupName) {
26114
- this._viewer.scene.globe.depthTestAgainstTerrain = true;
26134
+ if (!options) options = {};
26115
26135
 
26116
26136
  if (type === "point") {
26117
26137
  type = "marker";
26118
- options.disableDepthTestDistance = Number.POSITIVE_INFINITY;
26119
26138
  }
26120
26139
 
26121
- if (!options) options = {};
26122
- var unionOptions = JSON.parse(JSON.stringify(this._drawStyle[type]));
26140
+ if (type === "coloricon") {
26141
+ type = "marker";
26142
+ options.iconSize = [32, 32];
26143
+ options.iconUrl = const_image_.LABEL_SVG_ICONS[0];
26144
+ options.image = this.getImageWithColor(const_image_.LABEL_SVG_ICONS[0], options.color);
26145
+ }
26146
+
26147
+ if (type === "text") {
26148
+ this._viewer.scene.globe.depthTestAgainstTerrain = false;
26149
+ } else {
26150
+ this._viewer.scene.globe.depthTestAgainstTerrain = true;
26151
+ }
26152
+
26153
+ var unionOptions = { ...this._drawStyle[type],
26154
+ ...options
26155
+ };
26156
+
26157
+ if (type === "polyline") {
26158
+ //标记组件使用
26159
+ options.opacity = 1;
26160
+ }
26161
+
26162
+ if (type === "text") {
26163
+ //标记组件使用
26164
+ options.fontSize = this._drawStyle.text.fontSize;
26165
+ options.fontFamily = this._drawStyle.text.fontFamily;
26166
+ options.content = this._drawStyle.text.text;
26167
+ options.is3D = true;
26168
+ }
26123
26169
 
26124
- for (var key in options) {
26125
- unionOptions[key] = options[key];
26170
+ if (type === "polyline" || type === "polygon") {
26171
+ //标记组件使用
26172
+ if (unionOptions.hasOwnProperty("weight")) {
26173
+ unionOptions.width = unionOptions.weight;
26174
+ }
26126
26175
  }
26127
26176
 
26128
26177
  if (unionOptions.hasOwnProperty("color")) {
@@ -26135,24 +26184,31 @@ class DrawManager {
26135
26184
 
26136
26185
  this._drawHandler.startDraw(type, type, unionOptions);
26137
26186
 
26138
- if (callback) {
26139
- var that = this;
26140
- var removeEventListener = this.drawFinishedEvent.addEventListener(shape => {
26141
- if (groupName) shape.groupName = groupName;
26142
- that._viewer.scene.globe.depthTestAgainstTerrain = false;
26187
+ var that = this;
26188
+ var removeEventListener = this.drawFinishedEvent.addEventListener(shape => {
26189
+ if (groupName) shape.groupName = groupName;
26190
+
26191
+ if (shape.type === "text") {
26192
+ setTimeout(() => {
26193
+ shape._label.disableDepthTestDistance = Number.POSITIVE_INFINITY;
26194
+ }, 200);
26195
+ }
26196
+
26197
+ shape.options = options;
26198
+
26199
+ if (callback) {
26143
26200
  var feature = that.shapeToGeoFeature(shape);
26144
26201
  callback(feature.geometry, {
26145
26202
  layer: shape.guid
26146
26203
  });
26147
- removeEventListener();
26148
- });
26149
- }
26204
+ }
26205
+
26206
+ removeEventListener();
26207
+ });
26150
26208
  }
26151
26209
 
26152
26210
  stopDraw() {
26153
26211
  this._drawHandler.stopDraw();
26154
-
26155
- this._viewer.scene.globe.depthTestAgainstTerrain = false;
26156
26212
  } //是否启用连续绘制
26157
26213
 
26158
26214
 
@@ -26217,7 +26273,9 @@ class DrawManager {
26217
26273
  var that = this;
26218
26274
 
26219
26275
  if (shape) {
26220
- if (shape.type === that._drawHandler.ShapeTypes.MARKER.type) {
26276
+ if (shape.controlPoints && shape.controlPoints.length === 0) return shape;
26277
+
26278
+ if (shape.type === that._drawHandler.ShapeTypes.MARKER.type || shape.type === that._drawHandler.ShapeTypes.TEXT.type) {
26221
26279
  let position = that.transformPosition(shape._position);
26222
26280
  geoFeature = window.turf.point(position);
26223
26281
  } else if (shape.type === that._drawHandler.ShapeTypes.CIRCLE.type) {
@@ -26235,12 +26293,14 @@ class DrawManager {
26235
26293
  });
26236
26294
  geoFeature = window.turf.lineStrings(position).features[0];
26237
26295
  } else if (shape.type === that._drawHandler.ShapeTypes.RECTANGLE.type) {
26238
- let minX = shape.rectangle.west / Math.PI * 180;
26239
- let maxX = shape.rectangle.east / Math.PI * 180;
26240
- let minY = shape.rectangle.south / Math.PI * 180;
26241
- let maxY = shape.rectangle.north / Math.PI * 180;
26242
- let positions1 = [[[minX, minY], [minX, maxY], [maxX, maxY], [maxX, minY], [minX, minY]]];
26243
- geoFeature = window.turf.polygon(positions1);
26296
+ if (shape.rectangle) {
26297
+ let minX = shape.rectangle.west / Math.PI * 180;
26298
+ let maxX = shape.rectangle.east / Math.PI * 180;
26299
+ let minY = shape.rectangle.south / Math.PI * 180;
26300
+ let maxY = shape.rectangle.north / Math.PI * 180;
26301
+ let positions1 = [[[minX, minY], [minX, maxY], [maxX, maxY], [maxX, minY], [minX, minY]]];
26302
+ geoFeature = window.turf.polygon(positions1);
26303
+ }
26244
26304
  } else if (shape.type === that._drawHandler.ShapeTypes.POLYGON.type) {
26245
26305
  let positions = [[]];
26246
26306
  let posi;
@@ -26489,23 +26549,221 @@ class DrawManager {
26489
26549
  let primitive = this._drawLayer.getById(id);
26490
26550
 
26491
26551
  if (!primitive) return;
26492
- let type = primitive.geoType;
26493
-
26494
- if (type === 'point') {// 绘制点暂时不需要修改样式
26552
+ let type = primitive._geoType;
26553
+
26554
+ if (primitive.type === 'text') {
26555
+ primitive.fontSize = style.fontSize;
26556
+ primitive.fontFamily = style.fontFamily;
26557
+ primitive.text = style.content;
26558
+ primitive.fillColor = Cesium.Color.fromCssColorString(style.color);
26559
+ } else if (type === 'point') {
26560
+ primitive.image = this.getImageWithColor(style.iconUrl, style.color, style.iconSize[0], style.iconSize[1]);
26561
+ primitive.width = style.iconSize[0];
26562
+ primitive.height = style.iconSize[1];
26495
26563
  } else if (type === 'polyline' || type === 'polygon') {
26496
26564
  if (style.weight) primitive.width = style.weight;
26497
26565
  if (style.color) primitive.color = Cesium.Color.fromCssColorString(style.color);
26498
26566
  if (style.dashArray) primitive.dashArray = style.dashArray;
26567
+ if (style.opacity) primitive.color = primitive.color.withAlpha(style.opacity);
26499
26568
  }
26500
26569
 
26501
26570
  if (type === 'polygon') {
26502
- primitive.fill = style.fill;
26571
+ primitive.fill = style.fill === undefined ? true : style.fill;
26503
26572
 
26504
- if (style.fill) {
26573
+ if (primitive.fill) {
26505
26574
  let opacity = style.fillOpacity || this._drawStyle.polygon.fillOpacity;
26506
26575
  if (style.fillColor) primitive.fillColor = Cesium.Color.fromCssColorString(style.fillColor).withAlpha(opacity);
26507
26576
  }
26577
+ } // 存储绘图样式, 标记组件使用
26578
+
26579
+
26580
+ primitive.options = style;
26581
+ }
26582
+
26583
+ getShapeTypeById(id) {
26584
+ let type = '';
26585
+
26586
+ let primitive = this._drawLayer.getById(id);
26587
+
26588
+ if (primitive) {
26589
+ type = primitive.type;
26590
+ if (type == 'marker') type = 'Marker';
26591
+ if (type == 'polyline') type = 'Line';
26592
+ if (type == 'polygon') type = 'Polygon';
26593
+ if (type == 'rectangle') type = 'Rectangle';
26594
+ if (type == 'circle') type = 'Circle';
26595
+ if (type == 'text') type = 'Text';
26508
26596
  }
26597
+
26598
+ return type;
26599
+ }
26600
+
26601
+ getShapeStyle(id) {
26602
+ let primitive = this._drawLayer.getById(id);
26603
+
26604
+ if (primitive) {
26605
+ return primitive.options;
26606
+ }
26607
+ }
26608
+
26609
+ getShapeInfo(id) {
26610
+ let primitive = this._drawLayer.getById(id);
26611
+
26612
+ if (!primitive) return;
26613
+ let type = this.getShapeTypeById(id);
26614
+ let info = null;
26615
+ let options = primitive.options;
26616
+
26617
+ if (type == "Marker") {
26618
+ info = {
26619
+ coordinate: primitive.position,
26620
+ style: {
26621
+ iconSize: options.iconSize,
26622
+ iconUrl: options.iconUrl,
26623
+ color: options.color
26624
+ }
26625
+ };
26626
+ } else if (type == "Line") {
26627
+ info = {
26628
+ coordinate: primitive.controlPoints,
26629
+ style: {
26630
+ opacity: options.opacity,
26631
+ color: options.color,
26632
+ weight: options.weight,
26633
+ dashArray: options.dashArray
26634
+ }
26635
+ };
26636
+ } else if (type == "Polygon" || type == "Rectangle" || type == "Circle") {
26637
+ info = {
26638
+ coordinate: primitive.controlPoints,
26639
+ style: {
26640
+ fillColor: options.fillColor,
26641
+ fillOpacity: options.fillOpacity,
26642
+ color: options.color,
26643
+ weight: options.weight
26644
+ }
26645
+ };
26646
+ } else if (type == "Text") {
26647
+ info = {
26648
+ coordinate: primitive.position,
26649
+ style: {
26650
+ fontSize: options.fontSize,
26651
+ fontFamily: options.fontFamily,
26652
+ color: options.color,
26653
+ content: options.content,
26654
+ is3D: true
26655
+ }
26656
+ };
26657
+ }
26658
+
26659
+ return info;
26660
+ }
26661
+
26662
+ getJsonByLayerList(layerList) {
26663
+ let items = [];
26664
+
26665
+ for (let i = 0; i < layerList.length; i++) {
26666
+ const layer = layerList[i];
26667
+ const name = layer.name || "";
26668
+ const info = this.getShapeInfo(layer.layer);
26669
+ items.push({
26670
+ name: name,
26671
+ info: info,
26672
+ shape: layer.shape
26673
+ });
26674
+ }
26675
+
26676
+ return JSON.stringify(items);
26677
+ }
26678
+
26679
+ createShapeByInfo(info, type) {
26680
+ let shape = null;
26681
+
26682
+ if (type == "Marker") {
26683
+ shape = this._drawHandler.createShape(this._drawHandler.ShapeTypes.MARKER.type, '', {
26684
+ position: info.coordinate,
26685
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
26686
+ width: info.style.iconSize[0],
26687
+ height: info.style.iconSize[1],
26688
+ image: this.getImageWithColor(info.style.iconUrl, info.style.color, info.style.iconSize[0], info.style.iconSize[1])
26689
+ });
26690
+ } else if (type == "Line") {
26691
+ shape = this._drawHandler.createShape(this._drawHandler.ShapeTypes.POLYLINE.type, '', {
26692
+ controlPoints: info.coordinate,
26693
+ color: Cesium.Color.fromCssColorString(info.style.color).withAlpha(info.style.opacity),
26694
+ width: info.style.weight,
26695
+ dashArray: info.style.dashArray,
26696
+ clampToGround: true
26697
+ });
26698
+ } else if (type == "Polygon") {
26699
+ shape = this._drawHandler.createShape(this._drawHandler.ShapeTypes.POLYGON.type, '', {
26700
+ controlPoints: info.coordinate,
26701
+ color: Cesium.Color.fromCssColorString(info.style.color),
26702
+ width: info.style.weight,
26703
+ fillColor: Cesium.Color.fromCssColorString(info.style.fillColor).withAlpha(info.style.fillOpacity),
26704
+ fill: true,
26705
+ clampToGround: true
26706
+ });
26707
+ } else if (type == "Rectangle") {
26708
+ shape = this._drawHandler.createShape(this._drawHandler.ShapeTypes.RECTANGLE.type, '', {
26709
+ controlPoints: info.coordinate,
26710
+ color: Cesium.Color.fromCssColorString(info.style.color),
26711
+ width: info.style.weight,
26712
+ fillColor: Cesium.Color.fromCssColorString(info.style.fillColor).withAlpha(info.style.fillOpacity),
26713
+ fill: true,
26714
+ clampToGround: true
26715
+ });
26716
+ } else if (type == "Circle") {
26717
+ shape = this._drawHandler.createShape(this._drawHandler.ShapeTypes.CIRCLE.type, '', {
26718
+ controlPoints: info.coordinate,
26719
+ color: Cesium.Color.fromCssColorString(info.style.color),
26720
+ width: info.style.weight,
26721
+ fillColor: Cesium.Color.fromCssColorString(info.style.fillColor).withAlpha(info.style.fillOpacity),
26722
+ fill: true,
26723
+ clampToGround: true
26724
+ });
26725
+ } else if (type == "Text") {
26726
+ shape = this._drawHandler.createShape(this._drawHandler.ShapeTypes.TEXT.type, '', {
26727
+ latlng: info.coordinate,
26728
+ text: info.style.content,
26729
+ fontSize: info.style.fontSize,
26730
+ fontFamily: info.style.fontFamily,
26731
+ color: Cesium.Color.fromCssColorString(info.style.color)
26732
+ });
26733
+ setTimeout(() => {
26734
+ shape._label.disableDepthTestDistance = Number.POSITIVE_INFINITY;
26735
+ }, 200);
26736
+ }
26737
+
26738
+ return shape;
26739
+ }
26740
+
26741
+ createLayerListByJson(items) {
26742
+ let layerList = [];
26743
+
26744
+ for (let i = 0; i < items.length; i++) {
26745
+ const item = items[i];
26746
+ const type = item.shape;
26747
+ let shape = this.createShapeByInfo(item.info, type);
26748
+
26749
+ if (shape) {
26750
+ shape.options = item.info.style;
26751
+
26752
+ this._drawLayer.add(shape);
26753
+
26754
+ layerList.push({
26755
+ name: item.name,
26756
+ shape: type,
26757
+ layer: shape.id
26758
+ });
26759
+ }
26760
+ }
26761
+
26762
+ return layerList;
26763
+ }
26764
+
26765
+ removeGeometryById(id) {
26766
+ this._drawLayer.removeById(id);
26509
26767
  }
26510
26768
  /********** 地理编码通用组件使用 start ************/
26511
26769
  // 绘制点图标自带点击弹出气泡, 地理编码通用组件使用