org.mars_sim.msp.ui.standard.tool.map
Class NavpointEditLayer

java.lang.Object
  extended by org.mars_sim.msp.ui.standard.tool.map.NavpointEditLayer
All Implemented Interfaces:
MapLayer

public class NavpointEditLayer
extends java.lang.Object
implements MapLayer

A map layer to allow the editing of navpoints.


Constructor Summary
NavpointEditLayer(java.awt.Component displayComponent, boolean drawNavNumbers)
          Constructor
 
Method Summary
 void addNavpointPosition(IntPoint newNavpointPosition)
          Add a new navpoint position.
 void clearNavpointPositions()
          Clear all navpoint positions.
 void clearSelectedNavpoint()
          Clears the selected navpoint if any.
 void displayLayer(Coordinates mapCenter, java.lang.String mapType, java.awt.Graphics g)
          Displays the layer on the map image.
 IntPoint getNavpointPosition(int index)
          Gets a navpoint position at an index.
 int overNavIcon(int x, int y)
          Checks if an x,y position is over a navpoint flag.
 void selectNavpoint(int index)
          Sets a navpoint at an index as selected.
 void setNavpointPosition(int index, IntPoint newNavpointPosition)
          Sets a navpoint position at a given index.
 boolean withinDisplayEdges(IntPoint newNavpointPosition)
          Checks if navpoint position is within the display boundries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavpointEditLayer

public NavpointEditLayer(java.awt.Component displayComponent,
                         boolean drawNavNumbers)
Constructor

Parameters:
displayComponent - the component displaying the map.
drawNavNumbers - display navpoint flag numbers?
Method Detail

addNavpointPosition

public void addNavpointPosition(IntPoint newNavpointPosition)
Add a new navpoint position.

Parameters:
newNavpointPosition - the navpoint position.

clearNavpointPositions

public void clearNavpointPositions()
Clear all navpoint positions.


getNavpointPosition

public IntPoint getNavpointPosition(int index)
Gets a navpoint position at an index.

Parameters:
index - the navpoint position index.
Returns:
null if index isn't valid.

setNavpointPosition

public void setNavpointPosition(int index,
                                IntPoint newNavpointPosition)
Sets a navpoint position at a given index.

Parameters:
index - the index to set the position.
newNavpointPosition - the position to set at the index.

withinDisplayEdges

public boolean withinDisplayEdges(IntPoint newNavpointPosition)
Checks if navpoint position is within the display boundries.

Parameters:
newNavpointPosition - the navpoint position to check.
Returns:
true if within display boundries.

selectNavpoint

public void selectNavpoint(int index)
Sets a navpoint at an index as selected.

Parameters:
index - the index to select.

clearSelectedNavpoint

public void clearSelectedNavpoint()
Clears the selected navpoint if any.


overNavIcon

public int overNavIcon(int x,
                       int y)
Checks if an x,y position is over a navpoint flag.

Parameters:
x - the x position
y - the y position
Returns:
navpoint index the mouse is over or -1 if none.

displayLayer

public void displayLayer(Coordinates mapCenter,
                         java.lang.String mapType,
                         java.awt.Graphics g)
Displays the layer on the map image.

Specified by:
displayLayer in interface MapLayer
Parameters:
mapCenter - the location of the center of the map.
mapType - the type of map.
g - graphics context of the map display.