org.osm2world.core.world.network
Class AbstractNetworkWaySegmentWorldObject

Object
  extended by AbstractNetworkWaySegmentWorldObject
All Implemented Interfaces:
IntersectionTestObject, WaySegmentWorldObject, WorldObject, WorldObjectWithOutline, NetworkWaySegmentWorldObject
Direct Known Subclasses:
RoadModule.Road, WaterModule.Waterway

public abstract class AbstractNetworkWaySegmentWorldObject
extends Object
implements NetworkWaySegmentWorldObject, WaySegmentWorldObject, IntersectionTestObject, WorldObjectWithOutline


Field Summary
 MapWaySegment line
           
 
Constructor Summary
protected AbstractNetworkWaySegmentWorldObject(MapWaySegment line)
           
 
Method Summary
 AxisAlignedBoundingBoxXZ getAxisAlignedBoundingBoxXZ()
           
 List<VectorXYZ> getCenterline()
          returns a sequence of node running along the center of the line from start to end (each with offset).
 List<VectorXZ> getCenterlineXZ()
          version of getCenterline() in the XZ plane
 VectorXZ getCutVectorAt(MapNode node)
           
 VectorXZ getEndCutVector()
          returns the cut vector for the end of the line.
 VectorXZ getEndOffset()
          returns the current offset for the end of the line.
 VectorXZ getEndPosition()
          returns the end position.
protected  VectorXZ getEndWithOffset()
           
 List<VectorXYZ> getOutline(boolean right)
          provides the left or right border (a line at an appropriate distance from the center line), taking into account cut vectors, offsets and elevation information.
 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.
 VectorXYZ getPointOnCut(boolean start, double relativePosFromLeft)
          returns a point on the start or end cut line.
 MapElement getPrimaryMapElement()
          returns the "primary" MapElement for this WorldObject; i.e.
 VectorXZ getStartCutVector()
          returns the cut vector for the start of the line.
 VectorXZ getStartOffset()
          returns the current offset for the end of the line.
 VectorXZ getStartPosition()
          returns the start position.
protected  VectorXZ getStartWithOffset()
           
 void setEndCutVector(VectorXZ cutVector)
          Sets the cut vector for the end of the line.
 void setEndOffset(VectorXZ offsetVector)
          Sets the offset for the end of the line.
 void setStartCutVector(VectorXZ cutVector)
          Sets the cut vector for the start of the line.
 void setStartOffset(VectorXZ offsetVector)
          Sets the offset for the start of the line.
 String toString()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface NetworkWaySegmentWorldObject
getWidth
 
Methods inherited from interface WorldObject
getClearingAbove, getClearingBelow, getGroundState
 

Field Detail

line

public final MapWaySegment line
Constructor Detail

AbstractNetworkWaySegmentWorldObject

protected AbstractNetworkWaySegmentWorldObject(MapWaySegment line)
Method Detail

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

setStartCutVector

public void setStartCutVector(VectorXZ cutVector)
Description copied from interface: NetworkWaySegmentWorldObject
Sets the cut vector for the start of the line. //TODO: explain "cut vectors" To be used by NetworkCalculator.

Specified by:
setStartCutVector in interface NetworkWaySegmentWorldObject

setEndCutVector

public void setEndCutVector(VectorXZ cutVector)
Description copied from interface: NetworkWaySegmentWorldObject
Sets the cut vector for the end of the line. //TODO: explain "cut vectors" To be used by NetworkCalculator.

Specified by:
setEndCutVector in interface NetworkWaySegmentWorldObject

getStartCutVector

public VectorXZ getStartCutVector()
Description copied from interface: NetworkWaySegmentWorldObject
returns the cut vector for the start of the line. Only available after NetworkWaySegmentWorldObject.setStartCutVector(VectorXZ).

Specified by:
getStartCutVector in interface NetworkWaySegmentWorldObject

getEndCutVector

public VectorXZ getEndCutVector()
Description copied from interface: NetworkWaySegmentWorldObject
returns the cut vector for the end of the line. Only available after NetworkWaySegmentWorldObject.setStartCutVector(VectorXZ).

Specified by:
getEndCutVector in interface NetworkWaySegmentWorldObject

getCutVectorAt

public VectorXZ getCutVectorAt(MapNode node)

setStartOffset

public void setStartOffset(VectorXZ offsetVector)
Description copied from interface: NetworkWaySegmentWorldObject
Sets the offset for the start of the line. To be used by NetworkCalculator.

Specified by:
setStartOffset in interface NetworkWaySegmentWorldObject

setEndOffset

public void setEndOffset(VectorXZ offsetVector)
Description copied from interface: NetworkWaySegmentWorldObject
Sets the offset for the end of the line. To be used by NetworkCalculator.

Specified by:
setEndOffset in interface NetworkWaySegmentWorldObject

getStartWithOffset

protected VectorXZ getStartWithOffset()

getEndWithOffset

protected VectorXZ getEndWithOffset()

getCenterline

public List<VectorXYZ> getCenterline()
returns a sequence of node running along the center of the line from start to end (each with offset). Uses the WaySegmentElevationProfile for adding elevation information.


getCenterlineXZ

public List<VectorXZ> getCenterlineXZ()
version of getCenterline() in the XZ plane


getOutline

public List<VectorXYZ> getOutline(boolean right)
provides the left or right border (a line at an appropriate distance from the center line), taking into account cut vectors, offsets and elevation information. Available after cut vectors, offsets and elevation information have been calculated. Left and right border have the same number of nodes as the elevation profile's WaySegmentElevationProfile.getPointsWithEle(). //TODO: compatible with future offset/clearing influences?


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

getPointOnCut

public VectorXYZ getPointOnCut(boolean start,
                               double relativePosFromLeft)
returns a point on the start or end cut line.

Parameters:
start - point is on the start cut if true, on the end cut if false
relativePosFromLeft - 0 is the leftmost point, 1 the rightmost. Values in between are for interpolation.

getStartOffset

public VectorXZ getStartOffset()
Description copied from interface: NetworkWaySegmentWorldObject
returns the current offset for the end of the line. Should already be usable before first NetworkWaySegmentWorldObject.setEndOffset(VectorXZ) call, returning (0,0).

Specified by:
getStartOffset in interface NetworkWaySegmentWorldObject

getEndOffset

public VectorXZ getEndOffset()
Description copied from interface: NetworkWaySegmentWorldObject
returns the current offset for the end of the line. Should already be usable before first NetworkWaySegmentWorldObject.setEndOffset(VectorXZ) call, returning (0,0).

Specified by:
getEndOffset in interface NetworkWaySegmentWorldObject

getStartPosition

public VectorXZ getStartPosition()
Description copied from interface: WaySegmentWorldObject
returns the start position. Might be different from MapWaySegment's start position; as node features such as crossings require space, too.

Specified by:
getStartPosition in interface WaySegmentWorldObject

getEndPosition

public VectorXZ getEndPosition()
Description copied from interface: WaySegmentWorldObject
returns the end position. See WaySegmentWorldObject.getStartPosition() for details.

Specified by:
getEndPosition in interface WaySegmentWorldObject

getAxisAlignedBoundingBoxXZ

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

toString

public String toString()
Overrides:
toString in class Object