GeoTools學習筆記–MapContext

來源:互聯網
上載者:User

MapCOntext:

 

 

/*<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 java.awt.geom.AffineTransform;<br />import java.io.IOException;<br />import java.util.Collection;<br />import java.util.Iterator;</p><p>import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader;<br />import org.geotools.data.FeatureSource;<br />import org.geotools.feature.FeatureCollection;<br />import org.geotools.geometry.jts.ReferencedEnvelope;<br />import org.geotools.map.event.MapBoundsEvent;<br />import org.geotools.map.event.MapBoundsListener;<br />import org.geotools.map.event.MapLayerListListener;<br />import org.geotools.styling.Style;<br />import org.opengis.coverage.grid.GridCoverage;<br />import org.opengis.feature.simple.SimpleFeature;<br />import org.opengis.feature.simple.SimpleFeatureType;<br />import org.opengis.referencing.FactoryException;<br />import org.opengis.referencing.crs.CoordinateReferenceSystem;<br />import org.opengis.referencing.operation.TransformException;</p><p>import com.vividsolutions.jts.geom.Envelope;</p><p>/**<br /> * Store context information about a map display. This object is based on the<br /> * OGC Web Map Context Specification.<br /> *<br /> * @author Cameron Shorter<br /> * @source $URL: http://svn.geotools.org/trunk/modules/library/render/src/main/java/org/geotools/map/MapContext.java $<br /> * @version $Id: MapContext.java 30649 2008-06-12 19:44:08Z acuster $<br /> */<br /> /**<br /> *儲存需要顯示的圖形資訊<br /> *該介面的定義根據OGC 的描述<br /> */<br />public interface MapContext {<br />/**<br /> * Add a new layer if not already present and trigger a<br /> * {@link LayerListEvent}.<br /> *<br /> * @param layer<br /> * the layer to be inserted<br /> *<br /> * @return true if the layer has been added, false otherwise<br /> *<br /> *增加一個圖層 MapLayer<br /> *如果插入成功返回True 否則返回False<br /> *<br /> */<br />boolean addLayer(MapLayer layer);</p><p>/**<br /> * Add a new layer in the specified position and trigger a<br /> * {@link LayerListEvent}. Layer won't be added if it's already in the<br /> * list.<br /> *<br /> * @param index<br /> * index at which the layer will be inserted<br /> * @param layer<br /> * the layer to be inserted<br /> *<br /> * @return true if the layer has been added, false otherwise<br /> *<br /> *在特定的Idex增加一個圖層MapLayer<br /> *如果插入成功返回True<br /> *否則返回False<br /> */<br />boolean addLayer(int index, MapLayer layer);</p><p>/**<br /> * Add a new layer and trigger a {@link LayerListEvent}.<br /> *<br /> * @param featureSource<br /> * a FeatureSource<SimpleFeatureType, SimpleFeature> with the new layer that will be added.<br />*<br /> *根據FeatureSource和Style增加一個圖層<br /> */<br />void addLayer(FeatureSource<SimpleFeatureType, SimpleFeature> featureSource, Style style);</p><p>/**<br /> * Add a new layer and trigger a {@link LayerListEvent}.<br /> *<br /> * @param collection<br /> * a FeatureCollection<SimpleFeatureType, SimpleFeature> with the new layer that will be added.<br /> *根據FeatureCollection增加一個圖層<br /> */<br />void addLayer(FeatureCollection<SimpleFeatureType, SimpleFeature> collection, Style style);</p><p> /**<br /> * Add a new layer and trigger a {@link LayerListEvent}.<br /> *<br /> * @param collection Collection with the new layer that will be added.<br /> *、根據Collection增加圖層<br /> */<br /> void addLayer(Collection collection, Style style);</p><p>/**<br /> * Add a new layer and trigger a {@link LayerListEvent}<br /> *<br /> * @param gridCoverage<br /> * a GridCoverage with the new layer that will be added.<br /> *<br /> *增加GridCoverage型的圖層<br /> */<br />void addLayer(GridCoverage gridCoverage, Style style);</p><p>/**<br /> * Add a new layer and trigger a {@link LayerListEvent}<br /> *<br /> * @param gridCoverage<br /> * an AbstractGridCoverage2DReader with the new layer that will be added.<br /> *<br /> */<br />void addLayer(AbstractGridCoverage2DReader gridCoverage, Style style);</p><p>/**<br /> * Remove a layer, if present, and trigger a {@link LayerListEvent}.<br /> *<br /> * @param layer<br /> * a MapLayer that will be added.<br /> *<br /> * @return true if the layer has been removed<br /> *<br /> *移除一個圖層<br /> */<br />boolean removeLayer(MapLayer layer);</p><p>/**<br /> * Remove a layer and trigger a {@link LayerListEvent}.<br /> *<br /> * @param index<br /> * The index of the layer that it's going to be removed<br /> *<br /> * @return the layer removed, if any<br /> *<br /> *根據索引來刪除一個圖層<br /> */<br />MapLayer removeLayer(int index);</p><p>/**<br /> * Add an array of new layers and trigger a {@link LayerListEvent}.<br /> *<br /> * @param layers<br /> * The new layers that are to be added.<br /> *<br /> * @return the number of layers actually added to the MapContext<br /> *<br /> *增加Layers數組<br /> */<br />int addLayers(MapLayer[] layers);</p><p>/**<br /> * Remove an array of layers and trigger a {@link LayerListEvent}.<br /> *<br /> * @param layers<br /> * The layers that are to be removed.<br /> */<br />void removeLayers(MapLayer[] layers);</p><p>/**<br /> * Clears the whole layer list. Will fire a LayerListChangedEvent<br /> *清空列表<br /> */<br />void clearLayerList();</p><p>/**<br /> * Return this model's list of layers. If no layers are present, then an<br /> * empty array is returned.<br /> *<br /> * @return This model's list of layers.<br /> *<br /> *得到圖層列表<br /> */<br />MapLayer[] getLayers();</p><p>/**<br /> * Return the requested layer.<br /> *<br /> * @param index<br /> * index of layer to return.<br /> *<br /> * @return the layer at the specified position<br /> *<br /> * @throws IndexOutOfBoundsException<br /> * if the index is out of range<br /> *根據索引返回圖層<br /> */<br />MapLayer getLayer(int index) throws IndexOutOfBoundsException;</p><p>/**<br /> * Moves a layer from a position to another. Will fire a MapLayerListEvent<br /> *<br /> * @param sourcePosition<br /> * the layer current position<br /> * @param destPosition<br /> * the layer new position<br /> *移動圖層<br /> */<br />void moveLayer(int sourcePosition, int destPosition);</p><p>/**<br /> * Returns an iterator over the layers in this context in proper sequence.<br /> *<br /> * @return an iterator over the layers in this context in proper sequence.<br /> *返回一個迭代器<br /> */<br />Iterator iterator();</p><p>/**<br /> * Returns the index of the first occurrence of the specified layer, or -1<br /> * if this list does not contain this element.<br /> *<br /> * @param layer<br /> * the MapLayer to search for<br /> *<br /> * @return DOCUMENT ME!<br /> *返回一個layer<br /> *的索引<br /> */<br />int indexOf(MapLayer layer);</p><p>/**<br /> * Returns the number of layers in this map context<br /> *<br /> * @return the number of layers in this map context<br /> *返回圖層個數<br /> */<br />int getLayerCount();</p><p>/**<br /> * Get the bounding box of all the layers in this MapContext. If all the<br /> * layers cannot determine the bounding box in the speed required for each<br /> * layer, then null is returned. The bounds will be expressed in the<br /> * MapContext coordinate system.<br /> *<br /> * @return The bounding box of the features or null if unknown and too<br /> * expensive for the method to calculate.<br /> *<br /> * @throws IOException<br /> * if an IOException occurs while accessing the FeatureSource<br /> * bounds<br /> * 返回Bounds的BOX<br /> */<br />ReferencedEnvelope getLayerBounds() throws IOException;</p><p>/**<br /> * Register interest in receiving a {@link LayerListEvent}. A<br /> * <code>LayerListEvent</code> is sent if a layer is added or removed, but<br /> * not if the data within a layer changes.<br /> *<br /> * @param listener<br /> * The object to notify when Layers have changed.<br /> *增加一圖層事件監聽器<br /> *如果圖層增加或者刪除該事件被激發<br /> */<br />void addMapLayerListListener(MapLayerListListener listener);</p><p>/**<br /> * Remove interest in receiving {@link LayerListEvent}.<br /> *<br /> * @param listener<br /> * The object to stop sending <code>LayerListEvent</code>s.<br /> *移除事件監聽器<br /> */<br />void removeMapLayerListListener(MapLayerListListener listener);</p><p>/**<br /> * Set a new area of interest and trigger a {@link BoundingBoxEvent}.<br /> *<br /> * @param areaOfInterest<br /> * The new areaOfInterest.<br /> * @param coordinateReferenceSystem<br /> * The coordinate system being using by this model.<br /> *<br /> * @throws IllegalArgumentException<br /> * if an argument is <code>null</code>.<br /> *<br />*<br /> *設定感興趣的地區Envelope<br /> *激發BoundBox事件<br /> */<br />void setAreaOfInterest(Envelope areaOfInterest,<br />CoordinateReferenceSystem coordinateReferenceSystem)<br />throws IllegalArgumentException;</p><p>/**<br /> * Set a new area of interest and trigger an {@link BoundingBoxEvent}.<br /> *<br /> * @param areaOfInterest<br /> * The new area of interest.<br /> *<br /> * @throws IllegalArgumentException<br /> * if an argument is <code>null</code>.<br /> * @deprecated Please use {@link #setAreaOfInterest(ReferencedEnvelope)}<br /> * or {@link #setAreaOfInterest(Envelope, CoordinateReferenceSystem)}<br /> */<br />void setAreaOfInterest(Envelope areaOfInterest)<br />throws IllegalArgumentException;</p><p>/**<br /> * Set a new area of interest and trigger an {@link BoundingBoxEvent}.<br /> *<br /> * @param areaOfInterest<br /> * The new area of interest.<br /> *<br /> * @throws IllegalArgumentException<br /> * if an argument is <code>null</code>.<br /> *<br /> */<br />void setAreaOfInterest(ReferencedEnvelope areaOfInterest);</p><p>/**<br /> * Gets the current area of interest.<br /> *<br /> * @return Current area of interest<br /> *<br /> */<br />ReferencedEnvelope getAreaOfInterest();</p><p>/**<br /> * Get the current coordinate system.<br /> *<br /> * @return the coordinate system of this box.<br /> *返回現有圖層的座標參考系統<br /> */<br />CoordinateReferenceSystem getCoordinateReferenceSystem();</p><p>/**<br /> * Transform the coordinates according to the provided transform. Useful for<br /> * zooming and panning processes.<br /> *<br /> * @param transform<br /> * The transform to change area of interest.<br /> *轉化座標系統<br /> */<br />void transform(AffineTransform transform);</p><p>/**<br /> * Register interest in receiving {@link MapBoundsEvent}s.<br /> *<br /> * @param listener<br /> * The object to notify when the area of interest has changed.<br /> *增加時間監聽器<br /> */<br />void addMapBoundsListener(MapBoundsListener listener);</p><p>/**<br /> * Remove interest in receiving a {@link BoundingBoxEvent}s.<br /> *<br /> * @param listener<br /> * The object to stop sending change events.<br /> */<br />void removeMapBoundsListener(MapBoundsListener listener);</p><p>/**<br /> * Get the abstract which describes this interface, returns an empty string<br /> * if this has not been set yet.<br /> *<br /> * @return The Abstract.<br /> *返回該介面的描述資訊<br /> */<br />String getAbstract();</p><p>/**<br /> * Set an abstract which describes this context.<br /> *<br /> * @param conAbstract<br /> * the Abstract.<br /> *設定該介面的描述資訊<br /> */<br />void setAbstract(final String conAbstract);</p><p>/**<br /> * Get the contact information associated with this context, returns an<br /> * empty string if contactInformation has not been set.<br /> *<br /> * @return the ContactInformation.<br /> *返回相關資訊的描述<br /> */<br />String getContactInformation();</p><p>/**<br /> * Set contact inforation associated with this class.<br /> *<br /> * @param contactInformation<br /> * the ContactInformation.<br /> */<br />void setContactInformation(final String contactInformation);</p><p>/**<br /> * Set the <code>CoordinateReferenceSystem</code> for this map context.<br /> *<br /> * @param crs<br /> * @throws FactoryException<br /> * @throws TransformException<br /> *設定座標參考資訊<br /> */<br />void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs)<br />throws TransformException, FactoryException;</p><p>/**<br /> * Get an array of keywords associated with this context, returns an empty<br /> * array if no keywords have been set. The array returned is a copy, changes<br /> * to the returned array won't influence the MapContextState<br /> *<br /> * @return array of keywords<br /> */<br />String[] getKeywords();</p><p>/**<br /> * Set an array of keywords to associate with this context.<br /> *<br /> * @param keywords<br /> * the Keywords.<br /> */<br />void setKeywords(final String[] keywords);</p><p>/**<br /> * Get the title, returns an empty string if it has not been set yet.<br /> *<br /> * @return the title, or an empty string if it has not been set.<br /> */<br />String getTitle();</p><p>/**<br /> * Set the title of this context.<br /> *<br /> * @param title<br /> * the title.<br /> */<br />void setTitle(final String title);</p><p>/**<br /> * Registers PropertyChangeListener to receive events.<br /> *<br /> * @param listener<br /> * The listener to register.<br /> 增加實踐監聽器<br /> */<br />public void addPropertyChangeListener(<br />java.beans.PropertyChangeListener listener);</p><p>/**<br /> * Removes PropertyChangeListener from the list of listeners.<br /> *<br /> * @param listener<br /> * The listener to remove.<br /> */<br />public void removePropertyChangeListener(<br />java.beans.PropertyChangeListener listener);<br />}<br />

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.