xy-cesium3 0.0.177 → 0.0.178

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xy-cesium3",
3
- "version": "0.0.177",
3
+ "version": "0.0.178",
4
4
  "description": "雄越cesium3",
5
5
  "main": "xy-cesium3.umd.js",
6
6
  "scripts": {
package/xy-cesium3.mjs CHANGED
@@ -15193,7 +15193,19 @@ const defaultOptions$d = {
15193
15193
  levelCount: [20, 50, 100, 2e3],
15194
15194
  levelSize: [55, 60, 70, 80],
15195
15195
  imagePath: "/img/cluster/",
15196
- images: null
15196
+ images: null,
15197
+ label: {
15198
+ show: true,
15199
+ font: "bold 14px",
15200
+ fillColor: Cesium.Color.WHITE,
15201
+ outlineColor: Cesium.Color.BLACK,
15202
+ outlineWidth: 2,
15203
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE,
15204
+ showBackground: false,
15205
+ backgroundColor: "#000000",
15206
+ backgroundOpacity: 0.5,
15207
+ backgroundPadding: new Cesium.Cartesian2(5, 3)
15208
+ }
15197
15209
  }
15198
15210
  };
15199
15211
  const addEntityPoint = (viewer2, option) => {
@@ -15217,19 +15229,20 @@ const addEntityPoint = (viewer2, option) => {
15217
15229
  viewer2.dataSources.add(dataSource);
15218
15230
  data2.forEach((item) => {
15219
15231
  if (item[props2.lgtd] && item[props2.lttd]) {
15232
+ const itemImage = item.image || billboardStyle.image;
15220
15233
  var entity = new Cesium.Entity({
15221
15234
  name: item.id,
15222
15235
  show: show2,
15223
15236
  position: Cesium.Cartesian3.fromDegrees(Number(item[props2.lgtd]), Number(item[props2.lttd]), Number(item[props2.height] || 0)),
15224
15237
  billboard: Object.assign(
15225
15238
  {
15226
- image: item.image || billboardStyle.image,
15227
15239
  heightReference: billboardHeightReference,
15228
15240
  horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
15229
15241
  verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
15230
15242
  zIndex: 0
15231
15243
  },
15232
- billboardStyle
15244
+ billboardStyle,
15245
+ { image: itemImage }
15233
15246
  ),
15234
15247
  label: labelStyle.show ? Object.assign(
15235
15248
  {
@@ -15309,12 +15322,28 @@ const addClusterLayer = (viewer2, dataSource, clusterStyle = {}) => {
15309
15322
  cluster.billboard.horizontalOrigin = Cesium.HorizontalOrigin.CENTER;
15310
15323
  cluster.billboard.verticalOrigin = Cesium.VerticalOrigin.CENTER;
15311
15324
  cluster.billboard.image = clusterImage;
15312
- cluster.label.show = true;
15325
+ const labelStyle = clusterStyle.label || {};
15326
+ cluster.label.show = labelStyle.show !== false;
15313
15327
  cluster.label.text = clusteredEntities.length.toString();
15314
- cluster.label.font = "bold 12px";
15315
- cluster.label.horizontalOrigin = Cesium.HorizontalOrigin.CENTER;
15316
- cluster.label.verticalOrigin = Cesium.VerticalOrigin.CENTER;
15317
- cluster.label.eyeOffset = new Cesium.Cartesian3(0, 0, -10);
15328
+ cluster.label.font = labelStyle.font || "bold 14px";
15329
+ cluster.label.fillColor = labelStyle.fillColor || Cesium.Color.WHITE;
15330
+ cluster.label.outlineColor = labelStyle.outlineColor || Cesium.Color.BLACK;
15331
+ cluster.label.outlineWidth = labelStyle.outlineWidth ?? 2;
15332
+ cluster.label.style = labelStyle.style ?? Cesium.LabelStyle.FILL_AND_OUTLINE;
15333
+ cluster.label.horizontalOrigin = labelStyle.horizontalOrigin || Cesium.HorizontalOrigin.CENTER;
15334
+ cluster.label.verticalOrigin = labelStyle.verticalOrigin || Cesium.VerticalOrigin.CENTER;
15335
+ cluster.label.eyeOffset = labelStyle.eyeOffset || new Cesium.Cartesian3(0, 0, -1);
15336
+ if (labelStyle.showBackground) {
15337
+ const bgOpacity = labelStyle.backgroundOpacity ?? 0.5;
15338
+ const bgColor = labelStyle.backgroundColor || "#000000";
15339
+ const color = Cesium.Color.fromCssColorString(bgColor);
15340
+ color.alpha = bgOpacity;
15341
+ cluster.label.showBackground = true;
15342
+ cluster.label.backgroundColor = color;
15343
+ cluster.label.backgroundPadding = labelStyle.backgroundPadding || new Cesium.Cartesian2(5, 3);
15344
+ } else {
15345
+ cluster.label.showBackground = false;
15346
+ }
15318
15347
  });
15319
15348
  }
15320
15349
  };
@@ -15364,19 +15393,20 @@ const addPrimitivePoint = (viewer2, option) => {
15364
15393
  billboards.layerId = opt2.id;
15365
15394
  data2.forEach((item) => {
15366
15395
  if (item[props2.lgtd] && item[props2.lttd]) {
15396
+ const itemImage = item.image || billboardStyle.image;
15367
15397
  billboards.add(
15368
15398
  Object.assign(
15369
15399
  {
15370
15400
  id: Object.assign({ layerId: opt2.id }, item),
15371
15401
  show: show2,
15372
15402
  position: Cesium.Cartesian3.fromDegrees(item[props2.lgtd], item[props2.lttd], item[props2.height] || 0),
15373
- image: item.image || billboardStyle.image,
15374
15403
  horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
15375
15404
  verticalOrigin: Cesium.VerticalOrigin.CENTER,
15376
15405
  heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
15377
15406
  zIndex: 1
15378
15407
  },
15379
- billboardStyle
15408
+ billboardStyle,
15409
+ { image: itemImage }
15380
15410
  )
15381
15411
  );
15382
15412
  }