";
var liDom = $(liStr);
var camera = self.map.scene.camera;
var cartographic = Cesium.Cartographic.fromCartesian(camera.position);
var lat = Cesium.Math.toDegrees(cartographic.latitude);
var lng = Cesium.Math.toDegrees(cartographic.longitude);
var height = cartographic.height;
var data = {};
data.id = id;
data.lgtd = lng;
data.lttd = lat;
data.height = height;
data.heading = Cesium.Math.toDegrees(camera.heading);
data.pitch = Cesium.Math.toDegrees(camera.pitch);
data.roll = Cesium.Math.toDegrees(camera.roll);
data.time = 3;
dataArr.push(data);
liDom.on('click', data, function (event) {
});
$('#passPoint').append(liDom);
self.flightTool.RouteCollection.AddSiteByView(id);
id++;
});
//导出路线
$("#export").click(function () {
var data = {
name: $('#routeName').val(),
sites: dataArr
};
var content = JSON.stringify(data);
var blob = new Blob([content], {
type: "text/plain;charset=utf-8"
});
saveAs(blob, "save.json");
dataArr = [];
});
topic.subscribe("autoRoam", lang.hitch(this, this._executeRoam));
topic.subscribe("stopflay", lang.hitch(this, this._stopFlay));
topic.subscribe("stopflays", lang.hitch(this, this.stopFlay));
},
_executeRoam: function _executeRoam(data) {
var that = this;
this.flightTool.flyManager.stop();
this.flightTool.RouteCollection.removeAllSites();
var selectRoute = this.allRoutes.find(function (x) {
if (x.flyname == data) {
return x
}
});
$.ajax({
url: 'http://sw797.com:82/blade-ycreal/flyroute/selectInfo?fnid=' + selectRoute.id,
type: 'post',
dataType: 'JSON',
success: function (data) {
for (var i = 0; i < data.data.length; i++) {
var cartesian3 = Cesium.Cartesian3.fromDegrees(data.data[i].lgtd, data.data[i].lttd, data.data[i].height + 10000000000);
var site = {
"ids": data.data[i].id,
"position_x": cartesian3.x,
"position_y": cartesian3.y,
"position_z": cartesian3.z,
"pitch": Cesium.Math.toRadians(data.data[i].pitch),
"heading": Cesium.Math.toRadians(data.data[i].heading),
"roll": Cesium.Math.toRadians(data.data[i].roll),
"time": data.data[i].time
};
that.flightTool.allSites[i] = site;
}
that.flightTool.flyManager.play();
}
})
},
_stopFlay: function _stopFlay(data) {
if (data) {
this.flightTool.flyManager.stop();
this.flightTool.RouteCollection.removeAllSites();
}
},
stopFlay: function stopFlay() {
this.flightTool.flyManager.stop();
this.flightTool.RouteCollection.removeAllSites();
},
_loadRoute: function _loadRoute(route) {
var self = this;
$("#passPoint").empty();
self.flightTool.RouteCollection.AddRoute(route);
for (var j = 0; j < route.length; j++) {
var liStr = "
途径点" + (j + 1) + "
";
var liDom = $(liStr);
liDom.on('click', route[j], function (event) {
var site = self.flightTool.RouteCollection.getSiteByIndex(event.data.id);
self.flightTool.flyManager.viewToSite(site);
});
$('#passPoint').append(liDom);
}
},
onOpen: function onOpen() {
//面板打开的时候触发 (when open this panel trigger)
},
onClose: function onClose() {
//面板关闭的时候触发 (when this panel is closed trigger)
},
onMinimize: function onMinimize() {
this.resize();
},
onMaximize: function onMaximize() {
this.resize();
},
resize: function resize() {},
destroy: function destroy() {
//销毁的时候触发
//todo
//do something before this func
this.inherited(arguments);
}
});
});