Commit 1562bfc2 authored by Julian Zobel's avatar Julian Zobel
Browse files

Get blocked areas for viz from real world street movement

parent 9b42d951
......@@ -488,6 +488,10 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
}
}
public String getBlockedAreas() {
return this.blockedAreas;
}
public void setAllowAlternativeRoutes(boolean allowAlternativeRoutes) {
this.allowAlternativeRoutes = allowAlternativeRoutes;
}
......
......@@ -397,10 +397,10 @@ public class ModularMovementModel implements MovementModel, EventHandler, Attrac
this.localMovementStrategy = localMovementStrategy;
}
public void setITransitionStrategy(IAttractionAssigmentStrategy transition) {
public void setIAttractionAssigmentStrategy(IAttractionAssigmentStrategy transition) {
if (transition == null) {
throw new ConfigurationException(
"TransitionStrategy is missing in ModularMovementModel!");
"IAttractionAssigmentStrategy 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;
}
}
......@@ -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(1f, 0f, 0f, 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.getX()),
// 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()));
//
// 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.getX()),
// g2.fillRect(VisualizationInjector.scaleValue(p1.getX()), VisualizationInjector.scaleValue(p1.getY()),
// 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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment