|
@@ -11,6 +11,7 @@ import {isValue} from "@/utils/util";
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
import PointIcon from "@/assets/images/gis-layout/gis-layout-tools_tool-bz_icon.png"
|
|
import PointIcon from "@/assets/images/gis-layout/gis-layout-tools_tool-bz_icon.png"
|
|
import {v4} from "uuid";
|
|
import {v4} from "uuid";
|
|
|
|
+import store from "@/store";
|
|
|
|
|
|
const globalLineDash = [
|
|
const globalLineDash = [
|
|
[0, 0], //实线
|
|
[0, 0], //实线
|
|
@@ -31,7 +32,7 @@ const baseDrawConfig = {
|
|
lineWidth: 2, // LineString的线段宽度,默认1
|
|
lineWidth: 2, // LineString的线段宽度,默认1
|
|
lineType: 0, // LineString的线段类型索引,默认0,实线,取globalLineDash数组索引
|
|
lineType: 0, // LineString的线段类型索引,默认0,实线,取globalLineDash数组索引
|
|
lineDash: null, // LineString的线段类型,默认null,优先级比lineType高
|
|
lineDash: null, // LineString的线段类型,默认null,优先级比lineType高
|
|
- polyColor: 'rgba(20, 129, 241, 0.3)', // Polygon的填充色,默认蓝色
|
|
|
|
|
|
+ polyColor: 'rgba(20, 129, 241, 0.1)', // Polygon的填充色,默认蓝色
|
|
polyBorderColor: '#2860F1', // Polygon的边框颜色,默认蓝色
|
|
polyBorderColor: '#2860F1', // Polygon的边框颜色,默认蓝色
|
|
polyBorderWidth: 2, // Polygon的边框宽度,默认1
|
|
polyBorderWidth: 2, // Polygon的边框宽度,默认1
|
|
polyBorderType: 0, // Polygon的边框类型索引,默认0,实线,取globalLineDash数组索引
|
|
polyBorderType: 0, // Polygon的边框类型索引,默认0,实线,取globalLineDash数组索引
|
|
@@ -164,7 +165,8 @@ export const draw = (map, obj) => {
|
|
map.removeInteraction(oldModify[0])
|
|
map.removeInteraction(oldModify[0])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (!toolDrawTooltipElement) {
|
|
|
|
|
|
+ if (!toolDrawTooltipElement && !store.state.gis.isTooling) {
|
|
|
|
+ store.commit('gis/SET_IS_TOOLING', true)
|
|
// reset()
|
|
// reset()
|
|
let _source
|
|
let _source
|
|
const realLayer = map.getLayers().getArray().filter(v => v.get(layerFlag[0]) === layerFlag[1])
|
|
const realLayer = map.getLayers().getArray().filter(v => v.get(layerFlag[0]) === layerFlag[1])
|
|
@@ -184,6 +186,7 @@ export const draw = (map, obj) => {
|
|
}
|
|
}
|
|
const modifyInteraction = new Modify({
|
|
const modifyInteraction = new Modify({
|
|
source: _source,
|
|
source: _source,
|
|
|
|
+ pixelTolerance: 1
|
|
});
|
|
});
|
|
modifyInteraction.set(modifyFlag[0], modifyFlag[1])
|
|
modifyInteraction.set(modifyFlag[0], modifyFlag[1])
|
|
map.addInteraction(modifyInteraction)
|
|
map.addInteraction(modifyInteraction)
|
|
@@ -288,6 +291,7 @@ export const draw = (map, obj) => {
|
|
geometryFunction: obj.rectangle ? createBox() : null,
|
|
geometryFunction: obj.rectangle ? createBox() : null,
|
|
// geometryFunction: createRegularPolygon(6),
|
|
// geometryFunction: createRegularPolygon(6),
|
|
style: commonStyle(obj.featureType === 'Point' ? true : false),
|
|
style: commonStyle(obj.featureType === 'Point' ? true : false),
|
|
|
|
+ stopClick: true
|
|
});
|
|
});
|
|
draw.set('showText', obj.featureType === 'Point' ? true : false)
|
|
draw.set('showText', obj.featureType === 'Point' ? true : false)
|
|
draw.set(drawFlag[0], drawFlag[1])
|
|
draw.set(drawFlag[0], drawFlag[1])
|
|
@@ -346,6 +350,7 @@ export const draw = (map, obj) => {
|
|
featEnd.set('isInit', true)
|
|
featEnd.set('isInit', true)
|
|
featEnd.set(layerFlag[0], layerFlag[1])
|
|
featEnd.set(layerFlag[0], layerFlag[1])
|
|
featEnd.setId(v4())
|
|
featEnd.setId(v4())
|
|
|
|
+ store.commit('gis/SET_IS_TOOLING', false)
|
|
}
|
|
}
|
|
draw.on('drawend', drawendHandle);
|
|
draw.on('drawend', drawendHandle);
|
|
}
|
|
}
|
|
@@ -390,4 +395,23 @@ export const draw = (map, obj) => {
|
|
// }
|
|
// }
|
|
})
|
|
})
|
|
}))
|
|
}))
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+export const refreshModify = (map, _source) => {
|
|
|
|
+ const oldModify = map.getInteractions().getArray().filter(v => v.get(modifyFlag[0]) === modifyFlag[1])
|
|
|
|
+ if (oldModify) {
|
|
|
|
+ map.removeInteraction(oldModify[0])
|
|
|
|
+ }
|
|
|
|
+ const modifyInteraction = new Modify({
|
|
|
|
+ source: _source,
|
|
|
|
+ pixelTolerance: 1
|
|
|
|
+ });
|
|
|
|
+ modifyInteraction.set(modifyFlag[0], modifyFlag[1])
|
|
|
|
+ map.addInteraction(modifyInteraction)
|
|
|
|
+ modifyInteraction.on('modifyend', evt => {
|
|
|
|
+ try {
|
|
|
|
+ const feat = evt.features.item(0)
|
|
|
|
+ } catch {
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|