public final class TLspFXView extends Object implements ILspView
An ILspView
which is represented by a JavaFX node. The node can be
retrieved using getHostNode()
for inclusion in the application's UI.
Other nodes can be overlaid onto the view by adding them to
getOverlayNodes()
, which works in a similar way to JavaFX's
StackPane
. Note that the view adds a TLcdOverlayPane
to its
overlays by default. This allows for convenient positioning of overlays in
the corners or along the edges of the map.
TLspViewBuilder
is the recommended way of creating instances of
TLspFXView
.
The code below shows a minimal example of how to use TLspFXView
in
a JavaFX Application
:
public class BasicJavaFXSample extends Application {
@Override
public void start(Stage aPrimaryStage) {
// Create a JavaFX view
TLspFXView view = TLspViewBuilder
.newBuilder()
.viewType(ILspView.ViewType.VIEW_3D)
.defaultEffects()
.buildFXView();
// Add a layer to the view
view.addLayer(TLspLonLatGridLayerBuilder.newBuilder().build());
// Add a scale indicator to the bottom right corner of the view
TLspFXScaleIndicator scaleIndicator = new TLspFXScaleIndicator(view);
FXUtil.findOverlayPane(view).ifPresent(
o -> o.add(scaleIndicator.getNode(), TLcdOverlayPane.Location.SOUTH_EAST)
);
// Make a scene
BorderPane pane = new BorderPane(view.getHostNode());
Scene scene = new Scene(pane);
aPrimaryStage.setScene(scene);
aPrimaryStage.show();
}
}
ILspView.ViewType
Constructor and Description |
---|
TLspFXView()
Creates a new Lightspeed view with a default configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
addLayer(ILspLayer aLayer)
Adds the given layer to the view.
|
void |
addLayeredListener(ILcdLayeredListener aListener)
Registers the given
ILcdLayeredListener to be notified when layers are added,
removed or moved in the flat list. |
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 |
addModel(ILcdModel aModel)
Adds
aModel to be displayed in this ILcdView . |
void |
addPropertyChangeListener(PropertyChangeListener aListener)
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. |
boolean |
containsLayer(ILcdLayer aLayer)
Returns whether the flat list representation of the hierarchical layer structure contains
the given layer.
|
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.
|
ILcdGLDrawable |
getGLDrawable()
Returns the OpenGL drawable associated with this view.
|
int |
getHeight()
Returns the view's current height in number of screen pixels.
|
javafx.scene.Node |
getHostNode()
Returns the
Node hosting this Lightspeed view. |
javafx.scene.image.Image |
getImage()
Returns a snapshot of this view as a new
WritableImage . |
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 . |
javafx.collections.ObservableList<javafx.scene.Node> |
getOverlayNodes()
Returns the
Node s that are overlaid on this Lightspeed view. |
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.
|
ILcdLayerTreeNode |
getRootNode()
Returns the root node of the tree structure.
|
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.
|
int |
indexOf(ILcdLayer aLayer)
Returns the index of the given layer
aLayer in the flat list representation of
the hierarchical structure. |
void |
invalidate(boolean aRepaint,
Object aSource,
String aReason)
Invalidate the content of this
ILcdView . |
void |
invokeLater(Runnable aRunnable)
Schedules the specified runnable to be executed on the JavaFX platform thread.
|
boolean |
isAutoUpdate()
Returns true if the view automatically updates its representation upon
receiving any event that might require an update.
|
int |
layerCount()
Returns the number of layers in the flat list representation of the hierarchical layer
structure.
|
ILspLayer |
layerOf(ILcdModel aModel)
Returns the
ILcdLayer of the flat list that contains the given
ILcdModel . |
Enumeration |
layers()
Returns an
Enumeration of all the ILcdLayer s currently in the flat
list representation of the hierarchical layer structure, starting from the bottom layer to the
top layer. |
Enumeration |
layersBackwards()
Returns an
Enumeration of all the ILcdLayer s currently in the flat
list representation of the hierarchical layer structure, starting from the top layer to the
bottom layer. |
void |
moveLayerAt(int aIndex,
ILcdLayer aLayer)
Moves the given layer (which is already in
ILcdLayered ) to the existing index
aIndex. |
javafx.scene.image.Image |
print(TLspViewPrintSettings aPrintSettings)
Creates an image which shows a high-resolution printout of this view.
|
void |
removeAllLayers()
Remove all the layers from the hierarchical layer structure and the flat list
representation.
|
void |
removeLayer(ILcdLayer aLayer)
Removes a layer from both the hierarchical layer structure and the flat list representation.
|
void |
removeLayeredListener(ILcdLayeredListener aListener)
Unregisters the given
ILcdLayeredListener from receiving layered events for the
flat list. |
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 |
removeModel(ILcdModel aModel)
Removes a single representation of the specified model from this
view, if it is present in the view.
|
void |
removePropertyChangeListener(PropertyChangeListener aListener)
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 aVerticalExaggerationFactor)
Sets the vertical exaggeration factor that is applied to altitudes and elevations in this view.
|
void |
setAutoUpdate(boolean aAutoUpdate)
Sets whether to update the view's representation automatically to keep it
in sync with its state and the state of its models.
|
void |
setBackground(Color aColor)
Sets the 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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDPIScale, getLayers
addLayeredListener, removeLayeredListener
public TLspFXView() throws UnsatisfiedLinkError
TLspViewBuilder
provides a convenient way of configuring views if
you wish to deviate from the default settings for any reason.UnsatisfiedLinkError
public void addLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILspView
ILcdSelectionListener
to the view so
that is notified of any selection changes in any of the view's layers.addLayerSelectionListener
in interface ILspView
aSelectionListener
- the selection listener to addpublic void removeLayerSelectionListener(ILcdSelectionListener aSelectionListener)
ILspView
ILcdSelectionListener
from the view
so that it is no longer notified of selection changes.removeLayerSelectionListener
in interface ILspView
aSelectionListener
- the selection listener to removepublic void addLayerModelListener(ILcdModelListener aModelListener)
ILspView
ILcdModelListener
to receive model change events from
any layer's model in this view.addLayerModelListener
in interface ILspView
aModelListener
- the listener that will be notified of model change events
from any layer's model in this view.public void removeLayerModelListener(ILcdModelListener aModelListener)
ILspView
ILcdModelListener
from receiving model
change events from any layer's model in this view.removeLayerModelListener
in interface ILspView
aModelListener
- a listener that the view will no longer notify of model change eventspublic ALspViewXYZWorldTransformation getViewXYZWorldTransformation()
ILspView
getViewXYZWorldTransformation
in interface ILspView
public void setViewXYZWorldTransformation(ALspViewXYZWorldTransformation aViewXYZWorldTransformation)
ILspView
TLspViewTransformationUtil
provides a convenient way
to set up a 2D or 3D view.setViewXYZWorldTransformation
in interface ILspView
aViewXYZWorldTransformation
- the transformation that is used to transform
from view coordinates to world coordinates and vice versa.public void addLayer(ILspLayer aLayer)
ILspView
public Collection<ILspLayer> addLayersFor(ILcdModel aModel)
ILspView
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.addLayersFor
in interface ILspView
aModel
- the model to be added to the view as a new layerpublic ILspController getController()
ILspView
getController
in interface ILspView
public void setController(ILspController aController)
ILspView
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.setController
in interface ILspView
aController
- the controller to be used for the viewpublic ILcdXYZWorldReference getXYZWorldReference()
ILspView
getXYZWorldReference
in interface ILspView
public void setXYZWorldReference(ILcdXYZWorldReference aXYZWorldReference)
ILspView
isAutoUpdate
.
TLspViewTransformationUtil
provides a convenient way
to set up a 2D or 3D view.setXYZWorldReference
in interface ILspView
aXYZWorldReference
- the new world reference associated to this viewpublic ILspLayerFactory getLayerFactory()
ILspView
addModel
.getLayerFactory
in interface ILspView
public void setLayerFactory(ILspLayerFactory aLayerFactory)
ILspView
addModel
.setLayerFactory
in interface ILspView
aLayerFactory
- the factory that will be used to create layers for
models added to the viewpublic void removeModel(ILcdModel aModel)
ILcdView
removeModel
in interface ILcdView
public void addModel(ILcdModel aModel)
ILcdView
aModel
to be displayed in this ILcdView
.public boolean containsLayer(ILcdLayer aLayer)
ILcdTreeLayered
Returns whether the flat list representation of the hierarchical layer structure contains
the given layer. More formally, returns true
if and only if the flat list
representation contains at least one layer l
such that (aLayer==null ? l==null : aLayer.equals(l)).
Calling this method with the root node will return false
, since the
root node is not a part of the flat list representation.
containsLayer
in interface ILcdLayered
containsLayer
in interface ILcdTreeLayered
aLayer
- the layer to check whether it is in the flat list representationtrue
when the flat list representation contains the given layer,
false
otherwisepublic void removeAllLayers()
ILcdTreeLayered
Remove all the layers from the hierarchical layer structure and the flat list representation. An event will be fired for every layer that has been removed. This will not remove the root node.
removeAllLayers
in interface ILcdLayered
removeAllLayers
in interface ILcdTreeLayered
public void removeLayer(ILcdLayer aLayer)
ILcdTreeLayered
Removes a layer from both the hierarchical layer structure and the flat list representation.
When removing an ILcdLayerTreeNode
all of its children will also be removed. An
event will then be generated for every layer that has been removed (one for the node and one
for each of its child layers).
It is not possible to remove the root node
removeLayer
in interface ILcdLayered
removeLayer
in interface ILcdTreeLayered
aLayer
- the layer to remove. If the layer is not in the flat list, this method has no effect.public void moveLayerAt(int aIndex, ILcdLayer aLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException
ILcdLayered
ILcdLayered
) to the existing index
aIndex.
When a layer is moved down, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position up.
When a layer is moved up, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position down.
More formally, let previousIndex be the index of aLayer
before the move.
If previousIndex < aIndex, then the index of all ILcdLayer
objects
in from previousIndex + 1 to aIndex is decremented with 1.
If previousIndex > aIndex, then the index of all ILcdLayer
objects
in from aIndex to previousIndex -1 is incremented with 1.
moveLayerAt
in interface ILcdLayered
aIndex
- the index of the position where to move the layer.aLayer
- the layer to move.NoSuchElementException
- if aLayer
is not in this ILcdLayered
.ArrayIndexOutOfBoundsException
- if aIndex
is not an index of one of
the layers of this ILcdLayered
.public int indexOf(ILcdLayer aLayer) throws NoSuchElementException
ILcdTreeLayered
Returns the index of the given layer aLayer
in the flat list representation of
the hierarchical structure.
indexOf
in interface ILcdLayered
indexOf
in interface ILcdTreeLayered
aLayer
- the layer whose index to returnaLayer
in the flat list representationNoSuchElementException
- if aLayer
is not in the flat listpublic ILspLayer layerOf(ILcdModel aModel) throws NoSuchElementException
ILcdTreeLayered
ILcdLayer
of the flat list that contains the given
ILcdModel
.layerOf
in interface ILcdLayered
layerOf
in interface ILcdTreeLayered
aModel
- the model to check for in the flat listILcdLayer
of the flat list that contains the given
ILcdModel
.NoSuchElementException
- if there is no layer containing the given modelpublic ILspLayer getLayer(int aIndex) throws ArrayIndexOutOfBoundsException
ILspView
getLayer
in interface ILcdLayered
getLayer
in interface ILcdTreeLayered
getLayer
in interface ILspView
aIndex
- the index of the requested layerArrayIndexOutOfBoundsException
- if the given index is invalidpublic Enumeration layersBackwards()
ILcdTreeLayered
Returns an Enumeration
of all the ILcdLayer
s currently in the flat
list representation of the hierarchical layer structure, starting from the top layer to the
bottom layer. This does not include the root node.
layersBackwards
in interface ILcdLayered
layersBackwards
in interface ILcdTreeLayered
Enumeration
of all the ILcdLayer
s currently in the flat
list, starting from the top layer to the bottom layer. Does not include the root node.public Enumeration layers()
ILcdTreeLayered
Returns an Enumeration
of all the ILcdLayer
s currently in the flat
list representation of the hierarchical layer structure, starting from the bottom layer to the
top layer. This does not include the root node.
layers
in interface ILcdLayered
layers
in interface ILcdTreeLayered
Enumeration
of all the ILcdLayer
s currently in the flat
list, starting from the bottom layer to the top layer. Does not include the root node.public int layerCount()
ILcdTreeLayered
Returns the number of layers in the flat list representation of the hierarchical layer structure. This does not include the root node.
layerCount
in interface ILcdLayered
layerCount
in interface ILcdTreeLayered
public void removeLayeredListener(ILcdLayeredListener aListener)
ILcdTreeLayered
ILcdLayeredListener
from receiving layered events for the
flat list.removeLayeredListener
in interface ILcdLayered
removeLayeredListener
in interface ILcdTreeLayered
aListener
- the listener that will no longer be notified of changes in the flat
list.ILcdTreeLayered.addLayeredListener(com.luciad.view.ILcdLayeredListener)
public void addLayeredListener(ILcdLayeredListener aListener)
ILcdTreeLayered
ILcdLayeredListener
to be notified when layers are added,
removed or moved in the flat list.addLayeredListener
in interface ILcdLayered
addLayeredListener
in interface ILcdTreeLayered
aListener
- the listener that from now on will be notified of all changes to the
flat list.ILcdTreeLayered.removeLayeredListener(com.luciad.view.ILcdLayeredListener)
public ILcdLayerTreeNode getRootNode()
ILcdTreeLayered
Returns the root node of the tree structure.
getRootNode
in interface ILcdTreeLayered
public void addViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
ILspView
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)addViewInvalidationListener
in interface ILspView
aInvalidationListener
- the listener to notify when the view has been invalidatedILspView.removeViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)
public void removeViewInvalidationListener(ILcdViewInvalidationListener aInvalidationListener)
ILspView
ILcdViewInvalidationListener
so that it is no longer informed
of invalidation events for this view.removeViewInvalidationListener
in interface ILspView
aInvalidationListener
- the listener to no longer notify when the view has been invalidatedILspView.addViewInvalidationListener(com.luciad.view.ILcdViewInvalidationListener)
public void addViewListener(ILspViewListener aViewListener)
ILspView
ILspViewListener
to the view
to be notified of initialization, disposal or render events.addViewListener
in interface ILspView
aViewListener
- the view listener to addpublic void removeViewListener(ILspViewListener aViewListener)
ILspView
ILspViewListener
from the view.removeViewListener
in interface ILspView
aViewListener
- the view listener to remove.public Color getBackground()
ILspView
getBackground
in interface ILspView
public void setBackground(Color aColor)
ILspView
setBackground
in interface ILspView
aColor
- the color to be used for clearing the backgroundpublic ILcdGLDrawable getGLDrawable()
ILspView
null
.getGLDrawable
in interface ILspView
public int getWidth()
ILspView
public int getHeight()
ILspView
public void addPropertyChangeListener(PropertyChangeListener aListener)
ILspView
PropertyChangeListener
to be notified when this view's properties change.addPropertyChangeListener
in interface ILcdPropertyChangeSource
addPropertyChangeListener
in interface ILspView
aListener
- the listener to notify of changes of this view's propertiesALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aListener)
ILspView
PropertyChangeListener
from receiving property change events for this view.removePropertyChangeListener
in interface ILcdPropertyChangeSource
removePropertyChangeListener
in interface ILspView
aListener
- the listener that should no longer be notified of changes of
this views propertiesILcdPropertyChangeSource.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void invalidate(boolean aRepaint, Object aSource, String aReason)
ILcdView
ILcdView
.invalidate
in interface ILcdView
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.public boolean isAutoUpdate()
ILspView
isAutoUpdate
in interface ILcdView
isAutoUpdate
in interface ILspView
ILcdView.setAutoUpdate(boolean)
public void setAutoUpdate(boolean aAutoUpdate)
ILspView
setAutoUpdate
in interface ILcdView
setAutoUpdate
in interface ILspView
aAutoUpdate
- true if the view should update automatically; false if it will be repainted manuallyILcdView.isAutoUpdate()
public javafx.scene.image.Image getImage()
Returns a snapshot of this view as a new WritableImage
.
This method will repaint the view if it has been invalidated. This will happen automatically if auto-updating is enabled.
isAutoUpdate()
,
invalidate(boolean, Object, String)
public void destroy()
ILspView
public ILspPaintingOrder getPaintingOrder()
ILspView
getPaintingOrder
in interface ILspView
public void setPaintingOrder(ILspPaintingOrder aPaintingOrder)
ILspView
setPaintingOrder
in interface ILspView
aPaintingOrder
- the painting order objectpublic void setAltitudeExaggerationFactor(double aVerticalExaggerationFactor)
ILspView
0
). It is possible to disable terrain elevation using
ILspTerrainSupport#setElevationEnabled
.
A factor of 1.0
results in no exaggeration.setAltitudeExaggerationFactor
in interface ILspView
aVerticalExaggerationFactor
- the vertical exaggeration factorILspView.getAltitudeExaggerationFactor()
public double getAltitudeExaggerationFactor()
ILspView
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.getAltitudeExaggerationFactor
in interface ILspView
public ILspLabelPlacer getLabelPlacer()
ILspView
getLabelPlacer
in interface ILspView
null
.public void setLabelPlacer(ILspLabelPlacer aPlacer)
ILspView
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.
setLabelPlacer
in interface ILspView
aPlacer
- the new placer, never null
.TLspLabelPlacer
public TLspOpenGLProfile getRequiredOpenGLProfile()
ILspView
TLspOpenGLProfile.LIGHTSPEED_MINIMUM
.getRequiredOpenGLProfile
in interface ILspView
TLspGLProfile
public TLspViewServices getServices()
ILspView
ILspView.destroy()
.getServices
in interface ILspView
public ILcdPaintExceptionHandler getPaintExceptionHandler()
ILspView
getPaintExceptionHandler
in interface ILspView
public ILspView.ViewType getViewType()
ILspView
ILspView.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
.getViewType
in interface ILspView
public javafx.scene.Node getHostNode()
Node
hosting this Lightspeed view.Node
hosting this Lightspeed viewpublic javafx.collections.ObservableList<javafx.scene.Node> getOverlayNodes()
Node
s that are overlaid on this Lightspeed view. By default,
this list contains a single instance of TLcdOverlayPane
. Additional nodes
can be added as needed. The layout of the overlay nodes is handled internally using
a StackPane
.public void invokeLater(Runnable aRunnable)
invokeLater
in interface ILspView
aRunnable
- the runnable to be executedpublic javafx.scene.image.Image print(TLspViewPrintSettings aPrintSettings)
ImageView
with the image and supply it
to PrinterJob#printPage()
. It can also be grouped in a layout pane with
other nodes to add additional elements to the print, such as headers/footers or a
legend. The TLspViewPrintSettings object provides additional
configuration options for the print. Notably, the printBounds
property determines
the dimensions of the output image. Note that only the width and height of the bounds are
considered, the X and Y coordinates have no effect in a JavaFX view. The dimensions of
the print image are limited only by available memory.
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 a
read lock
on all models in the view.
This method is not required to be called on the JavaFX platform thread. Calling it on a
background thread makes it possible, for instance, to show a progress dialog during the
printing operation.aPrintSettings
- configuration settings for the printing operation