添加关照、全局等高线、修改图层问题
This commit is contained in:
@ -138,12 +138,20 @@ export default {
|
||||
// filePaths数组中包含图片类型(区分大小写)和其他类型区分开
|
||||
this.picturePaths = [];
|
||||
this.otherPaths = [];
|
||||
// filePaths.forEach((item) => {
|
||||
// if (item.endsWith(".png") || item.endsWith(".jpg") || item.endsWith(".jpeg") || item.endsWith(".PNG") || item.endsWith(".JPG") || item.endsWith(".JPEG")) {
|
||||
// this.picturePaths.push(item);
|
||||
// } else if (item.endsWith(".kml") || item.endsWith(".kmz") || item.endsWith(".czml") || item.endsWith(".geojson") || item.endsWith(".shp") || item.endsWith(".tab") || item.endsWith(".csv") || item.endsWith(".mif") || item.endsWith(".clt") || item.endsWith(".pak") || item.endsWith(".jct") || item.endsWith(".terrain") || item.endsWith(".bim") || item.endsWith(".json")) {
|
||||
// this.otherPaths.push(item);
|
||||
// } else {
|
||||
// this.$message.error("不支持的文件类型!");
|
||||
// }
|
||||
// });
|
||||
filePaths.forEach((item) => {
|
||||
// 转换为小写
|
||||
item = item.toLowerCase();
|
||||
if (item.endsWith(".png") || item.endsWith(".jpg") || item.endsWith(".jpeg")) {
|
||||
// 使用正则表达式进行不区分大小写的匹配
|
||||
if (/\.(png|jpg|jpeg)$/i.test(item)) {
|
||||
this.picturePaths.push(item);
|
||||
} else if (item.endsWith(".kml") || item.endsWith(".kmz") || item.endsWith(".czml") || item.endsWith(".geojson") || item.endsWith(".shp") || item.endsWith(".tab") || item.endsWith(".csv") || item.endsWith(".mif") || item.endsWith(".clt") || item.endsWith(".pak") || item.endsWith(".jct") || item.endsWith(".terrain") || item.endsWith(".bim") || item.endsWith(".json")) {
|
||||
} else if (/\.(kml|kmz|czml|geojson|shp|tab|csv|mif|clt|pak|jct|terrain|bim|json|mbtiles)$/i.test(item)) {
|
||||
this.otherPaths.push(item);
|
||||
} else {
|
||||
this.$message.error("不支持的文件类型!");
|
||||
@ -265,15 +273,36 @@ export default {
|
||||
cusAddNodes(this.$parent.treeObj, DbOption.p_id, [item]);
|
||||
});
|
||||
}
|
||||
).catch((err) => {
|
||||
this.$message.error("导入失败!", err);
|
||||
});
|
||||
)
|
||||
// .catch((err) => {
|
||||
// this.$message.error("导入失败!", err);
|
||||
// });
|
||||
},
|
||||
getLastPathComponent(path, extensionsToRemove = []) {
|
||||
// 处理路径分隔符
|
||||
const normalizedPath = path.replace(/\\/g, '/');
|
||||
const lastComponent = normalizedPath.split('/').pop();
|
||||
|
||||
// 如果没有提供需要移除的后缀列表,直接返回原始名称
|
||||
if (extensionsToRemove.length === 0) return lastComponent;
|
||||
|
||||
// 检查是否匹配任何需要移除的后缀
|
||||
for (const ext of extensionsToRemove) {
|
||||
const extWithDot = ext.startsWith('.') ? ext : `.${ext}`;
|
||||
if (lastComponent.endsWith(extWithDot)) {
|
||||
return lastComponent.slice(0, -extWithDot.length);
|
||||
}
|
||||
}
|
||||
|
||||
return lastComponent;
|
||||
},
|
||||
|
||||
// 添加资源
|
||||
addResource(filePaths) {
|
||||
let p_id = getKeyOfSelectedNode(this.$parent.treeObj, "source_id");
|
||||
filePaths.forEach((item) => {
|
||||
let name = getNamefromPath2(item);
|
||||
console.log('item', item);
|
||||
let name = this.getLastPathComponent(item,['clt','json','pak','kml','kmz','shp','geojson','geoJson', 'czml','jct','mif','tab','csv']);
|
||||
console.log("name", name);
|
||||
let source_type = "layer";
|
||||
if (item.endsWith(".clt") || item.endsWith(".json")) {
|
||||
@ -512,74 +541,70 @@ export default {
|
||||
if (way == "net") {
|
||||
treeSearchCb("");
|
||||
this.loading = true;
|
||||
this.loadAmp((err = "") => {
|
||||
// console.log("isOnline", this.isOnline);
|
||||
if (err) {
|
||||
this.$message.error("无网络连接,请检查网络");
|
||||
} else {
|
||||
this.mapModule.plugin(
|
||||
["AMap.PlaceSearch", "AMap.AutoComplete"],
|
||||
() => {
|
||||
// var auto = new AMap.AutoComplete(autoOptions);
|
||||
let placeSearch = new AMap.PlaceSearch(); //构造地点查询类
|
||||
var autoComplete = new AMap.AutoComplete();
|
||||
try {
|
||||
placeSearch.search(
|
||||
$("#keyword")
|
||||
.val()
|
||||
.trim(),
|
||||
(status, result) => {
|
||||
// console.log("高德地图----------", status, result);
|
||||
if (result.info && result.info === "OK") {
|
||||
let arr = [];
|
||||
result.poiList.pois.forEach((item, index) => {
|
||||
const location = YJ.CoordTransform.GCJ02ToWGS84(
|
||||
item.location.lng,
|
||||
item.location.lat
|
||||
);
|
||||
arr.push({
|
||||
address: item.name,
|
||||
search_key: item.name,
|
||||
search_type: item.id,
|
||||
lat: location[1],
|
||||
lng: location[0],
|
||||
});
|
||||
const doSearch = () => {
|
||||
this.mapModule.plugin(
|
||||
["AMap.PlaceSearch", "AMap.AutoComplete"],
|
||||
() => {
|
||||
this.placeSearch = new AMap.PlaceSearch();
|
||||
try {
|
||||
this.placeSearch.search(
|
||||
$("#keyword").val().trim(),
|
||||
(status, result) => {
|
||||
if (result.info && result.info === "OK") {
|
||||
let arr = [];
|
||||
result.poiList.pois.forEach((item) => {
|
||||
const location = YJ.CoordTransform.GCJ02ToWGS84(
|
||||
item.location.lng,
|
||||
item.location.lat
|
||||
);
|
||||
arr.push({
|
||||
address: item.name,
|
||||
search_key: item.name,
|
||||
search_type: item.id,
|
||||
lat: location[1],
|
||||
lng: location[0],
|
||||
});
|
||||
this.poiOptions = arr;
|
||||
if (this.poiOptions.length) {
|
||||
this.loading = false;
|
||||
this.$refs.select1.toggleMenu();
|
||||
// $("#selectorBox input").focus();
|
||||
}
|
||||
} else if (status == "error" || result === 'INVALID_PARAMS') {
|
||||
this.$message.error("请填写正确的搜索关键字");
|
||||
this.loading = false;
|
||||
} else if (status == "error") {
|
||||
this.$message.error("网络异常");
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message.warning("没有搜索结果");
|
||||
});
|
||||
this.poiOptions = arr;
|
||||
if (this.poiOptions.length) {
|
||||
this.loading = false;
|
||||
this.$refs.select1.toggleMenu();
|
||||
}
|
||||
//
|
||||
} else if (status == "error" || result === 'INVALID_PARAMS') {
|
||||
this.$message.error("请填写正确的搜索关键字");
|
||||
this.loading = false;
|
||||
} else if (status == "error") {
|
||||
this.$message.error("网络异常");
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.$message.warning("没有搜索结果");
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
this.loading = false;
|
||||
// console.log(e);
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
if (!this.mapModule) {
|
||||
this.loadAmp((err) => {
|
||||
if (err) {
|
||||
this.$message.error("无网络连接,请检查网络");
|
||||
this.loading = false;
|
||||
} else {
|
||||
doSearch();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
doSearch();
|
||||
}
|
||||
} else if (way == "poi") {
|
||||
let string = $("#keyword")
|
||||
.val()
|
||||
.trim();
|
||||
let string = $("#keyword").val().trim();
|
||||
if (string)
|
||||
queryPOI({ key: string }, (res) => {
|
||||
this.poiOptions = res.list;
|
||||
// console.log("poiOptions", this.poiOptions);
|
||||
if (this.poiOptions.length) {
|
||||
this.$refs.select1.toggleMenu();
|
||||
}
|
||||
@ -592,7 +617,7 @@ export default {
|
||||
this.value = "";
|
||||
treeSearchCb();
|
||||
}
|
||||
}, 300),
|
||||
}, 500),
|
||||
loadAmp(cb = () => { }) {
|
||||
// console.log("loadAmp", AMapLoader);
|
||||
AMapLoader.reset();
|
||||
|
||||
Reference in New Issue
Block a user