public class TLspViewBuilder extends Object
ILspView
instances. This builder has methods to
set a number of common view properties, as well as "build" methods for the
different available types of view (buildAWTView()
, buildSwingView()
,
buildOffscreenView()
) and buildStereoscopicView(TLspStereoscopicDevice)
.Modifier and Type | Method and Description |
---|---|
TLspViewBuilder |
addAtmosphere(boolean aAddAtmosphere)
Determines whether an "atmosphere" should be painted in the view.
|
TLspViewBuilder |
background(Color aColor)
Sets the background color of the view.
|
TLspAWTView |
buildAWTView()
Creates a
TLspAWTView with the current settings of this builder. |
TLspExternalView |
buildExternalStereoscopicView(TLspStereoscopicDevice aStereoscopicDevice)
Creates a stereoscopic Lightspeed
view that renders into an externally created OpenGL context
with the current settings of this builder. |
TLspExternalView |
buildExternalView()
Creates a Lightspeed
view that renders into an externally created OpenGL context
with the current settings of this builder. |
TLspFXView |
buildFXView()
Creates a
TLspFXView with the current settings of this builder. |
TLspOffscreenView |
buildOffscreenView()
Creates a
TLspOffscreenView with the current settings of this builder. |
ILspView |
buildStereoscopicView(TLspStereoscopicDevice aStereoscopicDevice)
Creates a
ILspView with the current settings of this builder. |
TLspSwingView |
buildSwingView()
Creates a
TLspSwingView with the current settings of this builder. |
TLspViewBuilder |
capabilities(ILcdGLCapabilities aGLCapabilities)
Sets the OpenGL capabilities with which to initialize the view.
|
TLspViewBuilder |
defaultEffects()
Adds a set of default graphics effects to the view consisting of
a sky/atmosphere background, fog, ambient light and a headlight.
|
TLspViewBuilder |
disableAutomaticContextSharing()
A static method to disable automatic context sharing.
|
TLspViewBuilder |
executorThreadCount(int aCount)
Sets the number of threads used by the view's task executor.
|
TLspViewBuilder |
glResourceCacheMaxEntries(int aCount)
Sets the maximal number of entries that can be stored in the OpenGL resource cache.
|
TLspViewBuilder |
glResourceCacheSize(long aSize)
Sets the size (in bytes) used by the OpenGL resource cache.
The default value is -1, which will trigger an automatic behavior that is suited for most uses. |
TLspViewBuilder |
graphicsDevice(GraphicsDevice aGraphicsDevice)
Creates a view for a specific, given
GraphicsDevice . |
static TLspViewBuilder |
newBuilder()
Creates a new view builder with default settings.
|
TLspViewBuilder |
overlayComponents(boolean aOverlayComponents)
Determines whether other GUI components will need to be overlaid on top
of the
ILspView after it has been created. |
TLspViewBuilder |
paintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
Sets a paint exception handler for the view.
|
TLspViewBuilder |
paintingHints(TLspViewPaintingHints aPaintingHints)
Sets the painting hints to be used by created views.
|
TLspViewBuilder |
resolutionScale(double aResolutionScale)
Allows rendering a view at a lower resolution than the view's host component.
|
TLspViewBuilder |
shareGLContext(ILcdGLDrawable aGLDrawable)
Sets an
ILcdGLDrawable with which new views should share an OpenGL context. |
TLspViewBuilder |
size(int aWidth,
int aHeight)
Sets the initial size of the view.
|
TLspViewBuilder |
viewType(ILspView.ViewType aViewType)
Determines whether views will be initialized to 2D or 3D.
|
TLspViewBuilder |
worldReference(ILcdXYZWorldReference aWorldReference)
Sets the initial world reference to be assigned to the view.
|
public static TLspViewBuilder newBuilder()
public TLspAWTView buildAWTView() throws UnsatisfiedLinkError
TLspAWTView
with the current settings of this builder.UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic ILspView buildStereoscopicView(TLspStereoscopicDevice aStereoscopicDevice) throws UnsatisfiedLinkError
ILspView
with the current settings of this builder. Depending on the device some
parameters may be ignored.aStereoscopicDevice
- the device for which this view will be used.UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic TLspOffscreenView buildOffscreenView() throws UnsatisfiedLinkError
Creates a TLspOffscreenView
with the current settings of this builder.
Note that automatic context sharing is not enabled for offscreen views.
UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic TLspSwingView buildSwingView() throws UnsatisfiedLinkError
TLspSwingView
with the current settings of this builder.UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic TLspFXView buildFXView() throws UnsatisfiedLinkError
TLspFXView
with the current settings of this builder.UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic TLspExternalView buildExternalView() throws UnsatisfiedLinkError
view
that renders into an externally created OpenGL context
with the current settings of this builder.UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic TLspExternalView buildExternalStereoscopicView(TLspStereoscopicDevice aStereoscopicDevice) throws UnsatisfiedLinkError
view
that renders into an externally created OpenGL context
with the current settings of this builder.UnsatisfiedLinkError
- if the OpenGL native libraries cannot be foundpublic TLspViewBuilder size(int aWidth, int aHeight)
aWidth
- the width of the view in pixelsaHeight
- the height of the view in pixelspublic TLspViewBuilder background(Color aColor)
aColor
- the background colorpublic TLspViewBuilder capabilities(ILcdGLCapabilities aGLCapabilities)
ALcdGLBinding.getInstance().getGLDrawableFactory().createGLCapabilities()
.aGLCapabilities
- the GL capabilities for the viewILcdGLDrawableFactory.createGLCapabilities()
public TLspViewBuilder shareGLContext(ILcdGLDrawable aGLDrawable)
ILcdGLDrawable
with which new views should share an OpenGL context.
Context sharing allows multiple views to share OpenGL resources such as textures,
shaders and buffer objects. By default, this property is null
, indicating that no
context sharing is performed.
When the context between two views is shared, the ILspGLResourceCache
is
automatically shared as well. In that case, the GL resource cache size and max entry count will correspond
to the first created view and calls to glResourceCacheSize(long)
and glResourceCacheMaxEntries(int)
for the other
views will be ignored.
aGLDrawable
- the drawable to share withpublic TLspViewBuilder graphicsDevice(GraphicsDevice aGraphicsDevice)
GraphicsDevice
. The default value is
null
. This method should not be called in most situations; it may (in some
rare cases) be necessary in certain multi-screen configurations to create a view on
a specific display. This method is only relevant when creating a
TLspAWTView
or TLspSwingView
.aGraphicsDevice
- a graphics devicepublic TLspViewBuilder executorThreadCount(int aCount)
aCount
- the number of threads used by the view's task executor.public TLspViewBuilder glResourceCacheSize(long aSize)
-Dcom.luciad.view.lightspeed.opengl.cacheSize=768
".aSize
- the size in bytespublic TLspViewBuilder glResourceCacheMaxEntries(int aCount)
com.luciad.view.lightspeed.opengl.maxCacheEntries
", e.g.
"-Dcom.luciad.view.lightspeed.opengl.maxCacheEntries=2000
" to limit the count to 2000 entries.aCount
- the maximal entry count. If aCount<=0 there is no limit on the count.public TLspViewBuilder paintExceptionHandler(ILcdPaintExceptionHandler aPaintExceptionHandler)
TLcdLoggingPaintExceptionHandler
.aPaintExceptionHandler
- the new exception handlerpublic TLspViewBuilder addAtmosphere(boolean aAddAtmosphere)
aAddAtmosphere
- whether or not to add an atmosphere to new viewspublic TLspViewBuilder defaultEffects()
TLspAtmosphere
,
TLspFog
,
TLspAmbientLight
,
TLspHeadLight
public TLspViewBuilder viewType(ILspView.ViewType aViewType)
aViewType
- the type of view (2D or 3D) to be createdworldReference(com.luciad.view.ILcdXYZWorldReference)
public TLspViewBuilder worldReference(ILcdXYZWorldReference aWorldReference)
view type
:
aWorldReference
- the initial world reference to be assigned to new viewspublic TLspViewBuilder overlayComponents(boolean aOverlayComponents)
ILspView
after it has been created. Typical examples of overlay
components are on-map navigation controls, such as those created by
TLspNavigationControlsBuilder.
This property is true
by default. Switching it off when it is not
needed may allow the view to perform some behind-the-scenes optimizations.
Note that when overlay component support is switched off,
ILspAWTView.getOverlayComponent()
may return null
.
Note that this method only affects TLspAWTView
and TLspExternalView
.aOverlayComponents
- whether or not overlay components should be supportedpublic TLspViewBuilder disableAutomaticContextSharing()
A static method to disable automatic context sharing. Automatic context sharing is on for all AWT, Swing and JavaFX views, unless this method is called. If enabled, all created views will share the same OpenGL context and GL resource cache. This function can be overridden by the shareGLContext(com.luciad.view.opengl.binding.ILcdGLDrawable) method, which allows you to group specific views together.
To elaborate on this mechanism, the following options are possible:
If disabled, all created views (that do not have an explicit shareGLContext called) will have a distinct OpenGL context and GL resource cache.
It is strongly recommended to leave automatic context sharing on to be more memory efficient.
Note: Offscreen views do not support automatic context sharing
public TLspViewBuilder paintingHints(TLspViewPaintingHints aPaintingHints)
TLspViewPaintingHints.newBuilder().build()
.
The hints must not be null
.aPaintingHints
- the painting hints to be usedthis
public TLspViewBuilder resolutionScale(double aResolutionScale)
aResolutionScale
- a value greater than zero and smaller than or equal to 1 (equal resolution)this