public interface ILcdGXYView extends ILcdView, ILcdTreeLayered, ILcdGXYViewXYWorldTransformationProvider, ILcdStatusSource
ILcdView
to visualize two-dimensional object geometry, based on AWT Graphics
and organized in ILcdGXYLayer
objects.
ILcdGXYView
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:
background color
;
view label painter
, if it is set;
ILcdGXYLayer
for more information about paint representations.
controller
. 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.
ILcdXYWorldReference
.
The following properties determine the view-world transformation:
unitless map scale ratio
or the number of pixels per world unit
;
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;
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.
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
.
ILcdGXYView
can be updated both automatically and manually.ILcdLayered
changes;
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)
and invalidateRegionSelection(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.
TLcdMapScale
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.
ILcdPaintExceptionHandler
(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.ILcdGXYLayer
,
ILcdGXYController
Modifier and Type | Field and Description |
---|---|
static int |
CENTER
Denotes the center position of the view when positioning corner icons.
|
static int |
LOWERLEFT
Denotes the lower left position of the view when positioning corner icons.
|
static int |
LOWERRIGHT
Denotes the lower right position of the view when positioning corner icons.
|
static int |
UPPERLEFT
Denotes the upper left position of the view when positioning corner icons.
|
static int |
UPPERRIGHT
Denotes the upper right position of the view when positioning corner icons.
|
Modifier and Type | Method and Description |
---|---|
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 |
addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
Registers the given
ILcdSelectionListener to be informed of selection change events
from any layer in this view. |
void |
addModelListener(ILcdModelListener aModelListener)
Registers the given
ILcdModelListener to be informed of ILcdModel change events
from any layer's model in this view. |
default void |
addStatusListener(ILcdStatusListener aStatusListener)
Registers the given
ILcdStatusListener to be notified of view status events. |
default void |
addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
Registers an
ILcdViewInvalidationListener to be informed when the view's contents are invalid. |
Color |
getBackground()
Returns the background color of the view.
|
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.
|
Color |
getForeground()
Deprecated.
This property is not used.
|
Graphics |
getGraphics()
Returns a graphics context for this view.
|
ILcdGXYController |
getGXYController()
Returns the
ILcdGXYController handling the user interaction of the view. |
ILcdGXYViewLabelPainter |
getGXYViewLabelPainter()
Deprecated.
ILcdGXYViewLabelPlacer offers more powerful and flexible decluttering functionality
|
default ILcdGXYViewLabelPlacer |
getGXYViewLabelPlacer()
Returns the label placer for this view.
|
int |
getHeight()
Returns the view's current height in AWT pixels.
|
Image |
getImage()
Returns an
Image of this view. |
default List<ILcdGXYLayer> |
getLayers()
Returns a
List of the layers. |
default TLcdMapScale |
getMapScale(TLcdMapScale.ScaleLocation aScaleLocation)
Returns the unitless map scale ratio for which to paint the view contents.
|
default TLcdDimensionInterval<TLcdMapScale> |
getMapScaleRange()
Returns the limits on the minimum and maximum scale of the view.
|
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 mode is not taken into account.
|
Dimension |
getPreferredSize()
Returns the preferred size of the view.
|
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.
|
int |
getWidth()
Returns the view's current width in AWT pixels.
|
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.
Implementations of this method should hence always return
true . |
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.
|
boolean |
isAntiAliased()
Specifies if anti-aliasing is enabled or not.
|
boolean |
isAsynchronousAllowed()
Returns whether this view allows asynchronous operations.
|
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. |
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.
|
void |
putCornerIcon(ILcdIcon aCornerIcon,
int aPosition)
Sets an
ILcdIcon to be painted at the given corner of this
view. |
void |
removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
Unregisters the given
ILcdSelectionListener from receiving selection change events
from any layer in this view. |
void |
removeModelListener(ILcdModelListener aModelListener)
Unregisters the given
ILcdModelListener from receiving ILcdModel change events
from any layer's model in this view. |
default void |
removeStatusListener(ILcdStatusListener aStatusListener)
Unregisters the given
ILcdStatusListener from being notified of view status events. |
default void |
removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
Unregisters an
ILcdViewInvalidationListener so that it is no longer informed
of invalidation events for this view. |
void |
repaint()
Repaints the view.
|
void |
repaint(int aX,
int aY,
int aWidth,
int aHeight)
Repaints the view within the given AWT rectangle.
|
void |
setBackground(Color aColor)
Sets the background color of the view.
|
void |
setCursor(Cursor aCursor)
Sets the view cursor to the given cursor.
|
void |
setDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint)
Sets whether the entire view's content is displayed, or only the current controller's
representation.
|
void |
setForeground(Color aColor)
Deprecated.
This property is not used. Implementations should remember the field so it can be queried
with
getForeground() |
void |
setGXYController(ILcdGXYController aGXYController)
Makes the given
ILcdGXYController handle the user interaction of the view. |
default void |
setGXYViewLabelPlacer(ILcdGXYViewLabelPlacer aLabelPlacer)
This method sets an
ILcdGXYViewLabelPlacer to use for global labeling. |
default void |
setMapScale(TLcdMapScale aMapScale,
TLcdMapScale.ScaleLocation aScaleLocation)
Sets the unitless map scale ratio of this view, repainting the view according to
isAutoUpdate . |
default void |
setMapScaleRange(TLcdDimensionInterval<TLcdMapScale> aMapScaleRange)
Enforces the given limits on the minimum and maximum scale of the view.
|
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.
|
default void |
setPaintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
Sets a handler to report paint exceptions.
|
void |
setPaintInBackground(boolean aPaintInBackground)
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 mode is not taken into account. Implementations should remember the value so that it can
be queried using
getPaintingMode() . |
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.
|
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 to
isAutoUpdate . |
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 |
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.
|
addModel, isAutoUpdate, removeModel, setAutoUpdate
addPropertyChangeListener, removePropertyChangeListener
addLayeredListener, containsLayer, getLayer, getRootNode, indexOf, layerCount, layerOf, layers, layersBackwards, removeAllLayers, removeLayer, removeLayeredListener
addLayeredListener, moveLayerAt, removeLayeredListener
getGXYViewXYWorldTransformation
static final int UPPERLEFT
static final int UPPERRIGHT
static final int LOWERRIGHT
static final int LOWERLEFT
static final int CENTER
default List<ILcdGXYLayer> getLayers()
ILcdLayered
List
of the layers.getLayers
in interface ILcdLayered
List
of the layers in this ILcdLayered
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.aPosition
- one of ILcdGXYView.UPPERLEFT
, ILcdGXYView.UPPERRIGHT
,
ILcdGXYView.LOWERRIGHT
, ILcdGXYView.LOWERLEFT
aCornerIcon
- the ILcdIcon
to be painted at the given corner or null
to unregister the iconboolean addGXYLayer(ILcdGXYLayer aLayer)
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.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)
boolean addGXYLayer(ILcdGXYLayer aLayer, boolean aRepaint)
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.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)
void addModelListener(ILcdModelListener aModelListener)
ILcdModelListener
to be informed of ILcdModel
change events
from any layer's model in this view.aModelListener
- a listener that will be notified of ILcdModel
change events
from any layer's model in this viewremoveModelListener(com.luciad.model.ILcdModelListener)
void removeModelListener(ILcdModelListener aModelListener)
ILcdModelListener
from receiving ILcdModel
change events
from any layer's model in this view.aModelListener
- a listener that the view will no longer notify of ILcdModel
change eventsaddModelListener(com.luciad.model.ILcdModelListener)
void addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILcdSelectionListener
to be informed of selection change events
from any layer in this view.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.removeLayerSelectionListener(com.luciad.util.ILcdSelectionListener)
void removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILcdSelectionListener
from receiving selection change events
from any layer in this view.aSelectionListener
- a listener that the view will no longer inform of selection change eventsaddLayerSelectionListener(com.luciad.util.ILcdSelectionListener)
int getNumberOfCachedBackgroundLayers()
setNumberOfCachedBackgroundLayers(int)
void setNumberOfCachedBackgroundLayers(int aNumberOfCachedBackgroundLayers)
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.
aNumberOfCachedBackgroundLayers
- the number of bottommost layers to cache. This number applies to the flat list
of layers.getNumberOfCachedBackgroundLayers()
,
invalidateGXYLayer(com.luciad.view.gxy.ILcdGXYLayer, boolean, java.lang.Object, java.lang.String)
boolean hasValidImage()
true
.true
if the view has a valid image.true
getImage()
Image getImage()
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.Graphics getGraphics()
int getWidth()
int getHeight()
Dimension getPreferredSize()
void setCursor(Cursor aCursor)
aCursor
- Cursor instance to use, or null to inherit the cursor
of a containing entity, if anyCursor
void setBackground(Color aColor)
aColor
- the color which appears at a location where no data is painted.IllegalArgumentException
- when the given color is nullgetBackground()
Color getBackground()
setBackground(java.awt.Color)
void setForeground(Color aColor)
getForeground()
aColor
- the desired foreground Color
getForeground()
Color getForeground()
setForeground(java.awt.Color)
void setScale(double aScale)
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.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.getScale()
,
getMinScale()
,
getMaxScale()
void setScale(double aScale, boolean aRepaint)
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.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.getScale()
,
getMinScale()
,
getMaxScale()
void setScale(double aScale, boolean aRepaint, boolean aAdjusting)
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.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.getScale()
,
getMinScale()
,
getMaxScale()
default void setScale(double aScaleX, double aScaleY, boolean aRepaint, boolean aAdjusting)
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.
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()
double getScale()
unitless map scale
instead.setScale(double)
,
getMapScale(com.luciad.view.TLcdMapScale.ScaleLocation)
default TLcdMapScale getMapScale(TLcdMapScale.ScaleLocation aScaleLocation)
setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
,
TLcdMapScale
default void setMapScale(TLcdMapScale aMapScale, TLcdMapScale.ScaleLocation aScaleLocation)
isAutoUpdate
.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. Never null
.getMapScale(com.luciad.view.TLcdMapScale.ScaleLocation)
,
getMapScaleRange()
default void setMapScaleRange(TLcdDimensionInterval<TLcdMapScale> aMapScaleRange)
setScale(double)
or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
will ensure that the scale falls within the given internal.aMapScaleRange
- a range expressing the minimum and maximum allowed scale of the view, or null
to disable the scale rangesetMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
default TLcdDimensionInterval<TLcdMapScale> getMapScaleRange()
setScale(double)
or setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
will ensure that the scale falls within the given internal.setMapScale(com.luciad.view.TLcdMapScale, com.luciad.view.TLcdMapScale.ScaleLocation)
void setMinScale(double aMinScale)
setScale(double)
or 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.aMinScale
- the new minimum scale of this viewsetScale(double)
,
getMinScale()
double getMinScale()
setScale(double)
or 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.setScale(double)
,
setMinScale(double)
void setMaxScale(double aMaxScale)
setScale(double)
or 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.aMaxScale
- the new maximum scale of this viewsetScale(double)
,
getMaxScale()
double getMaxScale()
setScale(double)
or 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.setScale(double)
,
setMaxScale(double)
void setWorldOrigin(ILcdPoint aWorldOrigin)
isAutoUpdate
.
The world origin is a point in world coordinates that maps onto the view origin.aWorldOrigin
- the new world origin of this view, expressed in world coordinates.
Only the XY coordinates are considered.getWorldOrigin()
,
getXYWorldReference()
void setWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint)
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.getWorldOrigin()
,
getXYWorldReference()
void setWorldOrigin(ILcdPoint aWorldOrigin, boolean aRepaint, boolean aAdjusting)
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.getWorldOrigin()
,
getXYWorldReference()
ILcdPoint getWorldOrigin()
setWorldOrigin(com.luciad.shape.ILcdPoint)
,
getViewOrigin()
,
getXYWorldReference()
void setViewOrigin(Point aViewOrigin)
isAutoUpdate
.
The view origin is a point in AWT pixel coordinates that maps onto the world origin.aViewOrigin
- the new view origin of this view, expressed in AWT pixel coordinatesgetViewOrigin()
,
getWorldOrigin()
void setViewOrigin(Point aViewOrigin, boolean aRepaint)
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.getWorldOrigin()
,
getViewOrigin()
void setViewOrigin(Point aViewOrigin, boolean aRepaint, boolean aAdjusting)
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.getWorldOrigin()
,
getViewOrigin()
Point getViewOrigin()
getWorldOrigin()
,
setViewOrigin(java.awt.Point)
void setXYWorldReference(ILcdXYWorldReference aXYWorldReference)
isAutoUpdate
.aXYWorldReference
- the new ILcdXYWorldReference
associated to this viewILcdXYWorldReference
,
getXYWorldReference()
,
setWorldOrigin(com.luciad.shape.ILcdPoint)
void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint)
aXYWorldReference
- the new ILcdXYWorldReference
associated to this viewaRepaint
- if true
, the view is repainted. If false, the view is not repainted.ILcdXYWorldReference
,
getXYWorldReference()
,
setWorldOrigin(com.luciad.shape.ILcdPoint)
void setXYWorldReference(ILcdXYWorldReference aXYWorldReference, boolean aRepaint, boolean aAdjusting)
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
,
getXYWorldReference()
,
setWorldOrigin(com.luciad.shape.ILcdPoint)
ILcdXYWorldReference getXYWorldReference()
ILcdXYWorldReference
,
setXYWorldReference(com.luciad.view.ILcdXYWorldReference)
,
getWorldOrigin()
void setGXYController(ILcdGXYController aGXYController)
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
.
aGXYController
- 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)
,
TLcdGXYViewJPanel.setGXYController(ILcdGXYController)
,
getGXYController()
ILcdGXYController getGXYController()
ILcdGXYController
handling the user interaction of the view.ILcdGXYController
,
setGXYController(com.luciad.view.gxy.ILcdGXYController)
ILcdGXYPen getDefaultPen()
ILcdGXYPen
supporting editing and painting on the view.ILcdGXYPen
of this viewILcdGXYPen
void setPaintingMode(int aPaintingMode)
getPaintingMode()
.aPaintingMode
- a binary OR of ILcdGXYLayer.BODIES, ILcdGXYLayer.LABELS, ILcdGXYLayer.SELECTIONgetPaintingMode()
int getPaintingMode()
setPaintingMode(int)
void pan(int aDeltaX, int aDeltaY, boolean aRepaint)
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.void paintGXYView(Graphics aGraphics)
Graphics
.
The painted image contains the following:
view label painter
, if it is set;
invalidate
methods.aGraphics
- the Graphics
to paint the contents of this view oninvalidate(boolean, java.lang.Object, java.lang.String)
void repaint()
invalidate
methods.
This method may return before the repaint is complete.void repaint(int aX, int aY, int aWidth, int aHeight)
invalidate
methods.
This method may return before the repaint is complete.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 rectanglerepaint()
,
invalidate(boolean, java.lang.Object, java.lang.String)
void invalidate(boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateAndWait(boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateGXYLayer(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage)
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.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.void invalidateGXYLayerAndWait(ILcdGXYLayer aGXYLayer, boolean aRepaint, Object aSource, String aMessage)
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.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.repaint()
void invalidateRegion(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateRegionAndWait(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateRegionSelection(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateRegionSelectionAndWait(Rectangle aClip, boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateSelection(boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void invalidateSelectionAndWait(boolean aRepaint, Object aSource, String aMessage)
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.repaint()
void setDrawOffScreenImageOnPaint(boolean aDrawOffScreenImageOnPaint)
aDrawOffScreenImageOnPaint
- true
to make the view paint itself
when one of the paint methods is called. False if only the current controller is painted.isDrawOffScreenImageOnPaint()
,
setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
paintGXYView(java.awt.Graphics)
boolean isDrawOffScreenImageOnPaint()
true
if the view paints itself
when one of the paint methods is called. False if only the current controller is
painted.setDrawOffScreenImageOnPaint(boolean)
,
paintGXYView(java.awt.Graphics)
ILcdGXYViewLabelPainter getGXYViewLabelPainter()
ILcdGXYLabelPainter
.ILcdGXYViewLabelPainter
default ILcdGXYViewLabelPlacer getGXYViewLabelPlacer()
null
.setGXYViewLabelPlacer(com.luciad.view.gxy.labeling.ILcdGXYViewLabelPlacer)
default void setGXYViewLabelPlacer(ILcdGXYViewLabelPlacer aLabelPlacer)
ILcdGXYViewLabelPlacer
to use for global labeling.
This will override any configured view label painter.
aLabelPlacer
- a view label placer.getGXYViewLabelPlacer()
boolean isPaintInBackground()
ILcdGXYAsynchronousLayerWrapper
interface and its implementations, which is more versatile and
which generally offers better thread safety.true
if background painting is enabled; false
otherwisevoid setPaintInBackground(boolean aPaintInBackground)
ILcdGXYAsynchronousLayerWrapper
interface and its implementations, which is more versatile and
which generally offers better thread safety.aPaintInBackground
- true
to enable painting in the background; false
to disable itILcdPaintExceptionHandler getPaintExceptionHandler()
default void setPaintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
aPaintExceptionHandler
- a handler to report paint exceptions. This handler should
never be null.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 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.
boolean isAntiAliased()
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.true
if anti-aliasing is enabled, false
otherwise.default 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
aStatusListener
- the listener that will be informed of status eventsremoveStatusListener(com.luciad.util.ILcdStatusListener)
default void removeStatusListener(ILcdStatusListener aStatusListener)
ILcdStatusListener
from being notified of view status events.removeStatusListener
in interface ILcdStatusSource
aStatusListener
- the listener that will no longer be informed of status eventsaddStatusListener(com.luciad.util.ILcdStatusListener)
default 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)
)aInvalidationListener
- the listener to notify when the view has been invalidatedremoveViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)
default void removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
ILcdViewInvalidationListener
so that it is no longer informed
of invalidation events for this view.aInvalidationListener
- the listener to no longer notify when the view has been invalidatedaddViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)