|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
dods.clients.importwizard.TMAP.map.MapCanvas
public class MapCanvas
Modified to a JLabel class modified by Sheila (zhifang) Jiang
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JLabel |
---|
JLabel.AccessibleJLabel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
MapGrid |
grid
The current grid being used by the map. |
double |
max_img_scaling
The maximum image scaling to be allowed. |
double |
min_img_scaling
The minimum image scaling to be allowed. |
boolean |
pan_down
Flag to indicate movement of the base image is desired. |
boolean |
pan_down_fast
Flag to indicate movement of the base image is desired. |
boolean |
pan_left
Flag to indicate movement of the base image is desired. |
boolean |
pan_left_fast
Flag to indicate movement of the base image is desired. |
boolean |
pan_right
Flag to indicate movement of the base image is desired. |
boolean |
pan_right_fast
Flag to indicate movement of the base image is desired. |
boolean |
pan_up
Flag to indicate movement of the base image is desired. |
boolean |
pan_up_fast
Flag to indicate movement of the base image is desired. |
MapRegion[] |
regionArray
|
boolean |
tool_driven
Flag determining whether scrolling is controlled by the active MapTool or externally by the application programmer. |
MapTool[] |
toolArray
|
double |
zoom_factor
The zoom factor to be applied when using the methods zoom_in() and zoom_out(). |
Fields inherited from class javax.swing.JLabel |
---|
labelFor |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface dods.clients.importwizard.TMAP.map.MapConstants |
---|
DEPTH_AXIS, HEIGHT_AXIS, HI, LATITUDE_AXIS, LO, LONGITUDE_AXIS, MID, PT, SNAP_MID, SNAP_ON, TIME_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MapCanvas(ImageIcon image_icon,
int width,
int height,
MapTool[] toolArray,
MapGrid grid)
Constructs and initializes a MapCanvas with the specified parameters. |
|
MapCanvas(ImageIcon image_icon,
int width,
int height,
MapTool[] toolArray,
MapGrid grid,
int x,
int y,
double scaling)
Constructs and initializes a MapCanvas with the specified parameters. |
Method Summary | |
---|---|
void |
center_tool(double zoom_factor)
|
Image |
get_image()
|
String |
get_internals()
Returns a string with information for initial positioning and and sizing of the base map. |
MapGrid |
getGrid()
|
Dimension |
getMinimumSize()
This method is necessary for layout managers. |
Dimension |
getPreferredSize()
This method is necessary for layout managers. |
int |
getSelected()
|
MapTool |
getTool()
|
MapTool |
getTool(int i)
|
void |
mouseClicked(MouseEvent evt)
|
void |
mouseDragged(MouseEvent evt)
|
void |
mouseEntered(MouseEvent evt)
|
void |
mouseExited(MouseEvent evt)
|
void |
mouseMoved(MouseEvent evt)
|
void |
mousePressed(MouseEvent evt)
|
void |
mouseReleased(MouseEvent evt)
|
void |
newToolFromOld(int i,
MapTool new_tool,
MapTool old_tool)
|
void |
paintComponent(Graphics g)
Paints the canvas with the base image and the current tool. |
boolean |
panning()
|
void |
resume_scrolling()
Resumes scrolling. |
void |
scroll_X(int delta)
Causes the map to scroll an amount in the X direction. |
void |
scroll_Y(int delta)
Causes the map to scroll an amount in the Y direction. |
void |
selectTool(int id)
|
void |
setGrid(MapGrid grid)
|
void |
setImage(ImageIcon image)
|
void |
setRegionArray(MapRegion[] regionArray)
|
void |
setTool(int i,
MapTool tool)
|
void |
setToolArray(MapTool[] toolArray)
|
void |
suspend_scrolling()
Suspends scrolling. |
void |
update(Graphics g)
Overrides the default method and omits the background fill. |
void |
zoom_in()
|
void |
zoom_out()
Decreases the base image size the internally maintained zoom factor. |
void |
zoom(double zoom_factor)
Increases/decreases the base image size by the specified zoom factor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean pan_down
public boolean pan_down_fast
public boolean pan_left
public boolean pan_left_fast
public boolean pan_right
public boolean pan_right_fast
public boolean pan_up
public boolean pan_up_fast
public boolean tool_driven
public double zoom_factor
public double max_img_scaling
public double min_img_scaling
public MapTool[] toolArray
public MapRegion[] regionArray
public MapGrid grid
Constructor Detail |
---|
public MapCanvas(ImageIcon image_icon, int width, int height, MapTool[] toolArray, MapGrid grid)
base_image
- the image over which the tool will be drawnwidth
- the width in pixels of the MapCanvasheight
- the height in pixels of the MapCanvastool
- the tool for user interactiongrid
- the grid associated with the underlying basemap.public MapCanvas(ImageIcon image_icon, int width, int height, MapTool[] toolArray, MapGrid grid, int x, int y, double scaling)
base_image
- the image over which the tool will be drawnwidth
- the width in pixels of the MapCanvasheight
- the height in pixels of the MapCanvastool
- the tool for user interactiongrid
- the grid associated with the underlying basemap.Method Detail |
---|
public boolean panning()
public void update(Graphics g)
update
in class JComponent
g
- the specified Graphics windowpublic void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- the specified Graphics windowpublic void scroll_X(int delta)
delta
- the number of pixels to scroll.public void scroll_Y(int delta)
delta
- the number of pixels to scroll.public void suspend_scrolling()
Scrolling can be resumed with resume_scrolling()
.
public void resume_scrolling()
Scrolling can be suspended with suspend_scrolling()
.
public void mouseMoved(MouseEvent evt)
mouseMoved
in interface MouseMotionListener
public void mousePressed(MouseEvent evt)
mousePressed
in interface MouseListener
public void mouseDragged(MouseEvent evt)
mouseDragged
in interface MouseMotionListener
public void mouseReleased(MouseEvent evt)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent evt)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent evt)
mouseExited
in interface MouseListener
public void mouseClicked(MouseEvent evt)
mouseClicked
in interface MouseListener
public void zoom_in() throws MaxZoomException, MinZoomException
MaxZoomException
MinZoomException
public void zoom_out() throws MaxZoomException, MinZoomException
MaxZoomException
- already at max zoom.
MinZoomException
- already at min zoom.public void zoom(double zoom_factor) throws MaxZoomException, MinZoomException
zoom_factor.
-
MaxZoomException
- already at max zoom.
MinZoomException
- already at min zoom.public void center_tool(double zoom_factor)
public int getSelected()
public MapTool getTool()
public MapTool getTool(int i)
public void newToolFromOld(int i, MapTool new_tool, MapTool old_tool)
public void setTool(int i, MapTool tool)
public void setToolArray(MapTool[] toolArray)
public void selectTool(int id)
public void setRegionArray(MapRegion[] regionArray)
public void setGrid(MapGrid grid)
public MapGrid getGrid()
public void setImage(ImageIcon image)
public Image get_image()
public String get_internals()
public Dimension getMinimumSize()
getMinimumSize
in class JComponent
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |