public interface ILspView extends ILcdView, ILcdTreeLayered
ILcdView
to visualize geospatial data in 2D or 3D, based on OpenGL.
ILspView
aggregates
and displays a
number of ILspLayer
objects. For example, a view might display a
map's geometry using three layers: countries, roads and rivers. Each layer
can provide multiple visual representations of its model, such as for
instance geometry and labels. The order in which layers and their visual
representations are drawn is decided by the view's ILspPaintingOrder
. ILspLayer
has a number of additional derived
interfaces for particular use cases, which are described in the documentation
of the com.luciad.view.lightspeed.layer
package.
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
ILspView
, it activates a default controller that combines common types of user interaction:
view navigation, selection and editing.
ILspAWTView
defines a view that lives in an AWT component.
Similarly, TLspFXView
defines a view that lives in a JavaFX node.
TLspOffscreenView
defines a view that can be rendered to an image.Modifier and Type | Interface and Description |
---|---|
static class |
ILspView.ViewType
View type enumeration that distinguishes between 2D and 3D views.
|
Modifier and Type | Method and Description |
---|---|
void |
addLayer(ILspLayer aLayer)
Adds the given layer to the view.
|
void |
addLayerModelListener(ILcdModelListener aModelListener)
Adds a
ILcdModelListener to receive model change events from
any layer's model in this view. |
void |
addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
Adds the given
ILcdSelectionListener to the view so
that is notified of any selection changes in any of the view's layers. |
Collection<ILspLayer> |
addLayersFor(ILcdModel aModel)
Adds a model to be displayed in this view.
|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Registers the given
PropertyChangeListener
to be notified when this view's properties change. |
void |
addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
Registers an
ILcdViewInvalidationListener to be informed when the view's contents are invalid. |
void |
addViewListener(ILspViewListener aViewListener)
Adds the given
ILspViewListener to the view
to be notified of initialization, disposal or render events. |
void |
destroy()
Frees resources associated with this view.
|
double |
getAltitudeExaggerationFactor()
Gets the vertical exaggeration factor that is applied to altitudes and
elevations in this view.
|
Color |
getBackground()
Returns the view's background clear color.
|
ILspController |
getController()
Gets the controller that the view uses to forward input events to.
|
default double |
getDPIScale()
Returns the DPI scaling factor of this view.
|
default ILcdGLDrawable |
getGLDrawable()
Returns the OpenGL drawable associated with this view.
|
int |
getHeight()
Returns the view's current height in number of screen pixels.
|
ILspLabelPlacer |
getLabelPlacer()
Gets the currently used label placer.
|
ILspLayer |
getLayer(int aIndex)
Returns the layer at the given index.
|
ILspLayerFactory |
getLayerFactory()
Sets the factory used to create layers for models added
to the view using
addModel . |
default List<ILspLayer> |
getLayers()
Returns a
List of the layers. |
ILcdPaintExceptionHandler |
getPaintExceptionHandler()
Returns a handler to report paint exceptions.
|
ILspPaintingOrder |
getPaintingOrder()
Gets the order object that
determines the order in which layers and their various painters are invoked.
|
TLspOpenGLProfile |
getRequiredOpenGLProfile()
Returns the minimum required OpenGL profile that an end user system must
support in order to be compatible with this view.
|
TLspViewServices |
getServices()
Returns a view services object which provides various utilities that can
be leveraged by the view's layers.
|
ILspView.ViewType |
getViewType()
Convenience method that returns whether the view is currently configured
for 2D or 3D visualization.
|
ALspViewXYZWorldTransformation |
getViewXYZWorldTransformation()
Returns the transformation that is used to transform from view coordinates
to world coordinates and vice versa.
|
int |
getWidth()
Returns the view's current width in number of screen pixels.
|
ILcdXYZWorldReference |
getXYZWorldReference()
Returns the view's current world coordinate system.
|
default void |
invokeLater(Runnable aRunnable)
Schedules the supplied
Runnable to be executed on the thread which
owns this view. |
boolean |
isAutoUpdate()
Returns true if the view automatically updates its representation upon
receiving any event that might require an update.
|
void |
removeLayerModelListener(ILcdModelListener aModelListener)
Unregisters the given
ILcdModelListener from receiving model
change events from any layer's model in this view. |
void |
removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
Removes the given
ILcdSelectionListener from the view
so that it is no longer notified of selection changes. |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Unregisters the given
PropertyChangeListener
from receiving property change events for this view. |
void |
removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
Unregisters an
ILcdViewInvalidationListener so that it is no longer informed
of invalidation events for this view. |
void |
removeViewListener(ILspViewListener aViewListener)
Removes the given
ILspViewListener from the view. |
void |
setAltitudeExaggerationFactor(double aFactor)
Sets the vertical exaggeration factor that is applied to altitudes and elevations in this view.
|
void |
setAutoUpdate(boolean b)
Sets whether to update the view's representation automatically to keep it
in sync with its state and the state of its models.
|
void |
setBackground(Color aColor)
Sets the view's background clear color.
|
void |
setController(ILspController aController)
Sets the controller that the view will forward input events to.
|
void |
setLabelPlacer(ILspLabelPlacer aPlacer)
Sets the label placer to be used by this view.
|
void |
setLayerFactory(ILspLayerFactory aLayerFactory)
Sets the factory used to create layers for models added
to the view using
addModel . |
void |
setPaintingOrder(ILspPaintingOrder aPaintingOrder)
Sets the order object that
determines the order in which layers and their various painters are invoked.
|
void |
setViewXYZWorldTransformation(ALspViewXYZWorldTransformation aViewXYZWorldTransformation)
Sets the transformation that is used to transform from view coordinates
to world coordinates and vice versa.
|
void |
setXYZWorldReference(ILcdXYZWorldReference aXYZWorldReference)
Sets the view's world coordinate system, repainting the view according
to
isAutoUpdate .
TLspViewTransformationUtil provides a convenient way
to set up a 2D or 3D view. |
addModel, invalidate, removeModel
addLayeredListener, containsLayer, getRootNode, indexOf, layerCount, layerOf, layers, layersBackwards, removeAllLayers, removeLayer, removeLayeredListener
addLayeredListener, moveLayerAt, removeLayeredListener
default List<ILspLayer> getLayers()
ILcdLayered
List
of the layers.getLayers
in interface ILcdLayered
List
of the layers in this ILcdLayered
TLspViewServices getServices()
destroy()
.void setAutoUpdate(boolean b)
setAutoUpdate
in interface ILcdView
b
- true if the view should update automatically; false if it will be repainted manuallyILcdView.isAutoUpdate()
boolean isAutoUpdate()
isAutoUpdate
in interface ILcdView
ILcdView.setAutoUpdate(boolean)
void setLayerFactory(ILspLayerFactory aLayerFactory)
addModel
.aLayerFactory
- the factory that will be used to create layers for
models added to the viewILspLayerFactory getLayerFactory()
addModel
.void addLayer(ILspLayer aLayer)
aLayer
- the layer to addILspLayer getLayer(int aIndex)
getLayer
in interface ILcdLayered
getLayer
in interface ILcdTreeLayered
aIndex
- the index of the requested layerCollection<ILspLayer> addLayersFor(ILcdModel aModel)
ILspLayer
s for the model, and adds
that to its layer list. This method returns the layers that were created, or
null if the layer factory failed to create a layer.aModel
- the model to be added to the view as a new layerColor getBackground()
void setBackground(Color aColor)
aColor
- the color to be used for clearing the backgroundint getWidth()
int getHeight()
void setXYZWorldReference(ILcdXYZWorldReference aXYZWorldReference)
isAutoUpdate
.
TLspViewTransformationUtil
provides a convenient way
to set up a 2D or 3D view.aXYZWorldReference
- the new world reference associated to this viewILcdXYZWorldReference getXYZWorldReference()
void setViewXYZWorldTransformation(ALspViewXYZWorldTransformation aViewXYZWorldTransformation)
TLspViewTransformationUtil
provides a convenient way
to set up a 2D or 3D view.aViewXYZWorldTransformation
- the transformation that is used to transform
from view coordinates to world coordinates and vice versa.ALspViewXYZWorldTransformation getViewXYZWorldTransformation()
void setController(ILspController aController)
startInteraction
when a controller is set on the view, and
terminateInteraction
when the controller is removed from the view. To detach a controller from the view, you either set another
controller or you set the controller to null
. Furthermore, the
view is responsible for providing input events to the controller via its
ILcdAWTEventListener.handleAWTEvent(java.awt.AWTEvent)
handleAWTEvent}
method. Finally, the view must also invoke the
paint
method of its controller any time the view itself is repainted.aController
- the controller to be used for the viewILspController getController()
void addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILcdSelectionListener
to the view so
that is notified of any selection changes in any of the view's layers.aSelectionListener
- the selection listener to addvoid removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILcdSelectionListener
from the view
so that it is no longer notified of selection changes.aSelectionListener
- the selection listener to removevoid addLayerModelListener(ILcdModelListener aModelListener)
ILcdModelListener
to receive model change events from
any layer's model in this view.aModelListener
- the listener that will be notified of model change events
from any layer's model in this view.void removeLayerModelListener(ILcdModelListener aModelListener)
ILcdModelListener
from receiving model
change events from any layer's model in this view.aModelListener
- a listener that the view will no longer notify of model change eventsvoid addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
to be notified when this view's properties change.addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener to notify of changes of this view's propertiesALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
from receiving property change events for this view.removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that should no longer be notified of changes of
this views propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
void addViewListener(ILspViewListener aViewListener)
ILspViewListener
to the view
to be notified of initialization, disposal or render events.aViewListener
- the view listener to addvoid removeViewListener(ILspViewListener aViewListener)
ILspViewListener
from the view.aViewListener
- the view listener to remove.void addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
ILcdViewInvalidationListener
to be informed when the view's contents are invalid.
This can happen directly (e.g. by calling ILcdView.invalidate(boolean, Object, String)
) or indirectly (e.g. by using a controller)aInvalidationListener
- the listener to notify when the view has been invalidatedremoveViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)
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)
void destroy()
ILspPaintingOrder getPaintingOrder()
void setPaintingOrder(ILspPaintingOrder aPaintingOrder)
aPaintingOrder
- the painting order objectdouble getAltitudeExaggerationFactor()
1.0
results in no exaggeration. Values between 0 and 1 result in reduced relief,
values higher than 1 result in increased relief. Rendering artifacts may
occur when using values that are too small or too large; for most
applications, values below 1 and above 20 or so will not produce useful
results.void setAltitudeExaggerationFactor(double aFactor)
0
). It is possible to disable terrain elevation using
ILspTerrainSupport#setElevationEnabled
.
A factor of 1.0
results in no exaggeration.aFactor
- the vertical exaggeration factorgetAltitudeExaggerationFactor()
void setLabelPlacer(ILspLabelPlacer aPlacer)
A label placer positions the labels of all the view's layers. The layers are only responsible for painting of their labels, not de-cluttering them.
aPlacer
- the new placer, never null
.IllegalArgumentException
- when the new label placer is null
.TLspLabelPlacer
ILspLabelPlacer getLabelPlacer()
null
.TLspOpenGLProfile getRequiredOpenGLProfile()
TLspOpenGLProfile.LIGHTSPEED_MINIMUM
.TLspGLProfile
ILcdPaintExceptionHandler getPaintExceptionHandler()
ILspView.ViewType getViewType()
getViewXYZWorldTransformation()
:
TLspViewXYZWorldTransformation2D
maps
to ILspView.ViewType.VIEW_2D
TLspViewXYZWorldTransformation3D
maps
to ILspView.ViewType.VIEW_3D
getViewType()
is equivalent to an instanceof
test on the ALspViewXYZWorldTransformation
.default void invokeLater(Runnable aRunnable)
Runnable
to be executed on the thread which
owns this view. For an ALspAWTView
, for instance, this is the
Swing EDT. This method returns immediately, without waiting for the
runnable to execute. Note that if the view is destroyed, any runnables that
are still pending will be discarded without being executed.
By default, this method throws an UnsupportedOperationException
.aRunnable
- the runnable to be executeddefault ILcdGLDrawable getGLDrawable()
null
.default double getDPIScale()
OpenGL viewport width or height
and the
width or height of the drawable itself
. When DPI scaling is
enabled in the host operating system, the former will be larger than the latter.
For instance, if the DPI scale is set to 150%, then this method will return 1.5
and ILcdGLDrawable.getViewportSize()
will be 50% wider and taller than ILcdGLDrawable.getSize()
.
For more information about DPI scaling, see
ILcdGLDrawable.getDPIScale()
and ALspViewXYZWorldTransformation
.