Interface ILcdGXYView
- All Superinterfaces:
ILcdGXYViewXYWorldTransformationProvider,ILcdLayered,ILcdPropertyChangeSource,ILcdStatusSource,ILcdTreeLayered,ILcdView,Serializable
- All Known Subinterfaces:
ILcdRotationCapableGXYView
- All Known Implementing Classes:
TLcdGXYViewBufferedImage,TLcdGXYViewCanvas,TLcdGXYViewJPanel,TLcdGXYViewJPanelLightWeight,TLcdGXYViewPanel,TLcdGXYViewPlanarImage,TLcdMapBufferedImage,TLcdMapCanvas,TLcdMapJPanel,TLcdMapJPanelLightWeight,TLcdMapPanel
ILcdView to visualize two-dimensional object geometry, based on AWT Graphics
and organized in ILcdGXYLayer objects.
View contents
AnILcdGXYView aggregates and displays a number of ILcdGXYLayer objects.
For example, a view might display a map's geometry using three layers: states, roads and rivers.
The view is painted bottom-to-top, depending on the object representation, in the following order:
- a
background color; - the bodies of each contained layer's models. Each layer is asked to paint itself, from bottom to top;
- the labels of each contained layer's models.
Typically labels are painted on top of any bodies.
The labels are painted by the layer itself, or by a
view label painter, if it is set; - the selected bodies of each contained layer's models. Typically selections are painted on top of bodies and labels.
- the selected labels of each contained layer's models. The labels are painted by the layer itself, or by a view label painter, if it is set;
- corner icons, if any;
- the controller handling user interaction.
ILcdGXYLayer for more information about paint representations.
User interaction
The view offers user interaction with its contained layers' objects through acontroller. In the view example of the previous section,
the user might pan and zoom on the map, and retrieve more information on the displayed roads.
Only one controller can be active at a time. When you instantiate a view implementing
ILcdGXYView, it activates a default controller that combines common types of user interaction:
view navigation, selection and editing.
Geographical aspects
The AWT coordinate system maps to a 2D world coordinate system, described by anILcdXYWorldReference.
The following properties determine the view-world transformation:
- a scale, expressed in a
unitless map scale ratioorthe number of pixels per world unit; - a
world origin, a point in the world coordinate system that corresponds with the view origin. Hence, the view and world origin represent the same physical point in different coordinate systems; - a
view origin, a point in the view coordinate system that corresponds with the world origin.
ILcdRotationCapableGXYView adds rotation as an extra view-world transformation parameter.
All view coordinates follow the Java AWT convention, meaning that the origin is in the upper-left corner.
Toolkit integration
This interface does not define how a view can be displayed on the screen.To achieve displaying 2D information,
ILcdGXYView extends ILcdView with some
AWT Component properties:
it has a width, a height, a background color, and a current java.awt.Cursor.
TLcdGXYViewJPanel defines a view that lives in a Swing component.
TLcdGXYViewBufferedImage defines a view that can be rendered to an image.
In addition, the ILcdGXYView can be painted on a Graphics or returned as
a java.awt.Image.
Invalidating content
AnILcdGXYView can be updated both automatically and manually.The view's representation is automatically invalidated for the following changes:
- changes in the containing layer's models;
- property changes of the containing layers;
- selection changes of the containing layers;
ILcdLayeredchanges;- property changes affecting the view's representation, such as the world reference.
auto-update property controls whether the view's representation is automatically updated
when any of the above changes occur.
Manual invalidations and updates are also possible using the invalidate(boolean, java.lang.Object, java.lang.String) method.
Possible uses are updating the view
after changing a painter property, or combining several view changes in a single update.
Depending on the view's implementation, one can avoid invalidating the
entire view using the following methods:
invalidateGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, boolean, java.lang.Object, java.lang.String)to invalidate a single layer, for example, after changing its painter's properties;invalidateRegion(java.awt.Rectangle, boolean, java.lang.Object, java.lang.String)to invalidate a region of the view representation, for example, after causing a change affecting the objects present in that region;invalidateSelection(boolean, java.lang.Object, java.lang.String)andinvalidateRegionSelection(java.awt.Rectangle, boolean, java.lang.Object, java.lang.String)to invalidate the layer's selected objects, after causing a change affecting the objects present in the selection.
ILcdGXYView may cache a number of layers near the bottom. This behavior is controlled by
the setNumberOfCachedBackgroundLayers(int) method.
Screen DPI and display scaling
To accurately work with map scales, the view needs the screen's DPI. Refer toTLcdMapScale for more information.
GXY views support high DPI rendering, meaning that map features such as icons, line widths or font sizes will be
scaled up in response to the DPI scale settings of the host operating system.
This is largely transparent to the user, but some caveats apply when using the custom GXY painters to take into
account the scaled view.
If you set the DPI scale factor to 1.5 (150%), for instance, then Swing components will report their size as
being 1.5 times smaller than their actual pixel size. This means that the width and height reported by, for instance,
a JPanel will be smaller than the panel's size in actual screen pixels.
GXY views will adapt themselves by generating larger views proportional to the DPI scale factor. In case of writing
your own custom GXY painters, if you are painting by using image buffers, you should take into account HiDPI support.
You have to use properly enlarged images according to the DPI scale factor, which can be retrieved
using TLcdGXYContext#getDPIScale().
High DPI rendering can be overridden using the -Dsun.java2d.uiScale=1.0 system property (1.0 corresponds to
100%). This sets the DPI scale to 100% (i.e. it switches DPI scaling off). The same property can also be used to
enforce a scale factor other than the one configured in the host operating system.
Further information
Exception handling can be controlled using anILcdPaintExceptionHandler
(see getPaintExceptionHandler(). When the view, a layer or a painter catches an
exception during painting, it can retrieve the ILcdPaintExceptionHandler from
the view and pass the exception to it.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDenotes the center position of the view when positioning corner icons.static final intDenotes the lower left position of the view when positioning corner icons.static final intDenotes the lower right position of the view when positioning corner icons.static final intDenotes the upper left position of the view when positioning corner icons.static final intDenotes the upper right position of the view when positioning corner icons. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddGXYLayer(ILcdGXYLayer aLayer) Adds the givenILcdGXYLayerto thisILcdGXYView.booleanaddGXYLayer(ILcdGXYLayer aLayer, boolean aRepaint) Adds the givenILcdGXYLayerto thisILcdGXYView, forcing a repaint if desired.voidaddLayerSelectionListener(ILcdSelectionListener aSelectionListener) Registers the givenILcdSelectionListenerto be informed of selection change events from any layer in this view.voidaddModelListener(ILcdModelListener aModelListener) Registers the givenILcdModelListenerto be informed ofILcdModelchange events from any layer's model in this view.default voidaddStatusListener(ILcdStatusListener aStatusListener) Registers the givenILcdStatusListenerto be notified of view status events.default voidaddViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener) Registers anILcdViewInvalidationListenerto be informed when the view's contents are invalid.Returns the background color of the view.Deprecated.Use the relevant layer's pen instead.Deprecated.This property is not used.Returns a graphics context for this view.Returns theILcdGXYControllerhandling the user interaction of the view.Deprecated.ILcdGXYViewLabelPlacer offers more powerful and flexible decluttering functionalitydefault ILcdGXYViewLabelPlacerReturns the label placer for this view.intReturns the view's current height in AWT pixels.getImage()Returns anImageof this view.default List<ILcdGXYLayer> Returns aListof the layers.default TLcdMapScalegetMapScale(TLcdMapScale.ScaleLocation aScaleLocation) Returns the unitless map scale ratio for which to paint the view contents.default TLcdDimensionInterval<TLcdMapScale> Returns the limits on the minimum and maximum scale of the view.doubleReturns the maximum zoomed in scale of the view.doubleReturns the maximum zoomed out scale of the view.intReturns the number of layers whose combined representation is cached across repaints.Returns a handler to report paint exceptions.intDeprecated.This mode is not taken into account.Returns the preferred size of the view.doublegetScale()Returns the scale for which to paint the view contents expressed in toolkit pixels per world unit.Returns the point in AWT pixel coordinates that maps onto the world origin.intgetWidth()Returns the view's current width in AWT pixels.Returns the point in world coordinates that maps onto the view origin.Returns the view's 2D world coordinate system.booleanDeprecated.getImage() always returns a valid image.voidinvalidate(boolean aRepaint, Object aSource, String aMessage) Asks the view to invalidate its content, optionally repainting the content asynchronously.voidinvalidateAndWait(boolean aRepaint, Object aSource, String aMessage) Asks the view to invalidate its content, optionally repainting the content synchronously.voidinvalidateGXYLayer(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage) Asks the view to invalidate the content of the givenILcdGXYLayer, optionally repainting the content asynchronously.voidinvalidateGXYLayerAndWait(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage) Asks the view to invalidate the content of the givenILcdGXYLayer, optionally repainting the content synchronously.voidinvalidateRegion(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.voidinvalidateRegionAndWait(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.voidinvalidateRegionSelection(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.voidinvalidateRegionSelectionAndWait(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.voidinvalidateSelection(boolean aRepaint, Object aSource, String aMessage) Asks the ILcdGXYView to invalidate its selection, optionally repainting the content asynchronously.voidinvalidateSelectionAndWait(boolean aRepaint, Object aSource, String aMessage) Asks the ILcdGXYView to invalidate its selection, optionally repainting the content synchronously.booleanSpecifies if anti-aliasing is enabled or not.booleanReturns whether this view allows asynchronous operations.booleanReturns whether the entire view's content is displayed, or only the controller's representation.booleanDeprecated.This method has been deprecated in favor of the approach provided by theILcdGXYAsynchronousLayerWrapperinterface and its implementations, which is more versatile and which generally offers better thread safety.voidpaintGXYView(Graphics aGraphics) Paints the view on the givenGraphics.voidpan(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.voidputCornerIcon(ILcdIcon aCornerIcon, int aPosition) Sets anILcdIconto be painted at the given corner of this view.voidremoveLayerSelectionListener(ILcdSelectionListener aSelectionListener) Unregisters the givenILcdSelectionListenerfrom receiving selection change events from any layer in this view.voidremoveModelListener(ILcdModelListener aModelListener) Unregisters the givenILcdModelListenerfrom receivingILcdModelchange events from any layer's model in this view.default voidremoveStatusListener(ILcdStatusListener aStatusListener) Unregisters the givenILcdStatusListenerfrom being notified of view status events.default voidremoveViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener) Unregisters anILcdViewInvalidationListenerso that it is no longer informed of invalidation events for this view.voidrepaint()Repaints the view.voidrepaint(int aX, int aY, int aWidth, int aHeight) Repaints the view within the given AWT rectangle.voidsetBackground(Color aColor) Sets the background color of the view.voidSets the view cursor to the given cursor.voidsetDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint) Sets whether the entire view's content is displayed, or only the current controller's representation.voidsetForeground(Color aColor) Deprecated.This property is not used.voidsetGXYController(ILcdGXYController aGXYController) Makes the givenILcdGXYControllerhandle the user interaction of the view.default voidsetGXYViewLabelPlacer(ILcdGXYViewLabelPlacer aLabelPlacer) This method sets anILcdGXYViewLabelPlacerto use for global labeling.default voidsetMapScale(TLcdMapScale aMapScale, TLcdMapScale.ScaleLocation aScaleLocation) Sets the unitless map scale ratio of this view, repainting the view according toisAutoUpdate.default voidsetMapScaleRange(TLcdDimensionInterval<TLcdMapScale> aMapScaleRange) Enforces the given limits on the minimum and maximum scale of the view.voidsetMaxScale(double aMaxScale) Limits the maximum zoomed in scale of the view.voidsetMinScale(double aMinScale) Limits the maximum zoomed out scale of the view.voidsetNumberOfCachedBackgroundLayers(int aNumberOfCachedBackgroundLayers) Sets the number of layers whose combined representation is cached across repaints.default voidsetPaintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler) Sets a handler to report paint exceptions.voidsetPaintInBackground(boolean aPaintInBackground) Deprecated.This method has been deprecated in favor of the approach provided by theILcdGXYAsynchronousLayerWrapperinterface and its implementations, which is more versatile and which generally offers better thread safety.voidsetPaintingMode(int aPaintingMode) Deprecated.This mode is not taken into account.voidsetScale(double aScale) Sets the scale of this view, repainting the view according toisAutoUpdate.voidsetScale(double aScale, boolean aRepaint) Sets the scale of this view, optionally repainting the view.voidsetScale(double aScale, boolean aRepaint, boolean aAdjusting) Sets the scale of this view, optionally indicating subsequent property changes.default voidsetScale(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 toisAutoUpdate.voidsetViewOrigin(Point aViewOrigin) Sets the view origin of the view, repainting the view according toisAutoUpdate.voidsetViewOrigin(Point aViewOrigin, boolean aRepaint) Sets the view origin of the view, optionally repainting the view.voidsetViewOrigin(Point aViewOrigin, boolean aRepaint, boolean aAdjusting) Sets the view origin of the view, optionally indicating subsequent property changes.voidsetWorldOrigin(ILcdPoint aWorldOrigin) Sets the world origin of the view, repainting the view according toisAutoUpdate.voidsetWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint) Sets the world origin of the view, optionally repainting the view.voidsetWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint, boolean aAdjusting) Sets the world origin of the view, optionally indicating subsequent property changes.voidsetXYWorldReference(ILcdXYWorldReference aXYWorldReference) Sets the view's 2D world coordinate system, repainting the view according toisAutoUpdate.voidsetXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint) Sets the view's 2D world coordinate system, optionally repainting the view.voidsetXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint, boolean aAdjusting) Sets the view's 2D world coordinate system, optionally indicating subsequent property changes.Methods inherited from interface com.luciad.view.gxy.ILcdGXYViewXYWorldTransformationProvider
getGXYViewXYWorldTransformationMethods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, moveLayerAt, removeLayeredListenerMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListenerMethods inherited from interface com.luciad.view.ILcdTreeLayered
addLayeredListener, containsLayer, getLayer, getRootNode, indexOf, layerCount, layerOf, layers, layersBackwards, removeAllLayers, removeLayer, removeLayeredListenerMethods inherited from interface com.luciad.view.ILcdView
addModel, isAutoUpdate, removeModel, setAutoUpdate
-
Field Details
-
UPPERLEFT
static final int UPPERLEFTDenotes the upper left position of the view when positioning corner icons.- See Also:
-
UPPERRIGHT
static final int UPPERRIGHTDenotes the upper right position of the view when positioning corner icons.- See Also:
-
LOWERRIGHT
static final int LOWERRIGHTDenotes the lower right position of the view when positioning corner icons.- See Also:
-
LOWERLEFT
static final int LOWERLEFTDenotes the lower left position of the view when positioning corner icons.- See Also:
-
CENTER
static final int CENTERDenotes the center position of the view when positioning corner icons.- See Also:
-
-
Method Details
-
getLayers
Description copied from interface:ILcdLayeredReturns aListof the layers.- Specified by:
getLayersin interfaceILcdLayered- Returns:
- an unmodifiable
Listof the layers in thisILcdLayered
-
putCornerIcon
Sets anILcdIconto be painted at the given corner of this view. Only the last set icon for the given position is painted.- Parameters:
aCornerIcon- theILcdIconto be painted at the given corner ornullto unregister the iconaPosition- one ofILcdGXYView.UPPERLEFT,ILcdGXYView.UPPERRIGHT,ILcdGXYView.LOWERRIGHT,ILcdGXYView.LOWERLEFT
-
addGXYLayer
Adds the givenILcdGXYLayerto thisILcdGXYView. 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 ofisAutoUpdate. No action is performed if the given layer is already contained in the list.- Parameters:
aLayer- the layer to add to this view- Returns:
trueif the layer was added successfully,falseif the view already contained the layer- See Also:
-
addGXYLayer
Adds the givenILcdGXYLayerto thisILcdGXYView, 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.- Parameters:
aLayer- the layer to add to this viewaRepaint- if true, the view is repainted. If false, the view is not repainted.- Returns:
trueif the layer was added successfully,falseif the view already contained the layer- See Also:
-
addModelListener
Registers the givenILcdModelListenerto be informed ofILcdModelchange events from any layer's model in this view.- Parameters:
aModelListener- a listener that will be notified ofILcdModelchange events from any layer's model in this view- See Also:
-
removeModelListener
Unregisters the givenILcdModelListenerfrom receivingILcdModelchange events from any layer's model in this view.- Parameters:
aModelListener- a listener that the view will no longer notify ofILcdModelchange events- See Also:
-
addLayerSelectionListener
Registers the givenILcdSelectionListenerto be informed of selection change events from any layer in this view.- Parameters:
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.- See Also:
-
removeLayerSelectionListener
Unregisters the givenILcdSelectionListenerfrom receiving selection change events from any layer in this view.- Parameters:
aSelectionListener- a listener that the view will no longer inform of selection change events- See Also:
-
getNumberOfCachedBackgroundLayers
int getNumberOfCachedBackgroundLayers()Returns the number of layers whose combined representation is cached across repaints. The layers are always the bottommost layer objects; they are regarded as background layers.- Returns:
- the number of bottommost layers to cache
- See Also:
-
setNumberOfCachedBackgroundLayers
void setNumberOfCachedBackgroundLayers(int aNumberOfCachedBackgroundLayers) Sets the number of layers whose combined representation is cached across repaints. The layers are the bottommost layer objects; they are regarded as background layers.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.
- Parameters:
aNumberOfCachedBackgroundLayers- the number of bottommost layers to cache. This number applies to theflat listof layers.- See Also:
-
hasValidImage
boolean hasValidImage()Deprecated.getImage() always returns a valid image. Implementations of this method should hence always returntrue.Returnstrueif the view has a valid image.- Returns:
true- See Also:
-
getImage
Image getImage()Returns anImageof 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 bygetWidth()andgetHeight()methods.- Returns:
- an image containing the representation of this view
-
getGraphics
Graphics getGraphics()Returns a graphics context for this view. Most view implementations offer this context only to retrieve information from. Typically it cannot be used to draw on the view, especially if the view is automatically repainted.- Returns:
- a graphics context for this view
-
getWidth
int getWidth()Returns the view's current width in AWT pixels.- Returns:
- the view's current width in AWT pixels
-
getHeight
int getHeight()Returns the view's current height in AWT pixels.- Returns:
- the view's current height in AWT pixels
-
getPreferredSize
Dimension getPreferredSize()Returns the preferred size of the view. This interface does not specify a functionality for this property.- Returns:
- the preferred size of the view in AWT pixels
-
setCursor
Sets the view cursor to the given cursor. Its image is displayed when the mouse is within the view boundaries.- Parameters:
aCursor- Cursor instance to use, or null to inherit the cursor of a containing entity, if any- See Also:
-
setBackground
Sets the background color of the view. This is the color that appears when no objects are painted on top of it.- Parameters:
aColor- the color which appears at a location where no data is painted.- Throws:
IllegalArgumentException- when the given color is null- See Also:
-
getBackground
Color getBackground()Returns the background color of the view. This is the color that appears when no objects are painted on top of it.- Returns:
- the background color of the view
- See Also:
-
setForeground
Deprecated.This property is not used. Implementations should remember the field so it can be queried withgetForeground()Sets the foreground color of the view.- Parameters:
aColor- the desired foregroundColor- See Also:
-
getForeground
Color getForeground()Deprecated.This property is not used.Returns the foreground color of the view.- Returns:
- the view's foreground color
- See Also:
-
setScale
void setScale(double aScale) Sets the scale of this view, repainting the view according toisAutoUpdate. The scale corresponds to the number of pixels per world unit, as determined by theILcdXYWorldReference. 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 theunitless map scaleinstead.- Parameters:
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.- See Also:
-
setScale
void setScale(double aScale, boolean aRepaint) Sets the scale of this view, optionally repainting the view. The scale corresponds to the number of pixels per world unit, as determined by theILcdXYWorldReference. 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 theunitless map scaleinstead.- Parameters:
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- iftrue, the view is repainted. If false, the view is not repainted.- See Also:
-
setScale
void setScale(double aScale, boolean aRepaint, boolean aAdjusting) Sets the scale of this view, optionally indicating subsequent property changes. The scale corresponds to the number of pixels per world unit, as determined by theILcdXYWorldReference. 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 theunitless map scaleinstead.- Parameters:
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- iftrue, the view is repainted. If false, the view is not repainted.aAdjusting- iftrue, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.- See Also:
-
setScale
default 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 toisAutoUpdate.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.
- Parameters:
aScaleX- the new scale along the x-axis of the view.aScaleY- the new scale along the y-axis of the view.aRepaint- iftrue, the view is repainted. If false, the view is not repainted.aAdjusting- iftrue, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.- Since:
- 2020.0
- See Also:
-
getScale
double getScale()Returns the scale for which to paint the view contents expressed in toolkit pixels per world unit. The world unit is determined by the view's world reference. Increasing the scale zooms in, and decreasing the scale zooms out. For most use cases, we recommended using theunitless map scaleinstead.- Returns:
- the scale of this view
- See Also:
-
getMapScale
Returns the unitless map scale ratio for which to paint the view contents.- Returns:
- the scale of this view
- Since:
- 2021.0
- See Also:
-
setMapScale
Sets the unitless map scale ratio of this view, repainting the view according toisAutoUpdate.- Parameters:
aMapScale- 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. Nevernull.- Since:
- 2021.0
- See Also:
-
setMapScaleRange
Enforces the given limits on the minimum and maximum scale of the view. Subsequent calls ofsetScale(double)orsetMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)will ensure that the scale falls within the given internal.- Parameters:
aMapScaleRange- a range expressing the minimum and maximum allowed scale of the view, ornullto disable the scale range- Since:
- 2021.0
- See Also:
-
getMapScaleRange
Returns the limits on the minimum and maximum scale of the view. Subsequent calls ofsetScale(double)orsetMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)will ensure that the scale falls within the given internal.- Returns:
- a range expressing the minimum and maximum allowed scale of the view
- Since:
- 2021.0
- See Also:
-
setMinScale
void setMinScale(double aMinScale) Limits the maximum zoomed out scale of the view. Subsequent calls ofsetScale(double)orsetMapScale(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 theunitless map scalevariant instead.- Parameters:
aMinScale- the new minimum scale of this view- See Also:
-
getMinScale
double getMinScale()Returns the maximum zoomed out scale of the view. Subsequent calls ofsetScale(double)orsetMapScale(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 theunitless map scalevariant instead.- Returns:
- the minimum scale of the view
- See Also:
-
setMaxScale
void setMaxScale(double aMaxScale) Limits the maximum zoomed in scale of the view. Subsequent calls ofsetScale(double)orsetMapScale(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 theunitless map scalevariant instead.- Parameters:
aMaxScale- the new maximum scale of this view- See Also:
-
getMaxScale
double getMaxScale()Returns the maximum zoomed in scale of the view. Subsequent calls ofsetScale(double)orsetMapScale(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 theunitless map scalevariant instead.- Returns:
- the maximum scale of the view
- See Also:
-
setWorldOrigin
Sets the world origin of the view, repainting the view according toisAutoUpdate. The world origin is a point in world coordinates that maps onto the view origin.- Parameters:
aWorldOrigin- the new world origin of this view, expressed in world coordinates. Only the XY coordinates are considered.- See Also:
-
setWorldOrigin
Sets the world origin of the view, optionally repainting the view. The world origin is a point in world coordinates that maps onto the view origin.- Parameters:
aWorldOrigin- the new world origin of this view, expressed in world coordinates. Only the XY coordinates are considered.aRepaint- iftrue, the view is repainted. If false, the view is not repainted.- See Also:
-
setWorldOrigin
Sets the world origin of the view, optionally indicating subsequent property changes. The world origin is a point in world coordinates that maps onto the view origin.- Parameters:
aWorldOrigin- the new world origin of this view, expressed in world coordinates. Only the XY coordinates are considered.aRepaint- iftrue, the view is repainted. If false, the view is not repainted.aAdjusting- iftrue, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.- See Also:
-
getWorldOrigin
ILcdPoint getWorldOrigin()Returns the point in world coordinates that maps onto the view origin. Hence, the combination of world origin and view origin determines which part of the world is visible in the view. The points are considered to be 'on top of each other'- Returns:
- the world origin of the view, expressed in world coordinates. Only the XY coordinates of the point are relevant.
- See Also:
-
setViewOrigin
Sets the view origin of the view, repainting the view according toisAutoUpdate. The view origin is a point in AWT pixel coordinates that maps onto the world origin.- Parameters:
aViewOrigin- the new view origin of this view, expressed in AWT pixel coordinates- See Also:
-
setViewOrigin
Sets the view origin of the view, optionally repainting the view. The view origin is a point in AWT pixel coordinates that maps onto the world origin.- Parameters:
aViewOrigin- the new view origin of this view, expressed in AWT pixel coordinatesaRepaint- iftrue, the view is repainted. If false, the view is not repainted.- See Also:
-
setViewOrigin
Sets the view origin of the view, optionally indicating subsequent property changes. The view origin is a point in AWT pixel coordinates that maps onto the world origin.- Parameters:
aViewOrigin- the new view origin of this view, expressed in AWT pixel coordinatesaRepaint- iftrue, the view is repainted. If false, the view is not repainted.aAdjusting- iftrue, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.- See Also:
-
getViewOrigin
Point getViewOrigin()Returns the point in AWT pixel coordinates that maps onto the world origin. Hence, the combination of world origin and view origin determines which part of the world is visible in the view. The points are considered to be 'on top of each other'.- Returns:
- the view origin expressed in AWT pixel coordinates
- See Also:
-
setXYWorldReference
Sets the view's 2D world coordinate system, repainting the view according toisAutoUpdate.- Parameters:
aXYWorldReference- the newILcdXYWorldReferenceassociated to this view- See Also:
-
setXYWorldReference
Sets the view's 2D world coordinate system, optionally repainting the view.- Parameters:
aXYWorldReference- the newILcdXYWorldReferenceassociated to this viewaRepaint- iftrue, the view is repainted. If false, the view is not repainted.- See Also:
-
setXYWorldReference
void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint, boolean aAdjusting) Sets the view's 2D world coordinate system, optionally indicating subsequent property changes.- Parameters:
aXYWorldReference- the newILcdXYWorldReferenceassociated to this viewaRepaint- iftrue, the view is repainted. If false, the view is not repainted.aAdjusting- iftrue, the caller indicates that he will trigger another property change right after this call. This is reflected in the associated property change event.- See Also:
-
getXYWorldReference
ILcdXYWorldReference getXYWorldReference()Returns the view's 2D world coordinate system.- Returns:
- the view's 2D world coordinate system
- See Also:
-
setGXYController
Makes the given
ILcdGXYControllerhandle the user interaction of the view. The view calls the controller'sstartInteractionmethod to make the controller aware of this fact, and calls the previous controller'sterminateInteractionmethod, 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
KeyListenerandMouseListener.- Parameters:
aGXYController- the new controller of this view, ornullif no controller is to be used- See Also:
-
getGXYController
ILcdGXYController getGXYController()Returns theILcdGXYControllerhandling the user interaction of the view.- Returns:
- the current controller handling the user interaction, or null if no controller is present
- See Also:
-
getDefaultPen
ILcdGXYPen getDefaultPen()Deprecated.Use the relevant layer's pen instead. Implementations of this method should return a pen supporting editing and painting on the view.Returns anILcdGXYPensupporting editing and painting on the view.- Returns:
- the default
ILcdGXYPenof this view - See Also:
-
setPaintingMode
void setPaintingMode(int aPaintingMode) Deprecated.This mode is not taken into account. Implementations should remember the value so that it can be queried usinggetPaintingMode().Sets the type or types of layer content to display in the ILcdGXYView.- Parameters:
aPaintingMode- a binary OR of ILcdGXYLayer.BODIES, ILcdGXYLayer.LABELS, ILcdGXYLayer.SELECTION- See Also:
-
getPaintingMode
int getPaintingMode()Deprecated.This mode is not taken into account.Gets the painting mode for this ILcdGXYView.- Returns:
- a binary OR of ILcdGXYLayer.BODIES, ILcdGXYLayer.LABELS, ILcdGXYLayer.SELECTION
- See Also:
-
pan
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. Implementations of this method are allowed to only repaint newly exposed areas, hence this method is preferred over simply changing the world origin.- Parameters:
aDeltaX- the shift in the X direction in screen coordinatesaDeltaY- the shift in the Y direction in screen coordinatesaRepaint- iftrue, 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.
-
paintGXYView
Paints the view on the givenGraphics. The painted image contains the following:- a background color;
- the bodies of each contained layer's models. Each layer is asked to paint itself, from bottom to top;
- the labels of each contained layer's models.
Typically labels are painted on top of any bodies.
The labels are painted by the layer itself, or by a
view label painter, if it is set; - the selected bodies of each contained layer's models. Typically selections are painted on top of bodies and labels.
- the selected labels of each contained layer's models. The labels are painted by the layer itself, or by a view label painter, if it is set;
- corner icons, if any;
- the controller handling user interaction.
invalidatemethods.- Parameters:
aGraphics- theGraphicsto paint the contents of this view on- See Also:
-
repaint
void repaint()Repaints the view. The view is allowed to reuse earlier painted results as long as they are valid. Invalidation of the contents may occur indirectly (e.g. by changing view or layer properties) or directly by calling one of theinvalidatemethods. This method may return before the repaint is complete.- See Also:
-
repaint
void repaint(int aX, int aY, int aWidth, int aHeight) Repaints the view within the given AWT rectangle. The view is allowed to reuse earlier painted results as long as they are valid. Invalidation of the contents may occur indirectly (e.g. by changing view or layer properties) or directly by calling one of theinvalidatemethods. This method may return before the repaint is complete.- Parameters:
aX- the x-coordinate of the rectangle's top-left pointaY- the y-coordinate of the rectangle's top-left pointaWidth- the width of the rectangleaHeight- the height of the rectangle- Since:
- 3.1
- See Also:
-
invalidate
Asks the view to invalidate its content, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection. This method is typically called when the entire view needs to be redrawn, for example, after a zoom operation or projection change.- Specified by:
invalidatein interfaceILcdView- Parameters:
aRepaint- iftrue, 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.- See Also:
-
invalidateAndWait
Asks the view to invalidate its content, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection. This method is typically called when the entire view needs to be redrawn, for example, after a zoom operation or projection change.- Parameters:
aRepaint- iftruethe 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.- See Also:
-
invalidateGXYLayer
Asks the view to invalidate the content of the givenILcdGXYLayer, 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.- Parameters:
aGXYLayer- the layer to invalidateaRepaint- iftrue, 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.
-
invalidateGXYLayerAndWait
void invalidateGXYLayerAndWait(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage) Asks the view to invalidate the content of the givenILcdGXYLayer, 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.- Parameters:
aGXYLayer- the layer to invalidateaRepaint- iftruethe 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.- See Also:
-
invalidateRegion
Asks the view to invalidate the content in the given AWT clip, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection in the given clip, and may reuse earlier generated imagery for the rest of the view. This method is typically called when a small portion of the view needs to be redrawn, for example, when the objects in that area have changed.- Parameters:
aClip- the clip to invalidateaRepaint- iftrue, 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.- See Also:
-
invalidateRegionAndWait
Asks the view to invalidate the content in the given AWT clip, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their bodies, labels and selection in the given clip, and may reuse earlier generated imagery for the rest of the view. This method is typically called when a small portion of the view needs to be redrawn, for example, when the objects in that area have changed.- Parameters:
aClip- the clip to invalidateaRepaint- iftruethe 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.- See Also:
-
invalidateRegionSelection
Asks the ILcdGXYView to invalidate its selection in the given AWT clip, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their selection in the given clip, and may reuse earlier generated imagery for the bodies, labels, and rest of the view. This method is typically called when the selection of a small portion of the view needs to be redrawn, for example, when changing the selection in that area.- Parameters:
aClip- the clip to invalidateaRepaint- iftrue, 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.- See Also:
-
invalidateRegionSelectionAndWait
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. A subsequent repaint will ask (at the least) all layers to draw their selection in the given clip, and may reuse earlier generated imagery for the bodies, labels, and rest of the view. This method is typically called when the selection of a small portion of the view needs to be redrawn, for example, when changing the selection in that area.- Parameters:
aClip- the clip to invalidateaRepaint- iftruethe 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.- See Also:
-
invalidateSelection
Asks the ILcdGXYView to invalidate its selection, optionally repainting the content asynchronously. A subsequent repaint will ask (at the least) all layers to draw their selection, and may reuse earlier generated imagery for the bodies and labels. This method is typically called when the selection needs to be redrawn, for example, when changing the selection.- Parameters:
aRepaint- iftrue, 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.- See Also:
-
invalidateSelectionAndWait
Asks the ILcdGXYView to invalidate its selection, optionally repainting the content synchronously. A subsequent repaint will ask (at the least) all layers to draw their selection, and may reuse earlier generated imagery for the bodies and labels. This method is typically called when the selection needs to be redrawn, for example, when changing the selection.- Parameters:
aRepaint- iftruethe 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.- See Also:
-
setDrawOffScreenImageOnPaint
void setDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint) Sets whether the entire view's content is displayed, or only the current controller's representation. The controller can use this method to temporarily override the view's contents. The effect is visible upon the next repaint.- Parameters:
aDrawOffScreenImageOnPaint-trueto make the view paint itself when one of the paint methods is called. False if only the current controller is painted.- See Also:
-
isDrawOffScreenImageOnPaint
boolean isDrawOffScreenImageOnPaint()Returns whether the entire view's content is displayed, or only the controller's representation.- Returns:
trueif the view paints itself when one of the paint methods is called. False if only the current controller is painted.- See Also:
-
getGXYViewLabelPainter
ILcdGXYViewLabelPainter getGXYViewLabelPainter()Deprecated.ILcdGXYViewLabelPlacer offers more powerful and flexible decluttering functionalityReturns the label painting algorithm for this view. A view label painter handles the labels of all the view's layers. Hence, the layers are not asked to paint their labels if the view label painter is not null. The view label painter can be used for decluttering labels across all layers. To do this, it can select the objects that need a label and delegate the actual painting to the relevant layer'sILcdGXYLabelPainter.- Returns:
- the painter handling this view's labels, or null
- See Also:
-
getGXYViewLabelPlacer
Returns the label placer for this view. A view label placer handles the labels of all the view's layers. The layers are only responsible for painting their labels while the label placer declutters the labels.- Returns:
- the label placer handling this view's labels, or
null. - Since:
- 2020.0
- See Also:
-
setGXYViewLabelPlacer
This method sets anILcdGXYViewLabelPlacerto use for global labeling.This will override any configured view label painter.
- Parameters:
aLabelPlacer- a view label placer.- Since:
- 2020.0
- See Also:
-
isPaintInBackground
boolean isPaintInBackground()Deprecated.This method has been deprecated in favor of the approach provided by theILcdGXYAsynchronousLayerWrapperinterface and its implementations, which is more versatile and which generally offers better thread safety.Returns whether the view is painted in a thread other than the event dispatch thread.- Returns:
trueif background painting is enabled;falseotherwise
-
setPaintInBackground
void setPaintInBackground(boolean aPaintInBackground) Deprecated.This method has been deprecated in favor of the approach provided by theILcdGXYAsynchronousLayerWrapperinterface and its implementations, which is more versatile and which generally offers better thread safety.Enables or disables painting in a thread other than the event dispatch thread. If background painting is not supported by an implementation, this method throws a runtime exception.- Parameters:
aPaintInBackground-trueto enable painting in the background;falseto disable it
-
getPaintExceptionHandler
ILcdPaintExceptionHandler getPaintExceptionHandler()Returns a handler to report paint exceptions. The view, as well as layers and painters can use this handler if they encounter an exception during painting. Because painting may happen asynchronously, the handler may be called from different threads.- Returns:
- a handler to report paint exceptions.
-
setPaintExceptionHandler
Sets a handler to report paint exceptions. Layers and/or painters can use this handler if they encounter a problem during painting. Because painting may happen asynchronously, the handler may be called from different threads.- Parameters:
aPaintExceptionHandler- a handler to report paint exceptions. This handler should never be null.- Since:
- 2020.0
-
isAsynchronousAllowed
boolean isAsynchronousAllowed()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 returnstrue, 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.
- Returns:
- whether this view allows asynchronous operations.
- Since:
- 2017.0
-
isAntiAliased
boolean isAntiAliased()Specifies if anti-aliasing is enabled or not. Anti-aliasing makes lines and text appear smoother, but slows down rendering a little bit. If this property isfalse, 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.- Returns:
trueif anti-aliasing is enabled,falseotherwise.- Since:
- 2017.0
-
addStatusListener
Registers the givenILcdStatusListenerto be notified of view status events. The amount, type and order of the status events is subject to change.- Specified by:
addStatusListenerin interfaceILcdStatusSource- Parameters:
aStatusListener- the listener that will be informed of status events- See Also:
-
removeStatusListener
Unregisters the givenILcdStatusListenerfrom being notified of view status events.- Specified by:
removeStatusListenerin interfaceILcdStatusSource- Parameters:
aStatusListener- the listener that will no longer be informed of status events- See Also:
-
addViewInvalidationListener
Registers anILcdViewInvalidationListenerto be informed when the view's contents are invalid. This can happen directly (e.g. by callinginvalidateGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, boolean, java.lang.Object, java.lang.String)) or indirectly (e.g. by callingpan(int, int, boolean))- Parameters:
aInvalidationListener- the listener to notify when the view has been invalidated- Since:
- 2020.0
- See Also:
-
removeViewInvalidationListener
Unregisters anILcdViewInvalidationListenerso that it is no longer informed of invalidation events for this view.- Parameters:
aInvalidationListener- the listener to no longer notify when the view has been invalidated- Since:
- 2020.0
- See Also:
-