ilog.views.maps.beans
Class IlvJScaleBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by ilog.views.maps.beans.IlvJScaleBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
IlvJAutomaticScaleBar

public class IlvJScaleBar
extends JComponent

This class defines a Swing component that displays the scale of an IlvManagerView. This component works only if the manager of the target view has an IlvCoordinateSystemProperty or an IlvProjectionProperty (for backward compatibility with JViews versions previous to 5.0).
This property defines the coordinate system of the manager and its units.

Since:
JViews 5.0
See Also:
IlvProjectionProperty, IlvCoordinateSystemProperty, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int DASH_SCALE_EVEN
          Displays alternate color filled rectangles, starting with a foreground colored rectangle.
static int DASH_SCALE_ODD
          Displays graduations with filled rectangles, starting with an alternate colored rectangle.
static int DOUBLE_DASH_SCALE_EVEN
          Displays alternate filled and non filled rectangles.
static int DOUBLE_DASH_SCALE_ODD
          Displays two lines of filled and non filled rectangles, starting with an alternate color filled rectangle.
static int DOUBLE_SCALE_EMPTY
          Displays two lines of empty rectangles.
static int SCALE_EMPTY
          Displays graduations with empty rectangles.
static int SIMPLE_SCALE_BOTTOM
          Displays graduations on a bottom line.
static int SIMPLE_SCALE_CENTER
          Displays graduations on a centered line.
static int THREE_LABELS
          Three labels are drawn on the top of the scale bar.
static int UNIQUE_LABEL
          A unique label is drawn on the top of the scale bar.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
IlvJScaleBar()
          Creates a new instance of IlvScaleBar.
 
Method Summary
 Color getAlternateScaleColor()
          Gets the alternate scale color.
 double getFarLimit()
          Returns the switch limit between a text display of the scale in a small unit (for instance, meters) and a text display in a large unit (for instance, kilometers).
 IlvLinearUnit getFarUnit()
          Returns the unit used to display the length of the scale bar for small scales.
 IlvGraphic getGraphic()
          Returns the IlvGraphic that represents the scale part of the IlvScaleBar.
 int getMarginHeight()
          Returns the vertical margin that must be left between the scale bar and the border of the component.
 int getMarginWidth()
          Returns the minimum margin that must be left between the scale bar and the border of the component.
 Dimension getMinimumSize()
          Returns the minimum size of the component.
 IlvLinearUnit getNearUnit()
          Returns the unit used to display the length of the scale bar for large scales.
 Dimension getPreferredSize()
          Returns the preferred size of the component.
 int getScaleHeight()
          Returns the height of the scale bar.
 int getScaleStyle()
          Returns the style used to draw the scale bar.
 int getScaleTextMode()
          Returns the text mode.
 int getTextSpacing()
          Returns the text spacing.
 IlvManagerView getView()
          Returns the view whose scale is displayed.
 void paint(Graphics g)
          Draws the component.
 void setAlternateScaleColor(Color color)
          Sets the alternate scale color.
 void setBounds(int x, int y, int width, int height)
          Sets the bounds for this component and updates the scale bar when component is resized.
 void setFarLimit(double limit)
          Sets the switch limit between a text display of the scale in a small unit (for instance, meters) and a text display in a large unit (for instance, kilometers).
 void setFarUnit(IlvLinearUnit unit)
          Sets the unit used to display the length of the scale bar for small scales.
 void setGraphic(IlvGraphic graphic)
          Sets the IlvGraphic that represents the scale part of the IlvScaleBar.
 void setMarginHeight(int margin)
          Specifies the vertical margin that must be left between the scale bar and the border of the component.
 void setMarginWidth(int margin)
          Specifies the minimum horizontal margin that must be left between the scale bar and the border of the component.
 void setNearUnit(IlvLinearUnit unit)
          Sets the unit used to display the length of the scale bar for large scales.
 void setScaleHeight(int scaleHeight)
          Sets the height of the scale bar.
 void setScaleStyle(int style)
          Sets the style used to draw the scale bar.
 void setScaleTextMode(int mode)
          Sets the label displaying mode.
 void setSize(int width, int height)
          Sets the size for this component.
 void setTextSpacing(int spacing)
          Specifies the text spacing.
 void setView(IlvManagerView view)
          Specifies the view that controls this component.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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
 
Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, 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, hide, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIMPLE_SCALE_CENTER

public static final int SIMPLE_SCALE_CENTER
Displays graduations on a centered line.

See Also:
Constant Field Values

DASH_SCALE_EVEN

public static final int DASH_SCALE_EVEN
Displays alternate color filled rectangles, starting with a foreground colored rectangle.

See Also:
Constant Field Values

DOUBLE_DASH_SCALE_EVEN

public static final int DOUBLE_DASH_SCALE_EVEN
Displays alternate filled and non filled rectangles.

See Also:
Constant Field Values

DASH_SCALE_ODD

public static final int DASH_SCALE_ODD
Displays graduations with filled rectangles, starting with an alternate colored rectangle.

See Also:
Constant Field Values

DOUBLE_DASH_SCALE_ODD

public static final int DOUBLE_DASH_SCALE_ODD
Displays two lines of filled and non filled rectangles, starting with an alternate color filled rectangle.

See Also:
Constant Field Values

SIMPLE_SCALE_BOTTOM

public static final int SIMPLE_SCALE_BOTTOM
Displays graduations on a bottom line.

See Also:
Constant Field Values

SCALE_EMPTY

public static final int SCALE_EMPTY
Displays graduations with empty rectangles.

See Also:
Constant Field Values

DOUBLE_SCALE_EMPTY

public static final int DOUBLE_SCALE_EMPTY
Displays two lines of empty rectangles.

See Also:
Constant Field Values

UNIQUE_LABEL

public static final int UNIQUE_LABEL
A unique label is drawn on the top of the scale bar. This label displays the length of the displayed bar, expressed in cartographic units.

See Also:
Constant Field Values

THREE_LABELS

public static final int THREE_LABELS
Three labels are drawn on the top of the scale bar. These three labels are the zero, the value of the first graduation, and the value of the last graduation. These labels are only drawn if the size of the scale is large enough.

See Also:
Constant Field Values
Constructor Detail

IlvJScaleBar

public IlvJScaleBar()
Creates a new instance of IlvScaleBar. The scale bar is not active until an IlvManagerView is set. The manager of the view should have an IlvCoordinateSystemProperty.

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

setView

public void setView(IlvManagerView view)
Specifies the view that controls this component.

Parameters:
view - The view.

getView

public IlvManagerView getView()
Returns the view whose scale is displayed.

Returns:
The attached view or null if the bean has no attached view.

setScaleStyle

public void setScaleStyle(int style)
Sets the style used to draw the scale bar.

Parameters:
style - The scale style.
See Also:
IlvScaleBar.SIMPLE_SCALE_CENTER, IlvScaleBar.DASH_SCALE_EVEN, IlvScaleBar.DOUBLE_DASH_SCALE_EVEN, IlvScaleBar.DASH_SCALE_ODD, IlvScaleBar.DOUBLE_DASH_SCALE_ODD, IlvScaleBar.SIMPLE_SCALE_BOTTOM, IlvScaleBar.SCALE_EMPTY, IlvScaleBar.DOUBLE_SCALE_EMPTY

getScaleStyle

public int getScaleStyle()
Returns the style used to draw the scale bar.

Returns:
The scale style.

setScaleTextMode

public void setScaleTextMode(int mode)
Sets the label displaying mode.

Parameters:
mode - The text displaying mode.
See Also:
IlvScaleBar.UNIQUE_LABEL, IlvScaleBar.THREE_LABELS

getScaleTextMode

public int getScaleTextMode()
Returns the text mode.

Returns:
The text mode.

setMarginWidth

public void setMarginWidth(int margin)
Specifies the minimum horizontal margin that must be left between the scale bar and the border of the component. This value must be greater than 0. The default value is 2 pixels.

Parameters:
margin - The margin width.

getMarginWidth

public int getMarginWidth()
Returns the minimum margin that must be left between the scale bar and the border of the component.

Returns:
The margin width.

setMarginHeight

public void setMarginHeight(int margin)
Specifies the vertical margin that must be left between the scale bar and the border of the component. This value must be greater than 0. The default value is 4 pixels.

Parameters:
margin - The margin height.

getMarginHeight

public int getMarginHeight()
Returns the vertical margin that must be left between the scale bar and the border of the component.

Returns:
The margin height.

setTextSpacing

public void setTextSpacing(int spacing)
Specifies the text spacing. The text spacing is the number of pixels between the scale text and the scale bar.

Parameters:
spacing - The text spacing.

getTextSpacing

public int getTextSpacing()
Returns the text spacing.

Returns:
The text spacing.

setScaleHeight

public void setScaleHeight(int scaleHeight)
Sets the height of the scale bar. The value must be greater than or equal to 1.

Parameters:
scaleHeight - The height.

getScaleHeight

public int getScaleHeight()
Returns the height of the scale bar.


setAlternateScaleColor

public void setAlternateScaleColor(Color color)
Sets the alternate scale color. Bicolor scale bar styles (DASH_SCALE_EVEN, DOUBLE_DASH_SCALE_EVEN) use this component foreground as first color and this alternate color as a second color.

Parameters:
color - The color.

getAlternateScaleColor

public Color getAlternateScaleColor()
Gets the alternate scale color.

Returns:
The alternate scale color.

setFarLimit

public void setFarLimit(double limit)
Sets the switch limit between a text display of the scale in a small unit (for instance, meters) and a text display in a large unit (for instance, kilometers). If the length of the scale bar expressed in the small units exceeds the limit, then the scale will be displayed in the large unit.

Parameters:
limit - The upper limit.
See Also:
IlvScaleBar.setNearUnit(ilog.views.maps.IlvLinearUnit), IlvScaleBar.setFarUnit(ilog.views.maps.IlvLinearUnit)

getFarLimit

public double getFarLimit()
Returns the switch limit between a text display of the scale in a small unit (for instance, meters) and a text display in a large unit (for instance, kilometers).

Returns:
The upper limit.

setNearUnit

public void setNearUnit(IlvLinearUnit unit)
Sets the unit used to display the length of the scale bar for large scales.

Parameters:
unit - The near unit converter.
See Also:
IlvScaleBar.setFarLimit(double), getNearUnit()

getNearUnit

public IlvLinearUnit getNearUnit()
Returns the unit used to display the length of the scale bar for large scales.

Returns:
The near unit or null if there is no unit.

setFarUnit

public void setFarUnit(IlvLinearUnit unit)
Sets the unit used to display the length of the scale bar for small scales.

Parameters:
unit - The far unit.
See Also:
IlvScaleBar.setFarLimit(double), getFarUnit()

getFarUnit

public IlvLinearUnit getFarUnit()
Returns the unit used to display the length of the scale bar for small scales.

Returns:
The far unit or null if there is no unit.

getPreferredSize

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

Overrides:
getPreferredSize in class JComponent

getMinimumSize

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

Overrides:
getMinimumSize in class JComponent

setGraphic

public void setGraphic(IlvGraphic graphic)
Sets the IlvGraphic that represents the scale part of the IlvScaleBar. If an IlvGraphic is set, then the predefined scales drawings are not used.

Parameters:
graphic - The IlvGraphic that represents the scale part of the IlvScaleBar.

getGraphic

public IlvGraphic getGraphic()
Returns the IlvGraphic that represents the scale part of the IlvScaleBar.

See Also:
setGraphic(ilog.views.IlvGraphic)

paint

public void paint(Graphics g)
Draws the component.

Overrides:
paint in class JComponent

setSize

public void setSize(int width,
                    int height)
Sets the size for this component.

Overrides:
setSize in class Component

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the bounds for this component and updates the scale bar when component is resized.

Overrides:
setBounds in class Component
Parameters:
x - the new x-coordinate of this component
y - the new y-coordinate of this component
width - the new width of this component
height - the new height of this component
Since:
JViews 8.0


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