|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
es.prodevelop.gvsig.mobile.gui.canvas.MapControl
This class is the canvas of the application, where layers and drawn. It receives events from: the viewport (extent events), the mapcontext (selection events) and the GPS device (when new GPS data is available). It holds also a reference to the tools (toolbars) and owns the project and the TOC.
ViewPort
,
MapContext
,
GPSManagementEventsListener
,
Serialized FormField Summary | |
MapCursor |
gps_cursor
|
GroupToolbar |
groupButtons
A reference to the group button tool bar |
Project |
project
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
MapControl(MainWindow mw,
int w)
Constructor. |
Method Summary | |
void |
addGroupButton(ToolBarGroupButton gb,
boolean b)
Adds a new group button in the group button bar (left side of the window) |
void |
addLayer(FLayer lyr,
boolean repaint)
Add a new layer to the map. |
void |
cancelDrawing()
Used to cancel the drawing. |
void |
clearCanvass()
Clears this component with the backgrouond color |
void |
clearSelection()
This method performs the "clear selection" action. |
void |
closeDataSources()
Closes current datasources. |
void |
componentHidden(java.awt.event.ComponentEvent arg0)
|
void |
componentMoved(java.awt.event.ComponentEvent arg0)
|
void |
componentResized(java.awt.event.ComponentEvent arg0)
|
void |
componentShown(java.awt.event.ComponentEvent arg0)
|
boolean |
draw(boolean doClear)
Main method to draw the map. |
void |
extentChanged(ExtentEvent e,
boolean repaint)
Called when the extent changes (part of viewport listener) |
int[] |
getCurrentColumn(int x,
int y,
int len)
Gets a column of pixels from the current image map. |
java.awt.Image |
getCurrentImage()
Gets the image of the current map |
int[] |
getCurrentRow(int x,
int y,
int len)
Gets a row of pixels from the current image map. |
TBButton |
getCurrentTool()
Returns the active Tool associated to the Listener in MapToolListener Only tools of type TBSelectableTool (subclass of
TBButton ) registers listeners, so only this
objects will be real active tools |
GPSRelevantEventsListener |
getGPSListener()
Gets the GPS event listener |
FLayer[] |
getInfoableLayers(boolean only_vect)
Gets an array with the layers that are infoable. |
FLayer |
getLayer(int index)
Gets i-th layer |
int |
getLayerCount()
Gets number of layers in current map |
MapContext |
getMapContext()
Gets the map context object |
MainWindow |
getParentFrame()
Gets parent main window. |
Project |
getProject()
Gets the current project |
IProjection |
getProjection()
Gets current projection (gets the data from the project) |
FLayer |
getSelectedLayer(boolean only_vect)
Gets currently selected layer (in TOC), or null if there is no selection |
TransparentCanvas |
getSymbolsCanvas()
Gets the object where measurement symbols are drawn. |
LayersTable |
getToc()
Get the TOC object (table of current layers) |
ViewPort |
getViewPort()
Get the viewport |
void |
gpsNewAltitude(double altitude)
New GPS event : altitude |
void |
gpsNewHeading(double heading)
Returns a new heading |
void |
gpsNewPDOP(double pdop)
New GPS event : PDOP value |
void |
gpsNewPosition(double longitude,
double latitude)
New GPS event: new position (this is the main GPS event) |
void |
gpsNewQuality(int quality)
New GPS event : quality value |
void |
gpsNewSatsUsed(int satUsed)
New GPS event : satellites used |
void |
gpsNewSecondsFromMidnight(int seconds)
New GPS event: time |
void |
gpsNewSpeed(double speed)
New GPS event: new speed data |
void |
gpsNewStatus(int status)
New GPS event : status value |
boolean |
isGpsPositionVisible()
Tells whether the GPS icon is currently visible |
boolean |
isProcessing()
Used to know if the canvas (this object) is currently in the drawing process. |
void |
paint(java.awt.Graphics g)
Overriden paint method. |
void |
recenter(int x_,
int y_)
Tells the map control to recenter the map at the given pixel. |
void |
redraw(boolean clear)
Used to redraw the map |
void |
refresh(boolean update)
Used to refresh the map |
void |
refresh(int x,
int y,
int w,
int h)
Forces a refresh fo the MapControl given the top-left corner
and the size |
void |
refresh(java.awt.Rectangle rectangle)
Forces a refresh fo the MapControl given a rectangle with
the area to refresh |
void |
refreshGPSCursor()
Tells the map copntrol to redraw the GPS cursor |
void |
removeLayer(FLayer lyr)
Remove one layer from the current map. |
void |
saveAsPng()
Saves current map as PNG (tells user output file name) |
void |
selectionChanged(SelectionEvent e)
Called when the selection changed a map has to be refreshed (part of selection listener) |
void |
setCurrentColumn(int x,
int y,
int[] pix)
Sets RGBA values in a column of the map |
void |
setCurrentRow(int x,
int y,
int[] pix)
Sets RGBA values in a row of the map |
boolean |
setDistanceGeometry(IGeometry ig,
int ref_minx,
int ref_miny,
int ref_maxx,
int ref_maxy)
Sets the new multiline geometry while using the measure distance tool |
void |
setListener(TBButton button,
boolean clearStatusBar)
Sets a new active button by assigning it to a new Listener |
void |
setOffsetAndRefresh(int offsetx,
int offsety,
boolean refresh)
Sets a new offset for the image (used with pan tool) |
void |
setProcessing(boolean b)
Used when drawing process begins or ends. |
void |
setProject(Project project)
Sets the current project |
void |
setProjection(IProjection proj)
Sets the current projection (sets the data in the project) |
void |
setStatusBarIcon(int id,
java.lang.String dir,
java.lang.String filename)
Set a new icon in the status bar |
void |
setStatusBarSubIcon(int id,
java.lang.String dir,
java.lang.String filename)
Set a new subicon in the status bar |
void |
setStatusBarText(int id,
java.lang.String txt)
Set text in status bar. |
void |
setSymbolGeometryAreaInStatusBar()
Tells the mapcontrol to write the area measurements as string in the status bar |
void |
setSymbolGeometryLengthAsDistanceInStatusBar()
Tells the mapcontrol to write the distance measurements as string in the status bar |
void |
setToolBar(ToolBar t,
int w)
Set a new tool bar as the one selected. |
void |
setToolsImageForPanDrag(boolean set)
Method used to warn this components that the pan tool starts to be in use, (mouse down), so drawing method will behave in a different way. |
void |
startGraphics(boolean initial)
Thsi method initializes the graphics of this component. |
void |
step(int qty)
Increases slightly the position of the group button bar |
void |
swap(int a,
int b,
boolean repaint)
Swap order of the layers (arrow buttons in TOC) |
void |
switchTracklog()
Switch tracklog activation button. |
void |
switchViewGPSPosition()
Switch GPS visibility |
void |
switchViewGPSPositionOff()
Force deactivation of GPS position visibility |
void |
switchViewGPSPositionOn()
Force activation of GPS position visibility |
void |
update(java.awt.Graphics g)
Overriden method to refresh component. |
void |
xorAndRepaint(int x,
int y,
int signed_w,
int signed_h)
Compute the XOR pixels of a region of the map. |
void |
zoomToSelection()
This method performs the "zoom to selection" action. |
Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public MapCursor gps_cursor
public Project project
public GroupToolbar groupButtons
Constructor Detail |
public MapControl(MainWindow mw, int w)
mw
- the main window that owns this controlw
- the width of the main window that owns this controlMethod Detail |
public void step(int qty)
Animable
step
in interface Animable
qty
- amount in pixelspublic void update(java.awt.Graphics g)
public void setToolBar(ToolBar t, int w)
t
- the tool bar to be set as selectedw
- canvas width (unused parameter)public MainWindow getParentFrame()
public void paint(java.awt.Graphics g)
public void setToolsImageForPanDrag(boolean set)
set
- whether or not the pan tool is in usepublic void startGraphics(boolean initial)
initial
- Whether it is the application startuppublic IProjection getProjection()
public void setProjection(IProjection proj)
proj
- the new projectionpublic void cancelDrawing()
public boolean draw(boolean doClear)
doClear
- whether the canvas has to be cleared before drawing.
public ViewPort getViewPort()
public void extentChanged(ExtentEvent e, boolean repaint)
extentChanged
in interface ViewPortListener
public void refresh(boolean update)
refresh
in interface Refreshable
update
- where to use the update method or just the repainpublic void refresh(int x, int y, int w, int h)
MapControl
given the top-left corner
and the size
x
- X coordinate of the left border area to refreshy
- Y coordinate of the top border area to refreshw
- Width of the area to refreshh
- Height of the area to refreshpublic void refresh(java.awt.Rectangle rectangle)
MapControl
given a rectangle with
the area to refresh
rectangle
- Area to be refreshedpublic void closeDataSources()
public void addLayer(FLayer lyr, boolean repaint)
lyr
- the new layer to be addedrepaint
- whether or not to repaint after adding the layerpublic void removeLayer(FLayer lyr)
lyr
- the layer to be removedpublic void swap(int a, int b, boolean repaint)
a
- 0-based index of one of the layersb
- 0-based index of the other layerrepaint
- whether or not the map has to be repaintepublic int getLayerCount()
public FLayer getLayer(int index)
index
- index of the desired layer
public FLayer getSelectedLayer(boolean only_vect)
only_vect
- whether we are interested only in vector layers
public void setListener(TBButton button, boolean clearStatusBar)
button
- TBButton
to set active and assign to the ListenerclearStatusBar
- whether the status bar has to be clearedpublic TBButton getCurrentTool()
Only tools of type TBSelectableTool
(subclass of
TBButton
) registers listeners, so only this
objects will be real active tools
TBButton
)public MapContext getMapContext()
public java.awt.Image getCurrentImage()
public void setOffsetAndRefresh(int offsetx, int offsety, boolean refresh)
setOffsetAndRefresh
in interface Refreshable
offsetx
- new x offsetoffsety
- new y offsetrefresh
- whether a new refresh has to be donepublic int[] getCurrentRow(int x, int y, int len)
x
- x coordinate of the beginning of the rowy
- y coordinate of the beginning of the rowlen
- length of the row
public int[] getCurrentColumn(int x, int y, int len)
x
- x coordinate of the beginning of the columny
- y coordinate of the beginning of the columnlen
- length of the column
public void setCurrentRow(int x, int y, int[] pix)
x
- x coordinate of the beginning of the rowy
- y coordinate of the beginning of the rowpix
- array of RGBA values to be writtenpublic void setCurrentColumn(int x, int y, int[] pix)
x
- x coordinate of the beginning of the columny
- y coordinate of the beginning of the columnpix
- array of RGBA values to be writtenpublic void xorAndRepaint(int x, int y, int signed_w, int signed_h)
x
- x coordinate of the origin of the zoney
- y coordinate of the origin of the zonesigned_w
- signed width of the regionsigned_h
- signed height of the regionpublic void clearCanvass()
public void addGroupButton(ToolBarGroupButton gb, boolean b)
gb
- a new group button to be addedb
- whether the new group button is selectedpublic void selectionChanged(SelectionEvent e)
selectionChanged
in interface SelectionListener
e
- public void zoomToSelection()
public void clearSelection()
public void setProcessing(boolean b)
setProcessing
in interface Refreshable
b
- true when the process begins, false when it ends.public boolean isProcessing()
isProcessing
in interface Refreshable
public FLayer[] getInfoableLayers(boolean only_vect)
only_vect
- whether only vector layers have to be included
public void redraw(boolean clear)
redraw
in interface Refreshable
clear
- whether the object has to be cleared before drawing againpublic LayersTable getToc()
public boolean setDistanceGeometry(IGeometry ig, int ref_minx, int ref_miny, int ref_maxx, int ref_maxy)
ig
- the new multiline geometryref_minx
- extent of the geometry in screen pixel coordinatesref_miny
- extent of the geometry in screen pixel coordinatesref_maxx
- extent of the geometry in screen pixel coordinatesref_maxy
- extent of the geometry in screen pixel coordinates
public void setSymbolGeometryLengthAsDistanceInStatusBar()
public void setSymbolGeometryAreaInStatusBar()
public void setStatusBarText(int id, java.lang.String txt)
id
- ID the the status bartxt
- text to be writtenpublic void setStatusBarIcon(int id, java.lang.String dir, java.lang.String filename)
id
- ID of the status bardir
- folder where the image isfilename
- file nameof the iconpublic void setStatusBarSubIcon(int id, java.lang.String dir, java.lang.String filename)
id
- ID of the status bardir
- folder where the image isfilename
- file nameof the subiconpublic void switchTracklog()
public boolean isGpsPositionVisible()
public void switchViewGPSPosition()
public void switchViewGPSPositionOff()
public void switchViewGPSPositionOn()
public GPSRelevantEventsListener getGPSListener()
public void gpsNewSecondsFromMidnight(int seconds)
seconds
- number of seconds since last midnightpublic void gpsNewPosition(double longitude, double latitude)
gpsNewPosition
in interface GPSRelevantEventsListener
longitude
- in EPSG:4326 (WGS84 datum)latitude
- in EPSG:4326 (WGS84 datum)public void gpsNewSpeed(double speed)
speed
- the speed computed by the GPS devicepublic void refreshGPSCursor()
public void saveAsPng()
public void componentResized(java.awt.event.ComponentEvent arg0)
componentResized
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent arg0)
componentShown
in interface java.awt.event.ComponentListener
public void componentHidden(java.awt.event.ComponentEvent arg0)
componentHidden
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent arg0)
componentMoved
in interface java.awt.event.ComponentListener
public Project getProject()
public void setProject(Project project)
project
- the new projectpublic TransparentCanvas getSymbolsCanvas()
public void gpsNewAltitude(double altitude)
gpsNewAltitude
in interface GPSRelevantEventsListener
altitude
- the new altitude computed by the GPS devicepublic void gpsNewSatsUsed(int satUsed)
gpsNewSatsUsed
in interface GPSRelevantEventsListener
satUsed
- the number of satellites currently detected and used by the GPS devicepublic void gpsNewPDOP(double pdop)
gpsNewPDOP
in interface GPSRelevantEventsListener
pdop
- a value regarding the quality of the GPS datapublic void gpsNewQuality(int quality)
gpsNewQuality
in interface GPSRelevantEventsListener
quality
- a value regarding the quality of the GPS datapublic void gpsNewStatus(int status)
gpsNewStatus
in interface GPSRelevantEventsListener
status
- a value regarding the state of the GPS devicepublic void recenter(int x_, int y_)
x_
- coordinates to recenter to (screen pixel reference system)y_
- coordinates to recenter to (screen pixel reference system)public void gpsNewHeading(double heading)
GPSRelevantEventsListener
gpsNewHeading
in interface GPSRelevantEventsListener
heading
- heading in degrees
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |