|
|
|
@ -24,6 +24,7 @@
|
|
|
|
|
<el-form-item label=" ">
|
|
|
|
|
<el-button icon="Search" type="primary" @click="handleQuery">{{ t('option.search') }}</el-button>
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">{{ t('option.reset') }}</el-button>
|
|
|
|
|
<el-button icon="Refresh" @click="getLine">获取点位</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
@ -44,10 +45,9 @@ const queryParams = ref({})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let map = null
|
|
|
|
|
let polyline = null
|
|
|
|
|
let passedPolyline = null
|
|
|
|
|
let mouseTool = null
|
|
|
|
|
let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]]
|
|
|
|
|
let path2 = [[116.400969, 39.921592], [116.401496, 39.919008], [116.399264, 39.919765], [116.39802, 39.921016]]
|
|
|
|
|
const areaPath = ref([path,path2])
|
|
|
|
|
let marketPath = [116.390669, 39.911147]
|
|
|
|
|
AMapLoader.load({
|
|
|
|
|
key: "ba8fb8d8bae1b280b93406d5959d492f", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
|
@ -75,7 +75,7 @@ AMapLoader.load({
|
|
|
|
|
marker.setLabel({
|
|
|
|
|
direction: 'top',
|
|
|
|
|
offset: new AMap.Pixel(0, -10), //设置文本标注偏移量
|
|
|
|
|
content: "" + AMap.GeometryUtil.isPointInRing(marketPath,path),
|
|
|
|
|
content: "" + AMap.GeometryUtil.isPointInRing(marketPath,path,path2),
|
|
|
|
|
});
|
|
|
|
|
marker.setMap(map);
|
|
|
|
|
|
|
|
|
@ -91,8 +91,8 @@ AMapLoader.load({
|
|
|
|
|
// 在图面添加类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
|
|
|
|
|
map.addControl(new AMap.MapType());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let polygon = new AMap.Polygon({path: path});
|
|
|
|
|
areaPath.value.forEach( (e,index)=> {
|
|
|
|
|
let polygon = new AMap.Polygon({path: e});
|
|
|
|
|
map.add([polygon]);
|
|
|
|
|
let polyEditor = new AMap.PolygonEditor(map);
|
|
|
|
|
polyEditor.addAdsorbPolygons([polygon]);
|
|
|
|
@ -103,20 +103,35 @@ AMapLoader.load({
|
|
|
|
|
})
|
|
|
|
|
polyEditor.on('addnode', function (data) {
|
|
|
|
|
// 获取区域坐标
|
|
|
|
|
console.log(polyEditor.getTarget()._opts.path)
|
|
|
|
|
areaPath.value[index] = polyEditor.getTarget()._opts.path
|
|
|
|
|
})
|
|
|
|
|
polyEditor.on('adjust', function (data) {
|
|
|
|
|
// 获取区域坐标
|
|
|
|
|
console.log(polyEditor.getTarget()._opts.path)
|
|
|
|
|
areaPath.value[index] = polyEditor.getTarget()._opts.path
|
|
|
|
|
})
|
|
|
|
|
polyEditor.setTarget(polygon);
|
|
|
|
|
polyEditor.open();
|
|
|
|
|
// map.setFitView();
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
|
console.log(e);
|
|
|
|
|
})
|
|
|
|
|
const getLine = () => {
|
|
|
|
|
let list = areaPath.value
|
|
|
|
|
let params = []
|
|
|
|
|
list.forEach((e,index)=>{
|
|
|
|
|
e.forEach(val => {
|
|
|
|
|
params.push({
|
|
|
|
|
longitude:val[0],
|
|
|
|
|
latitude:val[1],
|
|
|
|
|
index:index
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
console.log(params)
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
#container4 {
|
|
|
|
|