Class MbTilesFeatureLayer.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
MbTilesFeatureLayer
Builder for the MbTilesFeatureLayer class.- Since:
- 2024.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a new layer, based on the properties set on this builder.voidclose()protected voidfinalize()labeled(boolean labeled) Sets whether the layer should display labels initially.model(IFeatureTileModel model) Sets the feature tile model of the layer.Sets the style of the layer.Sets the title to use for the layer.visible(boolean visible) Sets whether the layer should be visible initially.
-
Constructor Details
-
Builder
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
build
Returns a new layer, based on the properties set on this builder.- Returns:
- a new layer, based on the properties set on this builder.
- Throws:
IllegalStateException- If not all mandatory parameters are set.IOException- If decoding the style fails.
-
title
Sets the title to use for the layer.If not set, the title from the
ModelMetadatais used.- Parameters:
title- the title for the layer.- Returns:
- this builder.
-
visible
Sets whether the layer should be visible initially.Default is
true.- Parameters:
visible- the visibility.- Returns:
- this builder.
-
model
@NotNull public MbTilesFeatureLayer.Builder model(@NotNull IFeatureTileModel model) throws NullPointerException Sets the feature tile model of the layer.Calling this function is mandatory.
- Parameters:
model- the feature tile model of the layer. Cannot benull.- Returns:
- this builder.
- Throws:
NullPointerException- when the given model isnull.
-
style
Sets the style of the layer.If not set, a default style is used instead.
The currently supported format is the Mapbox style format (see the Mapbox style specification). Only the sections that are relevant for styling MBTiles are supported, namely:
- Layers
- Types
- Expressions
- Sprite
When the Mapbox style contains a background layer style, it is applied on the extent of the feature tile data set. Use of interpolation based on zoom level is not supported for the background. The background at zoom level 0 is used.
Note that not all types, expressions and style properties defined by the Mapbox style format are supported. When an unsupported option is used in the style, that option is ignored and if appropriate, a fallback value is used instead.
The following is currently supported:
Types
array<number>array<string>booleancolor: strings of the following format are supported:"#RRGGBB","#RGB","#RRGGBBAA","#RGBA","rgb(r, g, b)","rgba(r, g, b, a)","hsl(h, s%, l%)","hsla(h, s%, l%, a)")formatted:formatexpressions are converted to strings and their formatting options are stripped and ignorednumberstring
Expressions
- Types:
array(lengths are not asserted),boolean,format(converted tostringand the formatting options are stripped and ignored),literal,number,string,to-boolean,to-color(if astringorarray<number>cannot be converted, transparent black is returned),to-number(if astringcannot be converted,0is returned),to-string,typeof - Feature data:
geometry-type,id - Lookup:
at(if index invalid,0/""is returned forarray<number>/array<string>respectively),get(only for feature properties, not objects),has(only for feature properties, not objects),in,index-of,length,slice - Ramps, scales, curves:
interpolate(interpolate-hclandinterpolate-labinterpolate in RGB colorspace as well),step - Decision:
!,!=,<,<=,==,>,>=,all,any,case,coalesce,match - String:
concat,downcase,is-supported-script(always returnstrue),resolved-locale(always returns"en"),upcase - Color:
hsl,hsla,rgb,rgba,to-rgba - Math:
-,*,/,%,^,+,abs,acos,asin,atan,ceil,cos,e,floor,ln,ln2,log10,log2,max,min,pi,random,round,sin,sqrt,tan - Camera:
zoom - Legacy:
stops,property,base,type,default, existential filters, comparison filters, set membership filters, combining filters
Layers
- All layers:
idtypefilterlayoutmaxzoomminzoompaintsource-layer
- Background layers:
background-colorbackground-opacitybackground-patternvisibility
- Fill layers:
fill-colorfill-opacityfill-outline-colorfill-patternfill-translatevisibility
- Line layers:
line-colorline-dasharrayline-offsetline-opacityline-patternvisibility
- Symbol layers:
icon-allow-overlap: also allows other symbols to be drawn on top (i.e. the behavior oficon-ignore-placement)icon-anchoricon-coloricon-imageicon-keep-uprighticon-offseticon-opacityicon-optionalicon-paddingicon-rotateicon-rotation-alignmenticon-sizeicon-text-fiticon-text-fit-paddingicon-translatesymbol-placementtext-allow-overlap: also allows other symbols to be drawn on top (i.e. the behavior oftext-ignore-placement)text-anchortext-colortext-fieldtext-font: defaults to Nototext-halo-colortext-halo-widthtext-justify:"auto"in conjunction with a variable anchor will result in centered texttext-keep-uprighttext-line-heighttext-offsettext-opacitytext-optionaltext-paddingtext-radial-offsettext-rotatetext-rotation-alignmenttext-sizetext-transformtext-translatetext-variable-anchorvisibility
- Circle layers:
circle-colorcircle-opacitycircle-radiuscircle-stroke-colorcircle-stroke-opacitycircle-stroke-widthcircle-translatevisibility
- Fill extrusion layers:
fill-extrusion-basefill-extrusion-colorfill-extrusion-heightfill-extrusion-opacityfill-extrusion-patternfill-extrusion-translatefill-extrusion-vertical-scalevisibility
- Parameters:
path- the path to a style file. Can be a URL or a file path to a JSON file.- Returns:
- this builder.
-
labeled
Sets whether the layer should display labels initially.The default is true.
- Parameters:
labeled- whether the layer should display labels initially.- Returns:
- this builder.
- See Also:
-