Class TLspXYGridOverlayLabelBuilder
Builder that makes it possible to create XY grid overlay labels. These are text labels that are added to the view and show a grid coordinate. These labels can have a pre-defined content, and style. Note that overlay labels are not attached to grid lines, but are added to the view.
The overlay label builder can be used in 2 ways:
- To build a JComponent that contains a coordinate readout. This component can be used as any Swing component. It can for example be added to the overlay panel or to a UI panel.
- To add to TLspXYGridLayerBuilder, see
TLspXYGridLayerBuilder#overlayLabel
. When using this method, the overlay label will be added to the overlay panel of the view. On top of that, the visibility of the overlay label will be synchronized with the visibility of the layer.
An example of how to use this builder:
JComponent component = TLspXYGridOverlayLabelBuilder.newBuilder(view)
.content(TLspXYGridOverlayLabelBuilder.Content.COORDINATE_AT_CENTER)
.style(gridStyle)
.build();
- Since:
- 2016.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The content that is displayed in the overlay label. -
Method Summary
Modifier and TypeMethodDescriptionall
(TLspXYGridOverlayLabelBuilder aBuilder) Copies all properties from the given builder.build()
Creates an XY grid label.content
(TLspXYGridOverlayLabelBuilder.Content aContent) The content which is being displayed.modelReference
(ILcdModelReference aModelReference) The model reference in which the overlay label displays its coordinates.Creates a new builder, capable of adding XY grid labels.style
(TLspXYGridStyle aXYGridStyle) The style with which the overlay label is being displayed.useWorldReference
(boolean aUseWorldReference) When set totrue
, the world reference of the view will be used as reference in which the overlay label displays coordinates.The view for which the overlay labels should be added.
-
Method Details
-
newBuilder
Creates a new builder, capable of adding XY grid labels.- Returns:
- a new builder
-
view
The view for which the overlay labels should be added. This method should not be called when adding this overlay layer builder to the grid layer, seeTLspXYGridLayerBuilder#overlayLabel
.- Parameters:
aView
- the view.- Returns:
- this builder.
-
useWorldReference
When set to
true
, the world reference of the view will be used as reference in which the overlay label displays coordinates. When not calling theview()
method when this method is used, an exception will be thrown when trying to build an overlay label. Note that theview
method will be called automatically when adding thisTLspXYGridOverlayLabelBuilder
to the grid layer builder, seeTLspXYGridLayerBuilder#overlayLabel
.When this method is called with
true
as argument, themodelReference
method will have no effect. When this method is called withfalse
as argument, themodelReference
method must be called.- Returns:
- this builder
-
modelReference
The model reference in which the overlay label displays its coordinates. This method will have no effect whenuseWorldReference(boolean)
is called withtrue
as argument. When calling this method,useWorldReference()
will be set tofalse
.- Parameters:
aModelReference
- the model reference of the grid for which an overlay label should be displayed.- Returns:
- this builder.
-
content
The content which is being displayed. By default, the content isCOORDINATE_AT_CENTER
.- Parameters:
aContent
- coordinate which is being displayed.- Returns:
- this builder
-
style
The style with which the overlay label is being displayed. When using this method, only styles and formats set after using the
TLspXYGridStyle.Builder.overlay()
method are used. Only the following styles are supported:This method is optional: when it is not called, a default style is used.
- Parameters:
aXYGridStyle
- the XY grid style.- Returns:
- this builder.
-
all
Copies all properties from the given builder.- Parameters:
aBuilder
- a builder- Returns:
- this builder.
-
build
Creates an XY grid label.- Returns:
- the created label.
-