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
1562bfc2
Commit
1562bfc2
authored
Nov 25, 2020
by
Julian Zobel
Browse files
Get blocked areas for viz from real world street movement
parent
9b42d951
Changes
3
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/local/RealWorldStreetsMovement.java
View file @
1562bfc2
...
...
@@ -488,6 +488,10 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
}
}
public
String
getBlockedAreas
()
{
return
this
.
blockedAreas
;
}
public
void
setAllowAlternativeRoutes
(
boolean
allowAlternativeRoutes
)
{
this
.
allowAlternativeRoutes
=
allowAlternativeRoutes
;
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/ModularMovementModel.java
View file @
1562bfc2
...
...
@@ -397,10 +397,10 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
this
.
localMovementStrategy
=
localMovementStrategy
;
}
public
void
setI
Transition
Strategy
(
IAttractionAssigmentStrategy
transition
)
{
public
void
setI
AttractionAssigment
Strategy
(
IAttractionAssigmentStrategy
transition
)
{
if
(
transition
==
null
)
{
throw
new
ConfigurationException
(
"
Transition
Strategy is missing in ModularMovementModel!"
);
"
IAttractionAssigment
Strategy is missing in ModularMovementModel!"
);
}
this
.
attractionAssigment
=
transition
;
}
...
...
@@ -432,4 +432,8 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
public
void
setAttractionPointViz
(
AttractionPointViz
viz
)
{
this
.
attractionPointViz
=
viz
;
}
public
LocalMovementStrategy
getLocalMovementStrategy
()
{
return
this
.
localMovementStrategy
;
}
}
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/ModularMovementModelViz.java
View file @
1562bfc2
...
...
@@ -186,24 +186,56 @@ public class ModularMovementModelViz extends JComponent
}
}
//<Variable name="GRAPHHOPPER_BLOCKED_AREAS" value="51.813680,8.783510,51.806795,8.804239;51.821036,8.771151,51.814987, 8.779090;" />
if
(
this
.
movementModel
.
getLocalMovementStrategy
()
instanceof
RealWorldStreetsMovement
)
{
RealWorldStreetsMovement
mov
=
(
RealWorldStreetsMovement
)
this
.
movementModel
.
getLocalMovementStrategy
();
if
(
mov
.
getBlockedAreas
()
!=
null
&&
!
mov
.
getBlockedAreas
().
isEmpty
())
{
g2
.
setColor
(
new
Color
(
1
f
,
0
f
,
0
f
,
0.5f
));
String
[]
split
=
mov
.
getBlockedAreas
().
split
(
";"
);
for
(
String
s
:
split
)
{
String
[]
vals
=
s
.
split
(
","
);
PositionVector
p1
=
GPSCalculation
.
transformGPSWindowToOwnWorld
(
Double
.
parseDouble
(
vals
[
0
]),
Double
.
parseDouble
(
vals
[
1
]));
PositionVector
p2
=
GPSCalculation
.
transformGPSWindowToOwnWorld
(
Double
.
parseDouble
(
vals
[
2
]),
Double
.
parseDouble
(
vals
[
3
]));
g2
.
fillRect
(
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p1
.
getY
()),
VisualizationInjector
.
scaleValue
(
p2
.
getX
())
-
VisualizationInjector
.
scaleValue
(
p1
.
getX
()),
VisualizationInjector
.
scaleValue
(
p2
.
getY
())-
VisualizationInjector
.
scaleValue
(
p1
.
getY
()));
}
}
}
// g2.setColor(Color.black);
// PositionVector p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.813680,8.783510);
// PositionVector p2 = GPSCalculation.transformGPSWindowToOwnWorld(51.806795,8.804239);
// g2.setColor(new Color(1f, 0f, 0f, 0.5f));
// PositionVector p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.813680, 8.783510);
// PositionVector p2 = GPSCalculation.transformGPSWindowToOwnWorld(51.806795, 8.804239);
//
// g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.get
X
()),
// g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.get
Y
()),
// VisualizationInjector.scaleValue(p2.getX()) - VisualizationInjector.scaleValue(p1.getX()),
// VisualizationInjector.scaleValue(p2.getY())- VisualizationInjector.scaleValue(p1.getY()));
//
// p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.821036,8.771151);
// p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.821036,
8.771151);
// p2 = GPSCalculation.transformGPSWindowToOwnWorld(51.814987, 8.779090);
//
// g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.get
X
()),
// g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.get
Y
()),
// VisualizationInjector.scaleValue(p2.getX() - p1.getX()),
// VisualizationInjector.scaleValue(p2.getY() - p1.getY()));
//
//
// p1 = GPSCalculation.transformGPSWindowToOwnWorld(51.792919, 8.785700);
// p2 = GPSCalculation.transformGPSWindowToOwnWorld(51.789575, 8.799222);
//
// g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.getY()),
// VisualizationInjector.scaleValue(p2.getX()) - VisualizationInjector.scaleValue(p1.getX()),
// VisualizationInjector.scaleValue(p2.getY())- VisualizationInjector.scaleValue(p1.getY()));
//
// for (PointList pointList : paths) {
// for (GHPoint3D temp : pointList) {
// PositionVector p = RealWorldStreetsMovement.transformGPSWindowToOwnWorld(temp.getLat(), temp.getLon());
...
...
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