Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.CadastralSystem
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4cd04f02
authored
2020-12-15 13:54:20 +0800
by
杨威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
gis重叠分析功能实现
1 parent
3f9a05d3
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
527 additions
and
81 deletions
src/assets/json/graphicSymbol.json
src/components/lineTree/lineTree.vue
src/components/lineTree/tx/importGeo.vue
src/components/lineTree/tx/js/geoUtils.js
src/components/map/EsriMap.vue
src/libs/map/IdentifyUtils.js
src/libs/map/featureUpdate.js
src/libs/map/queryUtils.js
src/views/systemTX/map.vue
src/views/systemTX/mapWeight/js/mapLayerManager.js
src/assets/json/graphicSymbol.json
View file @
4cd04f0
...
...
@@ -23,7 +23,15 @@
"color"
:
"#f50325"
,
"width"
:
1
}
},
"importSymbol"
:
{
"type"
:
"simple-fill"
,
"color"
:
[
245
,
3
,
37
,
0.4
],
"style"
:
"none"
,
"outline"
:
{
"color"
:
"#006cff"
,
"width"
:
2
}
}
}
}
\ No newline at end of file
...
...
src/components/lineTree/lineTree.vue
View file @
4cd04f0
...
...
@@ -101,7 +101,8 @@
<li
v-show=
"zdData.type == 'zdy'"
@
click=
"deleteZdy"
>
删除
</li>
</ul>
<el-dialog
title=
"导入图形"
:visible
.
sync=
"improtDialog"
>
<!--@close="closeImportDialog"-->
<el-dialog
title=
"导入图形"
:modal=
"false"
:close-on-click-modal=
"false"
custom-class=
"importDialog"
:visible
.
sync=
"improtDialog"
width=
"30%"
@
close=
"closeImportDialog"
>
<import-geo
:property-info=
"zdData"
:timeLine=
"new Date().getTime()"
:geo-info=
"currentClickZdGeo"
@
closeImportDialog=
"closeImportDialog"
></import-geo>
</el-dialog>
<!-- 添加定着物弹框 -->
...
...
@@ -430,6 +431,7 @@ export default {
}
else
{
BSM
=
this
.
zdData
.
bsm
;
}
//当确定导入图形是 跳转到图形界面
this
.
queryGeoByBsm
(
BSM
,
type
,
function
(
features
){
if
(
features
&&
features
.
length
>
0
){
if
(
features
[
0
].
geometry
){
...
...
@@ -438,6 +440,7 @@ export default {
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
self
.
postionToMap
();
self
.
improtDialog
=
true
;
self
.
currentClickZdGeo
=
features
[
0
];
}).
catch
(()
=>
{
...
...
@@ -447,11 +450,13 @@ export default {
});
});
}
else
{
self
.
postionToMap
();
self
.
currentClickZdGeo
=
features
[
0
];
self
.
improtDialog
=
true
;
}
}
else
{
self
.
postionToMap
();
self
.
currentClickZdGeo
=
null
;
self
.
improtDialog
=
true
;
}
...
...
@@ -500,7 +505,6 @@ export default {
}).then(res => {
debugger
});*/
}
else
{
self
.
$message
.
warning
(
"暂无空间信息!!!!"
);
}
...
...
@@ -574,6 +578,7 @@ export default {
//关闭图形弹框
closeImportDialog
(){
this
.
improtDialog
=
false
;
this
.
clearOverLayer
();
}
},
...
...
@@ -722,4 +727,8 @@ export default {
center
;
background-size
:
contain
;
}
/
deep
/
.importDialog
{
margin-top
:
120px
!important
;
margin-left
:
291px
;
}
</
style
>
...
...
src/components/lineTree/tx/importGeo.vue
View file @
4cd04f0
<
template
>
<div
>
<div
v-if=
"!resultDialog && !txtResultDialog"
class=
"importDiv"
>
<div
v-if=
"!resultDialog && !txtResultDialog
&& !dealDialog
"
class=
"importDiv"
>
<el-upload
class=
"upload-demo"
action=
"#"
...
...
@@ -108,7 +108,7 @@
{ required: true, message: '请选择地块', trigger: 'change' },
]"
>
<el-select
v-model=
"txtZd.name"
filterable
placeholder=
"请选择"
>
<el-select
v-model=
"txtZd.name"
filterable
placeholder=
"请选择"
@
change=
"txtChange"
>
<el-option
v-for=
"(item,index) in txtResult"
:key=
"index"
...
...
@@ -123,6 +123,30 @@
</el-form-item>
</el-form>
</div>
<div
v-if=
"dealDialog"
>
<el-form
:model=
"dealForm"
ref=
"dealForm"
label-width=
"100px"
size=
"small"
@
submit
.
native
.
prevent
class=
"demo-ruleForm"
>
<el-form-item
label=
"处理方法"
prop=
"method"
:rules=
"[
{ required: true, message: '请选择', trigger: 'change' },
]"
>
<el-select
v-model=
"dealForm.method"
filterable
placeholder=
"请选择"
>
<el-option
v-for=
"(item,index) in dealMethods"
:key=
"index"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"submitDealForm('dealForm')"
>
确定
</el-button>
<el-button
@
click=
"cancelDealForm('dealForm')"
>
取消
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</
template
>
<
script
>
...
...
@@ -157,6 +181,25 @@ export default {
txtResultDialog
:
null
,
txtZd
:{
name
:
""
},
overResults
:[],
//与导入宗地重叠的地块
currntDealGraphic
:
null
,
dealMethods
:[{
label
:
"不做处理"
,
value
:
"1"
},{
label
:
"删除叠加部分"
,
value
:
"2"
},{
label
:
"删除已重叠部分"
,
value
:
"3"
},{
label
:
"删除原图形"
,
value
:
"4"
}],
dealDialog
:
false
,
dealForm
:{
method
:
""
}
}
},
...
...
@@ -167,6 +210,7 @@ export default {
timeLine
(
newValue
,
oldValue
){
this
.
resultDialog
=
false
;
this
.
txtResultDialog
=
false
;
this
.
dealDialog
=
false
;
}
},
methods
:{
...
...
@@ -268,11 +312,7 @@ export default {
attributes
:
null
,
geometry
:
geometry
}
if
(
self
.
propertyInfo
.
type
==
"zd"
){
self
.
saveZd
(
graphic
);
}
else
{
self
.
saveZRZ
(
graphic
);
}
self
.
checkGeo
(
graphic
);
}
else
{
this
.
$message
.
warning
(
response
.
message
);
}
...
...
@@ -291,25 +331,95 @@ export default {
graphic
.
geometry
.
spatialReference
=
{
wkt
:
wkt
}
self
.
checkGeo
(
graphic
);
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
}
})
},
txtChange
(
value
){
var
wkt
=
"PROJCS[\"XADFZBX\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"
;
var
graphics
=
self
.
txtResult
.
filter
(
item
=>
{
return
item
.
attributes
.
name
==
value
;
})
var
graphic
=
graphics
[
0
];
graphic
.
geometry
.
type
=
"polygon"
;
graphic
.
geometry
.
spatialReference
=
{
wkt
:
wkt
}
this
.
addOverLayer
(
graphic
.
geometry
,[]);
},
//校验空间完整性
checkGeo
(
graphic
){
var
self
=
this
;
//校验完整性 直接调用空间方法 提交空间表
self
.
geoJoint
(
geometry
,
function
(
isJoint
,
message
)
{
self
.
geoJoint
(
graphic
.
geometry
,
function
(
isJoint
,
message
)
{
if
(
isJoint
){
self
.
$message
.
warning
(
message
)
return
;
}
else
{
if
(
self
.
propertyInfo
.
type
==
"zd"
){
var
type
=
self
.
propertyInfo
.
type
;
if
(
type
==
'zd'
){
//重叠分析
self
.
zdOverAnalys
(
self
.
propertyInfo
.
zdbsm
,
graphic
,
function
(
flag
,
results
)
{
if
(
flag
){
self
.
$message
.
warning
(
"导入的宗地与其他宗地有重叠,请处理!!"
);
self
.
dealOverData
(
results
,
graphic
);
}
else
{
self
.
saveZd
(
graphic
);
}
else
{
}
});
}
else
{
self
.
zrzOverAnalys
(
this
.
propertyInfo
.
bsm
,
graphic
,
function
(
flag
,
mes
)
{
if
(
flag
){
self
.
$message
.
warning
(
mes
);
return
;
}
else
{
self
.
saveZRZ
(
graphic
);
}
});
}
}
});
}
else
{
},
//选择处理方式
submitDealForm
(
formName
){
var
self
=
this
;
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
){
//选择处理方式
var
value
=
self
.
dealForm
.
method
;
switch
(
value
)
{
case
'1'
:
self
.
currntDealGraphic
.
attributes
.
BGZT
=
1
;
self
.
saveZd
(
self
.
currntDealGraphic
);
break
;
case
"2"
:
self
.
getDifference
(
self
.
currntDealGraphic
,
self
.
overResults
,
self
.
delOverGeo
);
break
;
case
"3"
:
self
.
getResultsDif
(
self
.
overResults
,
self
.
currntDealGraphic
,
self
.
delOtherGeo
,
true
);
break
;
case
"4"
:
self
.
getResultsDif
(
self
.
overResults
,
self
.
currntDealGraphic
,
self
.
delOtherGeo
,
false
);
break
;
}
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
}
})
},
//裁剪自己在保存
delOverGeo
(
geometry
){
this
.
currntDealGraphic
.
attributes
.
BGZT
=
2
;
if
(
geometry
==
null
){
this
.
$message
.
warning
(
"完全重叠,已删除图形信息!!!"
)
this
.
currntDealGraphic
.
geometry
=
geometry
;
}
this
.
saveZd
(
this
.
currntDealGraphic
);
},
//裁剪别的在保存
delOtherGeo
(
results
){
//执行编辑操作
var
layer
=
this
.
getLayerByName
(
"ZDJBXX"
);
var
featureUrl
=
layer
.
layerUrl
.
replace
(
"MapServer"
,
"FeatureServer"
);
featureUrl
+=
"/"
+
layer
.
id
;
this
.
updateGraphic
(
featureUrl
,
results
);
this
.
saveZd
(
this
.
currntDealGraphic
);
},
//下载文档模板
downloadFile
(
url
,
fileName
){
let
link
=
document
.
createElement
(
"a"
);
...
...
@@ -336,25 +446,20 @@ export default {
attributes
:
self
.
currentClickZd
,
geometry
:
geometry
}
self
.
geoJoint
(
geometry
,
function
(
isJoint
,
message
)
{
if
(
isJoint
){
self
.
$message
.
warning
(
message
)
return
;
}
else
{
if
(
self
.
propertyInfo
.
type
==
"zd"
){
self
.
saveZd
(
graphic
);
}
else
{
self
.
saveZRZ
(
graphic
);
}
}
});
self
.
checkGeo
(
graphic
);
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
}
});
},
dealOverData
(
results
,
graphic
){
this
.
overResults
=
results
;
this
.
currntDealGraphic
=
graphic
;
this
.
resultDialog
=
false
;
this
.
txtResultDialog
=
false
;
this
.
dealDialog
=
true
;
},
saveZd
(
graphic
){
var
self
=
this
;
var
points
=
null
,
lines
=
null
,
...
...
@@ -363,6 +468,9 @@ export default {
featureUrl
+=
"/"
+
layer
.
id
;
if
(
self
.
geoInfo
){
//替换 生成图像 高亮
if
(
graphic
.
attributes
&&
graphic
.
attributes
.
BGZT
){
self
.
geoInfo
.
attributes
.
BGZT
=
graphic
.
attributes
.
BGZT
;
}
self
.
geoInfo
.
attributes
.
BSM
=
this
.
propertyInfo
.
zdbsm
;
self
.
geoInfo
.
attributes
.
ZDDM
=
this
.
propertyInfo
.
zddm
;
self
.
geoInfo
.
attributes
.
XMMC
=
this
.
propertyInfo
.
mc
;
...
...
@@ -374,6 +482,7 @@ export default {
var
updResult
=
res
.
updateFeatureResults
[
0
];
if
(
updResult
.
objectId
){
var
OBJECTID
=
updResult
.
objectId
;
if
(
graphic
.
geometry
){
points
=
self
.
craetJZPoint
(
graphic
);
self
.
savejzd
(
points
)
//生成边框线
...
...
@@ -381,27 +490,36 @@ export default {
lines
=
res
;
self
.
saveJzx
(
lines
);
});
}
self
.
$message
.
success
(
"保存成功!!!"
);
self
.
goMap
();
}
});
}
else
{
//生成图像 保存
graphic
.
attributes
=
{
var
attributes
=
{
BSM
:
this
.
propertyInfo
.
zdbsm
,
ZDDM
:
this
.
propertyInfo
.
zddm
,
XMMC
:
this
.
propertyInfo
.
mc
};
if
(
graphic
.
attributes
&&
graphic
.
attributes
.
BGZT
){
attributes
.
BGZT
=
graphic
.
attributes
.
BGZT
;
}
graphic
.
attributes
=
attributes
;
self
.
addGraphic
(
featureUrl
,
graphic
,
function
(
res
)
{
var
addRresult
=
res
.
addFeatureResults
[
0
];
if
(
addRresult
.
objectId
){
var
OBJECTID
=
addRresult
.
objectId
;
if
(
graphic
.
geometry
)
{
points
=
self
.
craetJZPoint
(
graphic
);
self
.
savejzd
(
points
)
//生成边框线
self
.
createJZLine
(
graphic
,
function
(
res
)
{
self
.
createJZLine
(
graphic
,
function
(
res
)
{
lines
=
res
;
self
.
saveJzx
(
lines
);
});
}
self
.
$message
.
success
(
"保存成功!!!"
);
self
.
goMap
();
}
});
...
...
@@ -459,12 +577,13 @@ export default {
var
featureUrl
=
layer
.
layerUrl
.
replace
(
"MapServer"
,
"FeatureServer"
);
featureUrl
+=
"/"
+
layer
.
id
;
if
(
self
.
geoInfo
){
self
.
geoInfo
.
BSM
=
this
.
propertyInfo
.
bsm
;
self
.
geoInfo
.
BSM
=
self
.
propertyInfo
.
bsm
;
graphic
.
attributes
=
self
.
geoInfo
;
//替换 生成图像 高亮
self
.
updateGraphic
(
featureUrl
,
graphic
,
function
(
res
)
{
var
addRresult
=
res
.
updateFeatureResults
[
0
];
if
(
addRresult
.
objectId
)
{
self
.
$message
.
success
(
"保存成功!!!"
);
self
.
goMap
();
}
});
...
...
@@ -478,12 +597,13 @@ export default {
self
.
addGraphic
(
featureUrl
,
graphic
,
function
(
res
)
{
var
addRresult
=
res
.
addFeatureResults
[
0
];
if
(
addRresult
.
objectId
)
{
self
.
$message
.
success
(
"保存成功!!!"
);
self
.
goMap
();
}
});
}
},
//操作成功
跳转
//操作成功
不需要跳转地图 (直接定位新导入的图形)
goMap
(){
var
bsm
=
""
,
type
=
this
.
propertyInfo
.
type
;
if
(
type
==
"zd"
){
...
...
@@ -492,35 +612,46 @@ export default {
bsm
=
this
.
propertyInfo
.
bsm
;
}
this
.
resultDialog
=
false
;
this
.
txtResultDialog
=
false
;
this
.
dealDialog
=
false
;
this
.
$emit
(
"closeImportDialog"
);
var
curretRouterInfo
=
{
path
:
this
.
$route
.
path
,
query
:
this
.
$route
.
query
}
sessionStorage
.
setItem
(
"curretRouterInfo"
,
JSON
.
stringify
(
curretRouterInfo
));
this
.
$router
.
push
({
path
:
"/viewMap"
,
query
:
{
bsm
:
bsm
,
type
:
this
.
propertyInfo
.
type
}
});
//TODO 定位当前新导入的图形
this
.
addGeoByBsm
(
bsm
,
type
,
"testMap"
);
},
//取消
cancel
(){
this
.
zdForm
.
zdBsm
=
""
;
this
.
currentClickZd
=
null
;
this
.
resultDialog
=
false
;
// 清空当前图层上显示的图形
this
.
clearOverLayer
();
},
//取消文本选择的弹出框
cancelTxtForm
(){
this
.
txtZd
.
name
=
""
;
this
.
txtResultDialog
=
false
;
// 清空当前图层上显示的图形
this
.
clearOverLayer
();
},
//取消导入处理的结果
cancelDealForm
(){
this
.
dealForm
.
method
=
""
;
this
.
dealDialog
=
false
;
this
.
overResults
=
[];
// 清空当前图层上显示的图形
this
.
clearOverLayer
();
},
//宗地选择发生改变
zdChange
(
value
){
this
.
zdForm
.
zdBsm
=
value
.
XMMC
;
this
.
currentClickZd
=
value
;
var
geometry
=
this
.
parseWktToArc
(
this
.
currentClickZd
.
wkt
);
geometry
.
type
=
"polygon"
;
var
wkt
=
"PROJCS[\"XADFZBX\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"
;
geometry
.
spatialReference
=
{
wkt
:
wkt
}
this
.
addOverLayer
(
geometry
,[]);
}
}
}
...
...
src/components/lineTree/tx/js/geoUtils.js
View file @
4cd04f0
...
...
@@ -10,6 +10,7 @@ import featureUpdate from "@libs/map/featureUpdate";
import
arcgisParser
from
'terraformer-arcgis-parser'
import
wktParse
from
'terraformer-wkt-parser'
import
{
maps
}
from
'@/libs/map/mapUtils'
import
graphicSymbol
from
'@/assets/json/graphicSymbol.json'
export
default
{
data
(){
...
...
@@ -197,8 +198,9 @@ export default {
}
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
){
var
feature
=
results
[
i
].
feature
;
var
flag
=
geometryEngine
.
disjoint
(
polygon
,
feature
.
geometry
);
if
(
flag
){
var
flag
=
geometryEngine
.
intersects
(
polygon
,
feature
.
geometry
);
var
withinFlag
=
geometryEngine
.
within
(
polygon
,
feature
.
geometry
);
if
(
!
withinFlag
&&
flag
){
isJoint
=
true
;
layerName
=
results
[
i
].
layerName
;
switch
(
layerName
)
{
...
...
@@ -244,7 +246,260 @@ export default {
featureUpdate
.
methods
.
addGraphic
(
featureUrl
,
graphic
,
callBackFunction
)
;
}
});
},
//叠加分析 同一个图层的叠加分析
zdOverAnalys
(
bsm
,
graphic
,
callBacFunction
){
var
self
=
this
;
loadModules
([
"esri/geometry/Polygon"
]).
then
(([
Polygon
])
=>
{
var
zdLayer
=
null
;
zdLayer
=
self
.
getLayerByName
(
"ZDJBXX"
);
var
layerIds
=
[];
layerIds
.
push
(
zdLayer
.
id
);
var
polygon
=
new
Polygon
(
graphic
.
geometry
);
identifyUtils
.
methods
.
identify
(
zdLayer
.
layerUrl
,
layerIds
,
polygon
,
function
(
res
)
{
var
results
=
res
.
results
;
//判断数据是否与其他数据有重叠
var
flag
=
false
;
if
(
results
&&
results
.
length
>
0
){
flag
=
true
;
//加载在图层上 原本的要导入的数据 和重叠数据
self
.
addOverLayer
(
polygon
,
results
);
}
callBacFunction
(
flag
,
results
);
},
true
)
}).
catch
(
err
=>
{
console
.
log
(
err
);
throw
(
err
);
})
},
//添加添加元素和覆盖的元素到地图上
addOverLayer
(
geometry
,
results
){
var
view
=
maps
[
"testMap"
];
loadModules
([
"esri/Graphic"
,
"esri/layers/GraphicsLayer"
,
"esri/geometry/geometryEngineAsync"
,
"esri/geometry/Extent"
]).
then
(([
Graphic
,
GraphicsLayer
,
geometryEngineAsync
,
Extent
])
=>
{
var
graphic
=
new
Graphic
({
geometry
:
geometry
})
var
layer
=
view
.
map
.
findLayerById
(
"overLayer"
);
if
(
layer
){
layer
.
removeAll
();
}
else
{
layer
=
new
GraphicsLayer
({
id
:
"overLayer"
})
view
.
map
.
add
(
layer
);
}
var
impotSymbol
=
graphicSymbol
.
fillSymbol
.
importSymbol
,
defaultSymbol
=
graphicSymbol
.
fillSymbol
.
defaultSymbol
;
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
){
var
feature
=
results
[
i
].
feature
;
feature
.
symbol
=
defaultSymbol
;
layer
.
add
(
feature
);
var
geo
=
geometryEngineAsync
.
intersect
(
feature
.
geometry
,
geometry
);
geo
.
then
(
function
(
res
)
{
var
interGra
=
new
Graphic
({
geometry
:
res
,
symbol
:
graphicSymbol
.
fillSymbol
.
highlightSymbol
})
layer
.
add
(
interGra
);
})
}
graphic
.
symbol
=
impotSymbol
layer
.
add
(
graphic
);
var
extent
=
new
Extent
(
JSON
.
parse
(
JSON
.
stringify
(
graphic
.
geometry
.
extent
)))
extent
.
spatialReference
=
view
.
spatialReference
;
view
.
extent
=
extent
;
}).
catch
(
err
=>
{
console
.
log
(
err
);
})
},
clearOverLayer
(){
var
view
=
maps
[
"testMap"
];
var
layer
=
view
.
map
.
findLayerById
(
"overLayer"
);
if
(
layer
){
layer
.
removeAll
();
}
},
//自然幢叠加分析 不能跨宗地 图层本身的叠加分析
zrzOverAnalys
(
bsm
,
graphic
,
callBacFunction
){
var
self
=
this
;
loadModules
([
"esri/geometry/Polygon"
,
"esri/geometry/geometryEngine"
]).
then
(([
Polygon
,
geometryEngine
])
=>
{
var
polygon
=
new
Polygon
(
graphic
.
geometry
);
var
zdLayer
=
null
,
zrzLayer
=
null
;
zdLayer
=
self
.
getLayerByName
(
"ZDJBXX"
);
zdLayer
=
self
.
getLayerByName
(
"ZRZ"
);
var
layerIds
=
[];
layerIds
.
push
(
zdLayer
.
id
);
layerIds
.
push
(
zrzLayer
.
id
);
identifyUtils
.
methods
.
identify
(
zdLayer
.
layerUrl
,
layerIds
,
polygon
,
function
(
res
)
{
var
results
=
res
.
results
;
//判断数据是否与其他数据有重叠
var
flag
=
false
,
mesge
=
""
;
if
(
results
&&
results
.
length
>
0
){
for
(
var
i
=
1
;
i
<
results
.
length
;
i
++
){
var
feature
=
results
[
i
].
feature
,
layerName
=
results
[
i
].
layerName
;
if
(
layerName
==
'ZRZ'
){
if
(
feature
.
attributes
[
'标识码'
]
!=
bsm
){
var
interFlag
=
geometryEngine
.
intersects
(
polygon
,
feature
.
geometry
);
if
(
interFlag
){
flag
=
true
;
mesge
=
"导入的自然幢与其他自然幢重叠,不能导入!!!"
;
break
;
}
}
}
else
{
var
interFlag
=
geometryEngine
.
intersects
(
polygon
,
feature
.
geometry
);
var
withinFlag
=
geometryEngine
.
within
(
polygon
,
feature
.
geometry
);
if
(
!
withinFlag
&&
interFlag
){
flag
=
true
;
mesge
=
"导入的自然幢与其跨宗地,不能导入!!!"
;
break
;
}
}
}
}
callBacFunction
(
flag
,
mesge
);
},
true
)
}).
catch
(
err
=>
{
console
.
log
(
err
);
})
},
//去除重叠部分
getDifference
(
inputGraphic
,
subGraphic
,
callBackFuncton
){
loadModules
([
"esri/geometry/Polygon"
,
"esri/geometry/geometryEngine"
,
"esri/Graphic"
]).
then
(([
Polygon
,
geometryEngine
,
Graphic
])
=>
{
var
inputGeometry
=
new
Polygon
(
inputGraphic
.
geometry
);
var
outGeometry
=
null
;
for
(
var
i
=
0
;
i
<
subGraphic
.
length
;
i
++
){
var
feature
=
subGraphic
[
i
].
feature
;
outGeometry
=
geometryEngine
.
difference
(
inputGeometry
,
feature
.
geometry
);
}
if
(
callBackFuncton
&&
typeof
callBackFuncton
==
'function'
){
callBackFuncton
(
outGeometry
);
}
}).
catch
(
err
=>
{
console
.
log
(
err
);
})
},
//业务处理 先用query方法 查询将所有属性查询 在做空间裁剪
getResultsDif
(
subGraphics
,
currntGraphic
,
callBackFunction
,
flag
){
var
self
=
this
;
loadModules
([
"esri/geometry/geometryEngine"
,
"esri/geometry/Polygon"
]).
then
(([
geometryEngine
,
Polygon
])
=>
{
var
objectIds
=
[];
subGraphics
.
filter
(
item
=>
{
objectIds
.
push
(
item
.
feature
.
attributes
.
OBJECTID
);
})
var
inputGeometry
=
new
Polygon
(
currntGraphic
.
geometry
);
var
zdLayer
=
self
.
getLayerByName
(
"ZDJBXX"
);
queryUtils
.
methods
.
queryByWhere
(
zdLayer
.
layerUrl
+
"/"
+
zdLayer
.
id
,{
OBJECTID
:
objectIds
},
null
,
true
,
""
,
subGraphics
[
0
].
feature
.
geometry
.
spatialReference
,
function
(
result
)
{
var
features
=
result
.
features
;
if
(
flag
){
for
(
var
i
=
0
;
i
<
features
.
length
;
i
++
){
features
[
i
].
geometry
=
geometryEngine
.
difference
(
features
[
i
].
geometry
,
inputGeometry
);
features
[
i
].
attributes
.
BGZT
=
3
;
}
}
else
{
for
(
var
i
=
0
;
i
<
features
.
length
;
i
++
){
features
[
i
].
geometry
=
null
;
features
[
i
].
attributes
.
BGZT
=
4
;
}
}
if
(
callBackFunction
&&
typeof
callBackFunction
==
'function'
){
callBackFunction
(
features
);
}
})
}).
catch
(
err
=>
{
console
.
log
(
err
);
})
},
addGeoByBsm
(
bsm
,
type
,
viewId
)
{
var
self
=
this
;
var
layer
=
null
;
if
(
type
==
'zd'
)
{
layer
=
this
.
getLayerByName
(
"ZDJBXX"
);
}
else
if
(
type
==
'zrz'
)
{
layer
=
this
.
getLayerByName
(
"ZRZ"
);
}
else
{
console
.
log
(
"未定义类型!!"
);
return
;
}
if
(
!
layer
)
{
console
.
log
(
"没有找到图层,不能查询"
);
return
;
}
queryUtils
.
methods
.
queryByWhere
(
layer
.
layerUrl
+
"/"
+
layer
.
id
,
{
"BSM"
:
bsm
},
null
,
true
,
null
,
null
,
function
(
res
)
{
var
features
=
res
.
features
;
if
(
features
&&
features
.
length
>
0
){
if
(
!
features
[
0
].
geometry
){
self
.
$message
.
success
(
"暂无图形信息!!"
);
return
;
}
loadModules
([
"esri/layers/GraphicsLayer"
]).
then
(
([
GraphicsLayer
])
=>
{
var
view
=
maps
[
viewId
];
var
layer
=
view
.
map
.
findLayerById
(
"highlightLayer"
);
if
(
layer
){
layer
.
removeAll
();
}
else
{
layer
=
new
GraphicsLayer
({
id
:
"highlightLayer"
})
view
.
map
.
add
(
layer
,
5
);
}
var
symbol
=
graphicSymbol
.
fillSymbol
.
highlightSymbol
;
var
graphic
=
features
[
0
];
graphic
.
symbol
=
symbol
;
layer
.
add
(
graphic
);
view
.
extent
=
graphic
.
geometry
.
extent
;
}).
catch
(
err
=>
{
thow
(
err
);
})
}
else
{
self
.
$message
.
success
(
"暂无图形信息!!"
);
return
;
}
});
}
}
}
\ No newline at end of file
...
...
src/components/map/EsriMap.vue
View file @
4cd04f0
...
...
@@ -37,15 +37,13 @@
MapView
,
esriMap
])
=>
{
var
map
=
new
esriMap
({
basemap
:
"hybrid"
});
//
var
map
=
new
esriMap
();
//108.95 34.27
var
view
=
new
MapView
({
container
:
self
.
viewId
,
map
:
map
,
zoom
:
10
,
zoom
:
10
,
center
:
[
-
0.154133333770497
,
0.6138183594020817
],
spatialReference
:
{
wkid
:
102100
...
...
src/libs/map/IdentifyUtils.js
View file @
4cd04f0
...
...
@@ -24,7 +24,7 @@ export default {
identifyParameters
.
tolerance
=
tolerance
?
tolerance
:
3
;
identifyParameters
.
mapExtent
=
mapExtent
?
mapExtent
:
geometry
.
extent
;
identifyParameters
.
returnGeometry
=
returnGeometry
?
returnGeometry
:
false
;
//identifyParameters.returnFieldName =
fals
e;
//identifyParameters.returnFieldName =
tru
e;
identifyParameters
.
spatialReference
=
geometry
.
spatialReference
;
identifyTask
.
execute
(
identifyParameters
).
then
(
result
=>
{
if
(
callBackFunction
&&
typeof
callBackFunction
==
'function'
){
...
...
src/libs/map/featureUpdate.js
View file @
4cd04f0
...
...
@@ -22,20 +22,29 @@ export default {
var
featureLayer
=
new
FeatureLayer
({
url
:
url
})
var
saveGraphics
=
[];
if
(
!
Array
.
isArray
(
graphic
)){
graphic
=
[
graphic
];
}
for
(
var
i
=
0
;
i
<
graphic
.
length
;
i
++
){
var
geo
=
null
;
if
(
graphic
.
geometry
.
type
==
'point'
){
geo
=
new
Point
(
graphic
.
geometry
);
}
else
if
(
graphic
.
geometry
.
type
==
'polyline'
){
geo
=
new
Polyline
(
graphic
.
geometry
);
}
else
if
(
graphic
.
geometry
.
type
==
'polygon'
){
geo
=
new
Polygon
(
graphic
.
geometry
);
if
(
!
graphic
[
i
].
geometry
){
geo
=
null
;
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'point'
){
geo
=
new
Point
(
graphic
[
i
].
geometry
);
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'polyline'
){
geo
=
new
Polyline
(
graphic
[
i
].
geometry
);
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'polygon'
){
geo
=
new
Polygon
(
graphic
[
i
].
geometry
);
}
var
saveGraphic
=
new
Graphic
({
attributes
:
graphic
.
attributes
,
attributes
:
graphic
[
i
]
.
attributes
,
geometry
:
geo
});
saveGraphics
.
push
(
saveGraphic
);
}
featureLayer
.
applyEdits
({
addFeatures
:
[
saveGraphic
]
addFeatures
:
saveGraphics
}).
then
(
function
(
res
){
if
(
callBackFunction
&&
typeof
callBackFunction
==
'function'
){
callBackFunction
(
res
);
...
...
@@ -62,20 +71,30 @@ export default {
var
featureLayer
=
new
FeatureLayer
({
url
:
url
})
var
updGraphics
=
[];
if
(
!
Array
.
isArray
(
graphic
)){
graphic
=
[
graphic
];
}
for
(
var
i
=
0
;
i
<
graphic
.
length
;
i
++
){
var
geo
=
null
;
if
(
graphic
.
geometry
.
type
==
'point'
){
geo
=
new
Point
(
graphic
.
geometry
);
}
else
if
(
graphic
.
geometry
.
type
==
'polyline'
){
geo
=
new
Polyline
(
graphic
.
geometry
);
}
else
if
(
graphic
.
geometry
.
type
==
'polygon'
){
geo
=
new
Polygon
(
graphic
.
geometry
);
if
(
!
graphic
[
i
].
geometry
){
geo
=
new
Polygon
();
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'point'
){
geo
=
new
Point
(
graphic
[
i
].
geometry
);
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'polyline'
){
geo
=
new
Polyline
(
graphic
[
i
].
geometry
);
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'polygon'
){
geo
=
new
Polygon
(
graphic
[
i
].
geometry
);
}
var
updGraphic
=
new
Graphic
({
attributes
:
graphic
.
attributes
,
attributes
:
graphic
[
i
]
.
attributes
,
geometry
:
geo
});
updGraphics
.
push
(
updGraphic
);
}
featureLayer
.
applyEdits
({
updateFeatures
:
[
updGraphic
]
updateFeatures
:
updGraphics
}).
then
(
function
(
res
){
if
(
callBackFunction
&&
typeof
callBackFunction
==
'function'
){
callBackFunction
(
res
);
...
...
@@ -102,21 +121,31 @@ export default {
var
featureLayer
=
new
FeatureLayer
({
url
:
url
})
var
delGraphics
=
[];
if
(
!
Array
.
isArray
(
graphic
)){
graphic
=
[
graphic
];
}
for
(
var
i
=
0
;
i
<
graphic
.
length
;
i
++
){
var
geo
=
null
;
if
(
graphic
.
geometry
.
type
==
'point'
){
geo
=
new
Point
(
graphic
.
geometry
);
}
else
if
(
graphic
.
geometry
.
type
==
'polyline'
){
geo
=
new
Polyline
(
graphic
.
geometry
);
}
else
if
(
graphic
.
geometry
.
type
==
'polygon'
){
geo
=
new
Polygon
(
graphic
.
geometry
);
if
(
!
graphic
[
i
].
geometry
){
geo
=
null
;
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'point'
){
geo
=
new
Point
(
graphic
[
i
].
geometry
);
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'polyline'
){
geo
=
new
Polyline
(
graphic
[
i
].
geometry
);
}
else
if
(
graphic
[
i
].
geometry
.
type
==
'polygon'
){
geo
=
new
Polygon
(
graphic
[
i
].
geometry
);
}
var
delGraphic
=
new
Graphic
({
attributes
:
graphic
.
attributes
,
attributes
:
graphic
[
i
]
.
attributes
,
geometry
:
geo
});
delGraphics
.
push
(
delGraphic
);
}
featureLayer
.
applyEdits
({
deleteFeatures
:
[
delGraphic
]
deleteFeatures
:
delGraphics
}).
then
(
function
(
res
){
if
(
callBackFunction
&&
typeof
callBackFunction
==
'function'
){
callBackFunction
(
res
);
...
...
src/libs/map/queryUtils.js
View file @
4cd04f0
...
...
@@ -28,7 +28,7 @@ export default{
where
+=
" and "
;
}
if
(
Array
.
isArray
(
parames
[
i
].
value
)){
where
+=
parames
[
i
].
name
+
" in ("
+
parames
[
i
].
value
.
toString
+
")"
;
where
+=
parames
[
i
].
name
+
" in ("
+
parames
[
i
].
value
.
toString
()
+
")"
;
}
else
if
(
typeof
parames
[
i
].
value
==
'number'
){
where
+=
parames
[
i
].
name
+
" ="
+
parames
[
i
].
value
;
}
else
{
...
...
src/views/systemTX/map.vue
View file @
4cd04f0
...
...
@@ -76,15 +76,20 @@ export default {
},
mixins
:[
mapLayerManager
,
findTask
],
mounted
(){
var
query
=
this
.
$route
.
query
;
var
query
=
this
.
$route
.
query
var
self
=
this
;
setTimeout
(
function
()
{
if
(
query
&&
JSON
.
stringify
(
query
)
!=
"{}"
){
//self.addGeoByBsm(query.bsm,query.type,self.viewId);
if
(
query
.
type
==
'zd'
){
this
.
getRightTree
(
query
.
bsm
)
self
.
getRightTree
(
query
.
bsm
)
}
else
if
(
query
.
type
==
'zrz'
){
this
.
getRightTreeByZrzbsm
(
query
.
bsm
);
self
.
getRightTreeByZrzbsm
(
query
.
bsm
);
}
}
},
500
);
},
methods
:{
...
...
@@ -94,8 +99,10 @@ export default {
view
.
ui
.
remove
(
'zoom'
);
loadModules
([
"esri/layers/MapImageLayer"
,
"esri/geometry/Extent"
]).
then
(([
MapImageLayer
,
Extent
])
=>
{
var
mapImageLayer
=
new
MapImageLayer
({
url
:
self
.
layerUrl
,
...
...
@@ -115,6 +122,13 @@ export default {
}]
});
view
.
map
.
add
(
mapImageLayer
,
1
);
mapImageLayer
.
when
(
function
()
{
var
extent
=
new
Extent
(
JSON
.
parse
(
JSON
.
stringify
(
mapImageLayer
.
fullExtent
)))
extent
.
spatialReference
=
view
.
spatialReference
;
view
.
center
=
extent
.
center
;
view
.
zoom
=
15
;
// view.extent = mapImageLayer.fullExtent;
});
var
query
=
self
.
$route
.
query
;
if
(
query
&&
JSON
.
stringify
(
query
)
!=
"{}"
){
self
.
addGeoByBsm
(
query
.
bsm
,
query
.
type
,
self
.
viewId
);
...
...
@@ -137,9 +151,11 @@ export default {
},
//图层选择事件
selectLayerChange
(){
debugger
var
self
=
this
;
this
.
features
=
[];
var
layerAndResult
=
this
.
results
.
filter
(
function
(
item
)
{
return
item
.
layerId
=
self
.
selectResLayerId
;
return
item
.
layerId
=
=
self
.
selectResLayerId
;
})
if
(
layerAndResult
){
this
.
features
=
layerAndResult
[
0
].
features
;
...
...
src/views/systemTX/mapWeight/js/mapLayerManager.js
View file @
4cd04f0
...
...
@@ -79,12 +79,12 @@ export default {
return
;
}
for
(
var
i
=
0
;
i
<
searchResult
.
length
;
i
++
){
var
layer
=
view
.
map
.
findLayerById
(
"searchResult"
+
searchResult
.
layerName
);
var
layer
=
view
.
map
.
findLayerById
(
"searchResult"
+
searchResult
[
i
].
layerId
);
if
(
layer
){
layer
.
removeAll
();
}
else
{
layer
=
new
GraphicsLayer
({
id
:
"searchResult"
+
searchResult
.
layerName
id
:
"searchResult"
+
searchResult
[
i
].
layerId
})
view
.
map
.
add
(
layer
);
}
...
...
Please
register
or
sign in
to post a comment