public static final class WmsDataSource.Builder extends Object implements AutoCloseable
WmsDataSource
instances.
This builder requires at a minimum a URL and one or more layers
.
Constructor and Description |
---|
Builder(WmsDataSource.Builder other) |
Modifier and Type | Method and Description |
---|---|
WmsDataSource.Builder |
addLayer(String layerName)
Adds a WMS
layer to load. |
WmsDataSource.Builder |
addLayer(String layerName,
String layerStyleName)
Adds a WMS
layer to load. |
WmsDataSource |
build()
Build the WMS data source.
|
void |
close() |
protected void |
finalize() |
WmsDataSource.Builder |
format(String format)
Sets the image format for GetMap requests.
|
WmsDataSource.Builder |
styledLayerDescriptor(String styledLayerDescriptor)
Sets the Styled
Layer Descriptor to pass when making a request. |
WmsDataSource.Builder |
styledLayerDescriptorUrl(String styledLayerDescriptorUrl)
Sets an URL pointing to a valid Styled
Layer Descriptor which will be used by the server. |
WmsDataSource.Builder |
transparent(boolean transparent)
Sets if the requested image should have a transparent background, provided that the image format supports transparency.
|
WmsDataSource.Builder |
url(String url)
Sets the base URL of the WMS data source.
|
public Builder(@NotNull WmsDataSource.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public WmsDataSource.Builder url(@NotNull String url)
Calling this function is mandatory.
url
- the base URL of the WMS data source. Calling this function is mandatory.@NotNull public WmsDataSource.Builder addLayer(@NotNull String layerName)
layer
to load.
The layer is added on top of other added WMS layers.
At least one of the addLayer methods must be called.
layerName
- The name of the WMS layer.@NotNull public WmsDataSource.Builder addLayer(@NotNull String layerName, @NotNull String layerStyleName)
layer
to load.
The layer is added on top of other added WMS layers.
At least one of the addLayer methods must be called.
layerName
- The name of the WMS layer.layerStyleName
- The WMS layer style name. This refers to a published named layer style of the WMS capabilities.@NotNull public WmsDataSource.Builder format(@NotNull String format)
When this method is not called the image format is determined by the WMS model decoder
.
format
- the image format for GetMap requests.@NotNull public WmsDataSource.Builder transparent(boolean transparent)
When this method is not called the default value is true
.
transparent
- if the requested image should have a transparent background, provided that the image format supports transparency.@NotNull public WmsDataSource.Builder styledLayerDescriptor(@NotNull String styledLayerDescriptor)
Layer
Descriptor to pass when making a request.
This corresponds to the SLD_BODY
request parameter in the GetMap request. The SLD must not be URL encoded. The SLD can be set using either one of the following method :
Note that when these methods are called multiple times, only the last method call is taken into account.
You can find more information within the article on how to use Styled Layer Descriptor.
@NotNull public WmsDataSource.Builder styledLayerDescriptorUrl(@NotNull String styledLayerDescriptorUrl)
Layer
Descriptor which will be used by the server.
This corresponds to the SLD
request parameter in the GetMap request. The SLD can be set using either one of the following method :
Note that when these methods are called multiple times, only the last method call is taken into account.
You can find more information within the article on how to use Styled Layer Descriptor.
@NotNull public WmsDataSource build() throws IllegalStateException
After calling this function, this builder should no longer be used.
IllegalStateException
- If not all mandatory parameters are set.