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

java.lang.Object
  extended by uk.me.parabola.imgfmt.app.net.RoadDef
All Implemented Interfaces:
java.lang.Comparable<RoadDef>

public class RoadDef
extends java.lang.Object
implements java.lang.Comparable<RoadDef>

A road definition. This ties together all segments of a single road and provides street address information. This corresponds to an entry in NET1, which is linked with the polylines making up this road in RGN. Links to RGN are written via RoadIndex, while writing links from RGN to NET1 is delayed via setOffsetWriter. If the map includes routing, the NET1 record also points to a NOD2 record, written by writeNod2. Edges in the routing graph ("arcs") link to the corresponding road via the RoadDef, storing the NET1 offset via TableA, which also includes some road information.

Author:
Elrond, Steve Ratcliffe, Robert Vollmert

Constructor Summary
RoadDef(long id, java.lang.String name)
           
 
Method Summary
 void addLabel(Label l)
           
 void addOffsetTarget(int position, int flags)
          Add a target location in the RGN section where we should write the offset of this road def when it is written to NET.
 void addPolylineRef(Polyline pl)
          Add a polyline to this road.
 int compareTo(RoadDef other)
           
 boolean connectedTo(RoadDef other, int level)
           
 boolean doDeadEndCheck()
           
 void doDeadEndCheck(boolean dec)
           
 boolean doFlareCheck()
           
 void doFlareCheck(boolean fc)
           
 boolean ferry()
           
 void ferry(boolean f)
           
 City getCity()
           
 long getId()
           
 Label[] getLabels()
           
 java.lang.String getName()
           
 int getOffsetNet1()
          Return the offset of this road's NET1 entry.
 int getRoadClass()
           
 int getRoadSpeed()
           
 int getTabAAccess()
           
 int getTabAInfo()
           
 boolean hasInternalNodes()
          Does the road have any nodes besides start and end? This affects whether we need to write extra bits in the bitstream in RGN.
 boolean isLinkRoad()
           
 boolean isOneway()
           
 boolean isRoundabout()
           
 boolean isSynthesised()
           
 boolean messagePreviouslyIssued(java.lang.String key)
           
 boolean paved()
           
 void paved(boolean p)
           
 void putSortedRoadEntry(ImgFileWriter writer, Label label)
           
 void setAccess(boolean[] access)
           
 void setCity(City city)
           
 void setInternalNodes(boolean n)
           
 void setLength(double l)
          Set the road length (in meters).
 void setLinkRoad(boolean lr)
           
 void setNode(RouteNode node)
          Set the routing node associated with this road.
 void setNoThroughRouting()
           
 void setNumNodes(int n)
           
 void setOneway()
           
 void setRoadClass(int roadClass)
           
 void setRoundabout(boolean r)
           
 void setSpeed(int speed)
           
 void setStartsWithNode(boolean s)
           
 void setSynthesised(boolean s)
           
 void setToll()
           
 void setZip(Zip zip)
           
 java.lang.String toString()
           
 void writeNod2(ImgFileWriter writer)
          Write this road's NOD2 entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoadDef

public RoadDef(long id,
               java.lang.String name)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()

getId

public long getId()

putSortedRoadEntry

public void putSortedRoadEntry(ImgFileWriter writer,
                               Label label)

addLabel

public void addLabel(Label l)

getLabels

public Label[] getLabels()

addPolylineRef

public void addPolylineRef(Polyline pl)
Add a polyline to this road. References to these are written to NET. At a given zoom level, we're writing these in the order we get them, which possibly needs to be the order the segments have in the road.


connectedTo

public boolean connectedTo(RoadDef other,
                           int level)

setLength

public void setLength(double l)
Set the road length (in meters).


addOffsetTarget

public void addOffsetTarget(int position,
                            int flags)
Add a target location in the RGN section where we should write the offset of this road def when it is written to NET.

Parameters:
position - The offset in RGN.
flags - The flags that should be set.

hasInternalNodes

public boolean hasInternalNodes()
Does the road have any nodes besides start and end? This affects whether we need to write extra bits in the bitstream in RGN.


setInternalNodes

public void setInternalNodes(boolean n)

setNode

public void setNode(RouteNode node)
Set the routing node associated with this road. This implies that the road has an entry in NOD 2 which will be pointed at from NET 1.


setStartsWithNode

public void setStartsWithNode(boolean s)

setNumNodes

public void setNumNodes(int n)

writeNod2

public void writeNod2(ImgFileWriter writer)
Write this road's NOD2 entry. Stores the writing position to be able to link here from NET 1 later.

Parameters:
writer - A writer positioned in NOD2.

getOffsetNet1

public int getOffsetNet1()
Return the offset of this road's NET1 entry. Assumes writeNet1() has been called.


setToll

public void setToll()

setNoThroughRouting

public void setNoThroughRouting()

setAccess

public void setAccess(boolean[] access)

getTabAInfo

public int getTabAInfo()

getTabAAccess

public int getTabAAccess()

setRoadClass

public void setRoadClass(int roadClass)

getRoadClass

public int getRoadClass()

setSpeed

public void setSpeed(int speed)

getRoadSpeed

public int getRoadSpeed()

setOneway

public void setOneway()

isOneway

public boolean isOneway()

setCity

public void setCity(City city)

setZip

public void setZip(Zip zip)

compareTo

public int compareTo(RoadDef other)
Specified by:
compareTo in interface java.lang.Comparable<RoadDef>

getCity

public City getCity()

paved

public boolean paved()

paved

public void paved(boolean p)

ferry

public void ferry(boolean f)

ferry

public boolean ferry()

setRoundabout

public void setRoundabout(boolean r)

isRoundabout

public boolean isRoundabout()

setLinkRoad

public void setLinkRoad(boolean lr)

isLinkRoad

public boolean isLinkRoad()

setSynthesised

public void setSynthesised(boolean s)

isSynthesised

public boolean isSynthesised()

doFlareCheck

public void doFlareCheck(boolean fc)

doFlareCheck

public boolean doFlareCheck()

doDeadEndCheck

public void doDeadEndCheck(boolean dec)

doDeadEndCheck

public boolean doDeadEndCheck()

messagePreviouslyIssued

public boolean messagePreviouslyIssued(java.lang.String key)