Package worldBuilder
Class Map
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- worldBuilder.Map
-
- All Implemented Interfaces:
java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
public class Map extends javax.swing.JPanel implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
the displayable, resizeable, 2D representation of a mesh and the attributes of its points.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Map.Selection
selection types: points, line, rectangle, ...
-
Field Summary
Fields Modifier and Type Field Description Drainage
drainage
java.awt.Color[]
faunaColors
java.lang.String[]
faunaNames
java.awt.Color[]
floraColors
java.lang.String[]
floraNames
java.awt.image.BufferedImage[]
iconImages
boolean
isSubRegion
current map is a subRegion of a larger mapdouble
max_deposition
results of hydrological computationdouble
max_erosion
results of hydrological computationdouble
max_flux
results of hydrological computationdouble
max_height
results of hydrological computationdouble
max_rain
rainfalldouble
max_slope
results of hydrological computationdouble
max_velocity
results of hydrological computationMesh
mesh
underlying Mesh of Voronoi pointsdouble
min_flux
results of hydrological computationdouble
min_height
results of hydrological computationdouble
min_rain
rainfalldouble
min_slope
results of hydrological computationdouble
min_velocity
results of hydrological computationjava.awt.Color[]
rockColors
java.lang.String[]
rockNames
static int
SHOW_ALL
options for enabled display typesstatic int
SHOW_CITY
options for enabled display typesstatic int
SHOW_ERODE
options for enabled display typesstatic int
SHOW_FAUNA
options for enabled display typesstatic int
SHOW_FLORA
options for enabled display typesstatic int
SHOW_MESH
options for enabled display typesstatic int
SHOW_POINTS
options for enabled display typesstatic int
SHOW_RAIN
options for enabled display typesstatic int
SHOW_ROCKS
options for enabled display typesstatic int
SHOW_TOPO
options for enabled display typesstatic int
SHOW_WATER
options for enabled display typesWaterFlow
waterflow
-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description Map(int width, int height)
instantiate a displayable map widget
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMapListener(MapListener interested)
register a listener for selection eventsvoid
addName(java.lang.String name, double x, double y)
assoicate a name with the MeshPoint nearestvoid
addPOI(POI point)
add a POIboolean
checkSelection(Map.Selection type)
see if a selection has already been made and call listenerMeshPoint
choosePoint(int screen_x, int screen_y)
find the mesh point closest to a screen locationCartesian
getCartesian(Cartesian.vicinity type)
return MeshPoint to Cartesian translation matrix param type (NEIGBORS, POLOGYON, NEAREST)Drainage
getDrainage()
return reference to the Drainage calculatordouble[]
getErodeMap()
return array of net erosion/deposition at each mesh pointjava.awt.Color[]
getFaunaColors()
return map from flora types into preview colorsdouble[]
getFaunaMap()
return map of flora types for the current meshjava.lang.String[]
getFaunaNames()
return ID-> mineral name mapint
getFaunaType(java.lang.String name)
return type ID of a specified flora typejava.awt.Color[]
getFloraColors()
return map from flora types into preview colorsdouble[]
getFloraMap()
return map of flora types for the current meshint
getFloraType(java.lang.String name)
return type ID of a specified flora typedouble[]
getFluxMap()
return array of water flow through each mesh pointdouble[]
getHeightMap()
return heightmap (pre-erosion Z values) for the current meshdouble[]
getIncoming()
return incoming off-map riversMesh
getMesh()
return the Mesh underlying the current mapjava.awt.Dimension
getMinimumSize()
return minimum acceptable canvas sizejava.lang.String[]
getNameMap()
return the list of per-point names/descriptionsjava.util.LinkedList<POI>
getPOI()
return the list of Points of Interestjava.awt.Dimension
getPreferredSize()
return preferred canvas sizedouble[]
getRainMap()
return rainMap (cm of rainfall) for the current meshjava.awt.Color[]
getRockColors()
return ID-> mineral preview color mapjava.lang.String[]
getRockNames()
return ID-> mineral name mapdouble
getSeaLevel()
return the current sea level Z-valuedouble[]
getSoilMap()
return map of soil type for the current meshint
getSoilType(java.lang.String name)
return type ID of a specified mineral/soil namedouble[][]
getTileDepths()
return reference to the per-tile depths (in meters)double[][]
getTileHeights()
return reference to the per-tile heights (not valid until paint)double[]
getWaterLevel()
return array of nearest water level to each mesh pointvoid
highlight(double x, double y)
highlight non-mesh pointvoid
highlight(int point, java.awt.Color c)
highlight points (typically for diagnostic purposesboolean
inTheBox(double x, double y)
return whether or not Map coordinates are within a selected boxstatic double
linear(int min, int max, double value)
linear interpolation of a (color) value within a rangestatic double
logarithmic(int min, int max, double value, double base)
logarithmic interpolation of a (color) value within a rangeint
map_col(double x)
return the Cartesian Map column for a Map Y coordinatedouble
map_height(int y_pixels)
return height (in map units) of a number of pixelsint
map_row(double y)
return the Cartesian Map column for a Map Y coordinatedouble
map_width(int x_pixels)
return width (in map units) of a number of pixelsdouble
map_x(int screen_x)
return map (-0.5 to 0.5) x position for a screen columndouble
map_y(int screen_y)
return map (-0.5 to 0.5) y position for a screen rowvoid
mouseClicked(java.awt.event.MouseEvent e)
mouse click at an on-map locationvoid
mouseDragged(java.awt.event.MouseEvent e)
extend/alter the region being selectedvoid
mouseEntered(java.awt.event.MouseEvent e)
(perfunctory)void
mouseExited(java.awt.event.MouseEvent e)
(perfunctory)void
mouseMoved(java.awt.event.MouseEvent e)
(perfunctory)void
mousePressed(java.awt.event.MouseEvent e)
start the definition of region selectionvoid
mouseReleased(java.awt.event.MouseEvent e)
end the definition of a region selectionboolean
on_screen(double x, double y)
is a map position within the current display windowvoid
paintComponent(java.awt.Graphics g)
repaint the entire displayed map panejava.lang.String
pointName(int point)
return a descriptive name string for a chosen pointvoid
read(java.lang.String filename)
read a saved map in from a filevoid
region_stats()
summarize the world topography and hydrologyvoid
removeMapListener(MapListener which)
un-register a selection event listenerint
screen_x(double x)
return pixel column for a given map x positionint
screen_y(double y)
return pixel row for a given map y positionvoid
selectLine(int x0, int y0, int x1, int y1)
highlight a line on the displayed mapvoid
selectMode(Map.Selection type)
tell map-selection tool what kind of selection we expectvoid
selectPoints(int x0, int y0, int x1, int y1, boolean add)
highlight points in rectangular selection on the displayed mapvoid
selectRect(int x0, int y0, int x1, int y1)
highlight a rectangular selection on the displayed mapint
setDisplay(int view, boolean on)
enable/disable display elementsvoid
setFaunaColors(java.awt.Color[] newColors)
update the mapping from flora types to preview colorsdouble[]
setFaunaMap(double[] newFauna)
update the flora map for the current meshvoid
setFaunaNames(java.lang.String[] newNames)
update the mapping from flora types to namesvoid
setFloraColors(java.awt.Color[] newColors)
update the mapping from flora types to preview colorsdouble[]
setFloraMap(double[] newFlora)
update the flora map for the current meshvoid
setFloraNames(java.lang.String[] newNames)
update the mapping from flora types to namesdouble[]
setHeightMap(double[] newHeight)
update the height map for the current mesth * @param newHeight new set of Z valuesvoid
setIncoming(double[] new_map)
update the water-flow after a change to the incoming arterial rivervoid
setMesh(Mesh mesh)
create a map around a new Meshdouble[]
setRainMap(double[] newRain)
update the rainfall map for the current mesthvoid
setRockColors(java.awt.Color[] newColors)
update the mapping from rock types to preview colorsvoid
setRockNames(java.lang.String[] newNames)
update the mapping from mineral types to namesvoid
setSeaLevel(double z_value)
record a change in sea leveldouble[]
setSoilMap(double[] newSoil)
update the soil map for the current meshvoid
setWindow(double x0, double y0, double x1, double y1)
void
subregion(int numpoints)
create a new sub-region mapjava.util.LinkedList<TradeRoute>
tradeRoutes()
return list of trade routesvoid
tradeRoutes(java.util.LinkedList<TradeRoute> routes)
set the list of trade routesboolean
write(java.lang.String filename)
write a mesh of MapPoints out to a file-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
SHOW_ALL
public static final int SHOW_ALL
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_POINTS
public static final int SHOW_POINTS
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_MESH
public static final int SHOW_MESH
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_TOPO
public static final int SHOW_TOPO
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_RAIN
public static final int SHOW_RAIN
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_WATER
public static final int SHOW_WATER
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_ERODE
public static final int SHOW_ERODE
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_ROCKS
public static final int SHOW_ROCKS
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_FLORA
public static final int SHOW_FLORA
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_FAUNA
public static final int SHOW_FAUNA
options for enabled display types- See Also:
- Constant Field Values
-
SHOW_CITY
public static final int SHOW_CITY
options for enabled display types- See Also:
- Constant Field Values
-
isSubRegion
public boolean isSubRegion
current map is a subRegion of a larger map
-
mesh
public Mesh mesh
underlying Mesh of Voronoi points
-
drainage
public Drainage drainage
-
waterflow
public WaterFlow waterflow
-
floraColors
public java.awt.Color[] floraColors
-
rockColors
public java.awt.Color[] rockColors
-
faunaColors
public java.awt.Color[] faunaColors
-
floraNames
public java.lang.String[] floraNames
-
rockNames
public java.lang.String[] rockNames
-
faunaNames
public java.lang.String[] faunaNames
-
max_height
public double max_height
results of hydrological computation
-
min_height
public double min_height
results of hydrological computation
-
min_slope
public double min_slope
results of hydrological computation
-
max_slope
public double max_slope
results of hydrological computation
-
min_flux
public double min_flux
results of hydrological computation
-
max_flux
public double max_flux
results of hydrological computation
-
min_velocity
public double min_velocity
results of hydrological computation
-
max_velocity
public double max_velocity
results of hydrological computation
-
max_erosion
public double max_erosion
results of hydrological computation
-
max_deposition
public double max_deposition
results of hydrological computation
-
min_rain
public double min_rain
rainfall
-
max_rain
public double max_rain
rainfall
-
iconImages
public java.awt.image.BufferedImage[] iconImages
-
-
Method Detail
-
subregion
public void subregion(int numpoints)
create a new sub-region map- Parameters:
numpoints
- ... number of desired points in new Mesh
-
read
public void read(java.lang.String filename)
read a saved map in from a file- Parameters:
filename
- - of input file
-
region_stats
public void region_stats()
summarize the world topography and hydrology
-
write
public boolean write(java.lang.String filename)
write a mesh of MapPoints out to a file- Parameters:
filename
- - of the file to be (re)written
-
getMesh
public Mesh getMesh()
return the Mesh underlying the current map
-
setMesh
public void setMesh(Mesh mesh)
create a map around a new Mesh- Parameters:
mesh
- to be used
-
getHeightMap
public double[] getHeightMap()
return heightmap (pre-erosion Z values) for the current mesh
-
setHeightMap
public double[] setHeightMap(double[] newHeight)
update the height map for the current mesth * @param newHeight new set of Z values
-
getRainMap
public double[] getRainMap()
return rainMap (cm of rainfall) for the current mesh
-
setRainMap
public double[] setRainMap(double[] newRain)
update the rainfall map for the current mesth- Parameters:
newRain
- new set of rainfall values
-
setSeaLevel
public void setSeaLevel(double z_value)
record a change in sea level- Parameters:
z_value
- new sea level
-
getSeaLevel
public double getSeaLevel()
return the current sea level Z-value
-
setIncoming
public void setIncoming(double[] new_map)
update the water-flow after a change to the incoming arterial river- Parameters:
new_map
- new incoming flux per point
-
getIncoming
public double[] getIncoming()
return incoming off-map rivers
-
getSoilMap
public double[] getSoilMap()
return map of soil type for the current mesh
-
setSoilMap
public double[] setSoilMap(double[] newSoil)
update the soil map for the current mesh- Parameters:
newSoil
- new set of soil types
-
getSoilType
public int getSoilType(java.lang.String name)
return type ID of a specified mineral/soil name
-
getRockColors
public java.awt.Color[] getRockColors()
return ID-> mineral preview color map
-
getRockNames
public java.lang.String[] getRockNames()
return ID-> mineral name map
-
setRockColors
public void setRockColors(java.awt.Color[] newColors)
update the mapping from rock types to preview colors- Parameters:
newColors
-
-
setRockNames
public void setRockNames(java.lang.String[] newNames)
update the mapping from mineral types to names- Parameters:
newNames
-
-
getFloraMap
public double[] getFloraMap()
return map of flora types for the current mesh
-
setFloraMap
public double[] setFloraMap(double[] newFlora)
update the flora map for the current mesh- Parameters:
newFlora
- new set of flora types- Returns:
- previous flora map
-
getFloraType
public int getFloraType(java.lang.String name)
return type ID of a specified flora type
-
setFloraColors
public void setFloraColors(java.awt.Color[] newColors)
update the mapping from flora types to preview colors- Parameters:
newColors
-
-
setFloraNames
public void setFloraNames(java.lang.String[] newNames)
update the mapping from flora types to names- Parameters:
newNames
-
-
setFaunaMap
public double[] setFaunaMap(double[] newFauna)
update the flora map for the current mesh- Parameters:
newFlora
- new set of flora types- Returns:
- previous flora map
-
getFaunaMap
public double[] getFaunaMap()
return map of flora types for the current mesh
-
getFaunaNames
public java.lang.String[] getFaunaNames()
return ID-> mineral name map
-
getFaunaType
public int getFaunaType(java.lang.String name)
return type ID of a specified flora type
-
setFaunaColors
public void setFaunaColors(java.awt.Color[] newColors)
update the mapping from flora types to preview colors- Parameters:
newColors
-
-
setFaunaNames
public void setFaunaNames(java.lang.String[] newNames)
update the mapping from flora types to names- Parameters:
newNames
-
-
getNameMap
public java.lang.String[] getNameMap()
return the list of per-point names/descriptions
-
pointName
public java.lang.String pointName(int point)
return a descriptive name string for a chosen point
-
tradeRoutes
public java.util.LinkedList<TradeRoute> tradeRoutes()
return list of trade routes
-
tradeRoutes
public void tradeRoutes(java.util.LinkedList<TradeRoute> routes)
set the list of trade routes
-
addName
public void addName(java.lang.String name, double x, double y)
assoicate a name with the MeshPoint nearest- Parameters:
name
- new name stringx
- (map) x coordinatey
- (map) y coordinate
-
getPOI
public java.util.LinkedList<POI> getPOI()
return the list of Points of Interest
-
addPOI
public void addPOI(POI point)
add a POI- Parameters:
point
- new POI to be added
-
getFluxMap
public double[] getFluxMap()
return array of water flow through each mesh point
-
getErodeMap
public double[] getErodeMap()
return array of net erosion/deposition at each mesh point
-
getWaterLevel
public double[] getWaterLevel()
return array of nearest water level to each mesh point
-
getFloraColors
public java.awt.Color[] getFloraColors()
return map from flora types into preview colors
-
getFaunaColors
public java.awt.Color[] getFaunaColors()
return map from flora types into preview colors
-
getDrainage
public Drainage getDrainage()
return reference to the Drainage calculator
-
getTileHeights
public double[][] getTileHeights()
return reference to the per-tile heights (not valid until paint)
-
getTileDepths
public double[][] getTileDepths()
return reference to the per-tile depths (in meters)
-
getCartesian
public Cartesian getCartesian(Cartesian.vicinity type)
return MeshPoint to Cartesian translation matrix param type (NEIGBORS, POLOGYON, NEAREST)
-
setDisplay
public int setDisplay(int view, boolean on)
enable/disable display elements- Parameters:
view
- to be enabled/disabledon
- ... should this be enabled or disabled- Returns:
- current sense of that view
-
map_x
public double map_x(int screen_x)
return map (-0.5 to 0.5) x position for a screen column
-
map_y
public double map_y(int screen_y)
return map (-0.5 to 0.5) y position for a screen row
-
map_width
public double map_width(int x_pixels)
return width (in map units) of a number of pixels
-
map_height
public double map_height(int y_pixels)
return height (in map units) of a number of pixels
-
map_col
public int map_col(double x)
return the Cartesian Map column for a Map Y coordinate
-
map_row
public int map_row(double y)
return the Cartesian Map column for a Map Y coordinate
-
screen_x
public int screen_x(double x)
return pixel column for a given map x position
-
screen_y
public int screen_y(double y)
return pixel row for a given map y position
-
on_screen
public boolean on_screen(double x, double y)
is a map position within the current display window- Parameters:
x
- coordinate (e.g. -0.5 to 0.5)y
- coordinate (e.g. -0.5 to 0.5)- Returns:
- boolean ... are those coordinates in the display window
-
addMapListener
public void addMapListener(MapListener interested)
register a listener for selection events- Parameters:
interested
- class to receive call-backs
-
removeMapListener
public void removeMapListener(MapListener which)
un-register a selection event listener- Parameters:
which
- class to be removed
-
selectMode
public void selectMode(Map.Selection type)
tell map-selection tool what kind of selection we expect- Parameters:
type
- (RECTANGLE, POINT, LINE, ...)
-
checkSelection
public boolean checkSelection(Map.Selection type)
see if a selection has already been made and call listener- Parameters:
type
- desired type of selection- Returns:
- boolean whether or not selection is in place
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
mouse click at an on-map location- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
start the definition of region selection- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
extend/alter the region being selected- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
end the definition of a region selection- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
(perfunctory)- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
(perfunctory)- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
(perfunctory)- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
selectLine
public void selectLine(int x0, int y0, int x1, int y1)
highlight a line on the displayed map- Parameters:
x0
- screen xy0
- screen yx1
- screen xy1
- screen y
-
selectRect
public void selectRect(int x0, int y0, int x1, int y1)
highlight a rectangular selection on the displayed map- Parameters:
x0
- screen xy0
- screen yx1
- screen xy1
- screen y
-
selectPoints
public void selectPoints(int x0, int y0, int x1, int y1, boolean add)
highlight points in rectangular selection on the displayed map- Parameters:
x0
- screen xy0
- screen yx1
- screen xy1
- screen yadd
- add these to already selected points
-
inTheBox
public boolean inTheBox(double x, double y)
return whether or not Map coordinates are within a selected box
-
highlight
public void highlight(int point, java.awt.Color c)
highlight points (typically for diagnostic purposes- Parameters:
point
- number (-1 = reset)c
- Color for highlighing
-
highlight
public void highlight(double x, double y)
highlight non-mesh point- Parameters:
x
- - map X coordinatey
- - map Y coordinatec
- - color for highlighting
-
choosePoint
public MeshPoint choosePoint(int screen_x, int screen_y)
find the mesh point closest to a screen location- Parameters:
screen_x
-screen_y
-- Returns:
- nearest MeshPoint
-
setWindow
public void setWindow(double x0, double y0, double x1, double y1)
-
paintComponent
public void paintComponent(java.awt.Graphics g)
repaint the entire displayed map pane- Parameters:
g
- - Graphics component (pane) for displayed map Note: order of painting is carefully chosen to enable layering of some things atop others
-
linear
public static double linear(int min, int max, double value)
linear interpolation of a (color) value within a range- Parameters:
min
- value in desired rangemax
- value in desired rangevalue
- (0.0-1.0) to be scaled # @return interpolated value between min and max
-
logarithmic
public static double logarithmic(int min, int max, double value, double base)
logarithmic interpolation of a (color) value within a range- Parameters:
min
- value in desired rangemax
- value in desired rangevalue
- (0.0-1.0) to be scaledbase
- - fraction of value corresponding to half of range # @return interpolated value between min and max
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
return minimum acceptable canvas size- Overrides:
getMinimumSize
in classjavax.swing.JComponent
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
return preferred canvas size- Overrides:
getPreferredSize
in classjavax.swing.JComponent
-
-