Class TLspOffscreenView
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdLayered
,ILcdTreeLayered
,ILcdView
,ILspView
,Serializable
An offscreen Lightspeed view that uses an internal buffer to render images to.
To perform a paint operation, use the display(boolean)
method. This allows
the view to be repainted into the internal buffer. The resulting image can be retrieved using
getImage()
.
Note that an instance of this class can only be used on a single thread: the thread
that was used to construct an instance of this class. Furthermore, the
invokeLater(Runnable)
method requires that the user
specifies
an ALcdPaintExecutorService
, since it cannot otherwise schedule arbitrary work
on a thread over which it has no control.
- Since:
- 2012.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.view.lightspeed.ILspView
ILspView.ViewType
-
Constructor Summary
ConstructorDescriptionCreates a new offscreen view with a default configuration.TLspOffscreenView
(int aWidth, int aHeight) Creates a new view with given width and height. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given layer to the view.void
addLayeredListener
(ILcdLayeredListener aILcdLayeredListener) Registers the givenILcdLayeredListener
to be notified when layers are added, removed or moved in the flat list.void
addLayerModelListener
(ILcdModelListener aModelListener) Adds aILcdModelListener
to receive model change events from any layer's model in this view.void
addLayerSelectionListener
(ILcdSelectionListener aSelectionListener) Adds the givenILcdSelectionListener
to the view so that is notified of any selection changes in any of the view's layers.addLayersFor
(ILcdModel aModel) Adds a model to be displayed in this view.void
AddsaModel
to be displayed in thisILcdView
.void
Registers the givenPropertyChangeListener
to be notified when this view's properties change.void
addViewInvalidationListener
(ILcdViewInvalidationListener aInvalidationListener) Registers anILcdViewInvalidationListener
to be informed when the view's contents are invalid.void
addViewListener
(ILspViewListener aViewListener) Adds the givenILspViewListener
to the view to be notified of initialization, disposal or render events.void
Prepares the view to be printed.boolean
containsLayer
(ILcdLayer aILcdLayer) Returns whether the flat list representation of the hierarchical layer structure contains the given layer.void
destroy()
Frees resources associated with this view.boolean
display()
Paints the current state of the view to an offscreen PBuffer, without waiting for the painting to finish completely.boolean
display
(boolean aWaitTillFinished) Paints the current state of the view to an offscreen PBuffer.void
Returns the view to its normal state after a prior call to beginPrinting().double
Gets the vertical exaggeration factor that is applied to altitudes and elevations in this view.Returns the view's background clear color.Gets the controller that the view uses to forward input events to.Returns the OpenGL drawable associated with this view.int
Returns the view's current height in number of screen pixels.getImage()
Returns aBufferedImage
that represents this view.Gets the currently used label placer.getLayer
(int i) Returns the layer at the given index.Sets the factory used to create layers for models added to the view usingaddModel
.Returns a handler to report paint exceptions.Returns the executor service which is used by theinvokeLater(java.lang.Runnable)
method.Gets the order object that determines the order in which layers and their various painters are invoked.Returns the minimum required OpenGL profile that an end user system must support in order to be compatible with this view.Returns the root node of the tree structure.Returns a view services object which provides various utilities that can be leveraged by the view's layers.Convenience method that returns whether the view is currently configured for 2D or 3D visualization.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.Returns the view's current world coordinate system.int
Returns the index of the given layeraLayer
in the flat list representation of the hierarchical structure.void
invalidate
(boolean aRepaint, Object aSource, String aReason) Invalidate the content of thisILcdView
.void
invokeLater
(Runnable aRunnable) Schedules the suppliedRunnable
to be executed at some point in the future using the view's paint executor service.boolean
Returns true if the view automatically updates its representation upon receiving any event that might require an update.int
Returns the number of layers in the flat list representation of the hierarchical layer structure.Returns theILcdLayer
of the flat list that contains the givenILcdModel
.layers()
Returns anEnumeration
of all theILcdLayer
s currently in the flat list representation of the hierarchical layer structure, starting from the bottom layer to the top layer.Returns anEnumeration
of all theILcdLayer
s currently in the flat list representation of the hierarchical layer structure, starting from the top layer to the bottom layer.void
moveLayerAt
(int i, ILcdLayer aILcdLayer) Moves the given layer (which is already inILcdLayered
) to the existing index aIndex.void
print
(Graphics2D aGraphics) Prints the contents of the view to the given graphics.void
print
(Graphics2D aGraphics, TLspViewPrintSettings aPrintSettings) Prints the contents of the view to the given graphics.void
Remove all the layers from the hierarchical layer structure and the flat list representation.void
removeLayer
(ILcdLayer aILcdLayer) Removes a layer from both the hierarchical layer structure and the flat list representation.void
removeLayeredListener
(ILcdLayeredListener aILcdLayeredListener) Unregisters the givenILcdLayeredListener
from receiving layered events for the flat list.void
removeLayerModelListener
(ILcdModelListener aModelListener) Unregisters the givenILcdModelListener
from receiving model change events from any layer's model in this view.void
removeLayerSelectionListener
(ILcdSelectionListener aSelectionListener) Removes the givenILcdSelectionListener
from the view so that it is no longer notified of selection changes.void
removeModel
(ILcdModel aILcdModel) Removes a single representation of the specified model from this view, if it is present in the view.void
Unregisters the givenPropertyChangeListener
from receiving property change events for this view.void
removeViewInvalidationListener
(ILcdViewInvalidationListener aInvalidationListener) Unregisters anILcdViewInvalidationListener
so that it is no longer informed of invalidation events for this view.void
removeViewListener
(ILspViewListener aViewListener) Removes the givenILspViewListener
from the view.void
resize
(int aWidth, int aHeight) Resizes thisTLspOffscreenView
.void
setAltitudeExaggerationFactor
(double aVerticalExaggerationFactor) 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
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 usingaddModel
.void
setPaintExecutorService
(ALcdPaintExecutorService aPaintExecutorService) Sets the view's paint executor service, which is used by theinvokeLater(java.lang.Runnable)
method.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 toisAutoUpdate
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, removeLayeredListener
Methods inherited from interface com.luciad.view.lightspeed.ILspView
getDPIScale, getLayers
-
Constructor Details
-
TLspOffscreenView
Creates a new offscreen view with a default configuration. Note thatTLspViewBuilder
provides a convenient way of configuring views if you wish to deviate from the default settings for any reason.- Throws:
UnsatisfiedLinkError
-
TLspOffscreenView
Creates a new view with given width and height.- Throws:
UnsatisfiedLinkError
- when the OpenGL binding native libraries could not be loaded
-
-
Method Details
-
getPaintExecutorService
Returns the executor service which is used by theinvokeLater(java.lang.Runnable)
method. By default, the service is null.- Returns:
- the paint executor service of this view
- Since:
- 2020.0
- See Also:
-
setPaintExecutorService
Sets the view's paint executor service, which is used by theinvokeLater(java.lang.Runnable)
method. Note thatinvokeLater()
cannot be used until an executor service has been set.- Parameters:
aPaintExecutorService
- the executor service to be used by this view- Since:
- 2020.0
- See Also:
-
addLayerSelectionListener
Description copied from interface:ILspView
Adds the givenILcdSelectionListener
to the view so that is notified of any selection changes in any of the view's layers.- Specified by:
addLayerSelectionListener
in interfaceILspView
- Parameters:
aSelectionListener
- the selection listener to add
-
removeLayerSelectionListener
Description copied from interface:ILspView
Removes the givenILcdSelectionListener
from the view so that it is no longer notified of selection changes.- Specified by:
removeLayerSelectionListener
in interfaceILspView
- Parameters:
aSelectionListener
- the selection listener to remove
-
addLayerModelListener
Description copied from interface:ILspView
Adds aILcdModelListener
to receive model change events from any layer's model in this view.- Specified by:
addLayerModelListener
in interfaceILspView
- Parameters:
aModelListener
- the listener that will be notified of model change events from any layer's model in this view.
-
removeLayerModelListener
Description copied from interface:ILspView
Unregisters the givenILcdModelListener
from receiving model change events from any layer's model in this view.- Specified by:
removeLayerModelListener
in interfaceILspView
- Parameters:
aModelListener
- a listener that the view will no longer notify of model change events
-
getViewXYZWorldTransformation
Description copied from interface:ILspView
Returns the transformation that is used to transform from view coordinates to world coordinates and vice versa.- Specified by:
getViewXYZWorldTransformation
in interfaceILspView
- Returns:
- the transformation that is used to transform from view coordinates to world coordinates and vice versa.
-
setViewXYZWorldTransformation
public void setViewXYZWorldTransformation(ALspViewXYZWorldTransformation aViewXYZWorldTransformation) Description copied from interface:ILspView
Sets the transformation that is used to transform from view coordinates to world coordinates and vice versa.TLspViewTransformationUtil
provides a convenient way to set up a 2D or 3D view.- Specified by:
setViewXYZWorldTransformation
in interfaceILspView
- Parameters:
aViewXYZWorldTransformation
- the transformation that is used to transform from view coordinates to world coordinates and vice versa.
-
addLayer
Description copied from interface:ILspView
Adds the given layer to the view. -
addLayersFor
Description copied from interface:ILspView
Adds a model to be displayed in this view. To this effect, the view asks its layer factory to create one or moreILspLayer
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.- Specified by:
addLayersFor
in interfaceILspView
- Parameters:
aModel
- the model to be added to the view as a new layer- Returns:
- the layers that were added
-
getController
Description copied from interface:ILspView
Gets the controller that the view uses to forward input events to.- Specified by:
getController
in interfaceILspView
- Returns:
- the controller the view uses to forward input events to
-
setController
Description copied from interface:ILspView
Sets the controller that the view will forward input events to. Only one controller can be active at a time. It is the responsibility of the view to callstartInteraction
when a controller is set on the view, andterminateInteraction
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 tonull
. Furthermore, the view is responsible for providing input events to the controller via itsILcdAWTEventListener.handleAWTEvent(java.awt.AWTEvent)
handleAWTEvent} method. Finally, the view must also invoke thepaint
method of its controller any time the view itself is repainted.- Specified by:
setController
in interfaceILspView
- Parameters:
aController
- the controller to be used for the view
-
getXYZWorldReference
Description copied from interface:ILspView
Returns the view's current world coordinate system.- Specified by:
getXYZWorldReference
in interfaceILspView
- Returns:
- the view's world coordinate system
-
setXYZWorldReference
Description copied from interface:ILspView
Sets the view's world coordinate system, repainting the view according toisAutoUpdate
.TLspViewTransformationUtil
provides a convenient way to set up a 2D or 3D view.- Specified by:
setXYZWorldReference
in interfaceILspView
- Parameters:
aXYZWorldReference
- the new world reference associated to this view
-
getLayerFactory
Description copied from interface:ILspView
Sets the factory used to create layers for models added to the view usingaddModel
.- Specified by:
getLayerFactory
in interfaceILspView
- Returns:
- the factory used to create layers for models added to the view
-
setLayerFactory
Description copied from interface:ILspView
Sets the factory used to create layers for models added to the view usingaddModel
.- Specified by:
setLayerFactory
in interfaceILspView
- Parameters:
aLayerFactory
- the factory that will be used to create layers for models added to the view
-
removeModel
Description copied from interface:ILcdView
Removes a single representation of the specified model from this view, if it is present in the view.- Specified by:
removeModel
in interfaceILcdView
-
addModel
Description copied from interface:ILcdView
AddsaModel
to be displayed in thisILcdView
. -
containsLayer
Description copied from interface:ILcdTreeLayered
Returns whether the flat list representation of the hierarchical layer structure contains the given layer. More formally, returns
true
if and only if the flat list representation contains at least one layerl
such that (aLayer==null ? l==null : aLayer.equals(l)).Calling this method with the root node will return
false
, since the root node is not a part of the flat list representation.- Specified by:
containsLayer
in interfaceILcdLayered
- Specified by:
containsLayer
in interfaceILcdTreeLayered
- Parameters:
aILcdLayer
- the layer to check whether it is in the flat list representation- Returns:
true
when the flat list representation contains the given layer,false
otherwise
-
removeAllLayers
public void removeAllLayers()Description copied from interface:ILcdTreeLayered
Remove all the layers from the hierarchical layer structure and the flat list representation. An event will be fired for every layer that has been removed. This will not remove the root node.
- Specified by:
removeAllLayers
in interfaceILcdLayered
- Specified by:
removeAllLayers
in interfaceILcdTreeLayered
-
removeLayer
Description copied from interface:ILcdTreeLayered
Removes a layer from both the hierarchical layer structure and the flat list representation. When removing an
ILcdLayerTreeNode
all of its children will also be removed. An event will then be generated for every layer that has been removed (one for the node and one for each of its child layers).It is not possible to remove the root node
- Specified by:
removeLayer
in interfaceILcdLayered
- Specified by:
removeLayer
in interfaceILcdTreeLayered
- Parameters:
aILcdLayer
- the layer to remove. If the layer is not in the flat list, this method has no effect.
-
moveLayerAt
public void moveLayerAt(int i, ILcdLayer aILcdLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException Description copied from interface:ILcdLayered
Moves the given layer (which is already inILcdLayered
) to the existing index aIndex. When a layer is moved down, all layers in between the previous and future position of the given layer (including the layer at index aIndex) are moved one position up. When a layer is moved up, all layers in between the previous and future position of the given layer (including the layer at index aIndex) are moved one position down.More formally, let previousIndex be the index of
aLayer
before the move. If previousIndex < aIndex, then the index of allILcdLayer
objects in from previousIndex + 1 to aIndex is decremented with 1. If previousIndex > aIndex, then the index of allILcdLayer
objects in from aIndex to previousIndex -1 is incremented with 1.- Specified by:
moveLayerAt
in interfaceILcdLayered
- Parameters:
i
- the index of the position where to move the layer.aILcdLayer
- the layer to move.- Throws:
NoSuchElementException
- ifaLayer
is not in thisILcdLayered
.ArrayIndexOutOfBoundsException
- ifaIndex
is not an index of one of the layers of thisILcdLayered
.
-
indexOf
Description copied from interface:ILcdTreeLayered
Returns the index of the given layer
aLayer
in the flat list representation of the hierarchical structure.- Specified by:
indexOf
in interfaceILcdLayered
- Specified by:
indexOf
in interfaceILcdTreeLayered
- Parameters:
aILcdLayer
- the layer whose index to return- Returns:
- the index of
aLayer
in the flat list representation - Throws:
NoSuchElementException
- ifaLayer
is not in the flat list
-
layerOf
Description copied from interface:ILcdTreeLayered
Returns theILcdLayer
of the flat list that contains the givenILcdModel
.- Specified by:
layerOf
in interfaceILcdLayered
- Specified by:
layerOf
in interfaceILcdTreeLayered
- Parameters:
aILcdModel
- the model to check for in the flat list- Returns:
- the
ILcdLayer
of the flat list that contains the givenILcdModel
. - Throws:
NoSuchElementException
- if there is no layer containing the given model
-
getLayer
Description copied from interface:ILspView
Returns the layer at the given index.- Specified by:
getLayer
in interfaceILcdLayered
- Specified by:
getLayer
in interfaceILcdTreeLayered
- Specified by:
getLayer
in interfaceILspView
- Parameters:
i
- the index of the requested layer- Returns:
- the layer at the given index
- Throws:
ArrayIndexOutOfBoundsException
- if the given index is invalid
-
layersBackwards
Description copied from interface:ILcdTreeLayered
Returns an
Enumeration
of all theILcdLayer
s currently in the flat list representation of the hierarchical layer structure, starting from the top layer to the bottom layer. This does not include the root node.- Specified by:
layersBackwards
in interfaceILcdLayered
- Specified by:
layersBackwards
in interfaceILcdTreeLayered
- Returns:
- an
Enumeration
of all theILcdLayer
s currently in the flat list, starting from the top layer to the bottom layer. Does not include the root node.
-
layers
Description copied from interface:ILcdTreeLayered
Returns an
Enumeration
of all theILcdLayer
s currently in the flat list representation of the hierarchical layer structure, starting from the bottom layer to the top layer. This does not include the root node.- Specified by:
layers
in interfaceILcdLayered
- Specified by:
layers
in interfaceILcdTreeLayered
- Returns:
- an
Enumeration
of all theILcdLayer
s currently in the flat list, starting from the bottom layer to the top layer. Does not include the root node.
-
layerCount
public int layerCount()Description copied from interface:ILcdTreeLayered
Returns the number of layers in the flat list representation of the hierarchical layer structure. This does not include the root node.
- Specified by:
layerCount
in interfaceILcdLayered
- Specified by:
layerCount
in interfaceILcdTreeLayered
- Returns:
- the number of layers in the flat list. Does not include the root node.
-
removeLayeredListener
Description copied from interface:ILcdTreeLayered
Unregisters the givenILcdLayeredListener
from receiving layered events for the flat list.- Specified by:
removeLayeredListener
in interfaceILcdLayered
- Specified by:
removeLayeredListener
in interfaceILcdTreeLayered
- Parameters:
aILcdLayeredListener
- the listener that will no longer be notified of changes in the flat list.- See Also:
-
addLayeredListener
Description copied from interface:ILcdTreeLayered
Registers the givenILcdLayeredListener
to be notified when layers are added, removed or moved in the flat list.- Specified by:
addLayeredListener
in interfaceILcdLayered
- Specified by:
addLayeredListener
in interfaceILcdTreeLayered
- Parameters:
aILcdLayeredListener
- the listener that from now on will be notified of all changes to the flat list.- See Also:
-
getRootNode
Description copied from interface:ILcdTreeLayered
Returns the root node of the tree structure.
- Specified by:
getRootNode
in interfaceILcdTreeLayered
- Returns:
- the root node of the tree structure
-
addViewInvalidationListener
Description copied from interface:ILspView
Registers anILcdViewInvalidationListener
to be informed when the view's contents are invalid. This can happen directly (e.g. by callingILcdView.invalidate(boolean, Object, String)
) or indirectly (e.g. by using a controller)- Specified by:
addViewInvalidationListener
in interfaceILspView
- Parameters:
aInvalidationListener
- the listener to notify when the view has been invalidated- See Also:
-
removeViewInvalidationListener
Description copied from interface:ILspView
Unregisters anILcdViewInvalidationListener
so that it is no longer informed of invalidation events for this view.- Specified by:
removeViewInvalidationListener
in interfaceILspView
- Parameters:
aInvalidationListener
- the listener to no longer notify when the view has been invalidated- See Also:
-
addViewListener
Description copied from interface:ILspView
Adds the givenILspViewListener
to the view to be notified of initialization, disposal or render events.- Specified by:
addViewListener
in interfaceILspView
- Parameters:
aViewListener
- the view listener to add
-
removeViewListener
Description copied from interface:ILspView
Removes the givenILspViewListener
from the view.- Specified by:
removeViewListener
in interfaceILspView
- Parameters:
aViewListener
- the view listener to remove.
-
getBackground
Description copied from interface:ILspView
Returns the view's background clear color.- Specified by:
getBackground
in interfaceILspView
- Returns:
- the color which is used for clearing the background
-
setBackground
Description copied from interface:ILspView
Sets the view's background clear color.- Specified by:
setBackground
in interfaceILspView
- Parameters:
aColor
- the color to be used for clearing the background
-
getGLDrawable
Description copied from interface:ILspView
Returns the OpenGL drawable associated with this view. The drawable acts as the view's entry point to the OpenGL API. The default implementation of this method returnsnull
.- Specified by:
getGLDrawable
in interfaceILspView
- Returns:
- the OpenGL drawable associated with this view
-
getWidth
public int getWidth()Description copied from interface:ILspView
Returns the view's current width in number of screen pixels. Divide by the DPI scale to obtain toolkit pixels. -
getHeight
public int getHeight()Description copied from interface:ILspView
Returns the view's current height in number of screen pixels. Divide by the DPI scale to obtain toolkit pixels. -
addPropertyChangeListener
Description copied from interface:ILspView
Registers the givenPropertyChangeListener
to be notified when this view's properties change.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Specified by:
addPropertyChangeListener
in interfaceILspView
- Parameters:
listener
- the listener to notify of changes of this view's properties- See Also:
-
removePropertyChangeListener
Description copied from interface:ILspView
Unregisters the givenPropertyChangeListener
from receiving property change events for this view.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Specified by:
removePropertyChangeListener
in interfaceILspView
- Parameters:
listener
- the listener that should no longer be notified of changes of this views properties- See Also:
-
setCursor
-
getCursor
-
resize
public void resize(int aWidth, int aHeight) Resizes thisTLspOffscreenView
.- Parameters:
aWidth
- a new widthaHeight
- a new height
-
invalidate
Description copied from interface:ILcdView
Invalidate the content of thisILcdView
.- Specified by:
invalidate
in interfaceILcdView
- Parameters:
aRepaint
- if true, this ILcdView shall be repainted immediately.aSource
- the class instance that calls this method. Used for tracing.aReason
- a message associated with this call. Used for tracing.
-
display
public boolean display()Paints the current state of the view to an offscreen PBuffer, without waiting for the painting to finish completely. This is equivalent to calling display(false).- Returns:
- A boolean flag indicating whether the paint was fully finished.
-
display
public boolean display(boolean aWaitTillFinished) Paints the current state of the view to an offscreen PBuffer. The given boolean indicates whether or not this method should block until the view has completely finished painting. If true, this method will block the caller until painting is finished, otherwise only a partial paint will be performed. This partial paint can be useful for displaying partial results in an image.- Parameters:
aWaitTillFinished
- whether or not this method should wait until the painting to PBuffer was finished completely.- Returns:
- A boolean flag indicating whether the paint was fully finished. Note that
when the
aWaitTillFinished
was true, this will also be true.
-
isAutoUpdate
public boolean isAutoUpdate()Description copied from interface:ILspView
Returns true if the view automatically updates its representation upon receiving any event that might require an update. Such events can include changes to properties of the view or to an Object in a model, or addition/removal of models.- Specified by:
isAutoUpdate
in interfaceILcdView
- Specified by:
isAutoUpdate
in interfaceILspView
- Returns:
- true if the view automatically updates when necessary; false if the view must be repainted manually
- See Also:
-
setAutoUpdate
public void setAutoUpdate(boolean b) Description copied from interface:ILspView
Sets whether to update the view's representation automatically to keep it in sync with its state and the state of its models.- Specified by:
setAutoUpdate
in interfaceILcdView
- Specified by:
setAutoUpdate
in interfaceILspView
- Parameters:
b
- true if the view should update automatically; false if it will be repainted manually- See Also:
-
getImage
Returns a
BufferedImage
that represents this view.This method will only repaint the view if it has been
invalidated
. This will happen automatically ifauto-updating
is enabled. A repaint can also be forced by calling thedisplay
method.This method may re-use and return the same image instance to improve efficiency. So the returned image may change when this method is called again.
- Returns:
- an image of the view
- See Also:
-
print
Prints the contents of the view to the given graphics. This method is the equivalent ofjava.awt.Component.print()
for offscreen views. The view must not be changed while printing. This includes all layers in the view and their models. A typical case is a model that is updated asynchronously (for example updates received from a remote server or a updates from a simulation). These asynchronous updates should be paused before starting the print. You can for example do this by taking aread lock
on all models in the view.- Parameters:
aGraphics
- theGraphics
context in which to paint
-
print
Prints the contents of the view to the given graphics. The TLspViewPrintSettings object provides additional configuration options for the print, such as the aspect ratio. When doing multi-page prints, it is strongly recommended to call beginPrinting() before the first page and endPrinting() after the last. This avoids redundant state changes in between pages, thus reducing the time needed to complete the print. It also avoids potential inconsistencies between pages due to animations or other changes. If these methods are not called,print()
will call them itself. For single-page prints, this is sufficient. The view must not be changed while printing. This includes all layers in the view and their models. A typical case is a model that is updated asynchronously (for example updates received from a remote server or a updates from a simulation). These asynchronous updates should be paused before starting the print. You can for example do this by taking aread lock
on all models in the view.- Parameters:
aGraphics
- the graphics to print the view toaPrintSettings
- configuration settings for the printing operation
-
beginPrinting
public void beginPrinting()Prepares the view to be printed. Among other things, this method stops asynchronous tasks and animations, making sure that the state of the view cannot change unexpectedly while printing is in progress. When doing multi-page prints, this method should be called before the first page, and endPrinting() should be called after the last. Not doing so will allow animations and asynchronous tasks to briefly resume in between pages, leading to possible inconsistencies from one page to the next. For single-page prints, it is not technically necessary to call this method, although there is no harm in doing so. -
endPrinting
public void endPrinting()Returns the view to its normal state after a prior call to beginPrinting(). -
destroy
public void destroy()Description copied from interface:ILspView
Frees resources associated with this view. The view must not be used anymore after this method has been called. -
getPaintingOrder
Description copied from interface:ILspView
Gets the order object that determines the order in which layers and their various painters are invoked.- Specified by:
getPaintingOrder
in interfaceILspView
- Returns:
- the painting order object
-
setPaintingOrder
Description copied from interface:ILspView
Sets the order object that determines the order in which layers and their various painters are invoked.- Specified by:
setPaintingOrder
in interfaceILspView
- Parameters:
aPaintingOrder
- the painting order object
-
setAltitudeExaggerationFactor
public void setAltitudeExaggerationFactor(double aVerticalExaggerationFactor) Description copied from interface:ILspView
Sets the vertical exaggeration factor that is applied to altitudes and elevations in this view. Note that this method throws an exception when a non-strict positive value is passed to it (i.e. a negative number or0
). It is possible to disable terrain elevation usingILspTerrainSupport#setElevationEnabled
. A factor of1.0
results in no exaggeration.- Specified by:
setAltitudeExaggerationFactor
in interfaceILspView
- Parameters:
aVerticalExaggerationFactor
- the vertical exaggeration factor- See Also:
-
getAltitudeExaggerationFactor
public double getAltitudeExaggerationFactor()Description copied from interface:ILspView
Gets the vertical exaggeration factor that is applied to altitudes and elevations in this view. All elevations are multiplied with this factor during visualization. The exaggeration factor must be strictly positive. A factor of1.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.- Specified by:
getAltitudeExaggerationFactor
in interfaceILspView
- Returns:
- the vertical exaggeration factor
-
getLabelPlacer
Description copied from interface:ILspView
Gets the currently used label placer.- Specified by:
getLabelPlacer
in interfaceILspView
- Returns:
- the current placer, never
null
.
-
setLabelPlacer
Description copied from interface:ILspView
Sets the label placer to be used by this view.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.
- Specified by:
setLabelPlacer
in interfaceILspView
- Parameters:
aPlacer
- the new placer, nevernull
.- See Also:
-
getRequiredOpenGLProfile
Description copied from interface:ILspView
Returns the minimum required OpenGL profile that an end user system must support in order to be compatible with this view. This profile does NOT take into account any of the layers or painters that are present in the view -- these should be checked individually to get a complete overview of an application's OpenGL requirements. All current implementations of this method returnTLspOpenGLProfile.LIGHTSPEED_MINIMUM
.- Specified by:
getRequiredOpenGLProfile
in interfaceILspView
- Returns:
- a
TLspGLProfile
-
getServices
Description copied from interface:ILspView
Returns a view services object which provides various utilities that can be leveraged by the view's layers. Examples include caching mechanisms and asynchronous processing support. Note that this method returns null if invoked after a call toILspView.destroy()
.- Specified by:
getServices
in interfaceILspView
- Returns:
- a view services object
-
getPaintExceptionHandler
Description copied from interface:ILspView
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.- Specified by:
getPaintExceptionHandler
in interfaceILspView
- Returns:
- a handler to report paint exceptions.
-
getViewType
Description copied from interface:ILspView
Convenience method that returns whether the view is currently configured for 2D or 3D visualization. This is actually determined by the type ofILspView.getViewXYZWorldTransformation()
:TLspViewXYZWorldTransformation2D
maps toILspView.ViewType.VIEW_2D
TLspViewXYZWorldTransformation3D
maps toILspView.ViewType.VIEW_3D
getViewType()
is equivalent to aninstanceof
test on theALspViewXYZWorldTransformation
.- Specified by:
getViewType
in interfaceILspView
- Returns:
- the current view type
-
invokeLater
Schedules the suppliedRunnable
to be executed at some point in the future using the view's paint executor service. If the service has not been configured, this method throws anUnsupportedOperationException
.- Specified by:
invokeLater
in interfaceILspView
- Parameters:
aRunnable
- the runnable to be scheduled for execution- Since:
- 2020.0
- See Also:
-