public class TLcdGXYViewJPanel extends JPanel implements ILcdGXYView, ILcdRotationCapableGXYView, ILcdModelProducerListener, ILcdTreeLayered, ILcdAWTEventSource, ILcdStatusSource
ILcdGXYView
interface as a javax.swing.JPanel
.
ILcdGXYView
functionality, TLcdGXYViewJPanel
supports rotation and can
use an ILcdGXYLayerFactory
to automatically create ILcdGXYLayer
objects from models.
It also offers the ability to subscribe to view invalidation events
.
As with all Swing components, once the view has been realized, all code that might affect or depend on the state of that component should be executed in the event-dispatching thread. This includes all methods that can cause the view to repaint implicitly or explicitly.
This
For a ready-to-use implementation to display maps, see TLcdMapJPanel
.
TLcdMapJPanel
,
Serialized FormJPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
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
CENTER, LOWERLEFT, LOWERRIGHT, UPPERLEFT, UPPERRIGHT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TLcdGXYViewJPanel()
Constructs a new, empty
JPanel -based ILcdGXYView . |
TLcdGXYViewJPanel(boolean aRegisterInstance)
Deprecated.
Use the default constructor.
|
TLcdGXYViewJPanel(ILcdTreeLayeredSupport aTreeLayeredSupport)
Constructs a new, empty
JPanel -based ILcdGXYView . |
Modifier and Type | Method and Description |
---|---|
void |
addAWTEventListener(ILcdAWTEventListener aAWTListener)
This method registers a
ILcdAWTEventListener . |
boolean |
addGXYLayer(ILcdGXYLayer aLayer)
Adds the given
ILcdGXYLayer to this ILcdGXYView . |
boolean |
addGXYLayer(ILcdGXYLayer aLayer,
boolean aRepaint)
Adds the given
ILcdGXYLayer to this ILcdGXYView , forcing a repaint if
desired. |
void |
addLayeredListener(ILcdLayeredListener aLayeredListener)
Registers the given
ILcdLayeredListener to be notified when layers are added,
removed or moved in the flat list. |
void |
addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
Registers the given
ILcdSelectionListener to be informed of selection change events
from any layer in this view. |
void |
addModel(ILcdModel aModel)
Adds
aModel to be displayed in this ILcdView . |
void |
addModelListener(ILcdModelListener aModelListener)
Registers the given
ILcdModelListener to be informed of ILcdModel change events
from any layer's model in this view. |
void |
addNotify() |
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers a listener to be notified of component and view property changes.
|
void |
addStatusListener(ILcdStatusListener aStatusListener)
Registers the given
ILcdStatusListener to be notified of view status events. |
void |
addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
Registers an
ILcdViewInvalidationListener to be informed when the view's contents are invalid. |
ILcdGXYView |
asGXYView()
Deprecated.
Cast the object to
ILcdGXYView instead. |
boolean |
containsLayer(ILcdLayer aLayer)
Returns whether the flat list representation of the hierarchical layer structure contains
the given layer.
|
Color |
getBackground()
Returns the background color of the view.
|
ILcdIcon |
getCornerIcon(int aPosition)
Returns the
ILcdIcon to be painted at the given corner of the view. |
ILcdGXYPen |
getDefaultPen()
Deprecated.
Use the relevant layer's pen instead.
|
String |
getDisplayName()
Returns the name of the view for display purposes.
|
ILcdGXYController |
getGXYController()
Returns the
ILcdGXYController handling the user interaction of the view. |
ILcdGXYLayerFactory |
getGXYLayerFactory()
Returns the layer factory used when adding models to the view.
|
ILcdGXYViewLabelPainter |
getGXYViewLabelPainter()
Returns the label painting algorithm for this view.
|
ILcdGXYViewLabelPlacer |
getGXYViewLabelPlacer()
Returns the label placer for this view.
|
ILcdGXYViewXYWorldTransformation |
getGXYViewXYWorldTransformation()
Returns a valid
ILcdGXYViewXYWorldTransformation for an ILcdGXYView . |
Image |
getImage()
Returns an
Image of this view. |
ILcdLayer |
getLayer(int aIndex)
Returns the
ILcdLayer with index aIndex in the flat list
representation of the hierarchical layer structure. |
double |
getMaxScale()
Returns the maximum zoomed in scale of the view.
|
double |
getMinScale()
Returns the maximum zoomed out scale of the view.
|
int |
getNumberOfCachedBackgroundLayers()
Returns the number of layers whose combined representation is cached across repaints.
|
ILcdPaintExceptionHandler |
getPaintExceptionHandler()
Returns a handler to report paint exceptions.
|
int |
getPaintingMode()
Deprecated.
This implementation ignores the painting mode setting, always making sure that
bodies, labels and selections are painted.
|
ILcdLayerTreeNode |
getRootNode()
Returns the root node of the tree structure.
|
double |
getRotation()
Returns the rotation of this
ILcdGXYView . |
double |
getScale()
Returns the scale for which to paint the view contents expressed in toolkit pixels per world unit.
|
Point |
getViewOrigin()
Returns the point in AWT pixel coordinates that maps onto the world origin.
|
ILcdPoint |
getWorldOrigin()
Returns the point in world coordinates that maps onto the view origin.
|
ILcdXYWorldReference |
getXYWorldReference()
Returns the view's 2D world coordinate system.
|
boolean |
hasValidImage()
Deprecated.
getImage() always returns a valid image
|
int |
indexOf(ILcdLayer aLayer)
Returns the index of the given layer
aLayer in the flat list representation of
the hierarchical structure. |
void |
invalidate(boolean aRepaint,
Object aSource,
String aMessage)
Asks the view to invalidate its content,
optionally repainting the content asynchronously.
|
void |
invalidateAndWait(boolean aRepaint,
Object aSource,
String aMessage)
Asks the view to invalidate its content,
optionally repainting the content synchronously.
|
void |
invalidateGXYLayer(ILcdGXYLayer aGXYLayer,
boolean aRepaint,
Object aSource,
String aMessage)
Asks the view to invalidate the content of the given
ILcdGXYLayer ,
optionally repainting the content asynchronously. |
void |
invalidateGXYLayerAndWait(ILcdGXYLayer aGXYLayer,
boolean aRepaint,
Object aSource,
String aMessage)
Asks the view to invalidate the content of the given
ILcdGXYLayer ,
optionally repainting the content synchronously. |
void |
invalidateRegion(Rectangle aClip,
boolean aRepaint,
Object aSource,
String aMessage)
Asks the view to invalidate the content in the given AWT clip,
optionally repainting the content asynchronously.
|
void |
invalidateRegionAndWait(Rectangle aClip,
boolean aRepaint,
Object aSource,
String aMessage)
Asks the view to invalidate the content in the given AWT clip,
optionally repainting the content synchronously.
|
void |
invalidateRegionSelection(Rectangle aClip,
boolean aRepaint,
Object aSource,
String aMessage)
Asks the ILcdGXYView to invalidate its selection in the given AWT clip,
optionally repainting the content asynchronously.
|
void |
invalidateRegionSelectionAndWait(Rectangle aClip,
boolean aRepaint,
Object aSource,
String aMessage)
Asks the ILcdGXYView to invalidate its selection in the given AWT clip,
optionally repainting the content synchronously.
|
void |
invalidateSelection(boolean aRepaint,
Object aSource,
String aMessage)
Asks the ILcdGXYView to invalidate its selection,
optionally repainting the content asynchronously.
|
void |
invalidateSelectionAndWait(boolean aRepaint,
Object aSource,
String aMessage)
Asks the ILcdGXYView to invalidate its selection,
optionally repainting the content synchronously.
|
void |
invokeLater(Runnable aRunnable)
Deprecated.
|
boolean |
isAntiAliased()
Specifies if anti-aliasing is enabled or not.
|
boolean |
isAsynchronousAllowed()
Returns whether this view allows asynchronous operations.
|
boolean |
isAutoUpdate()
Returns whether the view's contents are automatically updated when necessary.
|
boolean |
isDrawOffScreenImageOnPaint()
Returns whether the entire view's content is displayed, or only the controller's
representation.
|
boolean |
isPaintInBackground()
Deprecated.
This method has been deprecated in favor of the approach
provided by the
ILcdGXYAsynchronousLayerWrapper
interface and its implementations, which is more versatile and
which generally offers better thread safety. |
boolean |
isSmartPan()
Indicates whether smart panning is turned on or off.
|
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
boolean |
isUpdateLabelsOnSelectionChanged()
Deprecated.
This property is not taken into account anymore.
|
boolean |
isWaitCursorOn()
Returns whether a wait cursor is displayed when the
ILcdGXYView is
repainting. |
int |
layerCount()
Returns the number of layers in the flat list representation of the hierarchical layer
structure.
|
ILcdLayer |
layerOf(ILcdModel aModel)
Returns the
ILcdLayer of the flat list that contains the given
ILcdModel . |
Enumeration |
layers()
Returns an
Enumeration of all the ILcdLayer s currently in the flat
list representation of the hierarchical layer structure, starting from the bottom layer to the
top layer. |
Enumeration |
layersBackwards()
Returns an
Enumeration of all the ILcdLayer s currently in the flat
list representation of the hierarchical layer structure, starting from the top layer to the
bottom layer. |
void |
modelProduced(TLcdModelProducerEvent aModelProducerEvent)
The produced model is added to the view, provided that a layer factory supporting
the model is set.
|
void |
moveLayerAt(int aIndex,
ILcdLayer aLayer)
Moves the given layer (which is already in
ILcdLayered ) to the existing index
aIndex. |
protected void |
paintComponent(Graphics aGraphics)
Calls paintGXYView( aGraphics ).
|
void |
paintGXYView(Graphics aGraphics)
Paints the view on the given
Graphics . |
void |
pan(int aDeltaX,
int aDeltaY,
boolean aRepaint)
Changes the view and/or world origin of the view so that the view contents are panned
by the specified AWT delta.
|
protected void |
printComponent(Graphics aGraphics)
Overrides
JComponent.printComponent(java.awt.Graphics) for unbuffered printing. |
protected void |
processEvent(AWTEvent e) |
void |
putCornerIcon(ILcdIcon aCornerIcon,
int aPosition)
Sets an
ILcdIcon to be painted at the given corner of this
view. |
protected void |
registerInstance()
Deprecated.
TLcdBeanManager registration is no longer used. |
void |
removeAllLayers()
Remove all the layers from the hierarchical layer structure and the flat list
representation.
|
void |
removeAWTEventListener(ILcdAWTEventListener aAWTListener)
This method removes a registered
ILcdAWTEventListener , or does nothing if the passed
listener wasn't registered. |
void |
removeLayer(ILcdLayer aLayer)
Removes a layer from both the hierarchical layer structure and the flat list representation.
|
void |
removeLayeredListener(ILcdLayeredListener aLayeredListener)
Unregisters the given
ILcdLayeredListener from receiving layered events for the
flat list. |
void |
removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
Unregisters the given
ILcdSelectionListener from receiving selection change events
from any layer in this view. |
void |
removeModel(ILcdModel aModel)
Removes the
ILcdGXYLayer containing the model from the view. |
void |
removeModelListener(ILcdModelListener aModelListener)
Unregisters the given
ILcdModelListener from receiving ILcdModel change events
from any layer's model in this view. |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Unregisters the given
PropertyChangeListener from receiving property change events
for this view. |
void |
removeStatusListener(ILcdStatusListener aStatusListener)
Unregisters the given
ILcdStatusListener from being notified of view status events. |
void |
removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
Unregisters an
ILcdViewInvalidationListener so that it is no longer informed
of invalidation events for this view. |
void |
setAntiAliased(boolean aAntiAliased)
Changes the anti-aliasing behavior.
|
void |
setAsynchronousAllowed(boolean aAsynchronousAllowed)
Sets if asynchronous operation are allowed for this view.
|
void |
setAutoUpdate(boolean aAutoUpdate)
Sets whether to update the view's representation automatically to keep it in sync with its
state and the state of its models.
|
void |
setBackground(Color aColor)
Sets the background color of the view.
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setDefaultPen(ILcdGXYPen aDefaultPen)
Deprecated.
Use the relevant layer's pen instead.
|
void |
setDisplayName(String newDisplayName)
Sets the name of the view for display purposes.
|
void |
setDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint)
Sets whether the entire view's content is displayed, or only the current controller's
representation.
|
void |
setGXYController(ILcdGXYController aGXYViewController)
Makes the given
ILcdGXYController handle the user interaction of the view. |
void |
setGXYLayerFactory(ILcdGXYLayerFactory newGXYLayerFactory)
Sets the layer factory to use when adding models to the view.
|
void |
setGXYViewLabelPainter(ILcdGXYViewLabelPainter aGXYViewLabelPainter)
Sets the label painter algorithm for this
ILcdGXYView . |
void |
setGXYViewLabelPlacer(ILcdGXYViewLabelPlacer aGXYViewLabelPlacer)
This method sets an
ILcdGXYViewLabelPlacer to use for global labeling. |
void |
setMaxScale(double aMaxScale)
Limits the maximum zoomed in scale of the view.
|
void |
setMinScale(double aMinScale)
Limits the maximum zoomed out scale of the view.
|
void |
setNumberOfCachedBackgroundLayers(int aNumberOfCachedBackgroundLayers)
Sets the number of layers whose combined representation is cached across repaints.
|
void |
setPaintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
Sets a handler to report paint exceptions.
|
void |
setPaintInBackground(boolean aUpdateInBackground)
Deprecated.
This method has been deprecated in favor of the approach
provided by the
ILcdGXYAsynchronousLayerWrapper
interface and its implementations, which is more versatile and
which generally offers better thread safety. |
void |
setPaintingMode(int aPaintingMode)
Deprecated.
This implementation ignores the painting mode setting, always making sure that
bodies, labels and selections are painted.
|
void |
setRotation(double aRotation)
Sets the rotation of this
ILcdGXYView , updating the view according to
ILcdView.isAutoUpdate() . |
void |
setRotation(double aRotation,
boolean aAdjusting)
Sets the rotation of this
ILcdGXYView , optionally indicating subsequent property changes. |
void |
setRotation(double aRotation,
boolean aRepaint,
boolean aAdjusting)
Sets the rotation of this
ILcdGXYView , optionally repainting the view. |
void |
setScale(double aScale)
Sets the scale of this view, repainting the view according to
isAutoUpdate . |
void |
setScale(double aScale,
boolean aRepaint)
Sets the scale of this view, optionally repainting the view.
|
void |
setScale(double aScale,
boolean aRepaint,
boolean aAdjusting)
Sets the scale of this view, optionally indicating subsequent property changes.
|
void |
setScale(double aScaleX,
double aScaleY,
boolean aRepaint,
boolean aAdjusting)
Sets the scale along the x-axis and y-axis of this view, repainting the view
according to
isAutoUpdate . |
void |
setSmartPan(boolean aSmartPan)
Sets whether to reuse existing imagery when panning.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setUpdateLabelsOnSelectionChanged(boolean aUpdateLabelsOnSelectionChanged)
Deprecated.
This property is not used.
|
void |
setViewOrigin(Point aViewOrigin)
Sets the view origin of the view, repainting the view according to
isAutoUpdate . |
void |
setViewOrigin(Point aViewOrigin,
boolean aRepaint)
Sets the view origin of the view, optionally repainting the view.
|
void |
setViewOrigin(Point aViewOrigin,
boolean aRepaint,
boolean aAdjusting)
Sets the view origin of the view, optionally indicating subsequent property changes.
|
void |
setWaitCursorOn(boolean aWaitCursorOn)
Sets whether to display a wait cursor when the
ILcdGXYView is
repainting. |
void |
setWorldOrigin(ILcdPoint aWorldOrigin)
Sets the world origin of the view, repainting the view according to
isAutoUpdate . |
void |
setWorldOrigin(ILcdPoint aWorldOrigin,
boolean aRepaint)
Sets the world origin of the view, optionally repainting the view.
|
void |
setWorldOrigin(ILcdPoint aWorldOrigin,
boolean aRepaint,
boolean aAdjusting)
Sets the world origin of the view, optionally indicating subsequent property changes.
|
void |
setXYWorldReference(ILcdXYWorldReference aXYWorldReference)
Sets the view's 2D world coordinate system, repainting the view according to
isAutoUpdate . |
void |
setXYWorldReference(ILcdXYWorldReference aXYWorldReference,
boolean aRepaint)
Sets the view's 2D world coordinate system, optionally repainting the view.
|
void |
setXYWorldReference(ILcdXYWorldReference aXYWorldReference,
boolean aRepaint,
boolean aAdjusting)
Sets the view's 2D world coordinate system, optionally indicating subsequent property changes.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, 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, 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
add, add, add, add, add, addContainerListener, addImpl, 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, 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, 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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getForeground, getGraphics, getHeight, getLayers, getMapScale, getMapScaleRange, getPreferredSize, getWidth, repaint, repaint, setCursor, setForeground, setMapScale, setMapScaleRange
addLayeredListener, removeLayeredListener
public TLcdGXYViewJPanel()
JPanel
-based ILcdGXYView
.
Auto-update is activated by default, no background layers are cached, and no default user interaction is provided.
After construction, a world coordinate system needs to be set using setXYWorldReference(com.luciad.view.ILcdXYWorldReference)
.
public TLcdGXYViewJPanel(ILcdTreeLayeredSupport aTreeLayeredSupport)
Constructs a new, empty JPanel
-based ILcdGXYView
. Auto-update is
activated by default, no background layers are cached, and no default user interaction is
provided.
After construction, a world coordinate system needs to be set using setXYWorldReference(com.luciad.view.ILcdXYWorldReference)
.
aTreeLayeredSupport
- an instance of ILcdTreeLayeredSupport
used to store the layerspublic TLcdGXYViewJPanel(boolean aRegisterInstance)
JPanel
-based ILcdGXYView
.aRegisterInstance
- if true, registers the view with TLcdBeanManager
TLcdGXYViewJPanel()
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.aTraceOn
- if true then all log messages are recorded for this
instance. If false, then only the informative, warning and
error log messages are recorded.public boolean isTraceOn()
true
if tracing is enabled for this class.protected void processEvent(AWTEvent e)
processEvent
in class Container
public void pan(int aDeltaX, int aDeltaY, boolean aRepaint)
smart pan
feature.pan
in interface ILcdGXYView
aDeltaX
- the shift in the X direction in screen coordinatesaDeltaY
- the shift in the Y direction in screen coordinatesaRepaint
- if true
, will trigger a repaint of the view's contents.
Depending on the implementation, only the newly exposed areas may be painted.
If false, the view is not repainted.isSmartPan()
public void invokeLater(Runnable aRunnable)
EventQueue.invokeLater(java.lang.Runnable)
aRunnable
- runnable to invokeprotected void paintComponent(Graphics aGraphics)
paintComponent
in class JComponent
JComponent.paintComponent(java.awt.Graphics)
,
paintGXYView(java.awt.Graphics)
public void paintGXYView(Graphics aGraphics)
ILcdGXYView
Graphics
.
The painted image contains the following:
view label painter
, if it is set;
invalidate
methods.paintGXYView
in interface ILcdGXYView
aGraphics
- the Graphics
to paint the contents of this view onILcdGXYView.invalidate(boolean, java.lang.Object, java.lang.String)
protected void printComponent(Graphics aGraphics)
JComponent.printComponent(java.awt.Graphics)
for unbuffered printing.printComponent
in class JComponent
protected void registerInstance()
TLcdBeanManager
registration is no longer used.TLcdBeanManager
public ILcdGXYView asGXYView()
ILcdGXYView
instead.ILcdGXYView
.public void setDisplayName(String newDisplayName)
newDisplayName
- the new name of the viewgetDisplayName()
public String getDisplayName()
setDisplayName(java.lang.String)
public void addNotify()
addNotify
in class JComponent
public void addModel(ILcdModel aModel)
aModel
to be displayed in this ILcdView
.
This method creates an ILcdGXYLayer
containing the model and adds it to the view.
For this to work, a layer factory supporting the given model must be set on the view.
addModel
in interface ILcdView
IllegalArgumentException
- if the model is null
, if no layer factory is set, or if
the layer factory cannot create a layer for the given modelremoveModel(com.luciad.model.ILcdModel)
,
setGXYLayerFactory(com.luciad.view.gxy.ILcdGXYLayerFactory)
public void removeModel(ILcdModel aModel)
ILcdGXYLayer
containing the model from the view.
Removes a single representation of the specified model from this
view, if it is present in the view.removeModel
in interface ILcdView
addModel(com.luciad.model.ILcdModel)
public void addLayeredListener(ILcdLayeredListener aLayeredListener)
ILcdLayeredListener
to be notified when layers are added,
removed or moved in the flat list.addLayeredListener
in interface ILcdLayered
addLayeredListener
in interface ILcdTreeLayered
aLayeredListener
- the listener that from now on will be notified of all changes to the
flat list.removeLayeredListener(com.luciad.view.ILcdLayeredListener)
public void removeLayeredListener(ILcdLayeredListener aLayeredListener)
ILcdLayeredListener
from receiving layered events for the
flat list.removeLayeredListener
in interface ILcdLayered
removeLayeredListener
in interface ILcdTreeLayered
aLayeredListener
- the listener that will no longer be notified of changes in the flat
list.addLayeredListener(com.luciad.view.ILcdLayeredListener)
public int layerCount()
ILcdTreeLayered
Returns the number of layers in the flat list representation of the hierarchical layer structure. This does not include the root node.
layerCount
in interface ILcdLayered
layerCount
in interface ILcdTreeLayered
public Enumeration layers()
ILcdTreeLayered
Returns an Enumeration
of all the ILcdLayer
s currently in the flat
list representation of the hierarchical layer structure, starting from the bottom layer to the
top layer. This does not include the root node.
layers
in interface ILcdLayered
layers
in interface ILcdTreeLayered
Enumeration
of all the ILcdLayer
s currently in the flat
list, starting from the bottom layer to the top layer. Does not include the root node.public Enumeration layersBackwards()
ILcdTreeLayered
Returns an Enumeration
of all the ILcdLayer
s currently in the flat
list representation of the hierarchical layer structure, starting from the top layer to the
bottom layer. This does not include the root node.
layersBackwards
in interface ILcdLayered
layersBackwards
in interface ILcdTreeLayered
Enumeration
of all the ILcdLayer
s currently in the flat
list, starting from the top layer to the bottom layer. Does not include the root node.public ILcdLayer getLayer(int aIndex) throws ArrayIndexOutOfBoundsException
ILcdTreeLayered
Returns the ILcdLayer
with index aIndex
in the flat list
representation of the hierarchical layer structure.
getLayer
in interface ILcdLayered
getLayer
in interface ILcdTreeLayered
aIndex
- the position of the layer to retrieve in the flat list representation.ILcdLayer
with index aIndex
in the flat list
representationArrayIndexOutOfBoundsException
- if the given index is invalidpublic ILcdLayer layerOf(ILcdModel aModel) throws NoSuchElementException
ILcdLayer
of the flat list that contains the given
ILcdModel
.
If more than one layer contain the model, the bottommost is returned.layerOf
in interface ILcdLayered
layerOf
in interface ILcdTreeLayered
aModel
- the model to check for in the flat listILcdLayer
of the flat list that contains the given
ILcdModel
.NoSuchElementException
- if there is no layer containing the given modelpublic int indexOf(ILcdLayer aLayer) throws NoSuchElementException
ILcdTreeLayered
Returns the index of the given layer aLayer
in the flat list representation of
the hierarchical structure.
indexOf
in interface ILcdLayered
indexOf
in interface ILcdTreeLayered
aLayer
- the layer whose index to returnaLayer
in the flat list representationNoSuchElementException
- if aLayer
is not in the flat listpublic void moveLayerAt(int aIndex, ILcdLayer aLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException
ILcdLayered
ILcdLayered
) to the existing index
aIndex.
When a layer is moved down, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position up.
When a layer is moved up, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position down.
More formally, let previousIndex be the index of aLayer
before the move.
If previousIndex < aIndex, then the index of all ILcdLayer
objects
in from previousIndex + 1 to aIndex is decremented with 1.
If previousIndex > aIndex, then the index of all ILcdLayer
objects
in from aIndex to previousIndex -1 is incremented with 1.
moveLayerAt
in interface ILcdLayered
aIndex
- the index of the position where to move the layer.aLayer
- the layer to move.NoSuchElementException
- if aLayer
is not in this ILcdLayered
.ArrayIndexOutOfBoundsException
- if aIndex
is not an index of one of
the layers of this ILcdLayered
.public void removeLayer(ILcdLayer aLayer)
ILcdTreeLayered
Removes a layer from both the hierarchical layer structure and the flat list representation.
When removing an ILcdLayerTreeNode
all of its children will also be removed. An
event will then be generated for every layer that has been removed (one for the node and one
for each of its child layers).
It is not possible to remove the root node
removeLayer
in interface ILcdLayered
removeLayer
in interface ILcdTreeLayered
aLayer
- the layer to remove. If the layer is not in the flat list, this method has no effect.public void removeAllLayers()
ILcdTreeLayered
Remove all the layers from the hierarchical layer structure and the flat list representation. An event will be fired for every layer that has been removed. This will not remove the root node.
removeAllLayers
in interface ILcdLayered
removeAllLayers
in interface ILcdTreeLayered
public boolean containsLayer(ILcdLayer aLayer)
ILcdTreeLayered
Returns whether the flat list representation of the hierarchical layer structure contains
the given layer. More formally, returns true
if and only if the flat list
representation contains at least one layer l
such that (aLayer==null ? l==null : aLayer.equals(l)).
Calling this method with the root node will return false
, since the
root node is not a part of the flat list representation.
containsLayer
in interface ILcdLayered
containsLayer
in interface ILcdTreeLayered
aLayer
- the layer to check whether it is in the flat list representationtrue
when the flat list representation contains the given layer,
false
otherwisepublic void putCornerIcon(ILcdIcon aCornerIcon, int aPosition)
ILcdIcon
to be painted at the given corner of this
view. Only the last set icon for the given position is painted.putCornerIcon
in interface ILcdGXYView
aCornerIcon
- the ILcdIcon
to be painted at the given corner or null
to unregister the iconaPosition
- one of ILcdGXYView.UPPERLEFT
, ILcdGXYView.UPPERRIGHT
,
ILcdGXYView.LOWERRIGHT
, ILcdGXYView.LOWERLEFT
getCornerIcon(int)
public ILcdIcon getCornerIcon(int aPosition)
ILcdIcon
to be painted at the given corner of the view.aPosition
- one of ILcdGXYView.UPPERLEFT
, ILcdGXYView.UPPERRIGHT
,
ILcdGXYView.LOWERRIGHT
, ILcdGXYView.LOWERLEFT
ILcdIcon
to be painted at the given corner or null
when
no icon has to be painted at the given cornerputCornerIcon(com.luciad.gui.ILcdIcon, int)
public boolean addGXYLayer(ILcdGXYLayer aLayer)
ILcdGXYView
ILcdGXYLayer
to this ILcdGXYView
. The layer is
normally added to the top of the view's layers, but that is implementation specific.
The view will be repainted depending on the result of isAutoUpdate
.
No action is performed if the given layer is already contained
in the list.addGXYLayer
in interface ILcdGXYView
aLayer
- the layer to add to this viewtrue
if the layer was added successfully,
false
if the view already contained the layerILcdLayered.containsLayer(com.luciad.view.ILcdLayer)
public boolean addGXYLayer(ILcdGXYLayer aLayer, boolean aRepaint)
ILcdGXYView
ILcdGXYLayer
to this ILcdGXYView
, forcing a repaint if
desired. The layer is normally added to the top of the view's layers, but that is
implementation specific. No action is performed if the given layer is already contained in the
list.addGXYLayer
in interface ILcdGXYView
aLayer
- the layer to add to this viewaRepaint
- if true, the view is repainted. If false, the view is not repainted.true
if the layer was added successfully,
false
if the view already contained the layerILcdLayered.containsLayer(com.luciad.view.ILcdLayer)
public int getNumberOfCachedBackgroundLayers()
ILcdGXYView
getNumberOfCachedBackgroundLayers
in interface ILcdGXYView
ILcdGXYView.setNumberOfCachedBackgroundLayers(int)
public void setNumberOfCachedBackgroundLayers(int aNumberOfCachedBackgroundLayers)
ILcdGXYView
Caching background layers is useful when one upper real-time layer needs to be refreshed often, whereas the contents of the background layers seldom change. When a real-time layer changes and needs to be repainted, the cached representation of the background layers is reused, speeding up the paint process. When a background layer changes, all layers need to be repainted to update the view.
setNumberOfCachedBackgroundLayers
in interface ILcdGXYView
aNumberOfCachedBackgroundLayers
- the number of bottommost layers to cache. This number applies to the flat list
of layers.ILcdGXYView.getNumberOfCachedBackgroundLayers()
,
ILcdGXYView.invalidateGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, boolean, java.lang.Object, java.lang.String)
public boolean hasValidImage()
true
if the view has a valid image.hasValidImage
in interface ILcdGXYView
true
ILcdGXYView.getImage()
public Image getImage()
ILcdGXYView
Image
of this view. The image has not been painted on by the controller.
This method is guaranteed to return an up-to-date image: if the view has been invalidated in
some way (e.g. when a layer has been removed) then this method first updates the view before
returning an image.
To improve performance and conserve memory, the view is allowed to cache, reuse and overwrite the image
in subsequent repaints.
NOTE: While using High DPI mode, this method will return an image which is bigger than the view dimensions reported
by getWidth()
and getHeight()
methods.getImage
in interface ILcdGXYView
public void setBackground(Color aColor)
The default color is the color returned by SystemColor.control. Note that the alpha channel of the Color is not taken into account.
setBackground
in interface ILcdGXYView
setBackground
in class JComponent
aColor
- the color which appears at a location where no data is painted.getBackground()
public Color getBackground()
The default color is the color returned by SystemColor.control. Note that the alpha channel of the Color is not taken into account.
getBackground
in interface ILcdGXYView
getBackground
in class Component
setBackground(java.awt.Color)
public void setScale(double aScale)
ILcdGXYView
isAutoUpdate
.
The scale corresponds to the number of pixels per world unit, as determined by the
ILcdXYWorldReference
. Hence, increasing the scale zooms in, and decreasing the
scale zooms out.
A view displaying geographical data usually employs a scale in pixels per meter.
As an example, to fit the world on a view that is 1000 pixels wide, a scale of about
1000 pixels/40.000km, or 1.0/40.000 is needed.
For most use cases, we recommended setting the unitless map scale
instead.setScale
in interface ILcdGXYView
aScale
- the new scale of the view. The view is scaled using the world origin as center.
The scale is limited so that it does not exceed the interval defined by
the minimum and maximum scales.ILcdGXYView.getScale()
,
ILcdGXYView.getMinScale()
,
ILcdGXYView.getMaxScale()
public void setScale(double aScale, boolean aRepaint)
ILcdGXYView
ILcdXYWorldReference
. Hence, increasing the scale zooms in, and decreasing the
scale zooms out.
A view displaying geographical data usually employs a scale in pixels per meter.
As an example, to fit the world on a view that is 1000 pixels wide, a scale of about
1000 pixels/40.000km, or 1.0/40.000 is needed.
For most use cases, we recommended setting the unitless map scale
instead.setScale
in interface ILcdGXYView
aScale
- the new scale of the view. The view is scaled using the world origin as center.
The scale is limited so that it does not exceed the interval defined by
the minimum and maximum scales.aRepaint
- if true
, the view is repainted. If false, the view is not repainted.ILcdGXYView.getScale()
,
ILcdGXYView.getMinScale()
,
ILcdGXYView.getMaxScale()
public void setScale(double aScale, boolean aRepaint, boolean aAdjusting)
ILcdGXYView
ILcdXYWorldReference
. Hence, increasing the scale zooms in, and decreasing the
scale zooms out.
A view displaying geographical data usually employs a scale in pixels per meter.
As an example, to fit the world on a view that is 1000 pixels wide, a scale of about
1000 pixels/40.000km, or 1.0/40.000 is needed.
For most use cases, we recommended setting the unitless map scale
instead.setScale
in interface ILcdGXYView
aScale
- the new scale of the view. The view is scaled using the world origin as center.
The scale is limited so that it does not exceed the interval defined by
the minimum and maximum scales.aRepaint
- if true
, the view is repainted. If false, the view is not repainted.aAdjusting
- if true
, the caller indicates that he will trigger another property change
right after this call. This is reflected in the associated property change event.ILcdGXYView.getScale()
,
ILcdGXYView.getMinScale()
,
ILcdGXYView.getMaxScale()
public void setScale(double aScaleX, double aScaleY, boolean aRepaint, boolean aAdjusting)
ILcdGXYView
isAutoUpdate
.
The scale corresponds to the number of pixels per world unit,
as determined by the ILcdXYWorldReference
. For example, a view displaying geographical data
could use a scale in pixels per meter.
The default implementation in this interface sets both scales to the geometric mean of the requested scales. The concrete view implementations do respect the individual scales.
setScale
in interface ILcdGXYView
aScaleX
- the new scale along the x-axis of the view.aScaleY
- the new scale along the y-axis of the view.aRepaint
- if true
, the view is repainted. If false, the view is not repainted.aAdjusting
- if true
, the caller indicates that he will trigger another property change
right after this call. This is reflected in the associated property change event.TLcdGXYViewXYWorldTransformation.getScaleX()
,
TLcdGXYViewXYWorldTransformation.getScaleY()
public double getScale()
ILcdGXYView
unitless map scale
instead.getScale
in interface ILcdGXYView
ILcdGXYView.setScale(double)
,
ILcdGXYView.getMapScale(com.luciad.view.TLcdMapScale.ScaleLocation)
public void setMinScale(double aMinScale)
ILcdGXYView
ILcdGXYView.setScale(double)
or ILcdGXYView.setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
will ensure that the scale does not fall below the minimum scale.
For most use cases, we recommended using the unitless map scale
variant instead.setMinScale
in interface ILcdGXYView
aMinScale
- the new minimum scale of this viewILcdGXYView.setScale(double)
,
ILcdGXYView.getMinScale()
public double getMinScale()
ILcdGXYView
ILcdGXYView.setScale(double)
or ILcdGXYView.setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
will ensure that the scale does not fall below the minimum scale.
For most use cases, we recommended using the unitless map scale
variant instead.getMinScale
in interface ILcdGXYView
ILcdGXYView.setScale(double)
,
ILcdGXYView.setMinScale(double)
public void setMaxScale(double aMaxScale)
ILcdGXYView
ILcdGXYView.setScale(double)
or ILcdGXYView.setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
will ensure that the scale does not rise above the maximum scale.
For most use cases, we recommended using the unitless map scale
variant instead.setMaxScale
in interface ILcdGXYView
aMaxScale
- the new maximum scale of this viewILcdGXYView.setScale(double)
,
ILcdGXYView.getMaxScale()
public double getMaxScale()
ILcdGXYView
ILcdGXYView.setScale(double)
or ILcdGXYView.setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
will ensure that the scale does not rise above the maximum scale.
For most use cases, we recommended using the unitless map scale
variant instead.getMaxScale
in interface ILcdGXYView
ILcdGXYView.setScale(double)
,
ILcdGXYView.setMaxScale(double)
public void setWorldOrigin(ILcdPoint aWorldOrigin)
ILcdGXYView
isAutoUpdate
.
The world origin is a point in world coordinates that maps onto the view origin.setWorldOrigin
in interface ILcdGXYView
aWorldOrigin
- the new world origin of this view, expressed in world coordinates.
Only the XY coordinates are considered.ILcdGXYView.getWorldOrigin()
,
ILcdGXYView.getXYWorldReference()
public void setWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint)
ILcdGXYView
setWorldOrigin
in interface ILcdGXYView
aWorldOrigin
- the new world origin of this view, expressed in world coordinates.
Only the XY coordinates are considered.aRepaint
- if true
, the view is repainted. If false, the view is not repainted.ILcdGXYView.getWorldOrigin()
,
ILcdGXYView.getXYWorldReference()
public void setWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint, boolean aAdjusting)
ILcdGXYView
setWorldOrigin
in interface ILcdGXYView
aWorldOrigin
- the new world origin of this view, expressed in world coordinates.
Only the XY coordinates are considered.aRepaint
- if true
, the view is repainted. If false, the view is not repainted.aAdjusting
- if true
, the caller indicates that he will trigger another property change right
after this call.
This is reflected in the associated property change event.ILcdGXYView.getWorldOrigin()
,
ILcdGXYView.getXYWorldReference()
public ILcdPoint getWorldOrigin()
ILcdGXYView
getWorldOrigin
in interface ILcdGXYView
ILcdGXYView.setWorldOrigin(com.luciad.shape.ILcdPoint)
,
ILcdGXYView.getViewOrigin()
,
ILcdGXYView.getXYWorldReference()
public void setViewOrigin(Point aViewOrigin)
ILcdGXYView
isAutoUpdate
.
The view origin is a point in AWT pixel coordinates that maps onto the world origin.setViewOrigin
in interface ILcdGXYView
aViewOrigin
- the new view origin of this view, expressed in AWT pixel coordinatesILcdGXYView.getViewOrigin()
,
ILcdGXYView.getWorldOrigin()
public void setViewOrigin(Point aViewOrigin, boolean aRepaint)
ILcdGXYView
setViewOrigin
in interface ILcdGXYView
aViewOrigin
- the new view origin of this view, expressed in AWT pixel coordinatesaRepaint
- if true
, the view is repainted. If false, the view is not repainted.ILcdGXYView.getWorldOrigin()
,
ILcdGXYView.getViewOrigin()
public void setViewOrigin(Point aViewOrigin, boolean aRepaint, boolean aAdjusting)
ILcdGXYView
setViewOrigin
in interface ILcdGXYView
aViewOrigin
- the new view origin of this view, expressed in AWT pixel coordinatesaRepaint
- if true
, the view is repainted. If false, the view is not repainted.aAdjusting
- if true
, the caller indicates that he will trigger another property change
right after this call. This is reflected in the associated property change event.ILcdGXYView.getWorldOrigin()
,
ILcdGXYView.getViewOrigin()
public Point getViewOrigin()
ILcdGXYView
getViewOrigin
in interface ILcdGXYView
ILcdGXYView.getWorldOrigin()
,
ILcdGXYView.setViewOrigin(java.awt.Point)
public double getRotation()
ILcdRotationCapableGXYView
ILcdGXYView
. The rotation is expressed in degrees
and is positive counter-clockwise. The rotation is applied in the world reference system
around the worldOrigin.getRotation
in interface ILcdRotationCapable
getRotation
in interface ILcdRotationCapableGXYView
ILcdGXYView
. The rotation is expressed in degrees
and is positive counter-clockwise.ILcdRotationCapableGXYView.setRotation(double)
public void setRotation(double aRotation, boolean aRepaint, boolean aAdjusting)
ILcdGXYView
, optionally repainting the view.
The rotation is expressed in degrees and is positive counter-clockwise.
The rotation is applied in the world reference system around the worldOrigin.aRotation
- the new rotation value expressed in degrees (positive counter-clockwise)aAdjusting
- if true, the caller indicates that he will trigger another property change right after this call.
This is reflected in the associated property change event.aRepaint
- if true, the view is repaintedgetRotation()
public void setRotation(double aRotation)
ILcdRotationCapableGXYView
ILcdGXYView
, updating the view according to
ILcdView.isAutoUpdate()
.
The rotation is expressed in degrees
and is positive counter-clockwise. The rotation is applied in the world reference system
around the worldOrigin.setRotation
in interface ILcdRotationCapable
setRotation
in interface ILcdRotationCapableGXYView
aRotation
- the new rotation value expressed in degrees (positive counter-clockwise).ILcdRotationCapableGXYView.getRotation()
public void setRotation(double aRotation, boolean aAdjusting)
ILcdRotationCapableGXYView
ILcdGXYView
, optionally indicating subsequent property changes.
The rotation is expressed in degrees and is positive counter-clockwise.
The rotation is applied in the world reference system around the worldOrigin.setRotation
in interface ILcdRotationCapable
setRotation
in interface ILcdRotationCapableGXYView
aRotation
- the new rotation value expressed in degrees (positive counter-clockwise)aAdjusting
- if true, the caller indicates that he will trigger another property change right after this call.
This is reflected in the associated property change event.ILcdRotationCapableGXYView.getRotation()
public ILcdGXYViewXYWorldTransformation getGXYViewXYWorldTransformation()
ILcdGXYViewXYWorldTransformationProvider
ILcdGXYViewXYWorldTransformation
for an ILcdGXYView
.
Users of the transformation should update their reference when the view's
world origin
,
view origin
,
rotation
, or scale
changes.getGXYViewXYWorldTransformation
in interface ILcdGXYViewXYWorldTransformationProvider
ILcdGXYViewXYWorldTransformation
public void setXYWorldReference(ILcdXYWorldReference aXYWorldReference)
ILcdGXYView
isAutoUpdate
.setXYWorldReference
in interface ILcdGXYView
aXYWorldReference
- the new ILcdXYWorldReference
associated to this viewILcdXYWorldReference
,
ILcdGXYView.getXYWorldReference()
,
ILcdGXYView.setWorldOrigin(com.luciad.shape.ILcdPoint)
public void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint)
ILcdGXYView
setXYWorldReference
in interface ILcdGXYView
aXYWorldReference
- the new ILcdXYWorldReference
associated to this viewaRepaint
- if true
, the view is repainted. If false, the view is not repainted.ILcdXYWorldReference
,
ILcdGXYView.getXYWorldReference()
,
ILcdGXYView.setWorldOrigin(com.luciad.shape.ILcdPoint)
public void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint, boolean aAdjusting)
ILcdGXYView
setXYWorldReference
in interface ILcdGXYView
aXYWorldReference
- the new ILcdXYWorldReference
associated to this viewaRepaint
- if true
, the view is repainted. If false, the view is not repainted.aAdjusting
- if true
, the caller indicates that he will trigger another property change
right after this call. This is reflected in the associated property change event.ILcdXYWorldReference
,
ILcdGXYView.getXYWorldReference()
,
ILcdGXYView.setWorldOrigin(com.luciad.shape.ILcdPoint)
public ILcdXYWorldReference getXYWorldReference()
ILcdGXYView
getXYWorldReference
in interface ILcdGXYView
ILcdXYWorldReference
,
ILcdGXYView.setXYWorldReference(com.luciad.view.ILcdXYWorldReference)
,
ILcdGXYView.getWorldOrigin()
public void setGXYController(ILcdGXYController aGXYViewController)
Makes the given ILcdGXYController
handle the user interaction of the view.
The view calls the controller's startInteraction
method to make the controller aware of this fact,
and calls the previous controller's terminateInteraction
method, if any.
Implementations of this method can direct input events to the controller by checking, for example,
if the controller implements AWT input interfaces such as KeyListener
and
MouseListener
.
This view implementation recognizes the following listener interfaces, making sure to forward the relevant events:
ComponentListener
KeyListener
MouseListener
MouseMotionListener
MouseWheelListener
ILcdAWTEventListener
.
If this is the case, the view dispatch all events using ILcdAWTEventListener
.
For example, a mouse drag event is only delivered to the controller's handleAWTEvent
, not its
mouseDragged
method.
The listeners are automatically removed.setGXYController
in interface ILcdGXYView
aGXYViewController
- the new controller of this view,
or null
if no controller is to be usedILcdGXYController.startInteraction(com.luciad.view.gxy.ILcdGXYView)
,
ILcdGXYController.terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
,
getGXYController()
public ILcdGXYController getGXYController()
ILcdGXYView
ILcdGXYController
handling the user interaction of the view.getGXYController
in interface ILcdGXYView
ILcdGXYController
,
ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
public ILcdGXYPen getDefaultPen()
ILcdGXYPen
supporting editing and painting on the view.getDefaultPen
in interface ILcdGXYView
ILcdGXYPen
of this viewILcdGXYPen
,
setDefaultPen(com.luciad.view.gxy.ILcdGXYPen)
public void setDefaultPen(ILcdGXYPen aDefaultPen)
ILcdGXYPen
supporting editing and painting on the view.aDefaultPen
- the new default ILcdGXYPen
of this viewILcdGXYPen
,
getDefaultPen()
public void setPaintingMode(int aPaintingMode)
setPaintingMode
in interface ILcdGXYView
aPaintingMode
- a binary OR of ILcdGXYLayer.BODIES, ILcdGXYLayer.LABELS, ILcdGXYLayer.SELECTIONgetPaintingMode()
public int getPaintingMode()
getPaintingMode
in interface ILcdGXYView
setPaintingMode(int)
public void invalidate(boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidate
in interface ILcdGXYView
invalidate
in interface ILcdView
aRepaint
- if true
, the view is updated immediately, but the method will not wait
for the update to finish.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateAndWait(boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateAndWait
in interface ILcdGXYView
aRepaint
- if true
the ILcdGXYView will be updated immediately, and the method will block
until the update is complete.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateRegion(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateRegion
in interface ILcdGXYView
aClip
- the clip to invalidateaRepaint
- if true
, the view is updated immediately, but the method will not wait
for the update to finish.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateRegionAndWait(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateRegionAndWait
in interface ILcdGXYView
aClip
- the clip to invalidateaRepaint
- if true
the ILcdGXYView will be updated immediately, and the method will block
until the update is complete.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateGXYLayer(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
ILcdGXYLayer
,
optionally repainting the content asynchronously.
A subsequent repaint will (at the least) ask the given layer to draw its bodies, labels and selection,
and may reuse earlier generated imagery for the other layers.
This method is typically called when a single layer needs to be redrawn, for example, when its painter
settings change.invalidateGXYLayer
in interface ILcdGXYView
aGXYLayer
- the layer to invalidateaRepaint
- if true
, the view is updated immediately, but the method will not wait
for the update to finish.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.public void invalidateGXYLayerAndWait(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
ILcdGXYLayer
,
optionally repainting the content synchronously.
A subsequent repaint will (at the least) ask the given layer to draw its bodies, labels and selection,
and may reuse earlier generated imagery for the other layers.
This method is typically called when a single layer needs to be redrawn, for example, when its painter
settings change.invalidateGXYLayerAndWait
in interface ILcdGXYView
aGXYLayer
- the layer to invalidateaRepaint
- if true
the ILcdGXYView will be updated immediately, and the method will block
until the update is complete.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateSelection(boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateSelection
in interface ILcdGXYView
aRepaint
- if true
, the view is updated immediately, but the method will not wait
for the update to finish.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateSelectionAndWait(boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateSelectionAndWait
in interface ILcdGXYView
aRepaint
- if true
the ILcdGXYView will be updated immediately, and the method will block
until the update is complete.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateRegionSelection(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateRegionSelection
in interface ILcdGXYView
aClip
- the clip to invalidateaRepaint
- if true
, the view is updated immediately, but the method will not wait
for the update to finish.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void invalidateRegionSelectionAndWait(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
ILcdGXYView
invalidateRegionSelectionAndWait
in interface ILcdGXYView
aClip
- the clip to invalidateaRepaint
- if true
the ILcdGXYView will be updated immediately, and the method will block
until the update is complete.
If false, the view is updated on the next paint or repaint method call.aSource
- class instance calling the method. For tracing purposes.aMessage
- a message associated to this method call. For tracing purposes.ILcdGXYView.repaint()
public void setAutoUpdate(boolean aAutoUpdate)
When switching the autoUpdate property from false
to true
, a repaint
will be triggered.
setAutoUpdate
in interface ILcdView
aAutoUpdate
- if true
, the view automatically updates its representation on
reception of any event that might require an update (e.g. when its
properties change, when an Object
in a model has changed, or
when a model has been added/removed). If false, the view must be repainted
manually.ILcdView.isAutoUpdate()
public boolean isAutoUpdate()
ILcdView
isAutoUpdate
in interface ILcdView
true
if the view automatically updates its representation on reception of
any event that might require an update (e.g. when its properties change, when an
Object
in a model has changed, or when a model has been added/removed).
false
if the view must be repainted manually.ILcdView.setAutoUpdate(boolean)
public void setSmartPan(boolean aSmartPan)
aSmartPan
- if true, subsequent pan operations will only paint newly exposed areas, reusing the
rest of the view content. If false, subsequent pan operations will repaint the entire view.
Smart panning may provide better performance for complex painting algorithms, but could cause
incorrect renderings, for example, when an painted object's visual representation is larger than its bounds.isSmartPan()
,
pan(int, int, boolean)
public boolean isSmartPan()
setSmartPan(boolean)
,
pan(int, int, boolean)
public void setDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint)
ILcdGXYView
setDrawOffScreenImageOnPaint
in interface ILcdGXYView
aDrawOffScreenImageOnPaint
- true
to make the view paint itself
when one of the paint methods is called. False if only the current controller is painted.ILcdGXYView.isDrawOffScreenImageOnPaint()
,
ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYView.paintGXYView(java.awt.Graphics)
public boolean isDrawOffScreenImageOnPaint()
ILcdGXYView
isDrawOffScreenImageOnPaint
in interface ILcdGXYView
true
if the view paints itself
when one of the paint methods is called. False if only the current controller is
painted.ILcdGXYView.setDrawOffScreenImageOnPaint(boolean)
,
ILcdGXYView.paintGXYView(java.awt.Graphics)
public void setUpdateLabelsOnSelectionChanged(boolean aUpdateLabelsOnSelectionChanged)
aUpdateLabelsOnSelectionChanged
- whether to force a label update upon selection changesisUpdateLabelsOnSelectionChanged()
public boolean isUpdateLabelsOnSelectionChanged()
setUpdateLabelsOnSelectionChanged(boolean)
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
addPropertyChangeListener
in interface ILcdPropertyChangeSource
addPropertyChangeListener
in class Container
aPropertyChangeListener
- the listener to notify of changes to this view as a component,
and as a viewremovePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
from receiving property change events
for this view.removePropertyChangeListener
in interface ILcdPropertyChangeSource
removePropertyChangeListener
in class Component
aPropertyChangeListener
- the listener that should no longer be notified of property
changes for the view as a component, nor as a viewaddPropertyChangeListener(java.beans.PropertyChangeListener)
public void setGXYViewLabelPainter(ILcdGXYViewLabelPainter aGXYViewLabelPainter)
ILcdGXYView
.
A view label painter handles the labels of all the view's layers.
When the view label painter is null, the layers are asked to paint their labels themselves.
This will override any configured view label placer.
Note that it is recommended to use setGXYViewLabelPlacer
instead.
Label placers offer better decluttering behavior, more algorithm choices, support for asynchronous
label placement, and easier customization.
aGXYViewLabelPainter
- the painter handling this view's labels, or nullILcdGXYViewLabelPainter
,
getGXYViewLabelPainter()
public ILcdGXYViewLabelPainter getGXYViewLabelPainter()
ILcdGXYView
ILcdGXYLabelPainter
.getGXYViewLabelPainter
in interface ILcdGXYView
ILcdGXYViewLabelPainter
public ILcdGXYViewLabelPlacer getGXYViewLabelPlacer()
ILcdGXYView
getGXYViewLabelPlacer
in interface ILcdGXYView
null
.ILcdGXYView.setGXYViewLabelPlacer(com.luciad.view.gxy.labeling.ILcdGXYViewLabelPlacer)
public void setGXYViewLabelPlacer(ILcdGXYViewLabelPlacer aGXYViewLabelPlacer)
ILcdGXYView
ILcdGXYViewLabelPlacer
to use for global labeling.
This will override any configured view label painter.
setGXYViewLabelPlacer
in interface ILcdGXYView
aGXYViewLabelPlacer
- a view label placer.ILcdGXYView.getGXYViewLabelPlacer()
public void setGXYLayerFactory(ILcdGXYLayerFactory newGXYLayerFactory)
addGXYLayer(com.luciad.view.gxy.ILcdGXYLayer)
.newGXYLayerFactory
- the layer factory to use when adding models to the view, or nullgetGXYLayerFactory()
public ILcdGXYLayerFactory getGXYLayerFactory()
addGXYLayer(com.luciad.view.gxy.ILcdGXYLayer)
.setGXYLayerFactory(com.luciad.view.gxy.ILcdGXYLayerFactory)
public void addStatusListener(ILcdStatusListener aStatusListener)
ILcdStatusListener
to be notified of view status events.
The amount, type and order of the status events is subject to change.addStatusListener
in interface ILcdStatusSource
addStatusListener
in interface ILcdGXYView
aStatusListener
- the listener that will be informed of status eventsremoveStatusListener(com.luciad.util.ILcdStatusListener)
public void removeStatusListener(ILcdStatusListener aStatusListener)
ILcdStatusListener
from being notified of view status events.removeStatusListener
in interface ILcdStatusSource
removeStatusListener
in interface ILcdGXYView
aStatusListener
- the listener that will no longer be informed of status eventsaddStatusListener(com.luciad.util.ILcdStatusListener)
public void modelProduced(TLcdModelProducerEvent aModelProducerEvent)
modelProduced
in interface ILcdModelProducerListener
aModelProducerEvent
- the event describing the model productionsetGXYLayerFactory(com.luciad.view.gxy.ILcdGXYLayerFactory)
public void addModelListener(ILcdModelListener aModelListener)
ILcdGXYView
ILcdModelListener
to be informed of ILcdModel
change events
from any layer's model in this view.addModelListener
in interface ILcdGXYView
aModelListener
- a listener that will be notified of ILcdModel
change events
from any layer's model in this viewILcdGXYView.removeModelListener(com.luciad.model.ILcdModelListener)
public void removeModelListener(ILcdModelListener aModelListener)
ILcdGXYView
ILcdModelListener
from receiving ILcdModel
change events
from any layer's model in this view.removeModelListener
in interface ILcdGXYView
aModelListener
- a listener that the view will no longer notify of ILcdModel
change eventsILcdGXYView.addModelListener(com.luciad.model.ILcdModelListener)
public void addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILcdGXYView
ILcdSelectionListener
to be informed of selection change events
from any layer in this view.addLayerSelectionListener
in interface ILcdGXYView
aSelectionListener
- a listener that will be notified of selection change events
from any layer in this view. The events will have the relevant layer as source.ILcdGXYView.removeLayerSelectionListener(com.luciad.util.ILcdSelectionListener)
public void removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILcdGXYView
ILcdSelectionListener
from receiving selection change events
from any layer in this view.removeLayerSelectionListener
in interface ILcdGXYView
aSelectionListener
- a listener that the view will no longer inform of selection change eventsILcdGXYView.addLayerSelectionListener(com.luciad.util.ILcdSelectionListener)
public void setWaitCursorOn(boolean aWaitCursorOn)
ILcdGXYView
is
repainting.
The default is false
.aWaitCursorOn
- if true, displays a wait cursor while repainting the viewisWaitCursorOn()
public boolean isWaitCursorOn()
ILcdGXYView
is
repainting.setWaitCursorOn(boolean)
public boolean isPaintInBackground()
ILcdGXYAsynchronousLayerWrapper
interface and its implementations, which is more versatile and
which generally offers better thread safety.isPaintInBackground
in interface ILcdGXYView
true
if background painting is enabled; false
otherwisepublic void setPaintInBackground(boolean aUpdateInBackground)
ILcdGXYAsynchronousLayerWrapper
interface and its implementations, which is more versatile and
which generally offers better thread safety.setPaintInBackground
in interface ILcdGXYView
aUpdateInBackground
- true
to enable painting in the background; false
to disable itpublic ILcdPaintExceptionHandler getPaintExceptionHandler()
ILcdGXYView
getPaintExceptionHandler
in interface ILcdGXYView
public void setPaintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
setPaintExceptionHandler
in interface ILcdGXYView
aPaintExceptionHandler
- a handler to report paint exceptions. This handler should
never be null.public ILcdLayerTreeNode getRootNode()
ILcdTreeLayered
Returns the root node of the tree structure.
getRootNode
in interface ILcdTreeLayered
public void addAWTEventListener(ILcdAWTEventListener aAWTListener)
ILcdAWTEventListener
. Dispatching events to the listeners
is the responsibility of the implementing class.
This view notifies the listeners of the following events:
addAWTEventListener
in interface ILcdAWTEventSource
aAWTListener
- the listener to be registered.public void removeAWTEventListener(ILcdAWTEventListener aAWTListener)
ILcdAWTEventSource
ILcdAWTEventListener
, or does nothing if the passed
listener wasn't registered.removeAWTEventListener
in interface ILcdAWTEventSource
aAWTListener
- the listener to be unregistered.public void addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
ILcdViewInvalidationListener
to be informed when the view's contents are invalid.
This can happen directly (e.g. by calling invalidateGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, boolean, java.lang.Object, java.lang.String)
) or indirectly (e.g. by calling pan(int, int, boolean)
)addViewInvalidationListener
in interface ILcdGXYView
aInvalidationListener
- the listener to notify when the view has been invalidatedremoveViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)
public void removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
ILcdViewInvalidationListener
so that it is no longer informed
of invalidation events for this view.removeViewInvalidationListener
in interface ILcdGXYView
aInvalidationListener
- the listener to no longer notify when the view has been invalidatedaddViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)
public boolean isAsynchronousAllowed()
ILcdGXYView
Returns whether this view allows asynchronous operations. Painters, layers or other parts of a
view should not perform asynchronous operations when this method returns false
. If this
method returns true
, they can decide either way.
When asynchronous operations are allowed, intermediate results of time-consuming asynchronous operations are displayed in order to provide an interactive user experience. For non-interactive applications, it is useful to disable asynchronous operations, since they can lead to more unpredictable results. Examples are tests, or server side functionality like the OGC WMS protocol which paints the view and returns it as an image. In these cases, you want the view to be painted completely without having to deal with intermediate results.
isAsynchronousAllowed
in interface ILcdGXYView
public void setAsynchronousAllowed(boolean aAsynchronousAllowed)
Sets if asynchronous operation are allowed for this view. See ILcdGXYView.isAsynchronousAllowed()
for
more information.
This method returns true
by default.
Note: it is advised to only modify this flag at construction time, not at runtime.
aAsynchronousAllowed
- true
to allow asynchronous operations.public boolean isAntiAliased()
ILcdGXYView
false
, it does not mean anti-aliasing is fully disabled.
It only means anti-aliasing is not enabled on the view level, various layers and painters may still decide to
enable anti-aliasing for what they render.isAntiAliased
in interface ILcdGXYView
true
if anti-aliasing is enabled, false
otherwise.public void setAntiAliased(boolean aAntiAliased)
ILcdGXYView.isAntiAliased()
for more information.aAntiAliased
- true
to enable anti-aliasing, false
to let layers and painters decide.