Skip to content

Commit 4d12fed

Browse files
author
潘卓然 Parn Deedlit
authored
Merge branch 'master' into v_4_26
2 parents 7595aa0 + b1e87c0 commit 4d12fed

File tree

261 files changed

+12207
-18014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+12207
-18014
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ src/config/opensource/output/
3030
/website/public/static/data/echarts/line/
3131
/website/public/static/data/echarts/point/
3232
/website/public/static/data/echarts/road/
33-
/website/public/static/libs/cdn
33+
/website/public/static/libs/cdn
34+
35+
package-lock.json

package-lock.json

Lines changed: 0 additions & 12394 deletions
This file was deleted.

src/cesiumjs/manager/LabelLayer.js

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,136 @@ export default class LabelLayer extends BaseLayer {
205205
return labelIcon;
206206
}
207207

208+
/**
209+
* 添加图标注记
210+
* @function module:客户端可视化.LabelLayer.prototype.appendLabelIconEx
211+
* @param {Number} lon 经度
212+
* @param {Number} lat 纬度
213+
* @param {Number} height 高程
214+
* @param {Object} [options] 可配置参数
215+
* @param {String} [options.iconUrl] 图标路径,默认值: undefined
216+
* @param {String} [options.text] 注记文字内容,默认值: undefined
217+
* @param {Number} [options.disableDepthTestDistance] 图片和文字注记的深度测试
218+
* @param {NearFarScalar} [options.translucencyByDistance] 透明显示参数 默认值: new NearFarScalar(1.5e5, 1.0, 1.5e9, 0.0)
219+
* @param {NearFarScalar} [options.scaleByDistance] 缩放距离参数 默认值: new Cesium.NearFarScalar(1.5e2, 1.5, 1.5e7, 0.0)
220+
* @param {Number} [options.iconWidth] 图标宽度 默认值: 64
221+
* @param {Number} [options.iconHeight] 图标高度 默认值: 64
222+
* @param {Cartesian2} [options.icoPixelOffset] 图标偏移 默认值: Cartesian2.ZERO
223+
* @param {NearFarScalar} [options.icoPixelOffsetScaleByDistance] 图标偏移值缩放距离参数 默认值: undefined
224+
* @param {Number} [options.icoVerticalOrigin] 图标相对于原点的竖直位置 默认值: VerticalOrigin.CENTER
225+
* @param {Number} [options.icoHorizontalOrigin] 图标相对于原点的水平位置 默认值: HorizontalOrigin.TOP
226+
* @param {String} [options.font] 字体 这里将字体和大小放在一起 eg:'14pt 楷体'
227+
* @param {Cartesian2} [options.labelPixelOffset] 默认值: new Cartesian2(0.0, -iconHeight / 4)
228+
* @param {NearFarScalar} [options.labelPixelOffsetScaleByDistance] 文字注记偏移值缩放距离参数默认值: new NearFarScalar(1.5e5, 1.5, 1.5e7, 0.0)
229+
* @param {Color} [options.labelFillColor] 默认值: Color.WHITE
230+
* @param {Color} [options.labelBackgroundColor] 默认值: new Color(0.165, 0.165, 0.165, 0.8)
231+
* @param {Bool} [options.labelShow] 默认值: true
232+
* @param {BOOL} [options.labelShowBackground] 默认值: false
233+
* @param {Number} [options.labelStyle] 默认值: LabelStyle.FILL_AND_OUTLINE
234+
* @param {Color} [options.labelOutlineWidth] 默认值: 1
235+
* @param {String} [options.labelVerticalOrigin] 文字注记相对于原点的竖直位置 默认值: VerticalOrigin.BOTTOM
236+
* @param {String} [options.labelHorizontalOrigin] 文字注记相对于原点的水平位置 默认值: HorizontalOrigin.BOTTOM
237+
* @param {String} [options.attribute] 属性参数 默认值: undefined
238+
* @example
239+
* const options = { iconUrl: '/car.png', text: '注记文本', font: '14pt 楷体', labelShowBackground: true, attribute: '这是属性信息查询时可以看到' }
240+
* const labelIcon = webGlobe.appendLabelIconEx(110, 33, 0, options);
241+
* @returns {Entity} labelIcon 图标注记对象 移除通过removeEntity(entity)
242+
*/
243+
appendLabelIconEx(lon, lat, height, options) {
244+
// eslint-disable-next-line no-param-reassign
245+
options = Cesium.defaultValue(options, {});
246+
247+
const text = Cesium.defaultValue(options.text, undefined);
248+
const iconUrl = Cesium.defaultValue(options.iconUrl, undefined);
249+
250+
if (!Cesium.defined(text) && !Cesium.defined(iconUrl)) {
251+
// eslint-disable-next-line no-console
252+
console.log('text 和 iconUrl 都未定义,无法正常添加 labelIcon');
253+
return null;
254+
}
255+
256+
const translucencyByDistance = Cesium.defaultValue(options.translucencyByDistance, new Cesium.NearFarScalar(1.5e5, 1.0, 1.5e9, 0.0));
257+
const scaleByDistance = Cesium.defaultValue(options.scaleByDistance, new Cesium.NearFarScalar(1.5e2, 1.5, 1.5e7, 0.0));
258+
const disableDepthTestDistance = Cesium.defaultValue(options.disableDepthTestDistance, Number.POSITIVE_INFINITY);
259+
260+
const iconWidth = Cesium.defaultValue(options.iconWidth, 64);
261+
const iconHeight = Cesium.defaultValue(options.iconHeight, 64);
262+
const icoPixelOffset = Cesium.defaultValue(options.icoPixelOffset, new Cesium.Cartesian2(0.0, 0.0));
263+
const icoPixelOffsetScaleByDistance = Cesium.defaultValue(options.icoPixelOffsetScaleByDistance, undefined);
264+
const icoVerticalOrigin = Cesium.defaultValue(options.icoVerticalOrigin, Cesium.VerticalOrigin.CENTER);
265+
const icoHorizontalOrigin = Cesium.defaultValue(options.icoHorizontalOrigin, Cesium.HorizontalOrigin.TOP);
266+
267+
const font = Cesium.defaultValue(options.font, '14pt 楷体');
268+
const labelPixelOffset = Cesium.defaultValue(options.labelPixelOffset, new Cesium.Cartesian2(0.0, -iconHeight / 2));
269+
const labelPixelOffsetScaleByDistance = Cesium.defaultValue(
270+
options.labelPixelOffsetScaleByDistance,
271+
new Cesium.NearFarScalar(1.5e5, 1.5, 1.5e7, 0.0)
272+
);
273+
const labelFillColor = Cesium.defaultValue(options.labelFillColor, Cesium.Color.WHITE);
274+
const labelShowBackground = Cesium.defaultValue(options.labelShowBackground, false);
275+
const labelBackgroundColor = Cesium.defaultValue(options.labelBackgroundColor, new Cesium.Color(0.165, 0.165, 0.165, 0.8));
276+
const labelShow = Cesium.defaultValue(options.labelShow, true);
277+
const labelStyle = Cesium.defaultValue(options.labelStyle, Cesium.LabelStyle.FILL_AND_OUTLINE);
278+
const labelOutlineWidth = Cesium.defaultValue(options.labelOutlineWidth, 1);
279+
const labelVerticalOrigin = Cesium.defaultValue(options.labelVerticalOrigin, Cesium.VerticalOrigin.BOTTOM);
280+
const labelHorizontalOrigin = Cesium.defaultValue(options.labelHorizontalOrigin, Cesium.HorizontalOrigin.BOTTOM);
281+
282+
const attribute = Cesium.defaultValue(options.attribute, undefined);
283+
284+
const entity = {
285+
name: Cesium.defined(text) ? text : 'defaut',
286+
position: Cesium.Cartesian3.fromDegrees(lon, lat, height),
287+
288+
description: attribute
289+
};
290+
291+
if (Cesium.defined(iconUrl)) {
292+
entity.billboard = {
293+
// 图标
294+
image: iconUrl,
295+
width: iconWidth,
296+
height: iconHeight,
297+
pixelOffset: icoPixelOffset,
298+
pixelOffsetScaleByDistance: icoPixelOffsetScaleByDistance,
299+
// 随远近隐藏
300+
translucencyByDistance,
301+
// 随远近缩放
302+
scaleByDistance,
303+
// 定位点
304+
verticalOrigin: icoVerticalOrigin,
305+
horizontalOrigin: icoHorizontalOrigin,
306+
disableDepthTestDistance
307+
};
308+
}
309+
310+
if (Cesium.defined(text)) {
311+
entity.label = {
312+
// 文字标签
313+
text,
314+
font,
315+
show: labelShow,
316+
style: labelStyle,
317+
fillColor: labelFillColor,
318+
showBackground: labelShowBackground,
319+
backgroundColor: labelBackgroundColor,
320+
outlineWidth: labelOutlineWidth,
321+
verticalOrigin: labelVerticalOrigin, // 垂直方向以底部来计算标签的位置
322+
horizontalOrigin: labelHorizontalOrigin, // 原点在下方
323+
// heightReference: heightReference,
324+
pixelOffset: labelPixelOffset, // x,y方向偏移 相对于屏幕
325+
pixelOffsetScaleByDistance: labelPixelOffsetScaleByDistance,
326+
// 随远近缩放
327+
scaleByDistance,
328+
// 随远近隐藏
329+
translucencyByDistance,
330+
disableDepthTestDistance
331+
};
332+
}
333+
334+
const labelIcon = this.viewer.entities.add(entity);
335+
return labelIcon;
336+
}
337+
208338
/**
209339
* 添加图标注记
210340
* @function module:客户端可视化.LabelLayer.prototype.appendLabelIconComm
63.1 KB
Loading
3.7 KB
Loading
398 Bytes
Loading
8.42 KB
Loading
2.47 KB
Loading

website/public/static/demo/cesium/example/analysis/analysis-animation.htm

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@
6464
scene.camera.enableTerrainAdjustmentWhenLoading = true; //避免穿透地形
6565

6666
//漫游路径
67-
positions = Cesium.Cartesian3.fromDegreesArray([
68-
117.213063, 31.812956, 117.213162, 31.812389, 117.212929, 31.812056, 117.213275, 31.811582,
69-
117.21348, 31.811513, 117.214141, 31.811682, 117.21497, 31.811691, 117.216318, 31.811454,
70-
117.216962, 31.812037, 117.217893, 31.812298, 117.218607, 31.811488, 117.219466, 31.810935,
71-
117.224439, 31.810929, 117.225266, 31.811119, 117.225308, 31.81131, 117.224819, 31.811724,
72-
117.225189, 31.811928, 117.225676, 31.811624, 117.225843, 31.811943, 117.22625, 31.812183,
73-
117.226292, 31.81281, 117.225888, 31.813287, 117.226093, 31.814059, 117.22564, 31.814582,
74-
117.225953, 31.814731, 117.225611, 31.814954, 117.22576, 31.815233, 117.224073, 31.816329,
75-
117.223694, 31.81627, 117.222769, 31.817007, 117.222259, 31.816871, 117.221922, 31.816707,
76-
117.221653, 31.816788, 117.22151, 31.817002, 117.221039, 31.816891, 117.220395, 31.816352,
77-
117.220166, 31.815734, 117.219804, 31.815607, 117.219461, 31.815122, 117.21878, 31.814846,
78-
117.218297, 31.815275, 117.217975, 31.815172, 117.217142, 31.815229, 117.216753, 31.815124,
79-
117.216652, 31.814308, 117.215726, 31.814049, 117.214769, 31.813517, 117.214111, 31.813717,
80-
117.213552, 31.814099, 117.213024, 31.813954, 117.212897, 31.813892, 117.213224, 31.813681,
81-
117.212788, 31.813147, 117.212928, 31.813018, 117.213063, 31.812956
67+
positions = Cesium.Cartesian3.fromDegreesArrayHeights([
68+
117.213063, 31.812956, 500, 117.213162, 31.812389, 500, 117.212929, 31.812056, 500, 117.213275, 31.811582, 500,
69+
117.21348, 31.811513, 500, 117.214141, 31.811682, 500, 117.21497, 31.811691, 500, 117.216318, 31.811454, 500,
70+
117.216962, 31.812037, 500, 117.217893, 31.812298, 500, 117.218607, 31.811488, 500, 117.219466, 31.810935, 500,
71+
117.224439, 31.810929, 500, 117.225266, 31.811119, 500, 117.225308, 31.81131, 500, 117.224819, 31.811724, 500,
72+
117.225189, 31.811928, 500, 117.225676, 31.811624, 500, 117.225843, 31.811943, 500, 117.22625, 31.812183, 500,
73+
117.226292, 31.81281, 500, 117.225888, 31.813287, 500, 117.226093, 31.814059, 500, 117.22564, 31.814582, 500,
74+
117.225953, 31.814731, 500, 117.225611, 31.814954, 500, 117.22576, 31.815233, 500, 117.224073, 31.816329, 500,
75+
117.223694, 31.81627, 500, 117.222769, 31.817007, 500, 117.222259, 31.816871, 500, 117.221922, 31.816707, 500,
76+
117.221653, 31.816788, 500, 117.22151, 31.817002, 500, 117.221039, 31.816891, 500, 117.220395, 31.816352, 500,
77+
117.220166, 31.815734, 500, 117.219804, 31.815607, 500, 117.219461, 31.815122, 500, 117.21878, 31.814846, 500,
78+
117.218297, 31.815275, 500, 117.217975, 31.815172, 500, 117.217142, 31.815229, 500, 117.216753, 31.815124, 500,
79+
117.216652, 31.814308, 500, 117.215726, 31.814049, 500, 117.214769, 31.813517, 500, 117.214111, 31.813717, 500,
80+
117.213552, 31.814099, 500, 117.213024, 31.813954, 500, 117.212897, 31.813892, 500, 117.213224, 31.813681, 500,
81+
117.212788, 31.813147, 500, 117.212928, 31.813018, 500, 117.213063, 31.812956, 500,
8282
]);
8383

8484
//初始化高级分析功能管理类

website/public/static/demo/cesium/example/data/data-3Dtiles.htm

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,27 @@
1616

1717
//定义三维视图的主要类
1818
var webGlobe;
19-
19+
var thirdPartyLayer;
2020
//地图初始化函数
2121
function init() {
2222
//构造三维视图类(视图容器div的id,三维视图设置参数)
2323
webGlobe = new Cesium.WebSceneControl('GlobeView', {});
2424

2525
//构造第三方图层对象
26-
var thirdPartyLayer = new CesiumZondy.Layer.ThirdPartyLayer({
26+
thirdPartyLayer = new CesiumZondy.Layer.ThirdPartyLayer({
2727
viewer: webGlobe.viewer
2828
});
29-
//加载天地图
30-
var tdtLayer = thirdPartyLayer.appendTDTuMap({
31-
//天地图经纬度数据
32-
url: 'http://t0.tianditu.com/DataServer?T=vec_c&X={x}&Y={y}&L={l}',
33-
//开发token (请到天地图官网申请自己的开发token,自带token仅做功能验证随时可能失效)
34-
token: "9c157e9585486c02edf817d2ecbc7752",
35-
//地图类型 'vec'矢量 'img'影像 'ter'地形
36-
ptype: "img"
37-
});
29+
var osm = thirdPartyLayer.appendOsmMap();
3830

3931
//构造通用数据管理对象
4032
var commonDataManager = new CesiumZondy.Manager.CommonDataManager({
4133
viewer: webGlobe.viewer
4234
});
43-
//加载3DTile数据
35+
var path = './static/data/3DTile/Tileset/tileset.json';
36+
// 加载3DTile数据
4437
var tiles = commonDataManager.append3DTile(
4538
//3DTile数据路径
46-
'./static/data/3DTile/Tileset/tileset.json',
39+
path,
4740
//成功回调函数
4841
load
4942
);

0 commit comments

Comments
 (0)