org.osm2world.core.world.network
Class JunctionNodeWorldObject

Object
  extended by JunctionNodeWorldObject
All Implemented Interfaces:
IntersectionTestObject, NodeWorldObject, WorldObject, WorldObjectWithOutline
Direct Known Subclasses:
RailwayModule.RailJunction, RoadModule.RoadJunction, WaterModule.RiverJunction

public abstract class JunctionNodeWorldObject
extends Object
implements NodeWorldObject, IntersectionTestObject, WorldObjectWithOutline


Field Summary
protected  List<VectorXZ> cutCenters
           
protected  List<VectorXZ> cutVectors
           
protected  boolean informationProvided
           
protected  MapNode node
           
protected  List<Float> widths
           
 
Constructor Summary
JunctionNodeWorldObject(MapNode node)
           
 
Method Summary
 AxisAlignedBoundingBoxXZ getAxisAlignedBoundingBoxXZ()
           
protected  VectorXZ getCutNode(int i, boolean right)
          calculates the left or right node of a cut (Only available if junction information for this representation has been provided using setInformation(List, List, List)).
protected  PolygonXYZ getJunctionArea()
          provides subclasses with an outline of the junction area.
 List<VectorXYZ> getOutline(int from, int to)
          provides outline for the areas covered by the junction.
 PolygonXYZ getOutlinePolygon()
          returns a counterclockwise polygon defining the object's ground footprint.
 Collection<TriangleXYZ> getTriangulation()
           
 void setInformation(List<VectorXZ> cutCenters, List<VectorXZ> cutVectors, List<Float> widths)
          sets the results of NetworkCalculator's calculations.
 String toString()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface WorldObject
getClearingAbove, getClearingBelow, getGroundState
 

Field Detail

node

protected final MapNode node

informationProvided

protected boolean informationProvided

cutVectors

protected List<VectorXZ> cutVectors

cutCenters

protected List<VectorXZ> cutCenters

widths

protected List<Float> widths
Constructor Detail

JunctionNodeWorldObject

public JunctionNodeWorldObject(MapNode node)
Method Detail

setInformation

public void setInformation(List<VectorXZ> cutCenters,
                           List<VectorXZ> cutVectors,
                           List<Float> widths)
sets the results of NetworkCalculator's calculations. Cut information will not be created for all way/area segments. The lists can therefore contain null entries.

Parameters:
cutCenters - centers of the cuts to each; indices are the same as for the GridNode's MapNode.getConnectedSegments()
cutVectors - vectors describing indicating the cut line, pointing to the right from the node's pov; for indices see junctionCutCenters
widths - widths of the junction cut; for indices see junctionCutCenters

getOutline

public List<VectorXYZ> getOutline(int from,
                                  int to)
provides outline for the areas covered by the junction. The from and to indices refer to the list returned by the underlying MapNode's MapNode.getConnectedSegments() method. TODO: method necessary after Terrain change?


getOutlinePolygon

public PolygonXYZ getOutlinePolygon()
Description copied from interface: WorldObjectWithOutline
returns a counterclockwise polygon defining the object's ground footprint.

Specified by:
getOutlinePolygon in interface WorldObjectWithOutline
Returns:
outline polygon; null if this world object doesn't cover any area

getAxisAlignedBoundingBoxXZ

public AxisAlignedBoundingBoxXZ getAxisAlignedBoundingBoxXZ()
Specified by:
getAxisAlignedBoundingBoxXZ in interface IntersectionTestObject

getTriangulation

public Collection<TriangleXYZ> getTriangulation()
Returns:
a triangulation of the area covered by this junction

getJunctionArea

protected PolygonXYZ getJunctionArea()
provides subclasses with an outline of the junction area. Can be null if the junction doesn't cover any area, which happens when there is only one connected way segment. (Only available if junction information for this representation has been provided using setInformation(List, List, List).)


getCutNode

protected VectorXZ getCutNode(int i,
                              boolean right)
calculates the left or right node of a cut (Only available if junction information for this representation has been provided using setInformation(List, List, List)).

Returns:
cut node position; null if connected section #i has no outline

toString

public String toString()
Overrides:
toString in class Object