public class IlvJCompass extends JComponent
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.
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
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.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvJCompass()
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. |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
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 IlvJCompass()
IlvCompass
object. The created instance is not active until it is
associated with an IlvManagerView
view.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:
paint
in class JComponent
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 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.public Dimension getMinimumSize()
getMinimumSize
in class JComponent
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
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 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.