ilog.views.maps.beans
Class IlvCompass

java.lang.Object
  extended by java.awt.Component
      extended by ilog.views.maps.beans.IlvCompass
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class IlvCompass
extends Component

This class defines a component representing a compass. The needles can indicate:

This component is packaged as a Java Bean and is designed to be used very easily in a JAVA development environment supporting visual programming with Beans.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int NEEDLE_STYLE_COMPASS
          The type for bicolored diamond needles.
static int NEEDLE_STYLE_COMPASS_ROSE
          The type for compass-rose style.
static int NEEDLE_STYLE_CROSS
          The type for cross-style needles.
static int NEEDLE_STYLE_SIMPLE
          The type for simple arrow needles.
 
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
IlvCompass()
          Creates an IlvCompass object.
 
Method Summary
protected  void drawCartographicNorth(Graphics g)
          Draws the elements of the compass that represent the cartographic north.
protected  void drawDecorations(Graphics g)
          Draws the background of the compass.
protected  void drawGeographicNorth(Graphics g)
          Draws the elements to represent the geographic north.
protected  void drawNeedle(int style, double angle, Color foreground, Color background, int xPosition, int yPosition, Graphics g)
          Draws a needle at the specified angle.
 Color getCartographicBackground()
          Returns the background color used to draw the needle that shows the direction of the cartographic north.
 Color getCartographicForeground()
          Returns the foreground color used to draw the needle representing the cartographic north.
 int getCartographicNeedleStyle()
          Returns the style used to draw the needle representing the cartographic north.
 double getCartographicNorth()
          Returns the current cartographic north.
 Color getDecorationBackground()
          Returns the background color used to draw the compass.
 Color getDecorationForeground()
          Returns the foreground color used to draw the compass.
 Color getGeographicBackground()
          Returns the background color used to draw the geographic needles.
 Color getGeographicForeground()
          Returns the foreground color used to draw the geographic needles.
 int getGeographicNeedleStyle()
          Returns the style used to draw the needle representing the geographic north.
 double getGeographicNorth()
          Returns the current geographic north.
 Dimension getMinimumSize()
          Returns the minimum size of the component.
 Dimension getPreferredSize()
          Returns the preferred size of the component.
 IlvManagerView getView()
          Returns the view for which the compass displays the north direction.
 void paint(Graphics g)
          Redraws the compass.
 void setCartographicBackground(Color color)
          Sets the background color for drawing cartographic needles.
 void setCartographicForeground(Color color)
          Sets the foreground color used to draw the needle representing the cartographic north.
 void setCartographicNeedleStyle(int style)
          Sets the style used to draw the needle representing the cartographic north.
 void setDecorationBackground(Color color)
          Sets the background color used to draw the compass.
 void setDecorationForeground(Color color)
          Sets the foreground color used to draw the compass.
 void setGeographicBackground(Color color)
          Sets the background color used to draw the geographic needles.
 void setGeographicForeground(Color color)
          Sets the foreground color used to draw the geographic north.
 void setGeographicNeedleStyle(int style)
          Sets the style used to draw the needle representing the geographic north.
 void setView(IlvManagerView view)
          Sets the IlvManagerView for which the compass will display the north direction.
 
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, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEEDLE_STYLE_SIMPLE

public static final int NEEDLE_STYLE_SIMPLE
The type for simple arrow needles.

See Also:
setCartographicNeedleStyle(int), setGeographicNeedleStyle(int), Constant Field Values

NEEDLE_STYLE_COMPASS

public static final int NEEDLE_STYLE_COMPASS
The type for bicolored diamond needles.

See Also:
setCartographicNeedleStyle(int), setGeographicNeedleStyle(int), Constant Field Values

NEEDLE_STYLE_CROSS

public static final int NEEDLE_STYLE_CROSS
The type for cross-style needles.

See Also:
setCartographicNeedleStyle(int), setGeographicNeedleStyle(int), Constant Field Values

NEEDLE_STYLE_COMPASS_ROSE

public static final int NEEDLE_STYLE_COMPASS_ROSE
The type for compass-rose style.

See Also:
setCartographicNeedleStyle(int), setGeographicNeedleStyle(int), Constant Field Values
Constructor Detail

IlvCompass

public IlvCompass()
Creates an IlvCompass object. The created instance is not active until it is associated with an IlvManagerView view.

See Also:
setView(ilog.views.IlvManagerView)
Method Detail

setView

public final void setView(IlvManagerView view)
Sets the IlvManagerView for which the compass will display the north direction. To show the direction of the geographic north in the manager view, the compass must know the projection used to display the map. If the manager of the view has an IlvProjectionProperty, the compass will use the property's projection, otherwise, it will assume that the geographic north is in the same direction as the cartographic north.

Parameters:
view - The view. A null value can be used to deactivate the compass.
See Also:
IlvProjectionProperty

getView

public final IlvManagerView getView()
Returns the view for which the compass displays the north direction.

Returns:
the attached view or null if there is none.

paint

public void paint(Graphics g)
Redraws the compass.

Redraw is performed by calling the following methods:

It is possible to subtype any of this protected method to change the way the different items are displayed.

Overrides:
paint in class Component

drawDecorations

protected void drawDecorations(Graphics g)
Draws the background of the compass.


drawCartographicNorth

protected void drawCartographicNorth(Graphics g)
Draws the elements of the compass that represent the cartographic north. The cartographic north is defined as the vertical when the map is displayed without rotation.


drawGeographicNorth

protected void drawGeographicNorth(Graphics g)
Draws the elements to represent the geographic north. The geographic north is defined as the tangent to a meridian line passing at the center of the manager view that controls the compass Bean.


drawNeedle

protected void drawNeedle(int style,
                          double angle,
                          Color foreground,
                          Color background,
                          int xPosition,
                          int yPosition,
                          Graphics g)
Draws a needle at the specified angle. The angle is specified in radians, positive values clockwise, with 0 at 12 o'clock.

Parameters:
style - The needle style
angle - Orientation in radians
foreground - Foreground color of needle
background - Background color of needle
xPosition - Center position of needle
yPosition - Center position of needle
g - The graphics for drawing

getMinimumSize

public Dimension getMinimumSize()
Returns the minimum size of the component.

Overrides:
getMinimumSize in class Component

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of the component.

Overrides:
getPreferredSize in class Component

getCartographicNorth

public double getCartographicNorth()
Returns the current cartographic north. The cartographic north is computed using the transformer of the current view. The cartographic north is expressed in radians, clockwise, with 0 at 12 o'clock.


getGeographicNorth

public double getGeographicNorth()
Returns the current geographic north. The geographic north is computed using the current transformer and current projection of the view. The geographic north is expressed in radians, clockwise, relative to the cartographic north.


setDecorationForeground

public void setDecorationForeground(Color color)
Sets the foreground color used to draw the compass.


getDecorationForeground

public Color getDecorationForeground()
Returns the foreground color used to draw the compass.


setDecorationBackground

public void setDecorationBackground(Color color)
Sets the background color used to draw the compass.


getDecorationBackground

public Color getDecorationBackground()
Returns the background color used to draw the compass.


setCartographicForeground

public void setCartographicForeground(Color color)
Sets the foreground color used to draw the needle representing the cartographic north.


getCartographicForeground

public Color getCartographicForeground()
Returns the foreground color used to draw the needle representing the cartographic north.


setCartographicBackground

public void setCartographicBackground(Color color)
Sets the background color for drawing cartographic needles. Background color is used as an alternate color for multicolored needles.


getCartographicBackground

public Color getCartographicBackground()
Returns the background color used to draw the needle that shows the direction of the cartographic north.


setGeographicForeground

public void setGeographicForeground(Color color)
Sets the foreground color used to draw the geographic north.


getGeographicForeground

public Color getGeographicForeground()
Returns the foreground color used to draw the geographic needles.


setGeographicBackground

public void setGeographicBackground(Color color)
Sets the background color used to draw the geographic needles. Background color is used as an alternate color for multicolored needles.


getGeographicBackground

public Color getGeographicBackground()
Returns the background color used to draw the geographic needles.


setCartographicNeedleStyle

public final void setCartographicNeedleStyle(int style)
Sets the style used to draw the needle representing the cartographic north.

See Also:
NEEDLE_STYLE_SIMPLE, NEEDLE_STYLE_COMPASS, NEEDLE_STYLE_CROSS, NEEDLE_STYLE_COMPASS_ROSE

getCartographicNeedleStyle

public final int getCartographicNeedleStyle()
Returns the style used to draw the needle representing the cartographic north.

See Also:
NEEDLE_STYLE_SIMPLE, NEEDLE_STYLE_COMPASS, NEEDLE_STYLE_CROSS, NEEDLE_STYLE_COMPASS_ROSE

setGeographicNeedleStyle

public final void setGeographicNeedleStyle(int style)
Sets the style used to draw the needle representing the geographic north.

See Also:
NEEDLE_STYLE_SIMPLE, NEEDLE_STYLE_COMPASS, NEEDLE_STYLE_CROSS, NEEDLE_STYLE_COMPASS_ROSE

getGeographicNeedleStyle

public final int getGeographicNeedleStyle()
Returns the style used to draw the needle representing the geographic north.

See Also:
NEEDLE_STYLE_SIMPLE, NEEDLE_STYLE_COMPASS, NEEDLE_STYLE_CROSS, NEEDLE_STYLE_COMPASS_ROSE


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.