org.flexgen.map
Class MapGenerator

java.lang.Object
  extended by org.flexgen.map.MapGenerator

public class MapGenerator
extends java.lang.Object

Class containing logic for randomly generating a map using a specified set of map tile types.


Constructor Summary
MapGenerator(ImprovedRandom improvedRandom, MapTileType[] mapTileTypes, int minX, int minY, int maxX, int maxY)
          Construct a map generator.
 
Method Summary
 void addMapTile(MapTileLocation mapTileLocation, MapTile mapTile)
          Add a map tile to the map at the specified location.
 void addMapTileAddedListener(MapTileAddedListener mapTileAddedListener)
          Add a new listener for the event of adding a map tile to the map.
 void generate()
          Generate the map.
 MapTile getMapTile(MapTileLocation mapTileLocation)
          Get the map tile at a specified location.
 int getMaxX()
          Get the largest possible X coordinate for map tiles in the map.
 int getMaxY()
          Get the largest possible Y coordinate for map tiles in the map.
 int getMinX()
          Get the smallest possible X coordinate for map tiles in the map.
 int getMinY()
          Get the smallest possible Y coordinate for map tiles in the map.
 int getTileSize()
          Get the size of the map unit array that defines the map tile types used by this map generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapGenerator

public MapGenerator(ImprovedRandom improvedRandom,
                    MapTileType[] mapTileTypes,
                    int minX,
                    int minY,
                    int maxX,
                    int maxY)
Construct a map generator.

Parameters:
improvedRandom - Random number generator to use for generating the map. Cannot be null.
mapTileTypes - Array of map tile types that define the available map tile types for randomly generating the map. Cannot be null. Must contain at least one element. No element can be null. Cannot contain two or more elements that are identical. All map tile types in the array must be the same size.
minX - Smallest possible X coordinate for map tiles in the map.
minY - Smallest possible Y coordinate for map tiles in the map.
maxX - Largest possible X coordinate for map tiles in the map. Must be greater than or equal to minX.
maxY - Largest possible Y coordinate for map tiles in the map. Must be greater than or equal to minY.
Method Detail

getTileSize

public int getTileSize()
Get the size of the map unit array that defines the map tile types used by this map generator.

Returns:
The size of the map unit array that defines the map tile types used by this map generator.

getMinX

public int getMinX()
Get the smallest possible X coordinate for map tiles in the map.

Returns:
The smallest possible X coordinate for map tiles in the map.

getMinY

public int getMinY()
Get the smallest possible Y coordinate for map tiles in the map.

Returns:
The smallest possible Y coordinate for map tiles in the map.

getMaxX

public int getMaxX()
Get the largest possible X coordinate for map tiles in the map.

Returns:
The largest possible X coordinate for map tiles in the map.

getMaxY

public int getMaxY()
Get the largest possible Y coordinate for map tiles in the map.

Returns:
The largest possible Y coordinate for map tiles in the map.

addMapTileAddedListener

public void addMapTileAddedListener(MapTileAddedListener mapTileAddedListener)
Add a new listener for the event of adding a map tile to the map.

Parameters:
mapTileAddedListener - The listener to add.

getMapTile

public MapTile getMapTile(MapTileLocation mapTileLocation)
Get the map tile at a specified location.

Parameters:
mapTileLocation - Location for which to get the map tile.
Returns:
The map tile at a specified location.

addMapTile

public void addMapTile(MapTileLocation mapTileLocation,
                       MapTile mapTile)
Add a map tile to the map at the specified location.

Parameters:
mapTileLocation - Location at which to add the map tile.
mapTile - Map tile to add.

generate

public void generate()
Generate the map.



FlexGen Home

Get FlexGen at SourceForge.net. Fast, secure and Free Open Source software downloads

Copyright © 2009 - Jeffrey J. Weston <jjweston@gmail.com>

All rights reserved. Use is subject to license terms.