tempusmud.carto.map
Class CartoMap

java.lang.Object
  |
  +--tempusmud.carto.map.RoomConstants
        |
        +--tempusmud.carto.map.CartoMap

public final class CartoMap
extends RoomConstants
implements java.io.Serializable

The cartograph Map

See Also:
Serialized Form

Inner Class Summary
(package private) static class CartoMap.AStarNode
          AStarNode used for buildPath.
 
Field Summary
static long serialVersionUID
          force serialazation compatibility
 
Fields inherited from class tempusmud.carto.map.RoomConstants
dirs, doorFlags, flowTypes, roomFlags, sectorColors, sectorTypes
 
Constructor Summary
protected CartoMap()
          no-arg constructor for serialization
  CartoMap(java.lang.String name, int vnum, int x, int y)
          constructor
 
Method Summary
 void addMapListener(CartoMapListener l)
          register a listener for map (change) events
 boolean addRoom(Room room)
          add a room
(package private)  void addVertexElements(java.util.Vector v)
          add some vertexes to the map matrix.
 java.util.Vector buildPath(java.awt.Point srcPoint, java.awt.Point dstPoint, int srcDir, int dstDir)
          A-Star path building implementation.
 void clearLabels()
           
 MapElement elementAt(int x, int y)
          get the element at
 MapElement elementAt(java.awt.Point p)
          get the element at
 boolean exportMudCommands(java.lang.String fname)
          dump a file full of tempus OLC commands into the file named by fname
 java.lang.String getName()
          get the name of the map
 Exit getSelectedExit()
          get the currently selected exit
 Room getSelectedRoom()
          get the currently selected room
 java.awt.Rectangle getSize()
          get the map-coordinate-space rectangle that represents the size of the map
 Box getWorkingExtent()
          This returns an unusual rectangle.
 boolean isEdge(java.awt.Point p)
          determines if a given point is outside the map or already occupied by a MapElement
 void issueNotify()
          force a maplistener notification
 void issueNotify(java.awt.Rectangle clip)
          force a maplistener notification
 boolean moveRoom(Room r, java.awt.Point newPos)
          puts an event on the list
static CartoMap open(java.lang.String filename)
          read the map from a file named by filename, using serialization
 void purge()
           
 void removeMapElement(MapElement elem, boolean silent)
           
 void removeMapListener(CartoMapListener l)
          register a listener for map (change) events
 Room[] removeRoom(Room room)
          remove a room
(package private)  void removeVertexElements(java.util.Vector v)
          remove some vertexes from the map matrix.
 Room roomAt(int x, int y)
          obtain the room at
 Room roomAt(java.awt.Point p)
          obtain the room at
(package private)  void roomChanged(Room r)
          a property of the room has changed ( e.g.
 boolean saveAs(java.lang.String filename)
          save the map into a file named by filename, using serialization
 void setSelectedExit(Exit ex)
          puts an event on the list, selects a room if needed
 void setSelectedRoom(Room r)
          puts an event on the list
(package private)  void stretchWorkingExtent(java.awt.Point p)
          stretch the working extent to include p TODO: change working extent to be a standard AWT rectangle!
 
Methods inherited from class tempusmud.carto.map.RoomConstants
, getFlagsString, getIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
force serialazation compatibility
Constructor Detail

CartoMap

protected CartoMap()
no-arg constructor for serialization

CartoMap

public CartoMap(java.lang.String name,
                int vnum,
                int x,
                int y)
constructor
Method Detail

purge

public void purge()

issueNotify

public void issueNotify(java.awt.Rectangle clip)
force a maplistener notification

issueNotify

public void issueNotify()
force a maplistener notification

roomChanged

void roomChanged(Room r)
a property of the room has changed ( e.g. flags, sector type, etc...)

getSelectedRoom

public Room getSelectedRoom()
get the currently selected room

getSelectedExit

public Exit getSelectedExit()
get the currently selected exit

getName

public java.lang.String getName()
get the name of the map

setSelectedRoom

public void setSelectedRoom(Room r)
puts an event on the list

setSelectedExit

public void setSelectedExit(Exit ex)
puts an event on the list, selects a room if needed

moveRoom

public boolean moveRoom(Room r,
                        java.awt.Point newPos)
puts an event on the list

addMapListener

public void addMapListener(CartoMapListener l)
register a listener for map (change) events

removeMapListener

public void removeMapListener(CartoMapListener l)
register a listener for map (change) events

getSize

public final java.awt.Rectangle getSize()
get the map-coordinate-space rectangle that represents the size of the map

getWorkingExtent

public final Box getWorkingExtent()
This returns an unusual rectangle. The width and height values are actual coordinate values, x and y

elementAt

public final MapElement elementAt(java.awt.Point p)
get the element at

elementAt

public final MapElement elementAt(int x,
                                  int y)
get the element at

roomAt

public final Room roomAt(java.awt.Point p)
obtain the room at

roomAt

public final Room roomAt(int x,
                         int y)
obtain the room at

stretchWorkingExtent

final void stretchWorkingExtent(java.awt.Point p)
stretch the working extent to include p TODO: change working extent to be a standard AWT rectangle!

addRoom

public final boolean addRoom(Room room)
add a room

removeRoom

public final Room[] removeRoom(Room room)
remove a room

removeMapElement

public final void removeMapElement(MapElement elem,
                                   boolean silent)

buildPath

public java.util.Vector buildPath(java.awt.Point srcPoint,
                                  java.awt.Point dstPoint,
                                  int srcDir,
                                  int dstDir)
A-Star path building implementation. Typically called from Room.setupLinks()
Parameters:
srcDir - the preferred direction to search FROM the srcPoint
dstDir - the preferred direction to search FROM the dstPoint
Returns:
Vector of Vertex, null if path failed ASSUMPTION: srcPoint and dstPoint are not the same. ASSUMPTION: the path is longer than 0 interior verts
Throws:
java.lang.IllegalArgumentException - if srcPoint and dstPoint are the same

isEdge

public boolean isEdge(java.awt.Point p)
determines if a given point is outside the map or already occupied by a MapElement

clearLabels

public void clearLabels()

saveAs

public boolean saveAs(java.lang.String filename)
save the map into a file named by filename, using serialization

open

public static CartoMap open(java.lang.String filename)
read the map from a file named by filename, using serialization

exportMudCommands

public boolean exportMudCommands(java.lang.String fname)
dump a file full of tempus OLC commands into the file named by fname

addVertexElements

void addVertexElements(java.util.Vector v)
add some vertexes to the map matrix. typically called by Room.setupLinks() the Vector contains the Vertexes corresponding to the begin/end rooms, so skip them.
Parameters:
v - a Vector of Vertex
Throws:
java.lang.IllegalArgumentException -  

removeVertexElements

void removeVertexElements(java.util.Vector v)
remove some vertexes from the map matrix. typically called by Room.setupLinks() the Vector contains the Vertexes corresponding to the begin/end rooms, so skip them.
Parameters:
v - a Vector of Vertex


Last modified: Sun Jan 30, 20:15 EST