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
PeerfactSim.KOM
Commits
b44bd143
Commit
b44bd143
authored
Jun 27, 2017
by
Tobias Meuser
Browse files
Made RoadNetwork accessable from Applications via VehicleMovementModel
parent
1024f054
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/VehicleMovementModel.java
View file @
b44bd143
...
...
@@ -54,6 +54,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSInformationProvider
import
de.tudarmstadt.maki.simonstrator.api.component.sis.exception.InformationNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.sis.type.SiSTypes
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetwork
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
public
class
VehicleMovementModel
implements
MovementModel
,
EventHandler
,
FutureLocationSensor
{
...
...
@@ -379,17 +380,17 @@ public class VehicleMovementModel implements MovementModel, EventHandler, Future
if
(!
idComponentMatcher
.
containsKey
(
vehicle
))
{
SimLocationActuator
simLocationActuator
=
freeComponents
.
poll
();
VehicleInformationComponent
vehicularHostComponent
;
try
{
vehicularHostComponent
=
simLocationActuator
.
getHost
().
getComponent
(
VehicleInformationComponent
.
class
);
}
catch
(
ComponentNotAvailableException
e
)
{
Host
host
=
simLocationActuator
.
getHost
();
vehicularHostComponent
=
new
DefaultVehicleInformationComponent
(
host
,
_controller
,
_extractor
);
host
.
registerComponent
(
vehicularHostComponent
);
}
vehicularHostComponent
.
setVehicleID
(
vehicle
);
if
(
simLocationActuator
!=
null
)
{
VehicleInformationComponent
vehicularHostComponent
;
try
{
vehicularHostComponent
=
simLocationActuator
.
getHost
().
getComponent
(
VehicleInformationComponent
.
class
);
}
catch
(
ComponentNotAvailableException
e
)
{
Host
host
=
simLocationActuator
.
getHost
();
vehicularHostComponent
=
new
DefaultVehicleInformationComponent
(
host
,
_controller
,
_extractor
);
host
.
registerComponent
(
vehicularHostComponent
);
}
vehicularHostComponent
.
setVehicleID
(
vehicle
);
idComponentMatcher
.
put
(
vehicle
,
simLocationActuator
);
hostVehicleIDMatching
.
put
(
simLocationActuator
.
getHost
().
getId
(),
vehicle
);
}
else
{
...
...
@@ -399,6 +400,10 @@ public class VehicleMovementModel implements MovementModel, EventHandler, Future
return
idComponentMatcher
.
get
(
vehicle
);
}
public
RoadNetwork
getRoadNetwork
()
{
return
_extractor
.
getRoadNetwork
();
}
/**
* Returns the future location of a certain host.
* @param pHost The host for which the location is being requested.
...
...
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/SimulationSetupExtractor.java
View file @
b44bd143
...
...
@@ -3,6 +3,7 @@ package de.tud.kom.p2psim.impl.topology.movement.vehicular.sumo.simulation.contr
import
java.util.List
;
import
de.tud.kom.p2psim.impl.topology.movement.vehicular.information.Position
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetwork
;
public
interface
SimulationSetupExtractor
{
...
...
@@ -14,5 +15,5 @@ public interface SimulationSetupExtractor {
double
getScenarioWidth
();
double
getScenarioHeight
();
//
RoadNetwork get
Scenario
RoadNetwork();
RoadNetwork
getRoadNetwork
();
}
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
b44bd143
...
...
@@ -407,6 +407,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
return
roadNetworkRoute
.
getDestination
();
}
@Override
public
RoadNetwork
getRoadNetwork
()
{
obtainRoadNetwork
();
...
...
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