dd.util
Class MapMaker

java.lang.Object
  extended bydd.util.MapMaker

public class MapMaker
extends java.lang.Object

A command-line utility for creating maps. This class takes as input text files specifying maps and outputs the XML representation of the map.

Map input file format

Map input lines should contain a map cell coordinate, a layer name, and attributes and can take the following forms:

 (1) <x,y> layerName attributeValue
 (2) <x,y> layerName:attributeName attributeValue  index ... 
 (3) <x,y> layerName v: value v: value ... (unimplemented)
 (4) <x,y> layerName v-v: value v-v: value ... (unimplemented)
 

In all the examples, x, y, and v are integer values.

Form (1) will create a layer and an attribute on that layer with the name of the layer and the value specified. Form (2) will use the name / value pair requested. If indices are present, they are placed in a HashMap for use by placeIcons(). Form (3) takes an arbitrary number of vertex numbers (0 <= v <= 5) and creates a "vertex attribute", meaning something is located at that vertex with the attribute provided. Form (4) is similar, defining an "edge attribute", the edge specified by two vertices provided. Vertex numbering is described in HexView.getVertex(int).

Author:
Eric Scharff

Constructor Summary
MapMaker(java.lang.String inFile, java.lang.String outFile)
          Creates the map utility.
 
Method Summary
 void convert()
          Begins the conversion process.
static void main(java.lang.String[] args)
          Command line support.
 void placeIcons()
          Places map icons for land-use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapMaker

public MapMaker(java.lang.String inFile,
                java.lang.String outFile)
Creates the map utility. Takes an input and an output filename and opens the files.

Parameters:
inFile - input file name
outFile - output file name
Method Detail

convert

public void convert()
Begins the conversion process. The text input file is parsed based on the rules outlined above, and the XML is produced by the standard SimObject XML generation system. The files will be closed when this function returns.


placeIcons

public void placeIcons()
Places map icons for land-use. The land-use layer contains name-value pairs indicating how many units of cell area (each unit is 5%) are taken up by various land uses. There are 19 possible sites (hexagonal number 3) where an icon can be placed. If the value has more than one number, the numbers that follow the total area taken incidate the indices of the land-use placement. This function strips the indices off the value and uses them to set the icon site array. If there are no indices, the function randomly fills the corresponding icon site array (where available) with the names of land uses as given by the values on the land-use layer. (Note that "open space" is not displayed, and each cell has at least 5% open space.)


main

public static void main(java.lang.String[] args)
Command line support. This program expects the input filename (and optionally the output filename). If no output filename is provided, the .map extension is appended to the input filename.

Parameters:
args - command line arguments, input and output file names