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
Hide 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 {
...
@@ -201,6 +201,9 @@ public class VehicleMovementModel implements MovementModel, EventHandler {
public
void
placeComponent
(
SimLocationActuator
actuator
)
{
public
void
placeComponent
(
SimLocationActuator
actuator
)
{
if
(!
initialized
)
{
if
(!
initialized
)
{
initializeModel
();
initializeModel
();
VehicleMovementModel
.
getRoadNetwork
();
initialized
=
true
;
initialized
=
true
;
}
}
// Initial placement
// 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
...
@@ -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.SerializableRoadNetwork
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoAdditionalRouteAvailableException
;
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.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.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.routing.RoutingAlgorithm
;
import
de.tudresden.sumo.cmd.Edge
;
import
de.tudresden.sumo.cmd.Edge
;
import
de.tudresden.sumo.cmd.Junction
;
import
de.tudresden.sumo.cmd.Junction
;
...
@@ -84,7 +84,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -84,7 +84,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
private
RoadNetwork
_roadNetwork
;
private
RoadNetwork
_roadNetwork
;
private
RoutingAlgorithm
_algorithm
=
new
BreadthFirstSearchRouting
Algorithm
();
private
RoutingAlgorithm
_algorithm
=
new
Dijkstra
Algorithm
();
public
static
synchronized
TraciSimulationController
createSimulationController
(
String
pSumoExe
,
String
pConfigFile
)
{
public
static
synchronized
TraciSimulationController
createSimulationController
(
String
pSumoExe
,
String
pConfigFile
)
{
if
(!
CONTROLLER
.
containsKey
(
pConfigFile
))
{
if
(!
CONTROLLER
.
containsKey
(
pConfigFile
))
{
...
@@ -418,7 +418,10 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -418,7 +418,10 @@ public class TraciSimulationController implements VehicleController, SimulationS
@Override
@Override
public
RoadNetworkRoute
getCurrentRoute
(
String
pVehicleID
)
{
public
RoadNetworkRoute
getCurrentRoute
(
String
pVehicleID
)
{
if
(
_positons
.
containsKey
(
pVehicleID
))
{
if
(
_positons
.
containsKey
(
pVehicleID
))
{
return
_positons
.
get
(
pVehicleID
).
getRoute
();
VehicleInformationContainer
route
=
_positons
.
get
(
pVehicleID
);
if
(
route
!=
null
)
{
return
route
.
getRoute
();
}
}
}
return
null
;
return
null
;
}
}
...
@@ -709,6 +712,8 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -709,6 +712,8 @@ public class TraciSimulationController implements VehicleController, SimulationS
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
RoadNetwork
.
CURRENT_ROAD_NETWORK
=
_roadNetwork
;
}
}
public
double
getMaxSpeed
(
String
laneID
)
{
public
double
getMaxSpeed
(
String
laneID
)
{
...
@@ -802,13 +807,29 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -802,13 +807,29 @@ public class TraciSimulationController implements VehicleController, SimulationS
edge
.
setMaxSpeed
(
pMaxSpeed
);
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
@Override
public
boolean
isEdgeUsable
(
String
pEdgeID
)
{
public
boolean
isEdgeUsable
(
String
pEdgeID
)
{
if
(
_observedAreaSet
)
{
if
(
_observedAreaSet
)
{
List
<
Location
>
laneShape
=
getLaneShape
(
_roadNetwork
.
getEdge
(
pEdgeID
).
getLanes
().
get
(
0
).
getLaneID
());
List
<
RoadNetworkLane
>
lanes
=
_roadNetwork
.
getEdge
(
pEdgeID
).
getLanes
();
for
(
Location
location
:
laneShape
)
{
if
(
lanes
.
size
()
>
0
)
{
if
(
_startX
<=
location
.
getLongitude
()
&&
location
.
getLongitude
()
<=
_endX
&&
_startY
<=
location
.
getLatitude
()
&&
location
.
getLatitude
()
<=
_endY
)
{
List
<
Location
>
laneShape
=
getLaneShape
(
lanes
.
get
(
0
).
getLaneID
());
return
true
;
for
(
Location
location
:
laneShape
)
{
if
(
0
<=
location
.
getLongitude
()
&&
location
.
getLongitude
()
<=
_endX
-
_startX
&&
0
<=
location
.
getLatitude
()
&&
location
.
getLatitude
()
<=
_endY
-
_startY
)
{
return
true
;
}
}
}
}
}
return
false
;
return
false
;
...
...
src/de/tud/kom/p2psim/impl/topology/views/visualization/world/NodeInfoComponentVis.java
View file @
8bc9fe82
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
*
* This file is part of PeerfactSim.KOM.
* This file is part of PeerfactSim.KOM.
*
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* any later version.
* any later version.
*
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*
...
@@ -53,21 +53,21 @@ import de.tudarmstadt.maki.simonstrator.api.component.overlay.NodeInformation;
...
@@ -53,21 +53,21 @@ import de.tudarmstadt.maki.simonstrator.api.component.overlay.NodeInformation;
/**
/**
* Generic component that visualizes information from nodes implementing the
* Generic component that visualizes information from nodes implementing the
* {@link NodeInformation} interface.
* {@link NodeInformation} interface.
*
*
* @author Bjoern Richerzhagen
* @author Bjoern Richerzhagen
* @version 1.0, Jul 9, 2015
* @version 1.0, Jul 9, 2015
*/
*/
public
class
NodeInfoComponentVis
extends
JComponent
public
class
NodeInfoComponentVis
extends
JComponent
implements
VisualizationComponent
{
implements
VisualizationComponent
{
protected
Collection
<
NodeVis
>
nodes
=
new
LinkedList
<>();
protected
Collection
<
NodeVis
>
nodes
=
new
LinkedList
<>();
private
JMenu
menu
=
new
JMenu
(
"Node Info"
);
private
JMenu
menu
=
new
JMenu
(
"Node Info"
);
protected
boolean
[]
activeLayers
=
n
ull
;
protected
boolean
[]
activeLayers
=
n
ew
boolean
[
0
]
;
boolean
hideInactiveNodes
=
false
;
boolean
hideInactiveNodes
=
false
;
private
final
String
name
;
private
final
String
name
;
public
<
T
extends
HostComponent
>
NodeInfoComponentVis
(
public
<
T
extends
HostComponent
>
NodeInfoComponentVis
(
...
@@ -96,7 +96,7 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -96,7 +96,7 @@ public class NodeInfoComponentVis extends JComponent
}
}
},
null
,
0
);
},
null
,
0
);
}
}
/**
/**
* Hide rings for inactive nodes.
* Hide rings for inactive nodes.
* @param hideOfflineNodes
* @param hideOfflineNodes
...
@@ -155,12 +155,12 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -155,12 +155,12 @@ public class NodeInfoComponentVis extends JComponent
/**
/**
* Visualization-fragments for Node-centric visualiation-information.
* Visualization-fragments for Node-centric visualiation-information.
*
*
* @author Bjoern Richerzhagen
* @author Bjoern Richerzhagen
* @version 1.0, Sep 22, 2013
* @version 1.0, Sep 22, 2013
*/
*/
private
class
NodeVis
{
private
class
NodeVis
{
public
final
VisNodeInformation
visNodeInfo
;
public
final
VisNodeInformation
visNodeInfo
;
public
final
NodeInformation
nodeInfo
;
public
final
NodeInformation
nodeInfo
;
...
@@ -174,22 +174,22 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -174,22 +174,22 @@ public class NodeInfoComponentVis extends JComponent
private
final
Color
[]
baseColors
=
{
Color
.
ORANGE
,
Color
.
BLUE
,
Color
.
RED
,
private
final
Color
[]
baseColors
=
{
Color
.
ORANGE
,
Color
.
BLUE
,
Color
.
RED
,
Color
.
PINK
,
Color
.
GRAY
,
Color
.
GREEN
,
Color
.
CYAN
,
Color
.
PINK
,
Color
.
GRAY
,
Color
.
GREEN
,
Color
.
CYAN
,
Color
.
WHITE
};
Color
.
WHITE
};
private
final
Color
[]
tuColors
=
{
private
final
Color
[]
tuColors
=
{
new
Color
(
93
,
133
,
195
),
// 1a
new
Color
(
93
,
133
,
195
),
// 1a
new
Color
(
80
,
182
,
149
),
// 3a
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
(
248
,
186
,
60
),
// 7a
new
Color
(
233
,
80
,
62
),
// 9a
new
Color
(
233
,
80
,
62
),
// 9a
new
Color
(
128
,
69
,
151
),
// 11a
new
Color
(
128
,
69
,
151
),
// 11a
new
Color
(
0
,
78
,
138
),
// 1c
new
Color
(
0
,
78
,
138
),
// 1c
new
Color
(
0
,
136
,
119
),
// 3c
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
(
210
,
135
,
0
),
// 7c
new
Color
(
185
,
15
,
34
),
// 9c
new
Color
(
185
,
15
,
34
),
// 9c
new
Color
(
97
,
28
,
115
),
// 11c
new
Color
(
97
,
28
,
115
),
// 11c
};
};
private
Color
[][]
colors
=
null
;
private
Color
[][]
colors
=
null
;
public
NodeVis
(
Host
host
,
NodeInformation
nodeInfo
)
{
public
NodeVis
(
Host
host
,
NodeInformation
nodeInfo
)
{
...
@@ -197,7 +197,7 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -197,7 +197,7 @@ public class NodeInfoComponentVis extends JComponent
this
.
host
=
(
SimHost
)
host
;
this
.
host
=
(
SimHost
)
host
;
this
.
loc
=
this
.
host
.
getTopologyComponent
().
getRealPosition
();
this
.
loc
=
this
.
host
.
getTopologyComponent
().
getRealPosition
();
this
.
visNodeInfo
=
VisualizationInjector
.
getNodeInformation
(
host
.
getId
());
this
.
visNodeInfo
=
VisualizationInjector
.
getNodeInformation
(
host
.
getId
());
/*
/*
* Create per-info-option colors by deriving the color from the base color
* Create per-info-option colors by deriving the color from the base color
*/
*/
...
@@ -211,31 +211,31 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -211,31 +211,31 @@ public class NodeInfoComponentVis extends JComponent
* http://stackoverflow.com/questions/2355157/dynamically-
* http://stackoverflow.com/questions/2355157/dynamically-
* creating-colors-with-different-brightness
* creating-colors-with-different-brightness
*/
*/
// float hsbVals[] = Color.RGBtoHSB(baseColor.getRed(),
// float hsbVals[] = Color.RGBtoHSB(baseColor.getRed(),
// baseColor.getGreen(), baseColor.getBlue(), null);
// baseColor.getGreen(), baseColor.getBlue(), null);
for
(
int
i
=
0
;
i
<
dimensionSize
;
i
++)
{
for
(
int
i
=
0
;
i
<
dimensionSize
;
i
++)
{
float
hue
=
i
/
(
float
)
dimensionSize
;
float
hue
=
i
/
(
float
)
dimensionSize
;
// colors[dim][i] = Color.getHSBColor(hue, hsbVals[1],
// colors[dim][i] = Color.getHSBColor(hue, hsbVals[1],
// hsbVals[2]);
// hsbVals[2]);
colors
[
dim
][
i
]
=
tuColors
[
i
];
colors
[
dim
][
i
]
=
tuColors
[
i
];
}
}
}
}
}
}
/**
/**
* Called on one of the nodes to draw global objects such as a legend.
* Called on one of the nodes to draw global objects such as a legend.
* Called before draw.
* Called before draw.
*
*
* @param g2
* @param g2
*/
*/
public
void
drawLegend
(
Graphics2D
g2
)
{
public
void
drawLegend
(
Graphics2D
g2
)
{
String
[]
dimensions
=
nodeInfo
.
getNodeColorDimensionDescriptions
();
String
[]
dimensions
=
nodeInfo
.
getNodeColorDimensionDescriptions
();
int
segments
=
dimensions
.
length
;
int
segments
=
dimensions
.
length
;
int
segmentDegrees
=
(
int
)
(
360
/
(
double
)
segments
);
int
segmentDegrees
=
(
int
)
(
360
/
(
double
)
segments
);
int
arcSize
=
8
;
int
arcSize
=
8
;
g2
.
setStroke
(
new
BasicStroke
(
3
));
g2
.
setStroke
(
new
BasicStroke
(
3
));
for
(
int
color
=
0
;
color
<
segments
;
color
++)
{
for
(
int
color
=
0
;
color
<
segments
;
color
++)
{
if
(!
activeLayers
[
color
])
{
if
(!
activeLayers
[
color
])
{
...
@@ -256,7 +256,7 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -256,7 +256,7 @@ public class NodeInfoComponentVis extends JComponent
}
}
public
void
draw
(
Graphics2D
g2
)
{
public
void
draw
(
Graphics2D
g2
)
{
if
(
hideInactiveNodes
&&
!
nodeInfo
.
isActive
())
{
if
(
hideInactiveNodes
&&
!
nodeInfo
.
isActive
())
{
visNodeInfo
.
disableClickListener
=
true
;
visNodeInfo
.
disableClickListener
=
true
;
return
;
return
;
...
@@ -273,15 +273,15 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -273,15 +273,15 @@ public class NodeInfoComponentVis extends JComponent
if
(!
nodeInfo
.
isActive
())
{
if
(!
nodeInfo
.
isActive
())
{
return
;
return
;
}
}
g2
.
setComposite
(
AlphaComposite
.
getInstance
(
AlphaComposite
.
SRC_OVER
,
1.0f
));
g2
.
setComposite
(
AlphaComposite
.
getInstance
(
AlphaComposite
.
SRC_OVER
,
1.0f
));
int
segments
=
nodeInfo
.
getNodeColorDimensions
();
int
segments
=
nodeInfo
.
getNodeColorDimensions
();
int
segmentDegrees
=
(
int
)
(
360
/
(
double
)
segments
);
int
segmentDegrees
=
(
int
)
(
360
/
(
double
)
segments
);
int
arcSize
=
8
;
int
arcSize
=
8
;
g2
.
setStroke
(
new
BasicStroke
(
8
,
BasicStroke
.
CAP_BUTT
,
BasicStroke
.
JOIN_BEVEL
));
g2
.
setStroke
(
new
BasicStroke
(
8
,
BasicStroke
.
CAP_BUTT
,
BasicStroke
.
JOIN_BEVEL
));
for
(
int
dim
=
0
;
dim
<
segments
;
dim
++)
{
for
(
int
dim
=
0
;
dim
<
segments
;
dim
++)
{
int
value
=
nodeInfo
.
getNodeColor
(
dim
);
int
value
=
nodeInfo
.
getNodeColor
(
dim
);
...
@@ -292,7 +292,7 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -292,7 +292,7 @@ public class NodeInfoComponentVis extends JComponent
g2
.
drawArc
(
VisualizationInjector
.
scaleValue
(
center
.
x
)-
arcSize
,
VisualizationInjector
.
scaleValue
(
center
.
y
)-
arcSize
,
2
*
arcSize
,
2
*
arcSize
,
dim
*
segmentDegrees
,
segmentDegrees
);
g2
.
drawArc
(
VisualizationInjector
.
scaleValue
(
center
.
x
)-
arcSize
,
VisualizationInjector
.
scaleValue
(
center
.
y
)-
arcSize
,
2
*
arcSize
,
2
*
arcSize
,
dim
*
segmentDegrees
,
segmentDegrees
);
}
}
g2
.
setStroke
(
new
BasicStroke
(
1
));
g2
.
setStroke
(
new
BasicStroke
(
1
));
String
nodeDesc
=
nodeInfo
.
getNodeDescription
();
String
nodeDesc
=
nodeInfo
.
getNodeDescription
();
g2
.
drawString
(
nodeDesc
,
center
.
x
+
4
,
center
.
y
+
4
);
g2
.
drawString
(
nodeDesc
,
center
.
x
+
4
,
center
.
y
+
4
);
}
}
...
@@ -313,7 +313,7 @@ public class NodeInfoComponentVis extends JComponent
...
@@ -313,7 +313,7 @@ public class NodeInfoComponentVis extends JComponent
public
boolean
isHidden
()
{
public
boolean
isHidden
()
{
return
false
;
return
false
;
}
}
@Override
@Override
public
String
getDisplayName
()
{
public
String
getDisplayName
()
{
return
"Info: "
+
name
;
return
"Info: "
+
name
;
...
...
src/de/tud/kom/p2psim/impl/util/guirunner/GUIRunner.java
View file @
8bc9fe82
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
*
* This file is part of PeerfactSim.KOM.
* This file is part of PeerfactSim.KOM.
*
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* any later version.
* any later version.
*
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*
...
@@ -27,6 +27,7 @@ import java.awt.GridBagConstraints;
...
@@ -27,6 +27,7 @@ import java.awt.GridBagConstraints;
import
java.awt.GridBagLayout
;
import
java.awt.GridBagLayout
;
import
java.awt.Image
;
import
java.awt.Image
;
import
java.awt.Point
;
import
java.awt.Point
;
import
java.awt.Toolkit
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionListener
;
import
java.awt.event.KeyAdapter
;
import
java.awt.event.KeyAdapter
;
...
@@ -58,15 +59,15 @@ import de.tud.kom.p2psim.impl.util.guirunner.seed.SeedChooser;
...
@@ -58,15 +59,15 @@ import de.tud.kom.p2psim.impl.util.guirunner.seed.SeedChooser;
* A window to select a configuration file to run PFS from. Useful for
* A window to select a configuration file to run PFS from. Useful for
* developers switching between different configuration files many times, as well as
* developers switching between different configuration files many times, as well as
* for presentations etc.
* for presentations etc.
*
*
* @author Leo Nobach
* @author Leo Nobach
* @version 3.0, 25.11.2008
* @version 3.0, 25.11.2008
*
*
*/
*/
public
class
GUIRunner
extends
JFrame
implements
WindowListener
,
KeyListener
{
public
class
GUIRunner
extends
JFrame
implements
WindowListener
,
KeyListener
{
/**
/**
*
*
*/
*/
private
static
final
long
serialVersionUID
=
6126914669745711438L
;
private
static
final
long
serialVersionUID
=
6126914669745711438L
;
...
@@ -93,11 +94,11 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -93,11 +94,11 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
public
static
LastOpened
lastOpened
=
new
LastOpened
();
public
static
LastOpened
lastOpened
=
new
LastOpened
();
public
static
RunnerController
ctrl
=
new
RunnerController
();
public
static
RunnerController
ctrl
=
new
RunnerController
();
JSplitPane
splitPane
;
JSplitPane
splitPane
;
JTextField
searchBar
;
JTextField
searchBar
;
DirView
dirView
;
DirView
dirView
;
public
GUIRunner
()
{
public
GUIRunner
()
{
...
@@ -113,8 +114,15 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -113,8 +114,15 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
int
winWidth
=
Config
.
getValue
(
CONF_PATH_WIDTH
,
600
);
int
winWidth
=
Config
.
getValue
(
CONF_PATH_WIDTH
,
600
);
int
winHeight
=
Config
.
getValue
(
CONF_PATH_HEIGHT
,
600
);
int
winHeight
=
Config
.
getValue
(
CONF_PATH_HEIGHT
,
600
);
this
.
setSize
(
winWidth
,
winHeight
);
this
.
setSize
(
winWidth
,
winHeight
);
this
.
setLocation
(
new
Point
(
Config
.
getValue
(
CONF_PATH_POSX
,
0
),
Config
Point
point
=
new
Point
(
Config
.
getValue
(
CONF_PATH_POSX
,
0
),
Config
.
getValue
(
CONF_PATH_POSY
,
0
)));
.
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
());
this
.
setLayout
(
new
BorderLayout
());
...
@@ -122,11 +130,11 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -122,11 +130,11 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
JScrollPane
sp
=
new
JScrollPane
(
dirView
);
JScrollPane
sp
=
new
JScrollPane
(
dirView
);
this
.
add
(
new
ButtonBar
(),
BorderLayout
.
SOUTH
);
this
.
add
(
new
ButtonBar
(),
BorderLayout
.
SOUTH
);
JPanel
sidepanel
=
new
JPanel
();
JPanel
sidepanel
=
new
JPanel
();
sidepanel
.
setLayout
(
new
GridBagLayout
());
sidepanel
.
setLayout
(
new
GridBagLayout
());
GridBagConstraints
c
=
new
GridBagConstraints
();
GridBagConstraints
c
=
new
GridBagConstraints
();
SeedChooser
seed
=
new
SeedChooser
(
ctrl
.
getDetermination
());
SeedChooser
seed
=
new
SeedChooser
(
ctrl
.
getDetermination
());
seed
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"Seed options"
));
seed
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"Seed options"
));
c
.
gridx
=
0
;
c
.
gridx
=
0
;
...
@@ -141,19 +149,19 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -141,19 +149,19 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
c
.
gridy
=
1
;
c
.
gridy
=
1
;
c
.
weighty
=
1
;
c
.
weighty
=
1
;
sidepanel
.
add
(
vars
,
c
);
sidepanel
.
add
(
vars
,
c
);
JComponent
variations
=
new
VariationSelector
(
ctrl
).
getComponent
();
JComponent
variations
=
new
VariationSelector
(
ctrl
).
getComponent
();
variations
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"Variations"
));
variations
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"Variations"
));
c
.
gridy
=
2
;
c
.
gridy
=
2
;
c
.
weighty
=
0
;
c
.
weighty
=
0
;
sidepanel
.
add
(
variations
,
c
);
sidepanel
.
add
(
variations
,
c
);
JComponent
desc
=
new
DescriptionWnd
(
ctrl
).
getComponent
();
JComponent
desc
=
new
DescriptionWnd
(
ctrl
).
getComponent
();
desc
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"Description"
));
desc
.
setBorder
(
BorderFactory
.
createTitledBorder
(
"Description"
));
c
.
gridy
=
3
;
c
.
gridy
=
3
;
c
.
weighty
=
1
;
c
.
weighty
=
1
;
sidepanel
.
add
(
desc
,
c
);
sidepanel
.
add
(
desc
,
c
);
searchBar
=
new
JTextField
();
searchBar
=
new
JTextField
();
searchBar
.
addKeyListener
(
new
KeyAdapter
()
{
searchBar
.
addKeyListener
(
new
KeyAdapter
()
{
@Override
@Override
...
@@ -162,14 +170,14 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -162,14 +170,14 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
dirView
.
updateUI
();
dirView
.
updateUI
();
}
}
});
});
JSplitPane
searchDirViewSplitPane
=
new
JSplitPane
(
JSplitPane
.
VERTICAL_SPLIT
,
searchBar
,
sp
);
JSplitPane
searchDirViewSplitPane
=
new
JSplitPane
(
JSplitPane
.
VERTICAL_SPLIT
,
searchBar
,
sp
);
searchDirViewSplitPane
.
setEnabled
(
false
);
searchDirViewSplitPane
.
setEnabled
(
false
);
splitPane
=
new
JSplitPane
(
JSplitPane
.
HORIZONTAL_SPLIT
,
sidepanel
,
searchDirViewSplitPane
);
splitPane
=
new
JSplitPane
(
JSplitPane
.
HORIZONTAL_SPLIT
,
sidepanel
,
searchDirViewSplitPane
);
splitPane
.
setDividerLocation
(
Config
.
getValue
(
SPLITTER_CONF_PATH
,
400
));
splitPane
.
setDividerLocation
(
Config
.
getValue
(
SPLITTER_CONF_PATH
,
400
));
this
.
add
(
splitPane
,
BorderLayout
.
CENTER
);
this
.
add
(
splitPane
,
BorderLayout
.
CENTER
);
GlobalKeyEventDispatcher
disp
=
new
GlobalKeyEventDispatcher
(
this
);
GlobalKeyEventDispatcher
disp
=
new
GlobalKeyEventDispatcher
(
this
);
disp
.
addKeyListener
(
this
);
disp
.
addKeyListener
(
this
);
...
@@ -178,7 +186,7 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -178,7 +186,7 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
public
class
ButtonBar
extends
JPanel
implements
ActionListener
{
public
class
ButtonBar
extends
JPanel
implements
ActionListener
{
/**
/**
*
*
*/
*/
private
static
final
long
serialVersionUID
=
-
7482502225920138689L
;
private
static
final
long
serialVersionUID
=
-
7482502225920138689L
;
...
@@ -206,7 +214,7 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
...
@@ -206,7 +214,7 @@ public class GUIRunner extends JFrame implements WindowListener, KeyListener {
}
}
public
void
closeRunner
()
{
public
void
closeRunner
()
{
disposeRunner
();
disposeRunner
();
System
.
exit
(
0
);
System
.
exit
(
0
);
}
}
...
...
src/de/tud/kom/p2psim/impl/vehicular/caching/DefaultCachingComponent.java
View file @
8bc9fe82
...
@@ -140,6 +140,7 @@ implements CachingComponent, ConnectivityListener {
...
@@ -140,6 +140,7 @@ implements CachingComponent, ConnectivityListener {
if
(!
_cache
.
containsKey
(
pCacheEntry
.
getClass
()))
{
if
(!
_cache
.
containsKey
(
pCacheEntry
.
getClass
()))
{
_cache
.
put
(
pCacheEntry
.
getClass
(),
new
ArrayList
<>());
_cache
.
put
(
pCacheEntry
.
getClass
(),
new
ArrayList
<>());
}
}
List
<
PointInformation
>
entries
=
_cache
.
get
(
pCacheEntry
.
getClass
());
List
<
PointInformation
>
entries
=
_cache
.
get
(
pCacheEntry
.
getClass
());
entries
.
add
(
pCacheEntry
);
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