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
9be24297
Commit
9be24297
authored
Aug 05, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成了模拟器的轨迹查询功能
parent
bfc87ff7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
188 additions
and
9 deletions
+188
-9
data/protocolTools/carData/M202003060520.json
data/protocolTools/carData/M202003060520.json
+1
-1
run.py
run.py
+2
-0
templates/otherTools/maptool.html
templates/otherTools/maptool.html
+78
-8
views/otherTools/mapTools_process.py
views/otherTools/mapTools_process.py
+106
-0
views/otherTools/mapTools_view.py
views/otherTools/mapTools_view.py
+1
-0
No files found.
data/protocolTools/carData/M202003060520.json
View file @
9be24297
{
"time"
:
{
"dateTime"
:
"2020-08-04 10:10:21"
,
"date"
:
"2020-08-04"
,
"time"
:
"10:10:21"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
415
,
"todayTotalOil"
:
40
,
"todayTotalTime"
:
25
,
"theMilleage"
:
415
,
"theOil"
:
40
,
"theTime"
:
25
},
"travelData"
:
{
"totalMilleage"
:
653410
,
"totalOil"
:
57475
,
"totalTime"
:
39385
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
58
,
"totalSharpSlowdown"
:
47
,
"totalSharpTurn"
:
49
}}}
\ No newline at end of file
{
"time"
:
{
"dateTime"
:
"2020-08-04 10:10:21"
,
"date"
:
"2020-08-04"
,
"time"
:
"10:10:21"
},
"curDayTravel"
:
{
"todayTotalMilleage"
:
1093
,
"todayTotalOil"
:
88
,
"todayTotalTime"
:
67
,
"theMilleage"
:
678
,
"theOil"
:
48
,
"theTime"
:
42
},
"travelData"
:
{
"totalMilleage"
:
654088
,
"totalOil"
:
57523
,
"totalTime"
:
39427
},
"event"
:
{
"threeRapid"
:
{
"totalRapidlyAccelerate"
:
58
,
"totalSharpSlowdown"
:
47
,
"totalSharpTurn"
:
49
}}}
\ No newline at end of file
run.py
View file @
9be24297
...
...
@@ -21,6 +21,7 @@ from views.messageTools.M_simulater_view import M_simulater_view
from
views.messageTools.M_simulater_process
import
M_simulater_process
from
views.otherTools.mapTools_view
import
mapTools_view
from
views.otherTools.mapTools_process
import
mapTools_process
app
=
Flask
(
__name__
)
app
.
register_blueprint
(
setting_view
,
url_prefix
=
"/protocolTools/setting_view"
)
...
...
@@ -44,6 +45,7 @@ app.register_blueprint(M_simulater_view,url_prefix = "/messageTools/M_simulater_
app
.
register_blueprint
(
M_simulater_process
,
url_prefix
=
"/messageTools/M_simulater_process"
)
app
.
register_blueprint
(
mapTools_view
,
url_prefix
=
"/otherTools/mapTools_view"
)
app
.
register_blueprint
(
mapTools_process
,
url_prefix
=
"/otherTools/mapTools_process"
)
@
app
.
route
(
'/'
)
def
hello
():
...
...
templates/otherTools/maptool.html
View file @
9be24297
...
...
@@ -113,18 +113,17 @@
}
格式'
></textarea>
<div>
<select
id=
"simulatorType"
class=
"form-control"
style=
"width:130px;"
>
<select
id=
"simulatorType"
class=
"form-control"
style=
"width:130px;"
onchange=
"getNewLines(this)"
>
<option
value=
"0"
>
M500模拟器
</option>
<option
value=
"1
6
"
>
M300模拟器
</option>
<option
value=
"
3
2"
>
车安优模拟器
</option>
<option
value=
"1"
>
M300模拟器
</option>
<option
value=
"2"
>
车安优模拟器
</option>
</select>
<select
id=
"witchLine"
class=
"form-control"
style=
"width:150px;"
>
<option
value=
"0"
>
自动模式
</option>
<option
value=
"16"
>
单GPS模式
</option>
<option
value=
"32"
>
单BDS模式
</option>
<option
value=
"48"
>
GPS+BDS双模式
</option>
{% for key,value in arg["gpsLines"].items() %}
<option
value=
"{{ key }}"
>
{{ value }}
</option>
{% endfor %}
</select>
<button
type=
"button"
class=
"btn btn-default"
onclick=
"
distanc
e()"
>
查询
</button>
<button
type=
"button"
class=
"btn btn-default"
onclick=
"
showModGpsLin
e()"
>
查询
</button>
</div>
</div>
<div
id=
"container"
style=
"width:100%; height: 750px;"
>
...
...
@@ -415,7 +414,78 @@
}
$
(
"
#lineData1
"
).
val
(
""
);
}
//切换模拟器后获取新的轨迹数据
function
getNewLines
(
e
){
var
type
=
$
(
e
).
val
();
var
data
=
{};
data
[
"
type
"
]
=
type
;
var
host
=
window
.
location
.
host
;
$
(
"
#showFeedback
"
).
val
(
""
)
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/otherTools/mapTools_process/getGPSLineList
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
$
(
"
#witchLine
"
).
children
().
remove
();
var
gpsLines
=
data
.
gpsLines
;
for
(
var
item
in
gpsLines
){
$
(
"
#witchLine
"
).
append
(
"
<option value=
"
+
item
+
"
>
"
+
gpsLines
[
item
]
+
"
</option>
"
);
}
}
else
{
alert
(
data
.
message
);
}
}
});
}
//点击查看gpsline
function
showModGpsLine
(){
var
type
=
$
(
"
#simulatorType
"
).
val
();
var
gpsLine
=
$
(
"
#witchLine option:selected
"
).
val
();
var
data
=
{};
data
[
"
type
"
]
=
type
;
data
[
"
gpsLine
"
]
=
gpsLine
;
var
host
=
window
.
location
.
host
;
$
(
"
#showFeedback
"
).
val
(
""
)
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/otherTools/mapTools_process/getGPSLineData
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
var
modGpsLines
=
data
[
"
gpsLines
"
];
if
(
showLineObj
!=
undefined
){
map
.
remove
(
showLineObj
);
}
for
(
var
j
=
0
;
j
<
modGpsLines
.
length
;
j
++
){
var
cvtGps
=
coordtransform
.
wgs84togcj02
(
parseFloat
(
modGpsLines
[
j
][
0
]),
parseFloat
(
modGpsLines
[
j
][
1
]));
cvtGps
[
0
]
=
cvtGps
[
0
].
toFixed
(
6
);
cvtGps
[
1
]
=
cvtGps
[
1
].
toFixed
(
6
);
modGpsLines
[
j
]
=
cvtGps
;
}
var
centerPoint
=
modGpsLines
[
parseInt
(
modGpsLines
.
length
/
2
)];
// 绘制轨迹
showLineObj
=
new
AMap
.
Polyline
({
map
:
map
,
path
:
modGpsLines
,
showDir
:
true
,
strokeColor
:
"
#28F
"
,
//线颜色
// strokeOpacity: 1, //线透明度
strokeWeight
:
6
,
//线宽
// strokeStyle: "solid" //线样式
});
map
.
setCenter
(
centerPoint
);
}
else
{
alert
(
data
.
message
);
}
}
});
}
</script>
{% endblock %}
</div>
...
...
views/otherTools/mapTools_process.py
0 → 100644
View file @
9be24297
#coding:utf-8
from
flask
import
Blueprint
,
Response
,
request
from
configparser
import
ConfigParser
from
lib.protocol.reportPlateform.Common_res
import
Common_res
from
lib.socket.ClientSocket
import
ClientSocket
import
json
import
traceback
import
binascii
from
lib.util
import
fileUtil
mapTools_process
=
Blueprint
(
'mapTools_process'
,
__name__
)
##########################################
# 【接口类型】获取模拟器的GPSline
##########################################
@
mapTools_process
.
route
(
"/getGPSLineList"
,
methods
=
[
'POST'
])
def
getGPSLineList
():
type
=
int
(
request
.
form
.
get
(
"type"
))
data
=
{}
if
(
type
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
if
(
type
==
0
):
data
[
"status"
]
=
"200"
data
[
"gpsLines"
]
=
fileUtil
.
getDirFilesListMap
(
"data/protocolTools/GPSLines"
)
elif
(
type
==
1
):
data
[
"status"
]
=
"200"
data
[
"gpsLines"
]
=
fileUtil
.
getDirFilesListMap
(
"data/m300Tools/GPSLines"
)
elif
(
type
==
2
):
data
[
"status"
]
=
"200"
data
[
"gpsLines"
]
=
fileUtil
.
getDirFilesListMap
(
"data/messageTools/GPSLines"
)
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
##########################################
# 【接口类型】获取GPSline 数据
##########################################
@
mapTools_process
.
route
(
"/getGPSLineData"
,
methods
=
[
'POST'
])
def
getGPSLineData
():
type
=
int
(
request
.
form
.
get
(
"type"
))
gpsLine
=
request
.
form
.
get
(
"gpsLine"
)
data
=
{}
if
(
type
==
None
or
gpsLine
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
if
(
type
==
0
):
with
open
(
"data/protocolTools/GPSLines/"
+
gpsLine
,
"r"
,
encoding
=
"utf-8"
)
as
fi
:
content
=
fi
.
read
()
conJson
=
json
.
loads
(
content
)
gpsLines
=
conJson
[
"GPSLine"
]
theGpsLines
=
[]
for
item
in
gpsLines
:
tem
=
[]
tem
.
append
(
float
(
item
[
"lng"
]
.
replace
(
"
\n
"
,
""
)))
tem
.
append
(
float
(
item
[
"lat"
]
.
replace
(
"
\n
"
,
""
)))
theGpsLines
.
append
(
tem
)
data
[
"status"
]
=
"200"
data
[
"gpsLines"
]
=
theGpsLines
elif
(
type
==
1
):
with
open
(
"data/m300Tools/GPSLines/"
+
gpsLine
,
"r"
,
encoding
=
"utf-8"
)
as
fi
:
content
=
fi
.
read
()
conJson
=
json
.
loads
(
content
)
gpsLines
=
conJson
[
"GPSLine"
]
theGpsLines
=
[]
for
item
in
gpsLines
:
tem
=
[]
tem
.
append
(
float
(
item
[
"lng"
]
.
replace
(
"
\n
"
,
""
)))
tem
.
append
(
float
(
item
[
"lat"
]
.
replace
(
"
\n
"
,
""
)))
theGpsLines
.
append
(
tem
)
data
[
"status"
]
=
"200"
data
[
"gpsLines"
]
=
theGpsLines
elif
(
type
==
2
):
with
open
(
"data/messageTools/GPSLines/"
+
gpsLine
,
"r"
,
encoding
=
"utf-8"
)
as
fi
:
content
=
fi
.
read
()
conJson
=
json
.
loads
(
content
)
gpsLines
=
conJson
[
"GPSLine"
]
theGpsLines
=
[]
for
item
in
gpsLines
:
tem
=
[]
tem
.
append
(
float
(
item
[
"lng"
]
.
replace
(
"
\n
"
,
""
)))
tem
.
append
(
float
(
item
[
"lat"
]
.
replace
(
"
\n
"
,
""
)))
theGpsLines
.
append
(
tem
)
data
[
"status"
]
=
"200"
data
[
"gpsLines"
]
=
theGpsLines
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
views/otherTools/mapTools_view.py
View file @
9be24297
...
...
@@ -19,4 +19,5 @@ def maptool_page():
arg
=
{}
path
=
"otherTools/maptool.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
arg
[
"gpsLines"
]
=
fileUtil
.
getDirFilesListMap
(
"data/protocolTools/GPSLines"
)
return
render_template
(
path
,
arg
=
arg
)
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