Class TLspXYGridLayerBuilder
Builder for creating ILspLayer
instances that visualize cartesian (XY) grid data. The
styling of the XY grid and its labels can be done using TLspXYGridStyle
.
An example of how to use this builder:
TLspXYGridStyle gridStyle = ...; // See TLspXYGridStyle documentation
ILcdModel gridModel = TLspXYGridLayerBuilder.createModel("XY grid");
ILspLayer layer = TLspXYGridLayerBuilder.newBuilder()
.model(gridModel)
.label("XY grid")
.style(gridStyle)
.build();
It is possible to specify a model reference for the xy grid, or to make the grid always use the world reference. Note that not all model references are supported. Geocentric references are not supported for example, which means that this grid can not be used in a (geocentric) 3D view. In that case nothing is visualized.
- Since:
- 2016.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a new layer instance.static ILcdModel
createModel
(String aModelName) Creates a model that can be used by this builder and uses the same reference as the view it is visualized in.static ILcdModel
createModel
(String aModelName, ILcdModelReference aModelReference) Creates a model that can be used by this builder.Sets the label of the layer.layerStyle
(TLspLayerStyle aLayerStyle) Set a layer style to be used during the rendering of the layer.layerType
(ILspLayer.LayerType aLayerType) This method is not supported for XY grid layersSets the model of the layer.static TLspXYGridLayerBuilder
Returns a new XY grid layer builderoverlayLabel
(TLspXYGridOverlayLabelBuilder aOverlayLabelBuilder, Object aConstraint) Adds an overlay label to be used.style
(TLspXYGridStyle aXYGridStyle) Sets the style to be used by this layer.Methods inherited from class com.luciad.view.lightspeed.layer.ALspLayerBuilder
getIcon, getLabel, getLayerStyle, getLayerType, getModel, icon
-
Method Details
-
newBuilder
Returns a new XY grid layer builder- Returns:
- a new XY grid layer builder
-
createModel
Creates a model that can be used by this builder. This method makes it is possible to specify the used model reference and model name. The model name is used as a default display name for the layer created by this builder. This method throws an exception when the given model reference is not an
ILcdXYWorldReference
.Use this method when you want your grid to be warped by the world reference.
- Parameters:
aModelName
- The desired model nameaModelReference
- The model reference in which the grid is defined- Returns:
- A model that can be used in this builder.
-
createModel
Creates a model that can be used by this builder and uses the same reference as the view it is visualized in. This means that the grid uses a different reference during painting when the world reference of the view changes. The model name is used as a default display name for the layer created by this builder.
Use this method when you always want to display an axis-aligned grid.
When the world reference of the view to which this grid model is added is not an
ILcdXYWorldReference
, nothing will be painted.Note that the returned model will always have a default geodetic model reference. So the model reference of the created model will not be changed to the model reference of the view. The XY grid layer will make sure that the grid is generated/painted for the world reference though. This is not explicitly modelled though.
Calling this method is optional. If not called, the layer builder will create a default model using this method.
- Parameters:
aModelName
- The desired model name- Returns:
- A model that can be used in this builder.
-
model
Sets the model of the layer. This model should be created using one of the following methods:
createModel(String)
: when the grid should use the reference of the view.createModel(String, ILcdModelReference)
: when the grid should use a specific model reference.
Calling this method is optional. If not called, the layer builder will create a default model using the createModel(String) method.
- Overrides:
model
in classALspLayerBuilder
- Parameters:
aModel
- a model- Returns:
- this builder
- Throws:
IllegalArgumentException
- if the given model is not a valid xy grid model.- See Also:
-
label
Sets the label of the layer. This is a short textual representation for it, often used to represent the layer to end-users. The default value is"XY Grid"
.- Overrides:
label
in classALspLayerBuilder
- Parameters:
aLabel
- the label- Returns:
- this builder
- See Also:
-
layerType
This method is not supported for XY grid layers- Overrides:
layerType
in classALspLayerBuilder
- Parameters:
aLayerType
- the layer type- Returns:
- this builder
- Throws:
UnsupportedOperationException
- this method is not supported for XY grid layers- See Also:
-
layerStyle
Description copied from class:ALspLayerBuilder
Set a layer style to be used during the rendering of the layer.TLspLayerStyle
is used to style the layer as a whole. Layer style can for example modify the transparency of a layer. Also, layer style can be modified after building the layer by callingILspLayer.setLayerStyle(TLspLayerStyle)
.- Overrides:
layerStyle
in classALspLayerBuilder
- Parameters:
aLayerStyle
- the layer style. Must not benull
. If you want to set the default layer style, setTLspLayerStyle.newBuilder().build()
- Returns:
- this
- See Also:
-
style
Sets the style to be used by this layer. This method is optional: when it is not called, a default style is used.
- Parameters:
aXYGridStyle
- the XY grid style to use.- Returns:
- this builder.
-
overlayLabel
public TLspXYGridLayerBuilder overlayLabel(TLspXYGridOverlayLabelBuilder aOverlayLabelBuilder, Object aConstraint) Adds an overlay label to be used. When the layer (built using this builder) is added to the view, this overlay label builder is used to add an overlay component to a view. The overlay component is also removed when the layer is removed from a view.
- Parameters:
aOverlayLabelBuilder
- the overlay label builder used to create an overlay component. It is not needed to call theTLspXYGridOverlayLabelBuilder.view()
method before calling this method. This will be done automatically when thebuild()
method is called.aConstraint
- an object expressing layout constraints for this component, usually one of these location constants.- Returns:
- this builder.
-
build
Creates a new layer instance.
This builder returns an
ILspStyledLayer
that containsILspCustomizableStyler
instances.- Specified by:
build
in classALspLayerBuilder
- Returns:
- the new layer instance
-