MapLayer:
/*<br /> * GeoTools - The Open Source Java GIS Toolkit<br /> * http://geotools.org<br /> *<br /> * (C) 2003-2008, Open Source Geospatial Foundation (OSGeo)<br /> *<br /> * This library is free software; you can redistribute it and/or<br /> * modify it under the terms of the GNU Lesser General Public<br /> * License as published by the Free Software Foundation;<br /> * version 2.1 of the License.<br /> *<br /> * This library is distributed in the hope that it will be useful,<br /> * but WITHOUT ANY WARRANTY; without even the implied warranty of<br /> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br /> * Lesser General Public License for more details.<br /> */<br />package org.geotools.map;</p><p>import org.geotools.data.FeatureSource;<br />import org.geotools.data.Query;<br />import org.geotools.data.memory.CollectionSource;<br />import org.geotools.geometry.jts.ReferencedEnvelope;<br />import org.geotools.map.event.MapLayerListener;<br />import org.geotools.styling.Style;<br />import org.opengis.feature.Feature;<br />import org.opengis.feature.type.FeatureType;</p><p>/**<br /> * A layer to be rendered on a device. A layer is an aggregation of both a<br /> * {@link FeatureCollection}, a {@link Style} and, optionally, a {@link Query}<br /> *<br /> * @author Cameron Shorter<br /> * @author Martin Desruisseaux<br /> * @source $URL: http://svn.geotools.org/trunk/modules/library/render/src/main/java/org/geotools/map/MapLayer.java $<br /> * @version $Id: MapLayer.java 30649 2008-06-12 19:44:08Z acuster $<br /> */<br />public interface MapLayer {<br /> /**<br /> * Get the feature collection for this layer.<br /> *<br /> * @return The features for this layer, null if not yet set<br /> * or if {@link Source} is used.<br /> *返回Feature的<br /> */<br /> FeatureSource<? extends FeatureType, ? extends Feature> getFeatureSource();</p><p> /**<br /> * Get the data source for this layer.<br /> *<br /> * @return Data source for this layer, null if not yet set<br /> * or if {@link FeatureSource} is used<br /> */</p><p> CollectionSource getSource();</p><p> /**<br /> * Get the style for this layer. If style has not been set, then null is<br /> * returned.<br /> *<br /> * @return The style (SLD).<br /> *返回該圖層的樣式表<br /> */<br /> Style getStyle();</p><p> /**<br /> * Sets the style for this layer. If a style has not been defined a default<br /> * one is used.<br /> *<br /> * @param style The new style<br /> *設定圖層的樣式表<br /> */<br /> void setStyle(Style style);</p><p> /**<br /> * Get the title of this layer. If title has not been defined then an empty<br /> * string is returned.<br /> *<br /> * @return The title of this layer.<br /> *返回圖層的標題<br /> */<br /> String getTitle();</p><p> /**<br /> * Set the title of this layer. A {@link LayerEvent} is fired if the new<br /> * title is different from the previous one.<br /> *<br /> * @param title The title of this layer.<br /> */<br /> void setTitle(String title);</p><p> /**<br /> * Determine whether this layer is visible on a map pane or whether the<br /> * layer is hidden.<br /> *<br /> * @return <code>true</code> if the layer is visible, or <code>false</code><br /> * if the layer is hidden.<br /> *確定圖層是否可見<br /> */<br /> boolean isVisible();</p><p> /**<br /> * Specify whether this layer is visible on a map pane or whether the layer<br /> * is hidden. A {@link LayerEvent} is fired if the visibility changed.<br /> *<br /> * @param visible Show the layer if <code>true</code>, or hide the layer if<br /> * <code>false</code><br /> */<br /> void setVisible(boolean visible);</p><p> /**<br /> * Returns the definition query (filter) for this layer. If no definition<br /> * query has been defined {@link Query.ALL} is returned.<br /> *返回圖層的查詢器<br /> */<br /> Query getQuery();</p><p> /**<br /> * Sets a definition query for the layer wich acts as a filter for the<br /> * features that the layer will draw.<br /> *<br /> * <p><br /> * A consumer must ensure that this query is used in combination with the<br /> * bounding box filter generated on each map interaction to limit the<br /> * number of features returned to those that complains both the definition<br /> * query and relies inside the area of interest.<br /> * </p><br /> * <p><br /> * IMPORTANT: only include attribute names in the query if you want them to<br /> * be ALWAYS returned. It is desirable to not include attributes at all<br /> * but let the layer user (a renderer?) to decide wich attributes are actually<br /> * needed to perform its requiered operation.<br /> * </p><br /> *<br /> * @param query<br /> *設定圖層的查詢器<br /> */<br /> void setQuery(Query query);<br /> /**<br /> * find out the bounds of the layer<br /> * @return - the layer's bounds<br /> *返回圖層的Bounds<br /> */<br /> ReferencedEnvelope getBounds();<br /> /**<br /> * Add a listener to notify when a layer property changes. Changes include<br /> * layer visibility and the title text.<br /> *<br /> * @param listener The listener to add to the listener list.<br /> *增加圖層屬性變化的事件監聽器<br /> */<br /> void addMapLayerListener(MapLayerListener listener);</p><p> /**<br /> * Removes a listener from the listener list for this layer.<br /> *<br /> * @param listener The listener to remove from the listener list.<br /> */<br /> void removeMapLayerListener(MapLayerListener listener);<br />}<br />