Package dev.avelar.mapnik
Class Layer
java.lang.Object
dev.avelar.mapnik.Layer
- All Implemented Interfaces:
AutoCloseable
A map layer. There are two kinds:
- A layer you build with
create(java.lang.String). You own it and shouldclose()it. Adding it to a map withMapnikMap.addLayer(dev.avelar.mapnik.Layer)copies it, so you can close yours afterwards. - A view onto a layer inside a map, from
MapnikMap.layer(String)and friends. Changes to it change the map. Closing it does nothing. It stops working, with anIllegalStateException, once the map's layer list changes (add, remove, load) or the map is closed.
-
Method Summary
Modifier and TypeMethodDescriptionAdd a copy ofchildunder this layer, to group layers.Buffer around the layer's tiles in pixels, if set.booleanchildCopy(int index) A copy of the child atindex, which you own and should close.intbooleanvoidclose()Frees a layer made withcreate(java.lang.String).compOp()How this layer is blended onto what is below it, by the name used in styles, such asmultiply,screenorsrc-over.static LayerA new standalone layer in EPSG:4326.static LayerA new standalone layer.A new handle onto the layer's datasource, which you should close, or empty if there is none.envelope()The extent of the layer's data, in the layer's projection.groupBy()The column rendering is grouped by, or an empty string.booleanisActive()Whether the layer is drawn at all.booleanbooleanisVisibleAt(double scaleDenominator) True if the layer is active andscaleDenominatoris inside its scale range.Extent beyond which this layer is not drawn, if set.doubledoublename()doubleopacity()setActive(boolean active) setBufferSize(int size) setCacheFeatures(boolean v) setClearLabelCache(boolean v) Set the blend mode.Attach a datasource.setGroupBy(String column) setMaximumExtent(Box2d box) setMaximumScaleDenominator(double v) setMinimumScaleDenominator(double v) setOpacity(double opacity) setQueryable(boolean v) srs()The projection of this layer's data.styles()Names of the styles this layer is drawn with, in order.
-
Method Details
-
create
A new standalone layer in EPSG:4326. -
create
A new standalone layer.srsmay be null for the default (WGS 84). -
name
-
setName
-
srs
The projection of this layer's data. -
setSrs
-
styles
Names of the styles this layer is drawn with, in order. -
addStyle
-
isActive
public boolean isActive()Whether the layer is drawn at all. On by default. -
setActive
-
minimumScaleDenominator
public double minimumScaleDenominator() -
setMinimumScaleDenominator
-
maximumScaleDenominator
public double maximumScaleDenominator() -
setMaximumScaleDenominator
-
isVisibleAt
public boolean isVisibleAt(double scaleDenominator) True if the layer is active andscaleDenominatoris inside its scale range. -
opacity
public double opacity() -
setOpacity
-
compOp
How this layer is blended onto what is below it, by the name used in styles, such asmultiply,screenorsrc-over. Empty if never set. -
setCompOp
Set the blend mode. ThrowsMapnikExceptionfor a name Mapnik does not know. -
setCompOp
-
addChild
Add a copy ofchildunder this layer, to group layers. -
childCount
public int childCount() -
childCopy
A copy of the child atindex, which you own and should close. Changes to it do not affect this layer. -
isQueryable
public boolean isQueryable() -
setQueryable
-
clearsLabelCache
public boolean clearsLabelCache() -
setClearLabelCache
-
cachesFeatures
public boolean cachesFeatures() -
setCacheFeatures
-
groupBy
The column rendering is grouped by, or an empty string. -
setGroupBy
-
bufferSize
Buffer around the layer's tiles in pixels, if set. Falls back to the map's buffer size. -
setBufferSize
-
resetBufferSize
-
maximumExtent
Extent beyond which this layer is not drawn, if set. -
setMaximumExtent
-
resetMaximumExtent
-
setDatasource
Attach a datasource. The layer keeps its own reference, so you may closedsafterwards. -
datasource
A new handle onto the layer's datasource, which you should close, or empty if there is none. -
envelope
The extent of the layer's data, in the layer's projection. Throws if there is no datasource. -
close
public void close()Frees a layer made withcreate(java.lang.String). Does nothing for a view onto a map's layer.- Specified by:
closein interfaceAutoCloseable
-