uk.me.parabola.imgfmt.app.mdr
Class Mdr5

java.lang.Object
  extended by uk.me.parabola.imgfmt.app.mdr.ConfigBase
      extended by uk.me.parabola.imgfmt.app.mdr.MdrSection
          extended by uk.me.parabola.imgfmt.app.mdr.MdrMapSection
              extended by uk.me.parabola.imgfmt.app.mdr.Mdr5

public class Mdr5
extends MdrMapSection

Section containing cities. We need: map number, city index in map, offset in LBL, flags and pointer into MDR 15 for the string name.

Author:
Steve Ratcliffe

Constructor Summary
Mdr5(MdrConfig config)
           
 
Method Summary
 void addCity(int mapIndex, Mdr5Record record, int lblOff, java.lang.String name, int strOff)
           
 void finishCities()
          Called after all cities to sort and number them.
 int getExtraValue()
          Known structure: bits 0-1: size of local city index - 1 (all values appear to work) bits 2-3: size of label offset (only 0 and 3 appear to work) bit 4 does not appear to have any effect
 int getItemSize()
          Base size of 8, plus enough bytes to represent the map number and the city number.
 int getNumberOfItems()
          The number of records in this section.
 int getPointerSize()
          Get the size of an integer that is sufficient to store a record number from this section.
 void writeSectData(ImgFileWriter writer)
          Write out the contents of this section.
 
Methods inherited from class uk.me.parabola.imgfmt.app.mdr.MdrMapSection
addIndexPointer, init, putCityIndex, putPoiIndex, putRegionIndex, setMapIndex
 
Methods inherited from class uk.me.parabola.imgfmt.app.mdr.MdrSection
getSizes, numberToPointerSize, putMapIndex, putN, putStringOffset, setSizes
 
Methods inherited from class uk.me.parabola.imgfmt.app.mdr.ConfigBase
getConfig, isForDevice, setConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mdr5

public Mdr5(MdrConfig config)
Method Detail

addCity

public void addCity(int mapIndex,
                    Mdr5Record record,
                    int lblOff,
                    java.lang.String name,
                    int strOff)

finishCities

public void finishCities()
Called after all cities to sort and number them.


writeSectData

public void writeSectData(ImgFileWriter writer)
Description copied from class: MdrSection
Write out the contents of this section.

Specified by:
writeSectData in class MdrSection
Parameters:
writer - Where to write it.

getItemSize

public int getItemSize()
Base size of 8, plus enough bytes to represent the map number and the city number.

Specified by:
getItemSize in class MdrSection
Returns:
The size of a record in this section.

getNumberOfItems

public int getNumberOfItems()
Description copied from class: MdrMapSection
The number of records in this section.

Specified by:
getNumberOfItems in class MdrMapSection
Returns:
The number of items in the section.

getPointerSize

public int getPointerSize()
Get the size of an integer that is sufficient to store a record number from this section.

Specified by:
getPointerSize in class MdrMapSection
Returns:
A number between 1 and 4 giving the number of bytes required to store the largest record number in this section.

getExtraValue

public int getExtraValue()
Known structure: bits 0-1: size of local city index - 1 (all values appear to work) bits 2-3: size of label offset (only 0 and 3 appear to work) bit 4 does not appear to have any effect

Specified by:
getExtraValue in class MdrMapSection
Returns:
The value to be placed in the header.