uk.me.parabola.imgfmt.app.net
Class RouteArc

java.lang.Object
  extended by uk.me.parabola.imgfmt.app.net.RouteArc

public class RouteArc
extends java.lang.Object

An arc joins two nodes within a RouteCenter. This may be renamed to a Segment. The arc also references the road that it is a part of. There are also links between nodes in different centers.

Author:
Steve Ratcliffe

Field Summary
static int MASK_CURVE_LEN
           
 
Constructor Summary
RouteArc(RoadDef roadDef, RouteNode source, RouteNode dest, int initialHeading, int finalHeading, double length, boolean curveEnabled, int pointsHash)
          Create a new arc.
 
Method Summary
 int boundSize()
          Provide an upper bound for the written size in bytes.
 RouteNode getDest()
           
 int getFinalHeading()
           
 byte getIndexA()
          Get this arc's index into Table A.
 byte getIndexB()
          Get this arc's index into Table B.
 int getInitialHeading()
           
 int getLength()
           
 int getPointsHash()
           
 RoadDef getRoadDef()
           
 RouteNode getSource()
           
 boolean isForward()
           
 boolean isInternal()
          Is this an arc within the RouteCenter?
protected  void setDestinationClass(int destinationClass)
           
 void setForward()
           
 void setIndexA(byte indexA)
          Set this arc's index into Table A.
 void setIndexB(byte indexB)
          Set this arc's index into Table B.
 void setInitialHeading(int ih)
           
 void setInternal(boolean internal)
           
 void setLast()
           
 void setNewDir()
           
 void write(ImgFileWriter writer)
           
 void writeSecond(ImgFileWriter writer)
          Second pass over the nodes in this RouteCenter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK_CURVE_LEN

public static final int MASK_CURVE_LEN
See Also:
Constant Field Values
Constructor Detail

RouteArc

public RouteArc(RoadDef roadDef,
                RouteNode source,
                RouteNode dest,
                int initialHeading,
                int finalHeading,
                double length,
                boolean curveEnabled,
                int pointsHash)
Create a new arc.

Parameters:
roadDef - The road that this arc segment is part of.
source - The source node.
dest - The destination node.
initialHeading - The initial heading (signed degrees)
Method Detail

getInitialHeading

public int getInitialHeading()

setInitialHeading

public void setInitialHeading(int ih)

getFinalHeading

public int getFinalHeading()

getSource

public RouteNode getSource()

getDest

public RouteNode getDest()

getLength

public int getLength()

getPointsHash

public int getPointsHash()

boundSize

public int boundSize()
Provide an upper bound for the written size in bytes.


isInternal

public boolean isInternal()
Is this an arc within the RouteCenter?


setInternal

public void setInternal(boolean internal)

setIndexA

public void setIndexA(byte indexA)
Set this arc's index into Table A.


getIndexA

public byte getIndexA()
Get this arc's index into Table A. Required for writing restrictions (Table C).


setIndexB

public void setIndexB(byte indexB)
Set this arc's index into Table B. Applies to external arcs only.


getIndexB

public byte getIndexB()
Get this arc's index into Table B. Required for writing restrictions (Table C).


write

public void write(ImgFileWriter writer)

writeSecond

public void writeSecond(ImgFileWriter writer)
Second pass over the nodes in this RouteCenter. Node offsets are now all known, so we can write the pointers for internal arcs.


getRoadDef

public RoadDef getRoadDef()

setNewDir

public void setNewDir()

setForward

public void setForward()

isForward

public boolean isForward()

setLast

public void setLast()

setDestinationClass

protected void setDestinationClass(int destinationClass)