net.sf.freecol.server.generator
Class MapGeneratorOptions

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption
          extended by net.sf.freecol.common.option.OptionGroup
              extended by net.sf.freecol.common.option.OptionMap
                  extended by net.sf.freecol.server.generator.MapGeneratorOptions
All Implemented Interfaces:
Option

public class MapGeneratorOptions
extends OptionMap

Keeps track of the available map generator options.

New options should be added to addDefaultOptions() and each option should be given an unique identifier (defined as a constant in this class).

See Also:
MapGenerator

Field Summary
static java.lang.String BONUS_NUMBER
          Option for setting the percentage of bonus tiles on the map.
static java.lang.String FOREST_NUMBER
          Option for setting the percentage of forests on the map.
static java.lang.String HUMIDITY
          Option for setting the humidity of the map.
static java.lang.String IMPORT_BONUSES
          Option for using the bonuses imported from a file.
static java.lang.String IMPORT_FILE
          Option for setting a file to be imported (map etc).
static java.lang.String IMPORT_RUMOURS
          Option for using the lost city rumours imported from a file.
static java.lang.String IMPORT_SETTLEMENTS
          Option for using the settlements imported from a file.
static java.lang.String IMPORT_TERRAIN
          Option for using the terrain imported from a file.
static int LAND_GEN_ARCHIPELAGO
           
static int LAND_GEN_CLASSIC
           
static int LAND_GEN_CONTINENT
           
static int LAND_GEN_ISLANDS
           
static java.lang.String LAND_GEN_TYPE
          Option for setting the type of land generator to be used.
static java.lang.String LAND_MASS
          Option for setting the land mass of the map.
static java.lang.String MAP_SIZE
          Option for setting the size of the map.
static int MAP_SIZE_HUGE
          One of the settings used by MAP_SIZE.
static int MAP_SIZE_LARGE
          One of the settings used by MAP_SIZE.
static int MAP_SIZE_MEDIUM
          One of the settings used by MAP_SIZE.
static int MAP_SIZE_SMALL
          One of the settings used by MAP_SIZE.
static int MAP_SIZE_VERY_LARGE
          One of the settings used by MAP_SIZE.
static java.lang.String MOUNTAIN_NUMBER
          Option for setting the number of mountains on the map.
static java.lang.String RIVER_NUMBER
          Option for setting the number of rivers on the map.
static java.lang.String RUMOUR_NUMBER
          Option for setting the number of rumours on the map.
static java.lang.String SETTLEMENT_NUMBER
          Option for setting the number of settlements on the map.
static java.lang.String TEMPERATURE
          Option for setting the temperature of the map.
static int TEMPERATURE_CHILLY
          One of the settings used by TEMPERATURE.
static int TEMPERATURE_COLD
          One of the settings used by TEMPERATURE.
static int TEMPERATURE_HOT
          One of the settings used by TEMPERATURE.
static int TEMPERATURE_TEMPERATE
          One of the settings used by TEMPERATURE.
static int TEMPERATURE_WARM
          One of the settings used by TEMPERATURE.
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
NO_ID
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
MapGeneratorOptions()
          Creates a new MapGeneratorOptions.
MapGeneratorOptions(org.w3c.dom.Element element)
          Creates a MapGeneratorOptions from an XML representation.
MapGeneratorOptions(javax.xml.stream.XMLStreamReader in)
          Creates a MapGeneratorOptions from an XML representation.
 
Method Summary
 int getDistLandHighSea()
          Gets the width of "short sea" of the map to be created.
 int getHeight()
          Gets the height of the map to be created.
static int getHeight(int size)
           
 int getHumidity()
          Gets the average humidity of the map.
 int getLand()
          Gets the approximate number of land tiles to be created.
 int getLandGeneratorType()
          Gets the type of land generator to be used.
 int getLandMass()
          Gets the percentage of land of the map to be created.
 int getMaxDistToEdge()
          Gets the maximum allowed distance between edge and possible highSea tile.
 int getNumberOfMountainTiles()
          Gets the number of mountain tiles on the map to be created.
 int getNumberOfRivers()
          Gets the number of rivers on the map to be created.
 int getNumberOfRumours()
          Gets the number of rumours on the map to be created.
 int getNumberOfSettlements()
          Gets the number of settlements on the map to be created.
 int getPercentageOfBonusTiles()
          Gets the percentage of bonus tiles on the map to be created.
 int getPercentageOfForests()
          Gets the percentage of forests on the map to be created.
 int getPrefDistToEdge()
          Gets the preferred distance to edge of the map to be created.
 int getTemperature()
          Gets the average temperature of the map.
 int getWidth()
          Gets the width of the map to be created.
static int getWidth(int size)
           
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 
Methods inherited from class net.sf.freecol.common.option.OptionMap
addToMap, getBoolean, getFile, getInteger, getObject, load, putOption, save, setFile, toXML
 
Methods inherited from class net.sf.freecol.common.option.OptionGroup
add, getName, getShortDescription, iterator, removeAll
 
Methods inherited from class net.sf.freecol.common.option.AbstractOption
getGroup, isPreviewEnabled, setGroup, setPreviewEnabled, toString
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readFromXML, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.option.Option
addPropertyChangeListener, getId, readFromXML, readFromXMLElement, removePropertyChangeListener, toXMLElement
 

Field Detail

MAP_SIZE

public static final java.lang.String MAP_SIZE
Option for setting the size of the map. Possible values are:

MAP_SIZE_SMALL

public static final int MAP_SIZE_SMALL
One of the settings used by MAP_SIZE.

See Also:
Constant Field Values

MAP_SIZE_MEDIUM

public static final int MAP_SIZE_MEDIUM
One of the settings used by MAP_SIZE.

See Also:
Constant Field Values

MAP_SIZE_LARGE

public static final int MAP_SIZE_LARGE
One of the settings used by MAP_SIZE.

See Also:
Constant Field Values

MAP_SIZE_VERY_LARGE

public static final int MAP_SIZE_VERY_LARGE
One of the settings used by MAP_SIZE.

See Also:
Constant Field Values

MAP_SIZE_HUGE

public static final int MAP_SIZE_HUGE
One of the settings used by MAP_SIZE.

See Also:
Constant Field Values

LAND_MASS

public static final java.lang.String LAND_MASS
Option for setting the land mass of the map.

See Also:
Constant Field Values

RIVER_NUMBER

public static final java.lang.String RIVER_NUMBER
Option for setting the number of rivers on the map.

See Also:
Constant Field Values

MOUNTAIN_NUMBER

public static final java.lang.String MOUNTAIN_NUMBER
Option for setting the number of mountains on the map.

See Also:
Constant Field Values

RUMOUR_NUMBER

public static final java.lang.String RUMOUR_NUMBER
Option for setting the number of rumours on the map.

See Also:
Constant Field Values

SETTLEMENT_NUMBER

public static final java.lang.String SETTLEMENT_NUMBER
Option for setting the number of settlements on the map.

See Also:
Constant Field Values

FOREST_NUMBER

public static final java.lang.String FOREST_NUMBER
Option for setting the percentage of forests on the map.

See Also:
Constant Field Values

BONUS_NUMBER

public static final java.lang.String BONUS_NUMBER
Option for setting the percentage of bonus tiles on the map.

See Also:
Constant Field Values

HUMIDITY

public static final java.lang.String HUMIDITY
Option for setting the humidity of the map.

See Also:
Constant Field Values

TEMPERATURE

public static final java.lang.String TEMPERATURE
Option for setting the temperature of the map.

See Also:
Constant Field Values

TEMPERATURE_COLD

public static final int TEMPERATURE_COLD
One of the settings used by TEMPERATURE.

See Also:
Constant Field Values

TEMPERATURE_CHILLY

public static final int TEMPERATURE_CHILLY
One of the settings used by TEMPERATURE.

See Also:
Constant Field Values

TEMPERATURE_TEMPERATE

public static final int TEMPERATURE_TEMPERATE
One of the settings used by TEMPERATURE.

See Also:
Constant Field Values

TEMPERATURE_WARM

public static final int TEMPERATURE_WARM
One of the settings used by TEMPERATURE.

See Also:
Constant Field Values

TEMPERATURE_HOT

public static final int TEMPERATURE_HOT
One of the settings used by TEMPERATURE.

See Also:
Constant Field Values

IMPORT_FILE

public static final java.lang.String IMPORT_FILE
Option for setting a file to be imported (map etc).

See Also:
Constant Field Values

IMPORT_TERRAIN

public static final java.lang.String IMPORT_TERRAIN
Option for using the terrain imported from a file.

See Also:
Constant Field Values

IMPORT_BONUSES

public static final java.lang.String IMPORT_BONUSES
Option for using the bonuses imported from a file.

See Also:
Constant Field Values

IMPORT_RUMOURS

public static final java.lang.String IMPORT_RUMOURS
Option for using the lost city rumours imported from a file.

See Also:
Constant Field Values

IMPORT_SETTLEMENTS

public static final java.lang.String IMPORT_SETTLEMENTS
Option for using the settlements imported from a file.

See Also:
Constant Field Values

LAND_GEN_TYPE

public static final java.lang.String LAND_GEN_TYPE
Option for setting the type of land generator to be used.

See Also:
Constant Field Values

LAND_GEN_CLASSIC

public static final int LAND_GEN_CLASSIC
See Also:
Constant Field Values

LAND_GEN_CONTINENT

public static final int LAND_GEN_CONTINENT
See Also:
Constant Field Values

LAND_GEN_ARCHIPELAGO

public static final int LAND_GEN_ARCHIPELAGO
See Also:
Constant Field Values

LAND_GEN_ISLANDS

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

MapGeneratorOptions

public MapGeneratorOptions()
Creates a new MapGeneratorOptions.


MapGeneratorOptions

public MapGeneratorOptions(org.w3c.dom.Element element)
Creates a MapGeneratorOptions from an XML representation.

Parameters:
element - The XML Element from which this object should be constructed.

MapGeneratorOptions

public MapGeneratorOptions(javax.xml.stream.XMLStreamReader in)
                    throws javax.xml.stream.XMLStreamException
Creates a MapGeneratorOptions from an XML representation.

Parameters:
in - The XML stream to read the data from.
Throws:
javax.xml.stream.XMLStreamException - if an error occurred during parsing.
Method Detail

getWidth

public int getWidth()
Gets the width of the map to be created.

Returns:
The width of the map.

getWidth

public static int getWidth(int size)

getHeight

public int getHeight()
Gets the height of the map to be created.

Returns:
The height of the map.

getHeight

public static int getHeight(int size)

getLandMass

public int getLandMass()
Gets the percentage of land of the map to be created.

Returns:
The percentage of land.

getLand

public int getLand()
Gets the approximate number of land tiles to be created.

Returns:
The approximate number of land tiles.

getLandGeneratorType

public int getLandGeneratorType()
Gets the type of land generator to be used.

Returns:
The value of the land generator.

getNumberOfRivers

public int getNumberOfRivers()
Gets the number of rivers on the map to be created.

Returns:
The number of rivers.

getNumberOfMountainTiles

public int getNumberOfMountainTiles()
Gets the number of mountain tiles on the map to be created.

Returns:
The number of mountain tiles.

getNumberOfRumours

public int getNumberOfRumours()
Gets the number of rumours on the map to be created.

Returns:
The number of rumours.

getNumberOfSettlements

public int getNumberOfSettlements()
Gets the number of settlements on the map to be created.

Returns:
The number of settlements.

getPercentageOfForests

public int getPercentageOfForests()
Gets the percentage of forests on the map to be created.

Returns:
The percentage of forests.

getPercentageOfBonusTiles

public int getPercentageOfBonusTiles()
Gets the percentage of bonus tiles on the map to be created.

Returns:
The percentage of bonus tiles.

getDistLandHighSea

public int getDistLandHighSea()
Gets the width of "short sea" of the map to be created.

Returns:
The distance to land from high seas.

getMaxDistToEdge

public int getMaxDistToEdge()
Gets the maximum allowed distance between edge and possible highSea tile.

Returns:
The maximum distance to edge.

getPrefDistToEdge

public int getPrefDistToEdge()
Gets the preferred distance to edge of the map to be created. This should always be higher than the value returned by #getDistLandHighSea(), to avoid having non-highSea on the map edge.

Returns:
The preferred distance to edge.

getHumidity

public int getHumidity()
Gets the average humidity of the map.

Returns:
The humidity.

getTemperature

public int getTemperature()
Gets the average temperature of the map.

Returns:
The temperature.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"mapGeneratorOptions".