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
Simonstrator
API
Commits
2a60e439
Commit
2a60e439
authored
May 09, 2019
by
Tobias Meuser
Browse files
Minor changes to Road Network
parent
dc916fdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetwork.java
View file @
2a60e439
...
...
@@ -25,6 +25,7 @@ import java.util.HashMap;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
...
...
@@ -64,6 +65,10 @@ public class RoadNetwork implements RoadNetworkEdgeListener {
_roadNetwork
=
pRoadNetwork
;
_edgeController
=
pEdgeController
;
for
(
Entry
<
String
,
RoadNetworkEdge
>
roadNetworkEdge
:
pRoadNetwork
.
entrySet
())
{
roadNetworkEdge
.
getValue
().
registerEdgeListener
(
this
);
}
}
/**
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetworkEdge.java
View file @
2a60e439
...
...
@@ -45,7 +45,7 @@ public class RoadNetworkEdge {
private
boolean
_isUsableInit
=
false
;
private
boolean
_isUsable
=
false
;
private
double
_length
=
Double
.
NaN
;
private
double
_length
=
-
1
;
private
List
<
RoadNetworkLane
>
_lanes
=
new
ArrayList
<>();
...
...
@@ -254,7 +254,7 @@ public class RoadNetworkEdge {
}
public
double
getLength
()
{
if
(
Double
.
isNaN
(
_length
)
)
{
if
(
_length
<
0
)
{
_length
=
_edgeController
.
getEdgeLength
(
_edgeID
);
}
return
_length
;
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetworkRoute.java
View file @
2a60e439
...
...
@@ -21,12 +21,13 @@
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.paths.VehiclePathTracker
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.paths.VehiclePathTrackerFactory
;
public
class
RoadNetworkRoute
{
public
class
RoadNetworkRoute
implements
Iterable
<
RoadNetworkEdge
>
{
private
List
<
RoadNetworkEdge
>
_route
;
public
RoadNetworkRoute
(
List
<
RoadNetworkEdge
>
pRoute
)
{
...
...
@@ -141,4 +142,17 @@ public class RoadNetworkRoute {
}
return
new
RoadNetworkRoute
(
edges
);
}
@Override
public
Iterator
<
RoadNetworkEdge
>
iterator
()
{
return
_route
.
iterator
();
}
public
double
calculateStandardRouteCosts
()
{
double
sum
=
0
;
for
(
RoadNetworkEdge
roadNetworkEdge
:
_route
)
{
sum
+=
roadNetworkEdge
.
calculateStandardEdgeCosts
();
}
return
sum
;
}
}
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