Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
new-socketemulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李远洪
new-socketemulator
Commits
8880e7f8
Commit
8880e7f8
authored
Jul 29, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图工具,正价了gps定位
parent
e316dd9d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
5 deletions
+34
-5
templates/otherTools/maptool.html
templates/otherTools/maptool.html
+34
-5
No files found.
templates/otherTools/maptool.html
View file @
8880e7f8
...
@@ -28,6 +28,9 @@
...
@@ -28,6 +28,9 @@
width
:
90px
;
width
:
90px
;
text-align
:
right
;
text-align
:
right
;
}
}
#container
:hover
{
cursor
:
crosshair
;
}
</style>
</style>
<div
id=
"container2"
style=
"width:85%;min-height:750px;float:left;_background:pink;"
>
<div
id=
"container2"
style=
"width:85%;min-height:750px;float:left;_background:pink;"
>
{% block content_1 %}
{% block content_1 %}
...
@@ -38,8 +41,14 @@
...
@@ -38,8 +41,14 @@
<a
href=
"#"
class=
"btn btn-default"
role=
"button"
id=
"ctrArea2"
onclick=
"ctrAreaShow(this)"
>
录制轨迹
</a>
<a
href=
"#"
class=
"btn btn-default"
role=
"button"
id=
"ctrArea2"
onclick=
"ctrAreaShow(this)"
>
录制轨迹
</a>
<a
href=
"#"
class=
"btn btn-default"
role=
"button"
id=
"ctrArea3"
onclick=
"ctrAreaShow(this)"
>
查询轨迹
</a>
<a
href=
"#"
class=
"btn btn-default"
role=
"button"
id=
"ctrArea3"
onclick=
"ctrAreaShow(this)"
>
查询轨迹
</a>
</div>
</div>
<div
id=
"ctrArea_1"
style=
"width:400px;height:250px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;"
class=
"btn-group btn-group-justified"
role=
"group"
>
<div
id=
"ctrArea_1"
style=
"width:400px;height:120px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;"
class=
"btn-group btn-group-justified"
role=
"group"
>
111
<div
style=
"border-width: 1px;border-bottom: 1px solid #eee;margin: 10px;padding-bottom: 5px;"
>
<label>
经 ,纬 度 :
</label><input
id=
"toLngLat"
type=
"text"
class=
"form-control"
value=
"106.54041,29.40268"
style=
"width:200px;"
>
<button
type=
"button"
class=
"btn btn-default"
onclick=
"setposition()"
>
定位
</button>
</div>
<div
style=
"border-width: 1px;border-bottom: 1px solid #eee;margin: 10px;padding-bottom: 5px;"
>
<label>
当前经纬度:
</label><input
id=
"curLngLat"
type=
"text"
class=
"form-control"
value=
"106.587436,29.565099"
style=
"width:200px;"
>
<label
style=
"font-size:10px;"
>
点击地图自动获取
</label>
</div>
</div>
</div>
<div
id=
"ctrArea_2"
style=
"width:400px;height:250px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;"
class=
"btn-group btn-group-justified"
role=
"group"
>
<div
id=
"ctrArea_2"
style=
"width:400px;height:250px;background:white;z-index:50;position:absolute;top:160px;right:40px;border-radius:5px;display:none;"
class=
"btn-group btn-group-justified"
role=
"group"
>
222
222
...
@@ -57,17 +66,23 @@
...
@@ -57,17 +66,23 @@
<script>
<script>
var
map
=
null
;
var
map
=
null
;
var
curShow
=
""
;
var
curShow
=
""
;
//控制点击地图的触发事件
var
clickType
=
0
;
var
marker
=
undefined
;
//单个点标记
//加载地图
//加载地图
(
function
(){
(
function
(){
map
=
new
AMap
.
Map
(
'
container
'
,
{
map
=
new
AMap
.
Map
(
'
container
'
,
{
zoom
:
1
2
,
//级别
zoom
:
1
3
,
//级别
center
:
[
106.587436
,
29.565099
]
center
:
[
106.587436
,
29.565099
]
});
});
})();
})();
//处理地图点击事件
//处理地图点击事件
map
.
on
(
'
click
'
,
function
(
ev
)
{
map
.
on
(
'
click
'
,
function
(
ev
)
{
if
(
clickType
==
0
){
var
lnglat
=
ev
.
lnglat
;
var
lnglat
=
ev
.
lnglat
;
console
.
log
(
lnglat
);
var
lnglattxt
=
lnglat
[
"
lng
"
]
+
"
,
"
+
lnglat
[
"
lat
"
];
$
(
"
#curLngLat
"
).
val
(
lnglattxt
);
}
});
});
function
ctrAreaShow
(
e
){
function
ctrAreaShow
(
e
){
var
cliId
=
$
(
e
).
attr
(
"
id
"
);
var
cliId
=
$
(
e
).
attr
(
"
id
"
);
...
@@ -103,6 +118,20 @@
...
@@ -103,6 +118,20 @@
}
}
}
}
}
}
//设置地图中心点,移动地图
function
setposition
(){
if
(
marker
!=
undefined
){
map
.
remove
(
marker
);
}
var
theGps
=
$
(
"
#toLngLat
"
).
val
().
split
(
"
,
"
)
marker
=
new
AMap
.
Marker
({
position
:
new
AMap
.
LngLat
(
theGps
[
0
],
theGps
[
1
]),
// 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title
:
'
定位
'
});
map
.
setCenter
(
theGps
);
map
.
add
(
marker
);
}
</script>
</script>
{% endblock %}
{% endblock %}
</div>
</div>
...
...
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