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()
           
 double getClearingAbove(VectorXZ pos)
          returns the amount of free space above the base elevation required by this feature.
 double getClearingBelow(VectorXZ pos)
          returns the amount of free space below the base elevation required by this feature.
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.
protected  PolygonXZ getJunctionAreaXZ()
          variant of getJunctionArea() in the XZ plane
 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.
 SimplePolygonXZ getOutlinePolygonXZ()
          returns a counterclockwise polygon defining the object's ground footprint, projected onto the XZ plane.
 MapElement getPrimaryMapElement()
          returns the "primary" MapElement for this WorldObject; i.e.
 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
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

getPrimaryMapElement

public MapElement getPrimaryMapElement()
Description copied from interface: WorldObject
returns the "primary" MapElement for this WorldObject; i.e. the one it is most strongly associated with. Can be null if there is no (clear) primary element for this feature.

Specified by:
getPrimaryMapElement in interface WorldObject

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.


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

getOutlinePolygonXZ

public SimplePolygonXZ getOutlinePolygonXZ()
Description copied from interface: WorldObjectWithOutline
returns a counterclockwise polygon defining the object's ground footprint, projected onto the XZ plane.

Specified by:
getOutlinePolygonXZ 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

getClearingAbove

public double getClearingAbove(VectorXZ pos)
Description copied from interface: WorldObject
returns the amount of free space above the base elevation required by this feature. If pos isn't on this representation, the clearing for a somewhat nearby point on the feature should be returned.

Specified by:
getClearingAbove in interface WorldObject

getClearingBelow

public double getClearingBelow(VectorXZ pos)
Description copied from interface: WorldObject
returns the amount of free space below the base elevation required by this feature. If pos isn't on this representation, the clearing for a somewhat nearby point on the feature should be returned.

Specified by:
getClearingBelow in interface WorldObject

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).)


getJunctionAreaXZ

protected PolygonXZ getJunctionAreaXZ()
variant of getJunctionArea() in the XZ plane


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