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
8bc9fe82
Commit
8bc9fe82
authored
Nov 28, 2017
by
Tobias Meuser
Committed by
Jose Ignacio Monreal Bailey
Aug 20, 2019
Browse files
Inital version of scalable information dissemination
parent
a86cc929
Changes
5
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/VehicleMovementModel.java
View file @
8bc9fe82
...
...
@@ -201,6 +201,9 @@ public class VehicleMovementModel implements MovementModel, EventHandler {
public
void
placeComponent
(
SimLocationActuator
actuator
)
{
if
(!
initialized
)
{
initializeModel
();
VehicleMovementModel
.
getRoadNetwork
();
initialized
=
true
;
}
// Initial placement
...
...
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
8bc9fe82
...
...
@@ -30,7 +30,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.SerializableRoadNetwork
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoAdditionalRouteAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoExitAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.
BreadthFirstSearchRouting
Algorithm
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.
Dijkstra
Algorithm
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.RoutingAlgorithm
;
import
de.tudresden.sumo.cmd.Edge
;
import
de.tudresden.sumo.cmd.Junction
;
...
...
@@ -84,7 +84,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
private
RoadNetwork
_roadNetwork
;
private
RoutingAlgorithm
_algorithm
=
new
BreadthFirstSearchRouting
Algorithm
();
private
RoutingAlgorithm
_algorithm
=
new
Dijkstra
Algorithm
();
public
static
synchronized
TraciSimulationController
createSimulationController
(
String
pSumoExe
,
String
pConfigFile
)
{
if
(!
CONTROLLER
.
containsKey
(
pConfigFile
))
{
...
...
@@ -418,7 +418,10 @@ public class TraciSimulationController implements VehicleController, SimulationS
@Override
public
RoadNetworkRoute
getCurrentRoute
(
String
pVehicleID
)
{
if
(
_positons
.
containsKey
(
pVehicleID
))
{
return
_positons
.
get
(
pVehicleID
).
getRoute
();
VehicleInformationContainer
route
=
_positons
.
get
(
pVehicleID
);
if
(
route
!=
null
)
{
return
route
.
getRoute
();
}
}
return
null
;
}
...
...
@@ -709,6 +712,8 @@ public class TraciSimulationController implements VehicleController, SimulationS
e
.
printStackTrace
();
}
}
RoadNetwork
.
CURRENT_ROAD_NETWORK
=
_roadNetwork
;
}
public
double
getMaxSpeed
(
String
laneID
)
{
...
...
@@ -802,15 +807,31 @@ public class TraciSimulationController implements VehicleController, SimulationS
edge
.
setMaxSpeed
(
pMaxSpeed
);
}
@Override
public
double
getEdgeLength
(
String
pEdgeID
)
{
double
length
=
0
;
for
(
RoadNetworkLane
lane
:
_roadNetwork
.
getEdge
(
pEdgeID
).
getLanes
())
{
SumoCommand
speedCommand
=
Lane
.
getLength
(
lane
.
getLaneID
());
Object
object
=
requestObject
(
speedCommand
);
length
+=
(
double
)
object
;
}
return
length
/
(
_roadNetwork
.
getEdge
(
pEdgeID
).
getLaneAmount
());
}
@Override
public
boolean
isEdgeUsable
(
String
pEdgeID
)
{
if
(
_observedAreaSet
)
{
List
<
Location
>
laneShape
=
getLaneShape
(
_roadNetwork
.
getEdge
(
pEdgeID
).
getLanes
().
get
(
0
).
getLaneID
());
List
<
RoadNetworkLane
>
lanes
=
_roadNetwork
.
getEdge
(
pEdgeID
).
getLanes
();
if
(
lanes
.
size
()
>
0
)
{
List
<
Location
>
laneShape
=
getLaneShape
(
lanes
.
get
(
0
).
getLaneID
());
for
(
Location
location
:
laneShape
)
{
if
(
_startX
<=
location
.
getLongitude
()
&&
location
.
getLongitude
()
<=
_endX
&&
_start
Y
<=
location
.
getLatitude
()
&&
location
.
getLatitude
()
<=
_endY
)
{
if
(
0
<=
location
.
getLongitude
()
&&
location
.
getLongitude
()
<=
_endX
-
_start
X
&&
0
<=
location
.
getLatitude
()
&&
location
.
getLatitude
()
<=
_endY
-
_startY
)
{
return
true
;
}
}
}
return
false
;
}
return
true
;
...
...
src/de/tud/kom/p2psim/impl/topology/views/visualization/world/NodeInfoComponentVis.java
View file @
8bc9fe82
...
...
@@ -58,13 +58,13 @@ import de.tudarmstadt.maki.simonstrator.api.component.overlay.NodeInformation;
* @version 1.0, Jul 9, 2015
*/
public
class
NodeInfoComponentVis
extends
JComponent
implements
VisualizationComponent
{
implements
VisualizationComponent
{
protected
Collection
<
NodeVis
>
nodes
=
new
LinkedList
<>();
private
JMenu
menu
=
new
JMenu
(
"Node Info"
);
protected
boolean
[]
activeLayers
=
n
ull
;
protected
boolean
[]
activeLayers
=
n
ew
boolean
[
0
]
;
boolean
hideInactiveNodes
=
false
;
...
...
@@ -178,13 +178,13 @@ public class NodeInfoComponentVis extends JComponent
private
final
Color
[]
tuColors
=
{
new
Color
(
93
,
133
,
195
),
// 1a
new
Color
(
80
,
182
,
149
),
// 3a
// new Color(221,223,72), // 5a
// new Color(221,223,72), // 5a
new
Color
(
248
,
186
,
60
),
// 7a
new
Color
(
233
,
80
,
62
),
// 9a
new
Color
(
128
,
69
,
151
),
// 11a
new
Color
(
0
,
78
,
138
),
// 1c
new
Color
(
0
,
136
,
119
),
// 3c
// new Color(177, 189, 0), // 5c
// new Color(177, 189, 0), // 5c
new
Color
(
210
,
135
,
0
),
// 7c
new
Color
(
185
,
15
,
34
),
// 9c
new
Color
(
97
,
28
,
115
),
// 11c
...
...
@@ -211,12 +211,12 @@ public class NodeInfoComponentVis extends JComponent
* http://stackoverflow.com/questions/2355157/dynamically-
* creating-colors-with-different-brightness
*/
// float hsbVals[] = Color.RGBtoHSB(baseColor.getRed(),
// baseColor.getGreen(), baseColor.getBlue(), null);
// float hsbVals[] = Color.RGBtoHSB(baseColor.getRed(),
// baseColor.getGreen(), baseColor.getBlue(), null);
for
(
int
i
=
0
;
i
<
dimensionSize
;
i
++)
{
float
hue
=
i
/
(
float
)
dimensionSize
;
// colors[dim][i] = Color.getHSBColor(hue, hsbVals[1],
// hsbVals[2]);
// colors[dim][i] = Color.getHSBColor(hue, hsbVals[1],
// hsbVals[2]);
colors
[
dim
][
i
]
=
tuColors
[
i
];
}
}
...
...
src/de/tud/kom/p2psim/impl/util/guirunner/GUIRunner.java
View file @
8bc9fe82
...
...
@@ -27,6 +27,7 @@ import java.awt.GridBagConstraints;
import
java.awt.GridBagLayout
;
import
java.awt.Image
;
import
java.awt.Point
;
import
java.awt.Toolkit
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.KeyAdapter
;
...
...
@@ -113,8 +114,15 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
int
winWidth
=
Config
.
getValue
(
CONF_PATH_WIDTH
,
600
);
int
winHeight
=
Config
.
getValue
(
CONF_PATH_HEIGHT
,
600
);
this
.
setSize
(
winWidth
,
winHeight
);
this
.
setLocation
(
new
Point
(
Config
.
getValue
(
CONF_PATH_POSX
,
0
),
Config
.
getValue
(
CONF_PATH_POSY
,
0
)));
Point
point
=
new
Point
(
Config
.
getValue
(
CONF_PATH_POSX
,
0
),
Config
.
getValue
(
CONF_PATH_POSY
,
0
));
if
(
point
.
getX
()
>=
0
&&
point
.
getY
()
>=
0
&&
Toolkit
.
getDefaultToolkit
().
getScreenSize
().
getWidth
()
<
point
.
getX
()
-
winWidth
&&
Toolkit
.
getDefaultToolkit
().
getScreenSize
().
getHeight
()
<
point
.
getY
()
-
winHeight
)
{
this
.
setLocation
(
point
);
}
this
.
setLayout
(
new
BorderLayout
());
...
...
src/de/tud/kom/p2psim/impl/vehicular/caching/DefaultCachingComponent.java
View file @
8bc9fe82
...
...
@@ -140,6 +140,7 @@ implements CachingComponent, ConnectivityListener {
if
(!
_cache
.
containsKey
(
pCacheEntry
.
getClass
()))
{
_cache
.
put
(
pCacheEntry
.
getClass
(),
new
ArrayList
<>());
}
List
<
PointInformation
>
entries
=
_cache
.
get
(
pCacheEntry
.
getClass
());
entries
.
add
(
pCacheEntry
);
}
...
...
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