software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer Maven / Gradle / Ivy
The newest version!
/*
* Copyright © 2019 XDEV Software (https://xdev.software)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package software.xdev.vaadin.maps.leaflet.layer.raster;
import software.xdev.vaadin.maps.leaflet.layer.LGridLayer;
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;
/**
* Represents a tile layer.
*
* Important
*
* - Before using tile servers check their usage policies
* - If the server is funded by donations consider donating
*
*
* @see List of raster tile providers
*/
public class LTileLayer extends LGridLayer
{
public LTileLayer(
final LComponentManagementRegistry compReg,
final String urlTemplate)
{
this(compReg, urlTemplate, null);
}
public LTileLayer(
final LComponentManagementRegistry compReg,
final String urlTemplate,
final LTileLayerOptions options)
{
super(compReg, "L.tileLayer($0" + compReg.writeOptionsOptionalNextParameter(options) + ")", urlTemplate);
}
public LTileLayer(
final LComponentManagementRegistry compReg,
final String urlTemplate,
final int maxZoom,
final String attribution)
{
this(compReg, urlTemplate, new LTileLayerOptions().withMaxZoom(maxZoom).withAttribution(attribution));
}
/**
* Use OpenStreetMap's tile server
* Important: By using this you accept the Usage Policy
*/
@SuppressWarnings("checkstyle:MagicNumber") // Default max Zoom
public static LTileLayer createDefaultForOpenStreetMapTileServer(final LComponentManagementRegistry compReg)
{
return new LTileLayer(
compReg,
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
19,
"© OpenStreetMap"
);
}
}