public class IlvCompass extends Component
IlvManagerView
.
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.
IlvManagerView
view.
The cartographic north is defined as
the vertical when the map is displayed without rotation.
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.
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
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.
|
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvCompass()
Creates an
IlvCompass object. |
Modifier and Type | Method and Description |
---|---|
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. |
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, getBaseline, getBaselineResizeBehavior, 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, revalidate, 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
public static final int NEEDLE_STYLE_SIMPLE
public static final int NEEDLE_STYLE_COMPASS
public static final int NEEDLE_STYLE_CROSS
public static final int NEEDLE_STYLE_COMPASS_ROSE
public IlvCompass()
IlvCompass
object. The created instance is not active until it is
associated with an IlvManagerView
view.setView(ilog.views.IlvManagerView)
public final void setView(IlvManagerView view)
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.view
- The view. A null value can be used to deactivate the compass.IlvProjectionProperty
public final IlvManagerView getView()
null
if there is none.public void paint(Graphics g)
Redraw is performed by calling the following methods:
protected void drawDecorations(Graphics g)
protected void drawCartographicNorth(Graphics g)
protected void drawGeographicNorth(Graphics g)
protected void drawNeedle(int style, double angle, Color foreground, Color background, int xPosition, int yPosition, Graphics g)
style
- The needle styleangle
- Orientation in radiansforeground
- Foreground color of needlebackground
- Background color of needlexPosition
- Center position of needleyPosition
- Center position of needleg
- The graphics for drawingpublic Dimension getMinimumSize()
getMinimumSize
in class Component
public Dimension getPreferredSize()
getPreferredSize
in class Component
public double getCartographicNorth()
public double getGeographicNorth()
public void setDecorationForeground(Color color)
public Color getDecorationForeground()
public void setDecorationBackground(Color color)
public Color getDecorationBackground()
public void setCartographicForeground(Color color)
public Color getCartographicForeground()
public void setCartographicBackground(Color color)
public Color getCartographicBackground()
public void setGeographicForeground(Color color)
public Color getGeographicForeground()
public void setGeographicBackground(Color color)
public Color getGeographicBackground()
public final void setCartographicNeedleStyle(int style)
public final int getCartographicNeedleStyle()
public final void setGeographicNeedleStyle(int style)
public final int getGeographicNeedleStyle()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.