//根据id获取单个建筑物
|
function getBuildingById(id){
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/building/getBuildingById.action",
|
data : "buildingId="+id,
|
success : function(data) {
|
if (data.length != 0) {
|
showInfoBuilding_3D(data);
|
showBuildingById(data);
|
}else{
|
swal("获取建筑物信息为空!","请重试!","error");
|
}
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
console.log("ajax请求失败!","请重试!","error");
|
}
|
});
|
}
|
var buildingData;
|
function getBuildingAll(){
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/building/getBuilding.action",
|
contentType : "charset=utf-8",
|
success : function(data) {
|
buildingData = data;
|
showBuildingAll(data);
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
console.log("ajax请求失败!","请重试!","error");
|
}
|
});
|
}
|
//条件查询建筑物信息
|
function queryBuilding(queryData) {
|
var args = JSON.stringify(queryData);
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/building/queryBuilding.action",
|
data : args,
|
contentType : "application/json;charset=utf-8",
|
success : function(data) {
|
if (data.length != 0) {
|
showQueryBuilding(data);
|
}else{
|
console.log("获取建筑物信息为空!");
|
}
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
console.log("条件查询建筑物信息失败!");
|
}
|
});
|
}
|
//上传方法
|
var jsonfullFileName;
|
function checkUpFile(){
|
var acceptFile = ".shp||.dbf||.prj||.sbn||.sbx||.xml||.shx";
|
var fileArr = file.files;
|
var urlStr = randomString(15);
|
for (var i = 0; i < fileArr.length; i++) {
|
var filePath = fileArr[i].name;
|
var ext = filePath.substring(filePath.lastIndexOf(".")).toLowerCase();
|
if (acceptFile.indexOf(ext)!=-1) {
|
var fileSize = 0;
|
var fileMaxSize = 1024*500;//500M
|
if(filePath){
|
fileSize = fileArr[i].size;
|
var size = fileSize / 1024;
|
if (size > fileMaxSize) {
|
swal("文件大小不能大于500M!","请重新选择文件!","error");
|
file.value = "";
|
}else if (size <= 0) {
|
swal("文件大小不能为0M!","请重新选择文件!","error");
|
file.value = "";
|
}else{
|
var fileObj = document.getElementById("file").files[i]; // js 获取文件对象
|
var FileController = "../../easyAPI/uploadFile/uploadshp.action";// 接收上传文件的后台地址
|
jsonfullFileName = urlStr + ext;
|
// FormData 对象
|
var form = new FormData();
|
form.append("fileName", urlStr);// 可以增加表单数据
|
form.append("file", fileObj);// 文件对象
|
|
// XMLHttpRequest 对象
|
var xhr = new XMLHttpRequest();
|
xhr.open("post", FileController, true);
|
// XMLHttpRequest回调函数
|
xhr.onload = function(e) {
|
var divresult = document.getElementById("upResult");
|
//接收响应数据
|
//判断对象状态是否交互完成,如果为4则交互完成 && 判断对象状态是否交互成功,如果成功则为200
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
divresult.value = "文件上传成功!";
|
}else{
|
divresult.value = "文件上传失败,请重新上传!";
|
}
|
};
|
xhr.send(form);
|
}
|
}else{
|
swal("文件选择不成功!","请重新选择文件!","error");
|
}
|
}else{
|
swal("请上传符合shp格式文件!","请重新选择文件!","error");
|
}
|
}
|
}
|
/**随机名称*/
|
function randomString(len) {
|
len = len || 32;
|
/****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
|
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
var maxPos = chars.length;
|
var randomStr = '';
|
for (i = 0; i < len; i++) {
|
randomStr += chars.charAt(Math.floor(Math.random() * maxPos));
|
}
|
return randomStr;
|
}
|
//解析SHP并利用geotools判断面面相交关系
|
function selectbyshp(){
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/building/selectbyshp.action",
|
data : "filename="+jsonfullFileName,
|
success : function(data) {
|
showShpQueryBuilding(data);
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
console.log("ajax请求失败!","请重试!","error");
|
}
|
});
|
}
|
//获取分层分户
|
function getFloorAll(){
|
//请求数据
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/floor/getFloor.action",
|
contentType : "charset=utf-8",
|
success : function(data) {
|
showFloorAll(data);
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
swal("ajax请求失败!","请重试!","error");
|
}
|
});
|
}
|
//获取该户重点人口
|
function getFloorById(id){
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/floor/getFloorById.action",
|
data : "floorId="+id,
|
success : function(data) {
|
console.log(data);
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
swal("ajax请求失败!","请重试!","error");
|
}
|
});
|
}
|
//重点人口信息管理,根据地名地址ID获取人口详细信息
|
function queryKeypeopleByAddId(addId) {
|
$.ajax({
|
type : "post",
|
url : "../../easyAPI/keyPeople/queryKeypeopleByAddId.action",
|
data : "addId="+addId,
|
success : function(data) {
|
if (data.length != 0) {
|
showInfoKeypeople_3D(data);
|
}else{
|
swal("获取重点人口信息为空!","请重试!","error");
|
}
|
},
|
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
console.log("根据ID获取重点人口详细信息失败!");
|
}
|
});
|
}
|