//搜索查询
|
function poisearch() {
|
|
var queryStr = $("#txt_querypoi").val();
|
if (queryStr != null && queryStr != "") {
|
//根据项目的名字搜索
|
$.ajax({
|
type: "get",
|
async: false,
|
url: httpConfig.webApiUrl + "landstamp/front/3dtileList?name=" + queryStr,
|
contentType: "application/json;charset=utf-8",
|
timeout: 3000,
|
success: function (data) {
|
if (data == null || data.length == 0) {
|
layer.msg('未查询到数据!');
|
return;
|
}
|
var lng;
|
var lat;
|
var head = 0, pitch = -30, range = 1000, offsetLat = 0;
|
for (var i = 0; i < data.length; i++) {
|
if (data[i].status == "0") {//禁用的模型
|
continue;
|
}
|
var id = data[i].tilesId;
|
var projectId = data[i].projectId;
|
currentProjectId = projectId;
|
var url = httpConfig.nginxUrl + data[i].tilesUrl;
|
lng = data[i].lng;
|
lat = data[i].lat;
|
var x = data[i].tilesX == null ? 0 : data[i].tilesX;
|
var y = data[i].tilesY == null ? 0 : data[i].tilesY;
|
var z = data[i].tilesZ == null ? 0 : data[i].tilesZ;
|
var tilesType = data[i].tilesType;
|
|
if (tilesType == "building") {
|
head = data[i].camHeading == null ? 0 : data[i].camHeading;
|
pitch = data[i].camPitch == null ? -30 : data[i].camPitch;
|
range = data[i].camPoi == null ? 1000 : data[i].camPoi;
|
offsetLat = data[i].offsetLat == null ? 0 : data[i].offsetLat;
|
}
|
var options = {
|
"id": id,
|
"url": url,
|
"lng": lng,
|
"lat": lat,
|
"x": x,
|
"y": y,
|
"z": z,
|
"tilesType": tilesType
|
};
|
// console.log(projectId);
|
add3dtiles(options);
|
}
|
|
let flyPromise = viewer.camera.flyTo({
|
duration: 3,
|
destination: Cesium.Cartesian3.fromDegrees(Number(lng), Number(lat) + Number(offsetLat), range),
|
orientation: {
|
heading: Cesium.Math.toRadians(head), //绕垂直于地心的轴旋转
|
pitch: Cesium.Math.toRadians(pitch), //绕纬度线旋转
|
roll: Cesium.Math.toRadians(0) //绕经度线旋转
|
},
|
|
});
|
|
},
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
console.log("ajax请求失败!");
|
},
|
});
|
|
} else {
|
layer.msg('请输入查询内容!');
|
}
|
}
|