es.prodevelop.gvsig.mobile.gui.canvas
Class TransparentCanvas

java.lang.Object
  extended byjava.awt.Component
      extended byes.prodevelop.gvsig.mobile.gui.canvas.TransparentCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TransparentCanvas
extends java.awt.Component

This is a second light canvas where measurement geometries (distance, area) are drawn.

Author:
jldominguez
See Also:
MapControl, ViewPort, DistanceAreaListener, Serialized Form

Field Summary
 
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
TransparentCanvas(ViewPort vp)
          Constructor.
 
Method Summary
 int addGeometry(IGeometry ig)
          Adds a new geometry to this canvas.
 boolean clear()
          Removes all geometries.
 IGeometry getGeometry(int i)
          Gets the i-th geometry in the canvas.
 ViewPort getViewPort()
          Gets the viewport
 void paint(java.awt.Graphics _g)
          overridden pain method
 void paint(java.awt.Graphics _g, boolean transf, FSymbol sym)
          Paint method.
 int removeGeometry(IGeometry ig)
          Removes a geometry from the current canvas
 void setViewPort(ViewPort vp)
          Sets a new viewport
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransparentCanvas

public TransparentCanvas(ViewPort vp)
Constructor.

Parameters:
vp - A reference to the viewport.
Method Detail

setViewPort

public void setViewPort(ViewPort vp)
Sets a new viewport

Parameters:
vp - the new viewport

getViewPort

public ViewPort getViewPort()
Gets the viewport

Returns:
the viewport

addGeometry

public int addGeometry(IGeometry ig)
Adds a new geometry to this canvas. Normally there is only one or zero geometries, (it is constantly being cleared).

Parameters:
ig - the new geometry to be added
Returns:
number of geometries currently in this canvas (after action)

removeGeometry

public int removeGeometry(IGeometry ig)
Removes a geometry from the current canvas

Parameters:
ig - the geometry to be removed
Returns:
number of geometries currently in this canvas (after action)

paint

public void paint(java.awt.Graphics _g)
overridden pain method


paint

public void paint(java.awt.Graphics _g,
                  boolean transf,
                  FSymbol sym)
Paint method.

Parameters:
_g - the graphics object where geometries are going to be drawn
transf - whether or not the affine transformation of the viewport has to be applied to geometries before drawing.
sym - symbol to be used for painting geometries

getGeometry

public IGeometry getGeometry(int i)
Gets the i-th geometry in the canvas.

Parameters:
i - index of the requested geometry
Returns:
the requested geometry or null if index >= size

clear

public boolean clear()
Removes all geometries.

Returns:
whether any geometry was removed. Returns false if canvas was already empty