Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
方 梦梦
world51tocmap
Commits
830e60d6
Commit
830e60d6
authored
Apr 11, 2025
by
chengdong.lv@inzymeits.com
Browse files
交通事件
parent
1177792a
Changes
2
Show whitespace changes
Inline
Side-by-side
data.js
View file @
830e60d6
const
arr
=
[
const
sj
arr
=
[
{
id
:
"
14578
"
,
type
:
"
ROAD_SPILL
"
,
...
...
index.html
View file @
830e60d6
...
...
@@ -275,6 +275,7 @@
<script
src=
"http://localhost:3000/gis_sdk/js/CMapLoader.map.js"
></script>
<!-- <script src="http://localhost:3000/gis_sdk/js/CMapLoader.map.js"></script> -->
<script
src=
"./SignalLines.js"
></script>
<!-- <script src="./data.js"></script> -->
</head>
<script>
...
...
@@ -391,7 +392,7 @@
function
flyTo
()
{
var
options
=
{
position
:
[
117.34584096
,
38.99557144
,
276.84
],
orientation
:
[
0
,
-
90
],
orientation
:
[
-
34.930073
,
-
44.426579
],
//
[0, -90],
//设置俯视
};
camera
.
flyTo
(
options
);
}
...
...
@@ -1013,9 +1014,10 @@
road
.
removeSignalStopLine
();
}
var
arr
=
[]
var
arr
=
[]
;
//开始交通事件
document
.
getElementById
(
"
addTrafficIncident
"
).
onclick
=
addTrafficIncident
;
async
function
addTrafficIncident
()
{
// 订阅事件 websocket事件
const
url
=
...
...
@@ -1024,69 +1026,29 @@
socket
.
onopen
=
function
(
event
)
{
console
.
log
(
"
socket连接成功!
"
);
};
const
fun
=
async
(
json
)
=>
{
const
{
id
,
name
,
type
,
location
}
=
json
;
window
.
trafficIncidentArr
=
trafficIncidentArr
;
let
index
=
0
;
let
show
=
false
;
const
fun1
=
async
(
json
)
=>
{
const
{
endTime
,
id
,
name
,
location
}
=
json
;
console
.
log
(
"
idididididid
"
,
index
,
id
,
name
);
if
(
name
==
"
违规停车/停车占道
"
&&
!
show
)
{
show
=
true
;
console
.
log
(
"
违规停车/停车占道违规停车/停车占道
"
,
json
,
id
);
let
optionsTest
=
{
position
:
[
location
[
0
].
longitude
,
location
[
0
].
latitude
,
28.12
],
orientation
:
[
-
34.930073
,
-
44.426579
],
};
camera
.
flyTo
(
optionsTest
);
}
const
find
=
trafficIncidentArr
.
find
((
item
)
=>
item
.
id
==
id
);
// 从 trafficIncidentArr 中的每一项中找出 trafficIncidentId== id 的数据
const
find
=
trafficIncidentArr
.
find
(
(
item
)
=>
item
.
trafficIncidentId
==
id
);
if
(
find
)
{
if
(
index
>
50
&&
name
==
"
违规停车/停车占道
"
)
{
if
(
json
.
endTime
)
{
if
(
find
)
{
map
.
stopTrafficIncident
(
id
,
json
);
return
;
}
return
;
}
index
++
;
// if (index > 50) {
// if (name == "违规停车/停车占道") {
// if (find) {
// debugger;
// map.stopTrafficIncident(id, json);
// }
// }
// return;
// } else {
// }
console
.
log
(
"
index
"
,
index
,
name
);
if
(
endTime
)
{
// trafficIncidentArr = map.stopTrafficIncident(id, json);
// debugger
// return;
if
(
find
)
{
return
;
}
trafficIncidentArr
=
await
map
.
renderTrafficIncident
(
json
);
trafficIncidentArr
.
push
(
json
);
await
map
.
renderTrafficIncident
(
json
);
};
socket
.
onmessage
=
async
function
(
event
)
{
const
json
=
JSON
.
parse
(
event
.
data
);
fun1
(
json
);
if
(
arr
.
length
<
100
)
{
arr
.
push
(
json
)
}
await
fun
(
json
);
};
}
...
...
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