Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SuperMan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
罗超
SuperMan
Commits
15d32ee4
Commit
15d32ee4
authored
Sep 15, 2023
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
7bdda247
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
34 deletions
+38
-34
tripmap.vue
...omponents/newTravelmanager/TravelGroupControl/tripmap.vue
+30
-34
index.js
src/plug/index.js
+8
-0
No files found.
src/components/newTravelmanager/TravelGroupControl/tripmap.vue
View file @
15d32ee4
...
...
@@ -299,33 +299,6 @@ export default {
this
.
drawMap
(
2
);
}
},
// 清除已有源
ClearSource
(
Id
,
type
){
if
(
type
){
if
(
this
.
map
.
getLayer
(
Id
))
{
this
.
map
.
removeLayer
(
Id
);
if
(
type
==
2
)
this
.
map
.
removeSource
(
Id
);
}
}
else
{
this
.
listCity
.
forEach
((
p
,
i
)
=>
{
if
(
this
.
map
.
getLayer
(
"curve-layer-"
+
p
.
MId
))
{
this
.
map
.
removeLayer
(
"curve-layer-"
+
p
.
MId
);
this
.
map
.
removeSource
(
"curve-source-"
+
p
.
MId
);
}
});
this
.
countriesData
.
forEach
((
x
,
i
)
=>
{
if
(
this
.
map
&&
this
.
map
.
getLayer
(
"world-layer-"
+
x
.
MId
))
{
this
.
map
.
removeLayer
(
"world-layer-"
+
x
.
MId
);
}
if
(
this
.
map
&&
this
.
map
.
getLayer
(
"mapLayer-"
+
x
.
MId
))
{
this
.
map
.
removeLayer
(
"mapLayer-"
+
x
.
MId
);
}
if
(
this
.
map
&&
this
.
map
.
getLayer
(
"mapLayerId-"
+
x
.
MId
))
{
this
.
map
.
removeLayer
(
"mapLayerId-"
+
x
.
MId
);
}
});
}
},
// 组装数据
UpdateDatas
(){
let
listCity
=
[];
...
...
@@ -395,6 +368,33 @@ export default {
});
console
.
log
(
this
.
countriesData
,
'------====='
)
},
// 清除已有源
ClearSource
(
Id
,
type
){
if
(
type
){
if
(
this
.
map
.
getLayer
(
Id
))
{
this
.
map
.
removeLayer
(
Id
);
if
(
type
==
2
)
this
.
map
.
removeSource
(
Id
);
}
}
else
{
this
.
listCity
.
forEach
((
p
,
i
)
=>
{
if
(
this
.
map
.
getLayer
(
"curve-layer-"
+
p
.
MId
))
{
this
.
map
.
removeLayer
(
"curve-layer-"
+
p
.
MId
);
this
.
map
.
removeSource
(
"curve-source-"
+
p
.
MId
);
}
});
this
.
countriesData
.
forEach
((
x
,
i
)
=>
{
if
(
this
.
map
&&
this
.
map
.
getLayer
(
"world-layer-"
+
x
.
MId
))
{
this
.
map
.
removeLayer
(
"world-layer-"
+
x
.
MId
);
}
if
(
this
.
map
&&
this
.
map
.
getLayer
(
"mapLayer-"
+
x
.
MId
))
{
this
.
map
.
removeLayer
(
"mapLayer-"
+
x
.
MId
);
}
if
(
this
.
map
&&
this
.
map
.
getLayer
(
"mapLayerId-"
+
x
.
MId
))
{
this
.
map
.
removeLayer
(
"mapLayerId-"
+
x
.
MId
);
}
});
}
},
// 绘制地图
async
drawMap
(
type
)
{
...
...
@@ -711,11 +711,6 @@ export default {
let
that
=
this
;
let
el
=
document
.
createElement
(
"div"
);
el
.
style
.
cursor
=
"pointer"
;
// let html = `
<
div
class
=
'arror-box-map hide'
id
=
'marker_${i}'
data
-
x
-
drift
=
'${item
// .name.length *
// 10}'
><
span
class
=
'top'
><
/span><span class='right'></
span
><
span
class
=
'bottom'
><
/span><span class='left'></
span
><
div
>
`;
// html = `
<
div
style
=
'position:relative'
><
div
>
$
{
item
.
name
}
<
/div>${html}</
div
>
`;
// .setLngLat([item.PositionStr.Left?item.PositionStr.Left:item.longitude, item.PositionStr.Right?item.PositionStr.Right:item.latitude])
el
.
innerHTML
=
item
.
name
;
var
marker
=
new
mapboxgl
.
Marker
(
el
,
{
offset
:
[
0
,
-
25
],
...
...
@@ -726,7 +721,6 @@ export default {
}
else
{
marker
.
setLngLat
([
item
.
longitude
,
item
.
latitude
]);
}
// marker.setLngLat([item.PositionStr.Left?item.PositionStr.Left:item.longitude, item.PositionStr.Right?item.PositionStr.Right:item.latitude])
marker
.
addTo
(
this
.
map
);
marker
.
on
(
"dragend"
,
function
()
{
let
currentMarkerLngLat
=
marker
.
getLngLat
();
...
...
@@ -924,7 +918,9 @@ export default {
let
currentMarkerLngLat
=
marker
.
getLngLat
();
x
.
Lng
=
currentMarkerLngLat
.
lng
;
x
.
Lat
=
currentMarkerLngLat
.
lat
;
console
.
log
(
that
.
countriesData
,
'--------'
)
console
.
log
(
x
.
MName
,
'====='
)
let
TripMapList
=
that
.
TripMapList
.
filter
(
y
=>
y
.
MName
==
x
.
MName
)
console
.
log
(
TripMapList
,
'--------'
)
});
this
.
countriesMarkers
.
push
(
marker
);
}
...
...
src/plug/index.js
View file @
15d32ee4
...
...
@@ -1787,5 +1787,13 @@ export default {
}
return
uuid
.
join
(
""
);
}
Vue
.
prototype
.
getRandomColor
=
function
()
{
var
letters
=
'0123456789ABCDEF'
;
var
color
=
'#'
;
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
color
+=
letters
[
Math
.
floor
(
Math
.
random
()
*
16
)];
}
return
color
;
}
}
}
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