2023-07-18 09:04:15 +08:00
|
|
|
|
(function (window, mars3d) {
|
2023-07-08 15:37:34 +08:00
|
|
|
|
//创建widget类,需要继承BaseWidget
|
|
|
|
|
|
class MyWidget extends mars3d.widget.BaseWidget {
|
|
|
|
|
|
//弹窗配置
|
|
|
|
|
|
get view() {
|
|
|
|
|
|
return {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
type: "window",
|
|
|
|
|
|
url: "view.html",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
windowOptions: {
|
|
|
|
|
|
width: 350,
|
|
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
};
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//gaodePOI 通过输入名称选点
|
|
|
|
|
|
queryPOI(text, type) {
|
|
|
|
|
|
if (!text || !type) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.gaodePOI.queryText({
|
|
|
|
|
|
text: text,
|
2023-07-18 09:04:15 +08:00
|
|
|
|
city: "合肥市",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
success: (res) => {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.viewWindow.setHtmlInMCXD(res, type); //展示搜索结果
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
error: (msg, error) => {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
window.toastr.error(msg);
|
|
|
|
|
|
haoutil.loading.close();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//初始化[仅执行1次]
|
|
|
|
|
|
create() {
|
|
|
|
|
|
this.gaodeRoute = new mars3d.query.GaodeRoute({
|
|
|
|
|
|
// key: ['ae29a37307840c7ae4a785ac905927e0'],
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
this.gaodePOI = new mars3d.query.GaodePOI({
|
|
|
|
|
|
// key: ['ae29a37307840c7ae4a785ac905927e0'],
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//图层管理使用的分组
|
|
|
|
|
|
this.groupLayer = new mars3d.layer.GroupLayer({
|
|
|
|
|
|
name: this.config.name,
|
|
|
|
|
|
pid: 99, //图层管理 中使用,父节点id
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//创建矢量数据图层
|
|
|
|
|
|
this.pointLayer = new mars3d.layer.GraphicLayer({
|
2023-07-18 09:04:15 +08:00
|
|
|
|
name: this.config.name + "-起止点",
|
|
|
|
|
|
});
|
|
|
|
|
|
this.groupLayer.addLayer(this.pointLayer); //加入分组
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
this.routeLayer = new mars3d.layer.GraphicLayer({
|
2023-07-18 09:04:15 +08:00
|
|
|
|
name: this.config.name + "-路线",
|
|
|
|
|
|
});
|
|
|
|
|
|
this.groupLayer.addLayer(this.routeLayer); //加入分组
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//设置路线随机色
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.randomColor = ["#eaf731", "#57f72e", "#2effd2", "#cc6e26", "#ff2ec7"];
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//每个窗口创建完成后调用
|
|
|
|
|
|
winCreateOK(opt, result) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.viewWindow = result;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//打开激活
|
|
|
|
|
|
activate() {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.addLayer(this.groupLayer);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//关闭释放
|
|
|
|
|
|
disable() {
|
|
|
|
|
|
if (this.startGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startGraphic.remove();
|
|
|
|
|
|
this.startGraphic = null;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (this.endGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.endGraphic.remove();
|
|
|
|
|
|
this.endGraphic = null;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.removeLayer(this.groupLayer);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.clearCoumpute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//=======================起点===============================
|
|
|
|
|
|
//绘制起点
|
|
|
|
|
|
drawStartPoint(callback) {
|
|
|
|
|
|
if (this.startGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startGraphic.remove();
|
|
|
|
|
|
this.startGraphic = null;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.pointLayer.startDraw({
|
2023-07-18 09:04:15 +08:00
|
|
|
|
type: "billboard",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
style: {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
image: this.path + "img/start.png",
|
|
|
|
|
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
success: (graphic) => {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startGraphic = graphic;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
if (callback) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
var point = graphic.point;
|
|
|
|
|
|
point.format();
|
|
|
|
|
|
callback(point.lng + "," + point.lat);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startCompute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//输入起点坐标
|
|
|
|
|
|
inputStartPoint(jd, wd) {
|
|
|
|
|
|
if (!jd || !wd) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
let point = [jd, wd];
|
2023-07-08 15:37:34 +08:00
|
|
|
|
if (this.startGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startGraphic.position = point;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.startGraphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
|
position: point,
|
|
|
|
|
|
style: {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
image: this.path + "img/start.png",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
scale: 1,
|
|
|
|
|
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.pointLayer.addGraphic(this.startGraphic);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.flyToPoint(point, { radius: 2500 });
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startCompute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//查询起点坐标
|
|
|
|
|
|
queryStartPoint(text) {
|
|
|
|
|
|
if (!text) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
window.toastr.error("请输入查询条件!");
|
|
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.queryPOI(text, "start");
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//=======================终点===============================
|
|
|
|
|
|
//绘制终点
|
|
|
|
|
|
drawEndPoint(callback) {
|
|
|
|
|
|
if (this.endGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.endGraphic.remove();
|
|
|
|
|
|
this.endGraphic = null;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.pointLayer.startDraw({
|
2023-07-18 09:04:15 +08:00
|
|
|
|
type: "billboard",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
style: {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
image: this.path + "img/end.png",
|
|
|
|
|
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
success: (graphic) => {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.endGraphic = graphic;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
if (callback) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
var point = graphic.point;
|
|
|
|
|
|
point.format();
|
|
|
|
|
|
callback(point.lng + "," + point.lat);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startCompute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//输入终点坐标
|
|
|
|
|
|
inputEndPoint(jd, wd) {
|
|
|
|
|
|
if (!jd || !wd) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
let point = [jd, wd];
|
2023-07-08 15:37:34 +08:00
|
|
|
|
if (this.endGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.endGraphic.position = point;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.endGraphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
|
position: point,
|
|
|
|
|
|
style: {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
image: this.path + "img/end.png",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
scale: 1,
|
|
|
|
|
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.pointLayer.addGraphic(this.endGraphic);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.flyToPoint(point, { radius: 2500 });
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.startCompute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//查询终点坐标
|
|
|
|
|
|
queryEndPoint(text) {
|
|
|
|
|
|
if (!text) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
window.toastr.error("请输入查询条件!");
|
|
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.queryPOI(text, "end");
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//===================开始计算路线========================
|
|
|
|
|
|
//清除计算的结果
|
|
|
|
|
|
clearCoumpute() {
|
|
|
|
|
|
//清除路线
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.routeLayer.clear();
|
|
|
|
|
|
this.viewWindow.clearRouteContent(); //清除页面搜索结果
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//取消当前的视角跟随
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.removeTrack();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
$("#mapDH_speed").remove();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//开始计算
|
|
|
|
|
|
startCompute() {
|
|
|
|
|
|
if (!this.startGraphic || !this.endGraphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//清除上一次的计算结果
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.clearCoumpute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//当两点存在时 自动计算
|
|
|
|
|
|
this.gaodeRoute.query({
|
|
|
|
|
|
points: [this.startGraphic.coordinate, this.endGraphic.coordinate],
|
|
|
|
|
|
type: 3,
|
2023-07-18 09:04:15 +08:00
|
|
|
|
extensions: "all",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
strategy: 11,
|
|
|
|
|
|
success: (data) => {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.viewWindow.startCompute();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
if (!data || data.paths.length < 1) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.viewWindow.showRouteBox(true);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//添加速度控制面板
|
|
|
|
|
|
for (var i = 0; i < data.paths.length; i++) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
var path = data.paths[i];
|
|
|
|
|
|
var points = path.points;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
if (!path.steps || path.steps.length < 1 || !points || points.length < 1) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
continue;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let graphic = new mars3d.graphic.PolylineEntity({
|
|
|
|
|
|
positions: points,
|
|
|
|
|
|
style: {
|
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
|
color: this.randomColor[i % 5],
|
|
|
|
|
|
opacity: 0.8,
|
|
|
|
|
|
width: 4,
|
|
|
|
|
|
},
|
|
|
|
|
|
attr: path,
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.routeLayer.addGraphic(graphic);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//漫游路线
|
|
|
|
|
|
let flyLine = new mars3d.graphic.RoamLine({
|
2023-07-18 09:04:15 +08:00
|
|
|
|
positions: points,
|
2023-07-08 15:37:34 +08:00
|
|
|
|
speed: 200,
|
2023-07-18 09:04:15 +08:00
|
|
|
|
camera: { type: "" },
|
2023-07-08 15:37:34 +08:00
|
|
|
|
model: {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
uri: "//data.mars3d.cn/gltf/mars/qiche.gltf",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
scale: 0.3,
|
|
|
|
|
|
minimumPixelSize: 30,
|
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
attr: {
|
|
|
|
|
|
lineId: graphic.id,
|
|
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.routeLayer.addGraphic(flyLine);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//展示路径信息
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.viewWindow.showRouteInfo(graphic.id, path);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.routeLayer.flyTo();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
},
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============= 计算漫游路线 ======================
|
|
|
|
|
|
getFlylineById(id) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return this.routeLayer.getGraphicByAttr("lineId", id);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
roamOneById(id) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.nowFline = this.getFlylineById(id);
|
|
|
|
|
|
this.nowFline.show = true;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
this.nowFline.start(() => {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.reset();
|
|
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//漫游自动结束 或点击 停止导航按钮 后,重置界面和操作
|
|
|
|
|
|
reset() {
|
|
|
|
|
|
//漫游结束 重置按钮 取消跟随
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.resetBtn();
|
|
|
|
|
|
this.removeTrack();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
if (this.nowFline) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.nowFline.show = false;
|
|
|
|
|
|
this.nowFline = null;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//重置速度面板
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.clock.multiplier = 1;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//还原线的高亮
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.highLightLine();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//重置按钮
|
|
|
|
|
|
resetBtn() {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.viewWindow.resetButton();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//取消当前的视角跟随
|
|
|
|
|
|
removeTrack() {
|
|
|
|
|
|
if (this.nowFline) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.nowFline.setCameraOptions({ type: "" });
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.trackedEntity = undefined;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
//==============开始导航===================
|
|
|
|
|
|
startDH(id, isGS) {
|
|
|
|
|
|
//导航前释放之前的所有导航操作
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.reset();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
if (!id) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.roamOneById(id);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
if (isGS) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.nowFline.setCameraOptions({
|
|
|
|
|
|
type: "gs",
|
|
|
|
|
|
heading: 0,
|
|
|
|
|
|
radius: 2500,
|
|
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//============开始视角跟随=============
|
|
|
|
|
|
startGS(id, ele) {
|
|
|
|
|
|
//判断当前点击的视角跟随的id 是否是已在导航时的id
|
|
|
|
|
|
if (this.nowFline) {
|
|
|
|
|
|
//表示已开始漫游即已点击开始导航
|
|
|
|
|
|
if (this.nowFline.attr.lineId == id) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.nowFline.setCameraOptions({
|
|
|
|
|
|
type: "gs",
|
|
|
|
|
|
heading: 0,
|
|
|
|
|
|
radius: 2500,
|
|
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
} else {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
window.toastr.error("当前路径沒有车辆运行!");
|
2023-07-08 15:37:34 +08:00
|
|
|
|
if (ele) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
ele.prop("checked", false);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//==================其它方法=====================
|
|
|
|
|
|
highLightLine(id) {
|
|
|
|
|
|
if (this.lastRoute) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.lastRoute.entityGraphic.material = this.lastRoute.entityGraphic.material_old;
|
|
|
|
|
|
this.lastRoute.entityGraphic.width = this.lastRoute.entityGraphic.width_old;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!id) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//动画线材质
|
2023-07-18 09:04:15 +08:00
|
|
|
|
let graphic = this.routeLayer.getGraphicById(id);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
if (!graphic) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!graphic.entityGraphic.material_old) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
graphic.entityGraphic.material_old = graphic.entityGraphic.material;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!graphic.entityGraphic.width_old) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
graphic.entityGraphic.width_old = graphic.entityGraphic.width;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
graphic.entityGraphic.width = 10;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
graphic.entityGraphic.material = new mars3d.material.LineFlowMaterialProperty({
|
|
|
|
|
|
color: Cesium.Color.AQUA,
|
2023-07-18 09:04:15 +08:00
|
|
|
|
image: "./img/textures/arrow2.png",
|
2023-07-08 15:37:34 +08:00
|
|
|
|
repeat: new Cesium.Cartesian2(50, 1),
|
|
|
|
|
|
speed: 40, //速度,建议取值范围1-100
|
2023-07-18 09:04:15 +08:00
|
|
|
|
});
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
graphic.flyTo();
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.lastRoute = graphic;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
resetSpeed(num) {
|
|
|
|
|
|
if (num == undefined) {
|
2023-07-18 09:04:15 +08:00
|
|
|
|
return;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
2023-07-18 09:04:15 +08:00
|
|
|
|
this.map.clock.multiplier = num / 120;
|
2023-07-08 15:37:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//注册到widget管理器中。
|
2023-07-18 09:04:15 +08:00
|
|
|
|
mars3d.widget.bindClass(MyWidget);
|
2023-07-08 15:37:34 +08:00
|
|
|
|
|
|
|
|
|
|
//每个widet之间都是直接引入到index.html中,会存在彼此命名冲突,所以闭包处理下。
|
2023-07-18 09:04:15 +08:00
|
|
|
|
})(window, mars3d);
|