Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/cesiumjs/layer/TilesLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export default class TilesLayer extends BaseLayer {
* @param {Rectangle} [optionsParam.tileRange=Rectangle.fromDegrees(-180,-90,180,90)] 默认范围为全球范围
* @param {Number} [optionsParam.colNum=2] 瓦片初始级的列数 默认为2
* @param {Number} [optionsParam.rowNum=1] 瓦片初始级的列数 默认为1
* @param {Number} [options.minimumLevel=0] 瓦片最小级别
* @param {Number} [options.maximumLevel=19] 瓦片最大级别
* @param {Number} [optionsParam.maxLevel=19] 瓦片最大显示级数 默认为19
* @param {String} [optionsParam.proxy] 转发代理
* @param {Array} [options.gdbps] gdbps地址数组
* @param {String} [options.layers] layers参数,用于过滤图层
Expand Down
4 changes: 2 additions & 2 deletions src/cesiumjs/manager/CommonDataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default class CommonDataManager extends LayerManager {
* @returns {Object} model 移除通过 removeModel()
* @example
* let modelUrl = '../../../../../../static/data/CesiumAir/Cesium_Air.gltf';
cesiumFun.appendModel('1', modelUrl, 114, 28, 200, 100000, {
cesiumFun.appendModels('1', modelUrl, 114, 28, 200, 100000, {
color: Cesium.Color.RED,
colorBlendMode: Cesium.ColorBlendMode.MIX,// MIX是混合 Cesium.ColorBlendMode.HIGHLIGHT, HIGHLIGHT是高亮
colorBlendAmount: 0.4 //这个是程度
Expand Down Expand Up @@ -160,7 +160,7 @@ export default class CommonDataManager extends LayerManager {

/**
* 通过文件批量添加模型
* @function module:客户端公共方法.CommonDataManager.prototype.appendModelsByFile
* @function module:客户端公共方法.CommonDataManager.prototype.appendModels
* @param {String} filePath 模型组织文件
* @param {Function} successCall 成功后的回调
* @returns {Object} 模型层对象
Expand Down
60 changes: 10 additions & 50 deletions src/cesiumjs/manager/CommonFuncManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,8 @@ export default class CommonFuncManager {
* //res.toPng();
*/
outputImageObj() {
let isAn = true;
if (this.viewer.shouldAnimate === false) {
this.viewer.shouldAnimate === true;
isAn = false;
}
this.viewer.render();
if (!isAn) {
this.viewer.shouldAnimate === false;
}
return Cesium.ReImg.fromCanvas(this.viewer.canvas);
return Cesium.reimg.fromCanvas(this.viewer.canvas);
}

/**
Expand All @@ -161,7 +153,7 @@ export default class CommonFuncManager {
*/
outputImageFile(fileName) {
this.viewer.render();
Cesium.ReImg.fromCanvas(this.viewer.canvas).downloadPng(fileName);
Cesium.reimg.fromCanvas(this.viewer.canvas).downloadPng(fileName);
}

/**
Expand Down Expand Up @@ -203,13 +195,6 @@ export default class CommonFuncManager {
* @function module:客户端公共方法.CommonFuncManager.prototype.getSceneRange
* @param {String} 视图元素ID
* @returns {Array[]} 场景范围(单位:经纬度)Array<[lon,lat]>
* @example
* var viewer = new Cesium.Viewer('GlobeView1', {
* terrainExaggeration: 1,
* requestRenderMode: true
* });
* let id = 'GlobeView1';
* cfm.getSceneRange(id);
*/
getSceneRange(elementID) {
const controlDiv = document.getElementById(elementID);
Expand Down Expand Up @@ -457,33 +442,15 @@ export default class CommonFuncManager {
let carCenter = new Cesium.Cartographic();
carCenter = Cesium.Cartographic.fromCartesian(center, this.ellipsoid, carCenter);
carCenter.height = 0;
const centerUse = Cesium.Cartesian3.fromRadians(
carCenter.longitude,
carCenter.latitude,
carCenter.height,
this.ellipsoid,
new Cesium.Cartesian3()
);
const centerUseEx = Cesium.Cartesian3.fromRadians(
carCenter.longitude,
carCenter.latitude + 0.1,
carCenter.height,
this.ellipsoid,
new Cesium.Cartesian3()
);
const centerUse = Cesium.Cartesian3.fromRadians(carCenter.longitude, carCenter.latitude, carCenter.height, this.ellipsoid, new Cesium.Cartesian3());
const centerUseEx = Cesium.Cartesian3.fromRadians(carCenter.longitude, carCenter.latitude + 0.1, carCenter.height, this.ellipsoid, new Cesium.Cartesian3());
let tempdir = Cesium.Cartesian3.subtract(centerUseEx, centerUse, new Cesium.Cartesian3());
tempdir = Cesium.Cartesian3.normalize(tempdir, tempdir);

let carTarget = new Cesium.Cartographic();
carTarget = Cesium.Cartographic.fromCartesian(target, this.ellipsoid, carTarget);
carTarget.height = 0;
const targetUse = Cesium.Cartesian3.fromRadians(
carTarget.longitude,
carTarget.latitude,
carTarget.height,
this.ellipsoid,
new Cesium.Cartesian3()
);
const targetUse = Cesium.Cartesian3.fromRadians(carTarget.longitude, carTarget.latitude, carTarget.height, this.ellipsoid, new Cesium.Cartesian3());

let tarDir = Cesium.Cartesian3.subtract(targetUse, centerUse, new Cesium.Cartesian3());
tarDir = Cesium.Cartesian3.normalize(tarDir, tarDir);
Expand Down Expand Up @@ -529,8 +496,8 @@ export default class CommonFuncManager {
* let drawElement = new Cesium.DrawElement(viewer);
* let commfun = new CommonFun({viewer:viewer});
* drawElement.startDrawingPolyline({
* callback: function(result){
* let simplify = commfun.simplifyLine(result.positions);
* callback: function(positions){
* let simplify = commfun.simplifyLine(positions);
* polyline = new Cesium.DrawElement.PolylinePrimitive({
* positions: simplify,
* width: 1,
Expand All @@ -553,11 +520,7 @@ export default class CommonFuncManager {
}
for (let i = 0; i <= posCopy.length - 3; i += 1) {
const isVertice = !((posCopy[i].z - posCopy[i + 1].z) * (posCopy[i + 1].z - posCopy[i + 2].z) > 0);
const angle = calAngleOf3Pnt(
[posCopy[i].x, posCopy[i].y, posCopy[i].z],
[posCopy[i + 1].x, posCopy[i + 1].y, posCopy[i + 1].z],
[posCopy[i + 2].x, posCopy[i + 2].y, posCopy[i + 2].z]
);
const angle = calAngleOf3Pnt([posCopy[i].x, posCopy[i].y, posCopy[i].z], [posCopy[i + 1].x, posCopy[i + 1].y, posCopy[i + 1].z], [posCopy[i + 2].x, posCopy[i + 2].y, posCopy[i + 2].z]);

if (angle > 175 && !isVertice) {
posCopy = posCopy.slice(0, i + 1).concat(posCopy.slice(i + 2));
Expand Down Expand Up @@ -592,10 +555,7 @@ export default class CommonFuncManager {
static calcParabola(options) {
// 方程 y=-(4h/L^2)*x^2+h h:顶点高度 L:横纵间距较大者
const h = options.height && options.height > 5000 ? options.height : 5000;
const L =
Math.abs(options.position1.lon - options.position2.lon) > Math.abs(options.position1.lat - options.position2.lat)
? Math.abs(options.position1.lon - options.position2.lon)
: Math.abs(options.position1.lat - options.position2.lat);
const L = Math.abs(options.position1.lon - options.position2.lon) > Math.abs(options.position1.lat - options.position2.lat) ? Math.abs(options.position1.lon - options.position2.lon) : Math.abs(options.position1.lat - options.position2.lat);
const num = options.num && options.num > 50 ? options.num : 50;
const result = [];
let dlt = L / num;
Expand Down Expand Up @@ -753,7 +713,7 @@ export default class CommonFuncManager {
});
*/
createNavigationTool(options) {
this.viewer.extend(Cesium.NavigationTool, options);
this.viewer.extend(Cesium.viewerCesiumNavigationMixin, options);
return this.viewer.cesiumNavigation;
}
}
Expand Down
14 changes: 2 additions & 12 deletions src/cesiumjs/manager/EntityController.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,22 +422,12 @@ export default class EntityController extends BaseLayer {
positions: simplifyPnts,
width: 1,
geodesic: true,
id: name,
vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
id: name
};
var color = Cesium.defaultValue(options.color,Cesium.Color.BLUE);
if (Cesium.defined(options)) {
Object.extend(para, options);
}
var polyline = new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.PolylineGeometry(para),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(color)
}
}),
appearance: new Cesium.PolylineColorAppearance()
})
const polyline = new Cesium.PathTool.PolylinePrimitive(para);
this.scene.primitives.add(polyline);
if (typeof callback === 'function') {
callback(polyline);
Expand Down