Package com.luciad.view.lightspeed.style
Class TLspScaleBasedStyler
java.lang.Object
com.luciad.view.lightspeed.style.styler.ALspStyler
com.luciad.view.lightspeed.style.TLspScaleBasedStyler
- All Implemented Interfaces:
ILspStyler
Styler that switches between multiple stylers depending on the map scale. It is allowed to have multiple styles for
the same scale range, and scale ranges are allowed to overlap.
Examples
TLspScaleBasedStylerBuilder
can be used to create a new instance of this class. The following example sets up
a scale based styler that switches between styles at a map scale of 1:10.000:
TLspScaleBasedStyler scaleBasedStyler =
TLspScaleBasedStylerBuilder.newBuilder()
.styles(TLcdMapScale.MAX_ZOOMED_OUT, new TLcdMapScale(1d / 10_000), zoomedOutStyle)
.styles(new TLcdMapScale(1d / 10_000), TLcdMapScale.MAX_ZOOMED_IN, zoomedInStyle)
.build();
TLspScaleBasedStylerBuilder
can also be used in combination with
getStylersByScaleRange()
to create a variation of an existing styler. The following
example derives a new styler by copying the stylers from a given TLspScaleBasedStyler
that apply at map scale
of 1:1000:
TLspScaleBasedStylerBuilder builder = TLspScaleBasedStylerBuilder.newBuilder();
existingStyler.getStylersByScaleRange().entrySet().stream()
.filter(entry -> entry.getKey().contains(new TLcdMapScale(1d / 1_000)))
.forEach(entry -> {
for (ILspStyler styler : entry.getValue()) {
builder.styler(entry.getKey(), styler);
}
});
TLspScaleBasedStyler newStyler = builder.build();
- Since:
- 2021.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns the map scale intervals and associated stylers of this styler.static TLspScaleBasedStylerBuilder
Creates a new builder without configured stylers.void
style
(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext) Implementation ofILspStyler.style
that applies the configured stylers, based on the map scale of the current view.Methods inherited from class com.luciad.view.lightspeed.style.styler.ALspStyler
addStyleChangeListener, fireStyleChangeEvent, fireStyleChangeEvent, removeStyleChangeListener
-
Method Details
-
newBuilder
Creates a new builder without configured stylers.- Returns:
- the new builder.
-
getStylersByScaleRange
Returns the map scale intervals and associated stylers of this styler.- Returns:
- An immutable mapping of map scale intervals to the list of associated stylers.
-
style
Implementation of
ILspStyler.style
that applies the configured stylers, based on the map scale of the current view.- Parameters:
aObjects
- The objects to be styled.aStyleCollector
- A style collector to which all styling information should be passed, this collector is only valid within this method call, and can no longer be used afterwards.aContext
- Provides context information that may affect styling, such as view specific properties.
-