Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
gassafety
Commits
db351864
Commit
db351864
authored
Feb 10, 2022
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
画线的时候直接计算长度
parent
69d7d39e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
pipelineView.vue
gassafety-web/src/components/PopWindow/pipelineView.vue
+2
-0
gaodeMap.js
gassafety-web/src/utils/gaodeMap.js
+46
-2
No files found.
gassafety-web/src/components/PopWindow/pipelineView.vue
View file @
db351864
...
@@ -189,6 +189,7 @@ export default {
...
@@ -189,6 +189,7 @@ export default {
pipeName
:
""
,
pipeName
:
""
,
pipeType
:
"1"
,
pipeType
:
"1"
,
pipePressure
:
"1"
,
pipePressure
:
"1"
,
pipeLength
:
""
,
iconUrl
:
""
,
iconUrl
:
""
,
}
,
}
,
dialogVisible
:
false
,
dialogVisible
:
false
,
...
@@ -235,6 +236,7 @@ export default {
...
@@ -235,6 +236,7 @@ export default {
}
,
}
,
created
()
{
created
()
{
console
.
log
(
"lineData"
,
this
.
lineData
,
this
.
lnglatsArr
,
this
.
pipeLength
);
console
.
log
(
"lineData"
,
this
.
lineData
,
this
.
lnglatsArr
,
this
.
pipeLength
);
this
.
editForm
.
pipeLength
=
parseInt
(
this
.
pipeLength
);
if
(
this
.
lineData
?.
pipeId
)
{
if
(
this
.
lineData
?.
pipeId
)
{
this
.
editForm
=
{
...
this
.
lineData
}
;
this
.
editForm
=
{
...
this
.
lineData
}
;
}
else
{
}
else
{
...
...
gassafety-web/src/utils/gaodeMap.js
View file @
db351864
...
@@ -101,6 +101,24 @@ class gaodeMap {
...
@@ -101,6 +101,24 @@ class gaodeMap {
this
.
closeInfoWindow
();
this
.
closeInfoWindow
();
this
.
polyLinesColorClear
();
this
.
polyLinesColorClear
();
});
});
// 鼠标在地图上移动
this
.
myMap
.
on
(
"mousemove"
,
e
=>
{
if
(
this
.
mouseTool
.
overlays
.
polyline
.
length
>
0
)
{
const
arr
=
this
.
mouseTool
.
overlays
.
polyline
;
const
length
=
parseInt
(
arr
[
0
].
getLength
());
if
(
this
.
lengthMarker
)
{
this
.
myMap
.
remove
(
this
.
lengthMarker
);
}
const
position
=
e
.
lnglat
;
this
.
lengthMarker
=
new
AMap
.
Marker
({
map
:
map
,
position
,
content
:
`<div style="color:#000;font-size:14px;display:inline-block;background:#fff;white-space:nowrap;padding:2px 5px;">
管道长度:<span>
${
length
}
米</span><div>`
,
offset
:
new
AMap
.
Pixel
(
20
,
20
)
});
}
});
this
.
myMap
.
on
(
"moveend"
,
()
=>
{
this
.
myMap
.
on
(
"moveend"
,
()
=>
{
if
(
this
.
handleInfoWindowOpenFunc
)
{
if
(
this
.
handleInfoWindowOpenFunc
)
{
this
.
handleInfoWindowOpenFunc
();
this
.
handleInfoWindowOpenFunc
();
...
@@ -751,13 +769,19 @@ class gaodeMap {
...
@@ -751,13 +769,19 @@ class gaodeMap {
createNewLine
()
{
createNewLine
()
{
map
.
remove
(
this
.
markerOverlays
);
map
.
remove
(
this
.
markerOverlays
);
console
.
log
(
"创造一条线了啊"
);
console
.
log
(
"创造一条线了啊"
);
// 线测距
map
.
plugin
([
"AMap.MouseTool"
],
()
=>
{
this
.
ruler
=
new
AMap
.
RangingTool
(
map
);
this
.
ruler
.
turnOn
();
// console.log(this.ruler.)
});
this
.
mouseTool
.
polyline
({
this
.
mouseTool
.
polyline
({
// bubbles:false,
// bubbles:false,
strokeWeight
:
4
,
strokeWeight
:
4
,
strokeColor
:
"#80d8ff"
,
strokeColor
:
"#80d8ff"
,
extData
:
{
extData
:
{
type
:
"newLine"
,
type
:
"newLine"
,
//
当前line状态 0:正常状态 1:正在编辑状态
//当前line状态 0:正常状态 1:正在编辑状态
isState
:
0
isState
:
0
}
}
//同Polyline的Option设置
//同Polyline的Option设置
...
@@ -770,6 +794,9 @@ class gaodeMap {
...
@@ -770,6 +794,9 @@ class gaodeMap {
this
.
lineFlag
=
false
;
this
.
lineFlag
=
false
;
if
(
this
.
mouserTool
)
{
if
(
this
.
mouserTool
)
{
this
.
mouseTool
.
close
();
this
.
mouseTool
.
close
();
if
(
this
.
lengthMarker
)
{
this
.
myMap
.
remove
(
this
.
lengthMarker
);
}
}
}
if
(
this
.
newLineObj
)
{
if
(
this
.
newLineObj
)
{
this
.
newLineObj
.
polyEditor
.
close
();
this
.
newLineObj
.
polyEditor
.
close
();
...
@@ -1006,6 +1033,10 @@ class gaodeMap {
...
@@ -1006,6 +1033,10 @@ class gaodeMap {
let
that
=
this
;
let
that
=
this
;
this
.
markerOverlays
=
[];
this
.
markerOverlays
=
[];
this
.
mouseTool
.
on
(
"draw"
,
function
(
e
)
{
this
.
mouseTool
.
on
(
"draw"
,
function
(
e
)
{
// 如果正在测量就删掉
if
(
that
.
lengthMarker
)
{
that
.
myMap
.
remove
(
that
.
lengthMarker
);
}
if
(
e
.
obj
.
getExtData
().
type
!=
"newLine"
)
{
if
(
e
.
obj
.
getExtData
().
type
!=
"newLine"
)
{
map
.
remove
(
that
.
markerOverlays
);
map
.
remove
(
that
.
markerOverlays
);
const
device
=
that
.
createInfowindow
(
"新增"
);
const
device
=
that
.
createInfowindow
(
"新增"
);
...
@@ -1037,19 +1068,29 @@ class gaodeMap {
...
@@ -1037,19 +1068,29 @@ class gaodeMap {
if
(
e
.
obj
&&
e
.
obj
.
getExtData
().
type
==
"newLine"
)
{
if
(
e
.
obj
&&
e
.
obj
.
getExtData
().
type
==
"newLine"
)
{
console
.
log
(
"挂上事件"
);
console
.
log
(
"挂上事件"
);
// that.mouseTool.overlays.polyLine = [];
// 清空当前算距离用的内部数组
that
.
mouseTool
.
overlays
.
polyline
=
[];
that
.
newLineAddEvent
(
e
.
obj
);
that
.
newLineAddEvent
(
e
.
obj
);
// 测距结束
that
.
ruler
.
turnOff
(
true
);
// console.log(e.obj)
e
.
obj
.
on
(
"mouseover"
,
()
=>
{
e
.
obj
.
on
(
"mouseover"
,
()
=>
{
e
.
obj
.
setOptions
({
strokeColor
:
"#F7FE38"
});
e
.
obj
.
setOptions
({
strokeColor
:
"#F7FE38"
});
});
});
e
.
obj
.
on
(
"mouseout"
,
()
=>
{
e
.
obj
.
on
(
"mouseout"
,
()
=>
{
e
.
obj
.
setOptions
({
strokeColor
:
"#80d8ff"
});
e
.
obj
.
setOptions
({
strokeColor
:
"#80d8ff"
});
});
});
// 记录这条线
// 记录这条线
// console.log(e.obj.getPath().length)
// console.log(e.obj.getPath().length)
// 如果只有一个点,并没有连成线的时候就不close 大于一个点的时候才执行clse
// 如果只有一个点,并没有连成线的时候就不close 大于一个点的时候才执行clse
console
.
log
(
that
.
lineType
);
//
console.log(that.lineType);
if
(
e
.
obj
.
getPath
().
length
>
1
)
{
if
(
e
.
obj
.
getPath
().
length
>
1
)
{
that
.
newLineObj
=
e
.
obj
;
that
.
newLineObj
=
e
.
obj
;
that
.
ruler
.
turnOff
(
true
);
that
.
mouseTool
.
close
();
that
.
mouseTool
.
close
();
}
else
{
}
else
{
// that.newLineObj = null;
// that.newLineObj = null;
...
@@ -1182,6 +1223,9 @@ class gaodeMap {
...
@@ -1182,6 +1223,9 @@ class gaodeMap {
closeAddMarker
()
{
closeAddMarker
()
{
this
.
mouseTool
.
close
();
this
.
mouseTool
.
close
();
map
.
remove
(
this
.
markerOverlays
);
map
.
remove
(
this
.
markerOverlays
);
if
(
this
.
lengthMarker
)
{
this
.
myMap
.
remove
(
this
.
lengthMarker
);
}
}
}
// 只上图没功能
// 只上图没功能
onlyLine
(
obj
)
{
onlyLine
(
obj
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment