Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfakhori
M4labplatform
Commits
9b87e55d
Commit
9b87e55d
authored
Jan 11, 2021
by
Patrick
Browse files
update Public nav
parent
c8897ff3
Changes
4
Show whitespace changes
Inline
Side-by-side
serveralternative.js
View file @
9b87e55d
...
@@ -398,12 +398,10 @@ function buildNavCar(){
...
@@ -398,12 +398,10 @@ function buildNavCar(){
"
type
"
:
"
vector
"
,
"
type
"
:
"
vector
"
,
"
stroke
"
:
{
"
stroke
"
:
{
"
color
"
:
[
"
color
"
:
[
128
,
30
,
144
,
255
,
128
,
128
,
1
1
],
],
"
width
"
:
2
,
"
width
"
:
3
,
"
lineDash
"
:
null
"
lineDash
"
:
null
}
}
}
}
...
@@ -427,12 +425,10 @@ function buildNavCar(){
...
@@ -427,12 +425,10 @@ function buildNavCar(){
"
type
"
:
"
vector
"
,
"
type
"
:
"
vector
"
,
"
stroke
"
:
{
"
stroke
"
:
{
"
color
"
:
[
"
color
"
:
[
128
,
30
,
144
,
255
,
128
,
128
,
1
1
],
],
"
width
"
:
2
,
"
width
"
:
3
,
"
lineDash
"
:
null
"
lineDash
"
:
null
}
}
}
}
...
@@ -462,7 +458,7 @@ function buildNavCar(){
...
@@ -462,7 +458,7 @@ function buildNavCar(){
199
,
21
,
133
,
199
,
21
,
133
,
1
1
],
],
"
width
"
:
2
,
"
width
"
:
4
,
"
lineDash
"
:
null
"
lineDash
"
:
null
}
}
}
}
...
@@ -956,6 +952,40 @@ function timeDifference(date11,date22) {
...
@@ -956,6 +952,40 @@ function timeDifference(date11,date22) {
}
}
function
timeDifference1
(
date11
,
date22
)
{
var
date2
=
new
Date
(
date11
);
var
date1
=
new
Date
(
date22
);
var
difference
=
date1
-
date2
var
minutesDifference1
var
hoursDifference1
var
secondsDifference1
var
daysDifference1
daysDifference1
=
Math
.
floor
(
difference
/
1000
/
60
/
60
/
24
);
difference
-=
daysDifference1
*
1000
*
60
*
60
*
24
hoursDifference1
=
Math
.
floor
(
difference
/
1000
/
60
/
60
);
difference
-=
hoursDifference1
*
1000
*
60
*
60
minutesDifference1
=
Math
.
floor
(
difference
/
1000
/
60
);
difference
-=
minutesDifference1
*
1000
*
60
secondsDifference1
=
Math
.
floor
(
difference
/
1000
);
console
.
log
(
'
difference =
'
+
daysDifference1
+
'
day/s
'
+
hoursDifference1
+
'
hour/s
'
+
minutesDifference1
+
'
minute/s
'
+
secondsDifference1
+
'
second/s
'
);
var
result
=
{
"
daysDifference
"
:
daysDifference1
,
"
hoursDifference
"
:
hoursDifference1
,
"
minutesDifference
"
:
minutesDifference1
,
"
secondsDifference
"
:
secondsDifference1
}
return
(
result
);
}
app
.
post
(
'
/Routecalc
'
,
function
(
req
,
res
)
{
app
.
post
(
'
/Routecalc
'
,
function
(
req
,
res
)
{
console
.
log
(
'
command angekommen ////// Route/////!
'
)
console
.
log
(
'
command angekommen ////// Route/////!
'
)
const
pointData
=
req
.
body
;
const
pointData
=
req
.
body
;
...
@@ -1010,15 +1040,15 @@ app.post('/navPublicT', function (req, res) {
...
@@ -1010,15 +1040,15 @@ app.post('/navPublicT', function (req, res) {
if
(
responseStuff
){
if
(
responseStuff
){
console
.
log
(
"
responseStuff
"
);
console
.
log
(
"
responseStuff
"
);
//
navPublicjson = {
navPublicjson
=
{
//
"name":"navPublic" + "01",
"
name
"
:
"
navPublic
"
+
"
01
"
,
//
"type":"FeatureCollection",
"
type
"
:
"
FeatureCollection
"
,
//
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"
crs
"
:
{
"
type
"
:
"
name
"
,
"
properties
"
:
{
"
name
"
:
"
urn:ogc:def:crs:OGC:1.3:CRS84
"
}
},
//
"features": buildNavPublic()
"
features
"
:
buildNavPublic
()
//
};
};
res
.
json
(
responseStuff
);
res
.
json
(
navPublicjson
);
break
;
break
;
}
}
...
@@ -1035,98 +1065,83 @@ app.post('/navPublicT', function (req, res) {
...
@@ -1035,98 +1065,83 @@ app.post('/navPublicT', function (req, res) {
function
buildNavPublic
(){
function
buildNavPublic
(){
var
JsonFeature
=
[];
var
JsonFeature
=
[];
var
pol
=
polycalc
.
decode
(
navcar
.
body
.
routes
[
0
].
sections
[
0
].
polyline
)
//
var pol = polycalc.decode(navcar.body.routes[0].sections[0].polyline)
var
length
=
pol
.
polyline
.
length
;
//
var length = pol.polyline.length;
// console.log(length);
// console.log(length);
var
id
=
navcar
.
body
.
routes
[
0
].
id
;
var
id
=
responseStuff
.
body
.
routes
[
0
].
id
;
var
mid
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
id
;
var
transport
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
transport
.
mode
;
var
departureTime
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
departure
.
time
;
var
departureOriglat
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
departure
.
place
.
originalLocation
.
lat
;
// console.log(departureOriglat)
var
departureOriglon
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
departure
.
place
.
originalLocation
.
lng
;
// console.log(departureOriglon)
var
departurelat
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
departure
.
place
.
location
.
lat
;
var
departurelon
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
departure
.
place
.
location
.
lng
;
var
arrivalTime
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
arrival
.
time
;
var
arrivalOriglat
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
arrival
.
place
.
originalLocation
.
lat
;
var
arrivalOriglon
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
arrival
.
place
.
originalLocation
.
lng
;
var
arrivallat
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
arrival
.
place
.
location
.
lat
;
var
arrivallon
=
navcar
.
body
.
routes
[
0
].
sections
[
0
].
arrival
.
place
.
location
.
lng
;
var
departure
=
[];
departure
.
push
([
parseFloat
(
parseFloat
(
departureOriglon
).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
departureOriglat
).
toFixed
(
5
))]);
departure
.
push
([
parseFloat
(
parseFloat
(
departurelon
).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
departurelat
).
toFixed
(
5
))])
timeDifference
(
departureTime
,
arrivalTime
);
JsonFeature
.
push
({
var
length
=
responseStuff
.
body
.
routes
[
0
].
sections
.
length
;
console
.
log
(
"
length of Sections:
"
+
length
)
for
(
var
i
=
0
;
i
<=
length
-
1
;
i
++
){
console
.
log
(
i
)
if
(
responseStuff
.
body
.
routes
[
0
].
sections
[
i
].
type
==
"
pedestrian
"
){
console
.
log
(
"
pedestrian
"
)
var
section
=
responseStuff
.
body
.
routes
[
0
].
sections
[
i
]
var
agencyid
=
section
.
id
;
var
agencyname
=
section
.
name
;
var
arrivaltime
=
section
.
arrival
.
time
;
var
arrivalplace
=
section
.
arrival
.
place
;
var
departuretime
=
section
.
departure
.
time
;
var
departureplace
=
section
.
departure
.
place
;
var
transportInfo
=
section
.
transport
;
var
pol
=
polycalc
.
decode
(
section
.
polyline
)
var
pollength
=
pol
.
polyline
.
length
;
var
timedifference
=
timeDifference1
(
departuretime
,
arrivaltime
);
var
pline
=
[];
"
type
"
:
"
Feature
"
,
for
(
var
j
=
0
;
j
<=
pollength
-
1
;
j
++
){
"
properties
"
:
{
"
id
"
:
id
,
"
name
"
:
"
linestring
"
,
"
transport
"
:
transport
,
"
departureTime
"
:
departureTime
,
"
daysDifference
"
:
daysDifference
,
"
hoursDifference
"
:
hoursDifference
,
"
minutesDifference
"
:
minutesDifference
,
"
secondsDifference
"
:
secondsDifference
},
pline
.
push
([
parseFloat
(
parseFloat
(
pol
.
polyline
[
j
][
1
]).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
pol
.
polyline
[
j
][
0
]).
toFixed
(
5
))])
"
geometry
"
:{
"
type
"
:
"
LineString
"
,
"
coordinates
"
:
departure
},
"
vcsMeta
"
:
{
"
style
"
:
{
"
type
"
:
"
vector
"
,
"
stroke
"
:
{
"
color
"
:
[
128
,
128
,
128
,
1
],
"
width
"
:
2
,
"
lineDash
"
:
null
}
}
}
}
})
var
arrival
=
[];
arrival
.
push
([
parseFloat
(
parseFloat
(
arrivalOriglon
).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
arrivalOriglat
).
toFixed
(
5
))]);
arrival
.
push
([
parseFloat
(
parseFloat
(
arrivallon
).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
arrivallat
).
toFixed
(
5
))])
// console.log(arrival)
JsonFeature
.
push
({
JsonFeature
.
push
({
"
type
"
:
"
Feature
"
,
"
type
"
:
"
Feature
"
,
"
properties
"
:
{
"
id
"
:
id
,
"
name
"
:
"
linestring
"
,
"
transport
"
:
transport
,
"
arrivalTime
"
:
arrival
T
ime
,
"
departureTime
"
:
departure
T
ime
,
"
daysDifference
"
:
daysDifference
,
"
hoursDifference
"
:
hoursDifference
,
"
minutesDifference
"
:
minutesDifference
,
"
secondsDifference
"
:
secondsDifference
},
"
properties
"
:
{
"
id
"
:
agencyid
,
"
agencyName
"
:
agencyname
,
"
name
"
:
"
linestring
"
,
"
type
"
:
"
pedestrian
"
,
"
transport
Info
"
:
transport
Info
,
"
arrivalTime
"
:
arrival
t
ime
,
"
arrivalPlace
"
:
arrivalplace
,
"
departureTime
"
:
departure
t
ime
,
"
departurePlace
"
:
departureplace
,
"
daysDifference
"
:
timedifference
.
daysDifference
,
"
hoursDifference
"
:
timedifference
.
hoursDifference
,
"
minutesDifference
"
:
timedifference
.
minutesDifference
,
"
secondsDifference
"
:
timedifference
.
secondsDifference
},
"
geometry
"
:{
"
geometry
"
:{
"
type
"
:
"
LineString
"
,
"
type
"
:
"
LineString
"
,
"
coordinates
"
:
arrival
"
coordinates
"
:
pline
},
},
"
vcsMeta
"
:
{
"
vcsMeta
"
:
{
"
style
"
:
{
"
style
"
:
{
"
type
"
:
"
vector
"
,
"
type
"
:
"
vector
"
,
"
stroke
"
:
{
"
stroke
"
:
{
"
color
"
:
[
"
color
"
:
[
128
,
30
,
144
,
255
,
128
,
128
,
1
1
],
],
"
width
"
:
2
,
"
width
"
:
3
,
"
lineDash
"
:
null
"
lineDash
"
:
null
}
}
}
}
}
}
})
})
console
.
log
(
JsonFeature
)
}
else
if
(
responseStuff
.
body
.
routes
[
0
].
sections
[
i
].
type
==
"
transit
"
){
console
.
log
(
"
transit
"
)
var
section
=
responseStuff
.
body
.
routes
[
0
].
sections
[
i
]
var
agencyid
=
section
.
id
;
var
agencyname
=
section
.
name
;
var
arrivaltime
=
section
.
arrival
.
time
;
var
arrivalplace
=
section
.
arrival
.
place
;
var
departuretime
=
section
.
departure
.
time
;
var
departureplace
=
section
.
departure
.
place
;
var
transportInfo
=
section
.
transport
;
var
pol
=
polycalc
.
decode
(
section
.
polyline
)
var
pollength
=
pol
.
polyline
.
length
;
var
timedifference
=
timeDifference1
(
departuretime
,
arrivaltime
);
var
pline
=
[];
var
pline
=
[];
var
length
=
pol
.
polyline
.
length
;
for
(
var
i
=
0
;
i
<=
length
-
1
;
i
++
){
for
(
var
j
=
0
;
j
<=
pol
length
-
1
;
j
++
){
pline
.
push
([
parseFloat
(
parseFloat
(
pol
.
polyline
[
i
][
1
]).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
pol
.
polyline
[
i
][
0
]).
toFixed
(
5
))])
pline
.
push
([
parseFloat
(
parseFloat
(
pol
.
polyline
[
j
][
1
]).
toFixed
(
5
)),
parseFloat
(
parseFloat
(
pol
.
polyline
[
j
][
0
]).
toFixed
(
5
))])
}
}
JsonFeature
.
push
({
JsonFeature
.
push
({
"
type
"
:
"
Feature
"
,
"
type
"
:
"
Feature
"
,
"
properties
"
:
{
"
id
"
:
id
,
"
name
"
:
"
linestring
"
,
"
transport
"
:
transport
,
"
departureTime
"
:
departure
T
ime
,
"
daysDifference
"
:
daysDifference
,
"
hoursDifference
"
:
hoursDifference
,
"
minutesDifference
"
:
minutesDifference
,
"
secondsDifference
"
:
secondsDifference
},
"
properties
"
:
{
"
id
"
:
agencyid
,
"
agencyName
"
:
agencyname
,
"
name
"
:
"
linestring
"
,
"
type
"
:
"
transit
"
,
"
transport
Info
"
:
transport
Info
,
"
arrivalTime
"
:
arrivaltime
,
"
arrivalPlace
"
:
arrivalplace
,
"
departureTime
"
:
departure
t
ime
,
"
departurePlace
"
:
departureplace
,
"
daysDifference
"
:
timedifference
.
daysDifference
,
"
hoursDifference
"
:
timedifference
.
hoursDifference
,
"
minutesDifference
"
:
timedifference
.
minutesDifference
,
"
secondsDifference
"
:
timedifference
.
secondsDifference
},
"
geometry
"
:{
"
geometry
"
:{
"
type
"
:
"
LineString
"
,
"
type
"
:
"
LineString
"
,
"
coordinates
"
:
pline
"
coordinates
"
:
pline
...
@@ -1136,20 +1151,40 @@ function buildNavPublic(){
...
@@ -1136,20 +1151,40 @@ function buildNavPublic(){
"
type
"
:
"
vector
"
,
"
type
"
:
"
vector
"
,
"
stroke
"
:
{
"
stroke
"
:
{
"
color
"
:
[
"
color
"
:
[
199
,
21
,
133
,
255
,
140
,
0
,
1
1
],
],
"
width
"
:
2
,
"
width
"
:
4
,
"
lineDash
"
:
null
"
lineDash
"
:
null
}
}
}
}
}
}
})
})
console
.
log
(
JsonFeature
)
// console.log(JsonFeature)
}
}
return
JsonFeature
return
JsonFeature
}
}
app
.
get
(
'
/NAVPUB
'
,
function
(
req
,
res
)
{
console
.
log
(
'
command angekommen!
'
)
try
{
// console.log(navcar.body.routes[0].sections[0].polyline)
// var pol = polycalc.decode(navcar.body.routes[0].sections[0].polyline)
// console.log(pol)
// res.json(testjsonsflow);
res
.
json
(
navPublicjson
);
// console.log(navcarjson)
console
.
log
(
'
.../loadSetP successful!
'
);
}
catch
(
err
)
{
console
.
log
(
'
.../loadSetP failed!
\n
'
+
err
);
}
});
\ No newline at end of file
vcm/index.html
View file @
9b87e55d
...
@@ -634,10 +634,16 @@
...
@@ -634,10 +634,16 @@
<button
onclick=
"getStart('End');"
>
Endpunkt
</button>
<button
onclick=
"getStart('End');"
>
Endpunkt
</button>
<input
type=
"text"
id=
"Epunktlat"
name=
"Epunktlat"
>
<input
type=
"text"
id=
"Epunktlat"
name=
"Epunktlat"
>
<input
type=
"text"
id=
"Epunktlon"
name=
"Epunktlon"
><br><br>
<input
type=
"text"
id=
"Epunktlon"
name=
"Epunktlon"
><br><br>
<select>
<option>
mit Parkplatz
</option>
<option>
ohne Parkplatz
</option>
</select>
<button
onclick=
"showRoute();"
>
Route berechnen
</button>
<button
onclick=
"showRoute();"
>
Route berechnen
</button>
<button
onclick=
"drawnavcar();"
>
Route anzeigen
</button>
<button
onclick=
"drawnavcar();drawnavpub();"
>
Route anzeigen
</button><br><br>
<input
type=
"text"
id=
"Routeduration"
name=
"Duration"
>
<p
class=
"contentOne"
>
Duration with Car
</p>
<input
type=
"text"
id=
"Routeduration"
name=
"Duration"
><br>
<p
class=
"contentOne"
>
Duration with Public
</p>
<input
type=
"text"
id=
"RoutedurationPub"
name=
"Duration"
>
</div>
</div>
</div>
</div>
<div
id=
"tour-button"
title=
"Karte/Story umschalten"
>
<div
id=
"tour-button"
title=
"Karte/Story umschalten"
>
...
...
vcm/js/here.js
View file @
9b87e55d
...
@@ -260,3 +260,27 @@ function getTraffic() {
...
@@ -260,3 +260,27 @@ function getTraffic() {
console
.
log
(
'
loading Gas Values from DB failed!
'
);
console
.
log
(
'
loading Gas Values from DB failed!
'
);
}
}
};
};
function
drawnavpub
(){
var
layern
=
[
"
NAVPUB
"
]
var
layers
=
framework
.
getLayers
();
for
(
var
i
=
0
;
i
<
layers
.
length
;
i
++
)
{
var
layer
=
layers
[
i
];
if
(
layern
.
indexOf
(
layer
.
name
)
>=
0
){
layer
.
activate
(
false
);
}
}
framework
.
removeLayerByName
(
"
NAVPUB
"
)
navcarlayer
=
new
vcs
.
vcm
.
layer
.
GeoJSON
({
name
:
"
NAVPUB
"
,
url
:
"
http://localhost:8083/NAVPUB
"
,
data
:
geojson
,
projection
:
{
epsg
:
4326
},
altitudeMode
:
"
relativeToGround
"
,
heightAboveGround
:
0
})
framework
.
addLayer
(
navcarlayer
)
navcarlayer
.
activate
(
true
);
}
\ No newline at end of file
vcm/js/navigation.js
View file @
9b87e55d
...
@@ -169,18 +169,26 @@ function showRoute(){
...
@@ -169,18 +169,26 @@ function showRoute(){
data
:
datapointSend
data
:
datapointSend
}).
done
(
function
(
SimSMid
)
{
}).
done
(
function
(
SimSMid
)
{
console
.
log
(
SimSMid
)
console
.
log
(
SimSMid
)
//
convertdata();
convertdata
(
SimSMid
);
return
(
SimSMid
)
return
(
SimSMid
)
});
});
function
convertdata
()
{
function
convertdata
(
data
)
{
var
minutesRoute
=
0
;
var
hourRoute
=
0
;
var
sekRoute
=
0
;
var
daysRoute
=
0
;
console
.
log
(
"
angekommen......
"
)
console
.
log
(
"
angekommen......
"
)
if
(
testing
==
"
Start
"
){
var
length
=
data
.
features
.
length
;
showStartPoint
();
for
(
var
i
=
0
;
i
<=
length
-
1
;
i
++
){
}
else
if
(
testing
==
"
End
"
){
daysRoute
+=
data
.
features
[
i
].
properties
.
daysDifference
;
showEndPoint
();
minutesRoute
+=
data
.
features
[
i
].
properties
.
minutesDifference
;
hourRoute
+=
data
.
features
[
i
].
properties
.
hoursDifference
;
sekRoute
+=
data
.
features
[
i
].
properties
.
secondsDifference
;
}
}
document
.
getElementById
(
"
RoutedurationPub
"
).
value
=
minutesRoute
+
"
min
"
+
sekRoute
+
"
sek
"
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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