/* * This is part of Geomajas, a GIS framework, http://www.geomajas.org/. * * Copyright 2008-2015 Geosparc nv, http://www.geosparc.com/, Belgium. * * The program is available in open source according to the GNU Affero * General Public License. All contributions in this program are covered * by the Geomajas Contributors License Agreement. For full licensing * details, see LICENSE.txt in the project root. */ package org.geomajas.gwt2.client.map.layer; import org.geomajas.annotation.Api; import org.geomajas.geometry.Bbox; import org.geomajas.gwt2.client.map.render.LayerRenderer; /** * The basic definition of a layer within the Geomajas GWT client. * * @author Pieter De Graef * @since 2.0.0 */ @Api(allMethods = true) public interface Layer { /** * Return this layer's client ID. * * @return id of the client layer */ String getId(); /** * Return the layer's title. The difference between the ID and the title, is that the ID is used behind the screens, * while the title is the visible name to the user. * * @return */ String getTitle(); /** * Mark this layer as selected or not. Only one layer can be selected at any given time within a map. * * @param selected * The boolean value that indicates whether or not to select this layer. */ void setSelected(boolean selected); /** * Is this layer currently marked as selected or not? * * @return Returns true or false. */ boolean isSelected(); /** * Mark this layer as visible or invisible. This may toggle the visibility flag, but does not guarantee that the * layer be visible. This is because other factors might intrude upon the layer visibility, such as the minimum and * maximum scales between which a layer can be visible. * * @param markedAsVisible * Should the layer be marked as visible or invisible? */ void setMarkedAsVisible(boolean markedAsVisible); /** * Has the layer been marked as visible? * * @return True or false. */ boolean isMarkedAsVisible(); /** * Is the layer currently showing on the map or not? In other words, can we actually look at the layer on the map? A * layer may be marked as visible but other factors (such as scale) may intrude upon the actual visibility of a * layer.<br/> * This value will return the final result of all these factors and clearly state whether or not the layer can be * seen. * * @return true or false. */ boolean isShowing(); /** Refresh this layer on the map. This method will completely erase the current contents and redraw. */ void refresh(); /** * Return the specific renderer for the layer. * * @return The layer specific renderer. */ LayerRenderer getRenderer(); /** * Apply a new opacity on the entire layer. Changing the opacity on a layer does NOT fire a layer style changed * event. * * @param opacity * The new opacity value. Must be a value between 0 and 1, where 0 means invisible and 1 is totally * visible. */ void setOpacity(double opacity); /** * Get the current opacity value for this layer. Must be a value between 0 and 1, where 0 means invisible and 1 is * totally visible. * * @return The current opacity value for this layer. */ double getOpacity(); /** * Return the maximum bounds. The bounds is defined in the map CRS. * * @return the maximum bounds * @since 2.1.0 */ Bbox getMaxBounds(); /** * Set the maximum bounds. The bounds is defined in the map CRS. For tile-based layers, only tiles within the * maximum bounds will be fetched. To avoid rounding errors, the center of the tile may be used for checking the * condition. * * @param maxBounds The maximum bounds * @since 2.1.0 */ void setMaxBounds(Bbox maxBounds); /** * Returns the maximum resolution at which the layer is visible. * By SLD convention, the maximum resolution value is inclusive: * the layer will be visible at this specific resolution. * * @return resolution * @since 2.3.0 */ double getMaxResolution(); /** * Returns the minimum resolution at which the layer is visible. * By SLD convention, the minimum resolution value is exclusive: * the layer will not be visible at this specific resolution. * * @return resolution * @since 2.3.0 */ double getMinResolution(); }