// 融合方法
import { simpleMap, thereDmap, anyingMap } from "./Mapeffects";
import { addModel, delModel } from "./Modeleffects";
import { Weather } from "./environment";
import {
setflyTo,
emergencyAlarm,
makeRotundity,
Polyline,
moveModelToPosition,
invertedTriangle,
nightVision,
makeContour,
addmarked,
guanbi,
} from "./Animationeffects";
import "./cesiumbowenyuan.js";
import MeasureDistance from "./cesiumceju.js";
import { isTranslucent } from "cesium";
// 融合方法,地图创建并添加报警效果,并标示报警源和视角拉近
function fusionalarm(that, mapName, baojing) {
simpleMap(that, mapName);
setflyTo(
that.viewer,
baojing.longitude,
baojing.latitude,
baojing.height,
3,
0,
-45,
0
);
emergencyAlarm(that.viewer);
makeRotundity(that.viewer, baojing.longitude, baojing.latitude, 50, "圆形");
that.viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(
baojing.longitude,
baojing.latitude
),
name: "波纹圆",
ellipse: {
semiMinorAxis: 1000.0,
semiMajorAxis: 1000.0,
material: new Cesium.CircleRippleMaterialProperty({
color: new Cesium.Color(1, 0, 0, 0.5), // 设置红色和透明度
speed: 12.0,
count: 4,
gradient: 0.2,
}),
},
});
}
// 融合方法,创建地图帮添加模型并平缓的移动到当前位置并显示历史轨迹
function fusionModelMovement(
that,
mapName,
old,
news,
name,
color,
pointcolor,
issetflyTo,
isdelmod
) {
if (issetflyTo) {
simpleMap(that, mapName);
setflyTo(
that.viewer,
old.longitude,
old.latitude,
old.height,
3,
0,
-45,
0
);
}
Polyline(
that.viewer,
old.longitude,
old.latitude,
old.height,
news.longitude,
news.latitude,
news.height,
name,
color,
pointcolor
);
let startPosition = Cesium.Cartesian3.fromDegrees(
old.longitude,
old.latitude,
old.height
);
let endPosition = Cesium.Cartesian3.fromDegrees(
news.longitude,
news.latitude,
news.height
);
moveModelToPosition(that.viewer, startPosition, endPosition, isdelmod);
}
// 融合方法,设备模型创建并添加锥形旋转
function modelCreation(that, mapName, model) {
simpleMap(that, mapName);
setflyTo(
that.viewer,
model.longitude,
model.latitude,
model.height,
3,
0,
-45,
0
);
addModel(
that.viewer,
model.longitude,
model.latitude,
model.height,
model.name,
model.url,
model.scale,
10,
2000,
-90,
-45,
0
);
invertedTriangle(
that.viewer,
model.longitude,
model.latitude,
model.height + 60,
model.name + "yuanzhui"
);
}
// 融合方法,cesium添加夜视效果并添加轮廓显示效果
function nightVisionall(that, mapName, model) {
simpleMap(that, mapName);
setflyTo(
that.viewer,
model.longitude,
model.latitude,
model.height,
3,
0,
-45,
0
);
thereDmap(that.viewer);
nightVision(that.viewer);
makeContour(that.viewer);
}
// 融合方法,cesium创建世界并添加雨雪雾等天气 并添加视角跳转和3D世界图
function rainSnow(that, mapName, model) {
simpleMap(that, mapName);
// anyingMap(that.viewer)
setflyTo(
that.viewer,
model.longitude,
model.latitude,
model.height,
3,
0,
-45,
0
);
thereDmap(that.viewer);
Weather(that.viewer, true, true, false);
}
// 融合方法,cesium 地图创建并添加测距效果
function ranging(that, mapName, ismap, isranging, istrue) {
if (ismap) {
simpleMap(that, mapName);
}
// 实例化MeasureDistance类
if (isranging) {
const measureDistance = new MeasureDistance(that.viewer, "jijiui");
// 激活测距功能
measureDistance.activate();
}
if (istrue) {
let lengthents = [];
let entities = that.viewer.entities.values;
entities.forEach(function (entity) {
// 检查实体的名称是否与指定的名称匹配
if (entity.name === "jijiui") {
// 根据名称删除实体
lengthents.push(entity);
// that.viewer.entities.remove(entity);
}
});
for (let index = 0; index < lengthents.length; index++) {
that.viewer.entities.remove(lengthents[index]);
}
}
}
// 融合方法,cesium 地图获取经纬度
function getpostion(that, isleft) {
if (isleft) {
addmarked(that.viewer);
}
}
export {
fusionalarm,
fusionModelMovement,
modelCreation,
nightVisionall,
rainSnow,
ranging,
getpostion,
};
cesium 融合方法使用
最新推荐文章于 2024-06-28 10:20:45 发布