|
@@ -162,8 +162,10 @@ export default {
|
|
* @str -- id
|
|
* @str -- id
|
|
* @coord -- 坐标信息
|
|
* @coord -- 坐标信息
|
|
* @data -- 其余数据
|
|
* @data -- 其余数据
|
|
|
|
+ * @geoType -- 几何体类型
|
|
*/
|
|
*/
|
|
- createLabelDiv(str, coord, data) {
|
|
|
|
|
|
+ createLabelDiv(str, coord, data, geoType) {
|
|
|
|
+ console.log(str, coord, data, geoType, "createLabelDiv");
|
|
console.log(str, "label - str");
|
|
console.log(str, "label - str");
|
|
this.currentLabelHtml = this.$refs.labelRef.$el.innerHTML;
|
|
this.currentLabelHtml = this.$refs.labelRef.$el.innerHTML;
|
|
if (this.currentLabelHtml) {
|
|
if (this.currentLabelHtml) {
|
|
@@ -182,8 +184,8 @@ export default {
|
|
this.deleteBtnEvent(str);
|
|
this.deleteBtnEvent(str);
|
|
break;
|
|
break;
|
|
case "保存":
|
|
case "保存":
|
|
- this.saveBtnEvent(str, coord, data);
|
|
|
|
- console.log(str, coord, data);
|
|
|
|
|
|
+ this.saveBtnEvent(str, data, geoType);
|
|
|
|
+ // console.log(str, coord, data);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -201,19 +203,75 @@ export default {
|
|
console.log("delete btn");
|
|
console.log("delete btn");
|
|
},
|
|
},
|
|
|
|
|
|
- // 点击保存事件时保存点数据
|
|
|
|
- saveBtnEvent(str, coord, data) {
|
|
|
|
- console.log("save btn");
|
|
|
|
- let type = $(`#${str}_id select`).val();
|
|
|
|
- let des = $(`#${str}_id textarea`).val();
|
|
|
|
- let geometryAttr = {
|
|
|
|
- id: publicFun.buildGuid("myLabel"),
|
|
|
|
- coord: coord,
|
|
|
|
- type: type,
|
|
|
|
- des: des,
|
|
|
|
- };
|
|
|
|
- this.$store.getters.myLabelPointsArr.push(geometryAttr);
|
|
|
|
- map2DViewer.map.closePopup();
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 点击保存事件时保存点数据
|
|
|
|
+ * @str
|
|
|
|
+ * @data -- 绘制几何体时获取的数据;
|
|
|
|
+ * @geoType 几何体类型 类型: 0 点;1 线;2 面;3 矩形;4 圆形;5 其他;
|
|
|
|
+ */
|
|
|
|
+ saveBtnEvent(str, data, geoType) {
|
|
|
|
+ if (localStorage.getItem("USER_ID")) {
|
|
|
|
+ let title = $(`#${str}_id select`).val();
|
|
|
|
+ let des = $(`#${str}_id textarea`).val();
|
|
|
|
+ let coordinates = [data.points];
|
|
|
|
+ let geometry = publicFun.generateGeoJSON(
|
|
|
|
+ title,
|
|
|
|
+ des,
|
|
|
|
+ geoType,
|
|
|
|
+ coordinates
|
|
|
|
+ );
|
|
|
|
+ console.log(data, "标记疑点 -- 绘制的疑点信息");
|
|
|
|
+ console.log(geometry, "转换后的geoJson数据");
|
|
|
|
+ let params = new FormData();
|
|
|
|
+
|
|
|
|
+ params = {
|
|
|
|
+ geojson: JSON.stringify(geometry),
|
|
|
|
+ type: geoType,
|
|
|
|
+ userId: Number(localStorage.getItem("USER_ID")),
|
|
|
|
+ sourceId: 0,
|
|
|
|
+ };
|
|
|
|
+ console.log(params, "params");
|
|
|
|
+
|
|
|
|
+ this.$Post(this.urlsCollection.addConllection, params).then(
|
|
|
|
+ (res) => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ console.log(res, "添加标记成功");
|
|
|
|
+ map2DViewer.map.closePopup();
|
|
|
|
+ // 根据用户获取标记
|
|
|
|
+ let paramData = new FormData();
|
|
|
|
+ paramData = {
|
|
|
|
+ userId: Number(localStorage.getItem("USER_ID")),
|
|
|
|
+ sourceId: 0,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ };
|
|
|
|
+ this.$Post(this.urlsCollection.selectByUser, paramData).then(
|
|
|
|
+ (userRes) => {
|
|
|
|
+ if (userRes.code === 200) {
|
|
|
|
+ console.log(userRes, "获取我的标记疑点数据");
|
|
|
|
+
|
|
|
|
+ if (userRes.content.length > 0) {
|
|
|
|
+ this.$store.state.myLabelPointsArr = [];
|
|
|
|
+ this.$store.state.myLabelPointsArr = userRes.content.map(
|
|
|
|
+ (v) => {
|
|
|
|
+ return {
|
|
|
|
+ id: v.id,
|
|
|
|
+ geojson: v.geojson,
|
|
|
|
+ type: v.type,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 更新时调用一次搜索接口
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 卷帘对比
|
|
// 卷帘对比
|
|
JLControl() {
|
|
JLControl() {
|
|
@@ -246,28 +304,45 @@ export default {
|
|
},
|
|
},
|
|
// 初始化引入绘制工具
|
|
// 初始化引入绘制工具
|
|
initDraw() {
|
|
initDraw() {
|
|
- console.log(map2DViewer.measureTool, "initDraw");
|
|
|
|
if (!map2DViewer.measureTool) {
|
|
if (!map2DViewer.measureTool) {
|
|
// 引入疑点标记绘制方法
|
|
// 引入疑点标记绘制方法
|
|
map2DViewer.drawToolFire = (data) => {
|
|
map2DViewer.drawToolFire = (data) => {
|
|
- try {
|
|
|
|
- // 纬经度
|
|
|
|
- if (data && data.points.length >= 1) {
|
|
|
|
- console.log(data.points[data.points.length - 1], "绘制的图形");
|
|
|
|
- let coord = data.points[data.points.length - 1];
|
|
|
|
- if (coord && coord.length >= 2) {
|
|
|
|
- let newCoord = { lat: coord[0], lng: coord[1] };
|
|
|
|
- this.labelDetailsPopupShow = true;
|
|
|
|
- this.labelPopup = L.popup({ maxWidth: 700, maxHeight: 600 })
|
|
|
|
- .setLatLng(newCoord)
|
|
|
|
- .setContent(this.createLabelDiv("label", coord, data))
|
|
|
|
- .openOn(map2DViewer.map);
|
|
|
|
- this.labelDetailsPopupShow = false;
|
|
|
|
- }
|
|
|
|
|
|
+ // 纬经度
|
|
|
|
+ if (data && data.points.length >= 1) {
|
|
|
|
+ let geoType = null;
|
|
|
|
+ console.log(data, "测试绘制的数据");
|
|
|
|
+ // 类型: 0 点;1 线;2 面;3 矩形;4 圆形;5 其他;
|
|
|
|
+ if (data.points.length === 1 && data.area === 0) {
|
|
|
|
+ geoType = 0;
|
|
|
|
+ }
|
|
|
|
+ if (data.points.length === 2 && data.distance > 0) {
|
|
|
|
+ geoType = 4;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (data.points.length > 2 && data.area === 0) {
|
|
|
|
+ geoType = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (data.points.length > 2 && data.area != 0 && data.area != "") {
|
|
|
|
+ geoType = 2;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let coord = data.points[data.points.length - 1];
|
|
|
|
+ if (coord && coord.length >= 2) {
|
|
|
|
+ let newCoord = { lat: coord[0], lng: coord[1] };
|
|
|
|
+ this.labelDetailsPopupShow = true;
|
|
|
|
+ this.labelPopup = L.popup({ maxWidth: 700, maxHeight: 600 })
|
|
|
|
+ .setLatLng(newCoord)
|
|
|
|
+ .setContent(this.createLabelDiv("label", coord, data, geoType))
|
|
|
|
+ .openOn(map2DViewer.map);
|
|
|
|
+ this.labelDetailsPopupShow = false;
|
|
}
|
|
}
|
|
- } catch (e) {
|
|
|
|
- console.log("引入疑点标记绘制方法 error");
|
|
|
|
}
|
|
}
|
|
|
|
+ // try {
|
|
|
|
+
|
|
|
|
+ // } catch (e) {
|
|
|
|
+ // console.log("引入疑点标记绘制方法 error");
|
|
|
|
+ // }
|
|
};
|
|
};
|
|
map2DViewer.setDrawTool({
|
|
map2DViewer.setDrawTool({
|
|
action: "add",
|
|
action: "add",
|