(function (window, mars3d) {
//创建widget类,需要继承BaseWidget
class MyWidget extends mars3d.widget.BaseWidget {
//弹窗配置
get view() {
return {
type: "window",
url: "view.html",
windowOptions: {
width: 350,
},
};
}
reloadData(new_taxi_sn) {
this.viewWindow.resetStartQueryTaxiDataText(new_taxi_sn);
this.taxi_sn = new_taxi_sn;
if (this.startGraphic) {
this.startGraphic.remove();
this.startGraphic = null;
}
if (this.endGraphic) {
this.endGraphic.remove();
this.endGraphic = null;
}
this.routeLayer.clear();
}
clearReplayLayers() {
this.pointLayer.clear();
this.routeLayer.clear();
}
addTaxiReplayGraphic(points) {
this.startGraphic = new mars3d.graphic.BillboardEntity({
position: points[0],
style: {
image: this.path + "img/start.png",
scale: 1,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
clampToGround: true,
},
});
this.pointLayer.addGraphic(this.startGraphic);
this.endGraphic = new mars3d.graphic.BillboardEntity({
position: points[points.length - 1],
style: {
image: this.path + "img/end.png",
scale: 1,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
clampToGround: true,
},
});
this.pointLayer.addGraphic(this.endGraphic);
let graphic = new mars3d.graphic.PolylineEntity({
positions: points,
style: {
width: 10,
material: new mars3d.material.LineFlowMaterialProperty({
color: Cesium.Color.AQUA,
image: "./img/textures/arrow2.png",
repeat: new Cesium.Cartesian2(50, 1),
speed: 40, //速度,建议取值范围1-100
})
},
});
this.routeLayer.addGraphic(graphic);
this.routeLayer.flyTo();
}
addTaxiPointInfoGraphic() {
var Pointsdata = mars3d.global_variables.singleTaxiReplayData
for (var i = 0, len = Pointsdata.length; i < len; i++) {
var item = Pointsdata[i];
var lng = Number(item["lon"]); //经度
var lat = Number(item["lat"]); //纬度
var position = null;
if (lng && lat) {
position = Cesium.Cartesian3.fromDegrees(lng, lat);
}
item = changeNullAndundefinedToEmpty(item)
var CircleEntity = new mars3d.graphic.CircleEntity({
position: position,
style: {
radius: 8.0,
diffHeight: this.qindex == "co" ? 20 * item[this.qindex] : item[this.qindex], //高度
color:this.viewWindow.getLayerPointColorByQindexandValue(1004,this.qindex, item[this.qindex]),
opacity: 0.5,
rotationDegree: 45,
highlight: {
opacity: 1
}
},
item: item,
popup:"编号:" +
item["code"] +
"
时间:" +
item["datatime"] +
"
车速:" +
item["speed"] +
"
| PM₂.₅: | " + item["pm25"] + ' ' + " | μg/m³ |
| PM₁₀: | " + item["pm10"] + ' ' + " | μg/m³ |
| NO: | " + item["no"] + ' ' + " | μg/m³ |
| NO₂: | " + item["no2"] + ' ' + " | μg/m³ |
| NOₓ: | " + item["nox"] + ' ' + " | μg/m³ |
| CO: | " + item["co"] + ' ' + " | mg/m³ |