|
|
@ -49,8 +49,8 @@ |
|
|
|
resize="none" |
|
|
|
size="small" |
|
|
|
style="width:200px" |
|
|
|
:precision="6" |
|
|
|
:step="0.00001" |
|
|
|
:precision="5" |
|
|
|
:step="0.0001" |
|
|
|
placeholder='请输入经度偏差' |
|
|
|
v-model="xOffset"> |
|
|
|
</el-input-number> |
|
|
@ -58,8 +58,8 @@ |
|
|
|
<el-input-number v-if="showBtn&&hasPolygon" |
|
|
|
resize="none" |
|
|
|
size="small" |
|
|
|
:precision="6" |
|
|
|
:step="0.00001" |
|
|
|
:precision="5" |
|
|
|
:step="0.0001" |
|
|
|
style="width:200px" |
|
|
|
placeholder='请输入维度偏差' |
|
|
|
v-model="yOffset"> |
|
|
@ -100,14 +100,52 @@ |
|
|
|
width="50%" |
|
|
|
:before-close="handleClose"> |
|
|
|
<div class="div_textarea"> |
|
|
|
<el-input type="textarea" |
|
|
|
:autosize="{ minRows: 20, maxRows: 50}" |
|
|
|
:rows="20" |
|
|
|
style="width:600px;height:500px" |
|
|
|
placeholder='请复制坐标数据' |
|
|
|
v-model="polygonManullyString"> |
|
|
|
</el-input> |
|
|
|
<div style="margin-top:10px"> |
|
|
|
<span> 中心点经度:</span> |
|
|
|
<el-input resize="none" |
|
|
|
size="small" |
|
|
|
style="width:200px" |
|
|
|
placeholder='请输入中心点经度' |
|
|
|
v-model="longitude"> |
|
|
|
</el-input> |
|
|
|
<span style="margin-left:15px"> 中心点纬度:</span> |
|
|
|
<el-input resize="none" |
|
|
|
size="small" |
|
|
|
style="width:200px" |
|
|
|
placeholder='请输入中心点纬度' |
|
|
|
v-model="latitude"> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
<div style="margin-top:20px"> |
|
|
|
<el-input type="textarea" |
|
|
|
:rows="15" |
|
|
|
style="width:600px;max-height:500px" |
|
|
|
placeholder='请复制坐标数据' |
|
|
|
v-model="polygonManullyString"> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
<div style="margin-top:20px"> |
|
|
|
<span> 经度偏差:</span> |
|
|
|
<el-input-number resize="none" |
|
|
|
size="small" |
|
|
|
style="width:200px" |
|
|
|
:precision="5" |
|
|
|
:step="0.0001" |
|
|
|
placeholder='请输入经度偏差' |
|
|
|
v-model="xOffset_customize"> |
|
|
|
</el-input-number> |
|
|
|
<span style="margin-left:15px"> 纬度偏差:</span> |
|
|
|
<el-input-number resize="none" |
|
|
|
size="small" |
|
|
|
:precision="5" |
|
|
|
:step="0.0001" |
|
|
|
style="width:200px" |
|
|
|
placeholder='请输入维度偏差' |
|
|
|
v-model="yOffset_customize"> |
|
|
|
</el-input-number> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<span slot="footer" |
|
|
|
class="dialog-footer"> |
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button> |
|
|
@ -248,10 +286,14 @@ const vueGis = { |
|
|
|
showOffset: false, |
|
|
|
// polygonManullyString: "POLYGON (( 120.33902844 36.10290786, 120.33928218 36.10292997, 120.33956336 36.10316381, 120.34016675 36.10367715, 120.34044913 36.10391476, 120.34045707 36.10392145, 120.34068696 36.10411489, 120.34103181 36.10436285, 120.34117309 36.10441824, 120.34134613 36.10447927, 120.34164715 36.10465122, 120.34124679 36.10507284, 120.34088128 36.10538902, 120.34076198 36.10549222, 120.34053890 36.10520966, 120.34044967 36.10507284, 120.34030632 36.10494761, 120.34019091 36.10484679, 120.33976558 36.10448095, 120.33966658 36.10439980, 120.33947147 36.10425822, 120.33932037 36.10417613, 120.33913002 36.10411307, 120.33895751 36.10406073, 120.33879451 36.10403693, 120.33864104 36.10403158, 120.33864031 36.10395235, 120.33863211 36.10305897, 120.33902175 36.10290728, 120.33902844 36.10290786))", |
|
|
|
polygonManullyString: "", |
|
|
|
polygonStringResult: '', |
|
|
|
|
|
|
|
xOffset: 0, |
|
|
|
yOffset: 0, |
|
|
|
xOffset_customize: 0.0051, |
|
|
|
yOffset_customize: 0.0002, |
|
|
|
|
|
|
|
longitude: '', |
|
|
|
latitude: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
async mounted () { |
|
|
@ -725,6 +767,14 @@ const vueGis = { |
|
|
|
}, |
|
|
|
|
|
|
|
handleManuallyOk () { |
|
|
|
if (this.longitude || this.latitude) { |
|
|
|
if (!(this.longitude && this.latitude)) { |
|
|
|
this.$message({ |
|
|
|
type: "warning", |
|
|
|
message: "请同时填写中心点经纬度,或不填写" |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
//转化成需要的格式 |
|
|
|
//120.54033616308595,36.53603370922851,120.69620469335939,36.5408402277832,120.63166001562502,36.46771248120117,120.52728989843752,36.458786089599606,120.54033616308595,36.53603370922851 |
|
|
|
//中国经纬度范围 |
|
|
@ -734,18 +784,27 @@ const vueGis = { |
|
|
|
const arrayString = this.polygonManullyString |
|
|
|
let array = arrayString.split(/[, ]/) |
|
|
|
console.log(array) |
|
|
|
this.polygonStringResult = '' |
|
|
|
let polygonStringResult = '' |
|
|
|
|
|
|
|
|
|
|
|
array.forEach(element => { |
|
|
|
let num = Number(element) |
|
|
|
if (num) { |
|
|
|
this.polygonStringResult = this.polygonStringResult + element + ',' |
|
|
|
polygonStringResult = polygonStringResult + element + ',' |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.polygonStringResult = this.polygonStringResult.substring(0, this.polygonStringResult.length - 1) |
|
|
|
polygonStringResult = polygonStringResult.substring(0, polygonStringResult.length - 1) |
|
|
|
|
|
|
|
if (this.xOffset_customize !== 0 || this.yOffset_customize !== 0) { |
|
|
|
this.saveOffset(this.xOffset_customize, this.yOffset_customize, polygonStringResult) |
|
|
|
} else { |
|
|
|
this.addPolygon(polygonStringResult) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.addPolygon(this.polygonStringResult) |
|
|
|
}, |
|
|
|
|
|
|
|
handleSetOffset () { |
|
|
@ -753,7 +812,7 @@ const vueGis = { |
|
|
|
}, |
|
|
|
handleOffsetOk () { |
|
|
|
let selPolygonString = "" |
|
|
|
let offsetPolygonString = ''//偏移后的坐标字符串 |
|
|
|
|
|
|
|
this.subAgencyArray.forEach(element => { |
|
|
|
if (element.id === this.selAgencyId && element.coordinates && element.coordinates.length > 0) { |
|
|
|
selPolygonString = element.coordinates |
|
|
@ -761,35 +820,32 @@ const vueGis = { |
|
|
|
}); |
|
|
|
|
|
|
|
if (selPolygonString) { |
|
|
|
let tempArray = selPolygonString.split(',') |
|
|
|
|
|
|
|
tempArray.forEach((element, index) => { |
|
|
|
let aaa = 0 |
|
|
|
|
|
|
|
if (index % 2 === 0) {//偶数 |
|
|
|
aaa = parseFloat(element) + parseFloat(this.xOffset) |
|
|
|
} else { |
|
|
|
aaa = parseFloat(element) + parseFloat(this.yOffset) |
|
|
|
} |
|
|
|
|
|
|
|
if (index % 2 !== 0) {//奇数 |
|
|
|
this.saveOffset(tyhis.xOffset, this.yOffset, selPolygonString) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
offsetPolygonString = offsetPolygonString + aaa + ',' |
|
|
|
}, |
|
|
|
saveOffset (xOffset, yOffset, selPolygonString) { |
|
|
|
let offsetPolygonString = ''//偏移后的坐标字符串 |
|
|
|
let tempArray = selPolygonString.split(',') |
|
|
|
|
|
|
|
}); |
|
|
|
tempArray.forEach((element, index) => { |
|
|
|
let aaa = 0 |
|
|
|
|
|
|
|
offsetPolygonString = offsetPolygonString.substring(0, offsetPolygonString.length - 1) |
|
|
|
} |
|
|
|
if (index % 2 === 0) {//偶数 |
|
|
|
aaa = parseFloat(element) + parseFloat(xOffset) |
|
|
|
} else { |
|
|
|
aaa = parseFloat(element) + parseFloat(yOffset) |
|
|
|
} |
|
|
|
|
|
|
|
if (index % 2 !== 0) {//奇数 |
|
|
|
|
|
|
|
} |
|
|
|
offsetPolygonString = offsetPolygonString + aaa + ',' |
|
|
|
|
|
|
|
console.log('selPolygonString', selPolygonString) |
|
|
|
console.log('offsetPolygonString', offsetPolygonString) |
|
|
|
}); |
|
|
|
|
|
|
|
offsetPolygonString = offsetPolygonString.substring(0, offsetPolygonString.length - 1) |
|
|
|
this.addPolygon(offsetPolygonString) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
handleSetOffset () { |
|
|
|
this.handleOffsetCancel = false |
|
|
@ -924,7 +980,9 @@ const vueGis = { |
|
|
|
let params = { |
|
|
|
orgId: this.selAgency.id, |
|
|
|
level: this.selAgency.level, |
|
|
|
coordinates: coorString |
|
|
|
coordinates: coorString, |
|
|
|
longitude: this.longitude, |
|
|
|
latitude: this.latitude |
|
|
|
} |
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
@ -935,6 +993,7 @@ const vueGis = { |
|
|
|
message: "绘制成功" |
|
|
|
}); |
|
|
|
if (this.dialogVisible) { |
|
|
|
this.polygonManullyString = ' ' |
|
|
|
this.dialogVisible = false |
|
|
|
} |
|
|
|
this.refreshMap(false) |
|
|
|