001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/portal/context/LayerExtension.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042:
043: ---------------------------------------------------------------------------*/
044: package org.deegree.portal.context;
045:
046: import java.util.HashMap;
047: import java.util.Iterator;
048: import java.util.Map;
049:
050: /**
051: * provides additional information about a layer described in a web map context document. Additional
052: * description is not requiered so an instance of <tt>org.deegree_impl.clients.context.Layer</tt>
053: * may doesn't provide an instance of this class.
054: *
055: * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
056: * @author last edited by: $Author: apoth $
057: *
058: * @version $Revision: 9346 $, $Date: 2007-12-27 08:39:07 -0800 (Thu, 27 Dec 2007) $
059: */
060: public class LayerExtension {
061:
062: public static final int NONE = -1;
063:
064: public static final int SESSIONID = 0;
065:
066: public static final int USERPASSWORD = 1;
067:
068: private DataService dataService = null;
069:
070: private boolean masterLayer = false;
071:
072: private double minScaleHint = 0;
073:
074: private double maxScaleHint = 9E99;
075:
076: private boolean selectedForQuery = false;
077:
078: private int authentication = NONE;
079:
080: private int parentNodeId = NONE;
081:
082: private boolean showLegendGraphic = false;
083:
084: private Map<String, String> vendorspecificParams = new HashMap<String, String>();
085:
086: /**
087: * default constructor
088: *
089: */
090: public LayerExtension() {
091: }
092:
093: /**
094: * Creates a new LayerExtension object.
095: *
096: * @param dataService
097: * description of the service/server behind a WMS layer
098: * @param masterLayer
099: * true if a layer is one of the main layers of an application; false if it just
100: * provides background or additional informations.
101: * @param minScaleHint
102: * @param maxScaleHint
103: * @param selectedForQuery
104: * @param authentication
105: */
106: public LayerExtension(DataService dataService, boolean masterLayer,
107: double minScaleHint, double maxScaleHint,
108: boolean selectedForQuery, int authentication,
109: int parentNodeId, boolean showLegendGraphic) {
110: setDataService(dataService);
111: setMasterLayer(masterLayer);
112: setMinScaleHint(minScaleHint);
113: setMaxScaleHint(maxScaleHint);
114: setSelectedForQuery(selectedForQuery);
115: setAuthentication(authentication);
116: setParentNodeId(parentNodeId);
117: setShowLegendGraphic(showLegendGraphic);
118:
119: }
120:
121: /**
122: * returns a description of the service/server behind a WMS layer. The returned value will be
123: * <tt>null</tt> if the WMS uses an internal mechanism to access a layers data.
124: *
125: * @return instance of <tt>DataService</tt>
126: */
127: public DataService getDataService() {
128: return this .dataService;
129: // return null;
130: }
131:
132: /**
133: * sets a description of the service/server behind a WMS layer. The returned value will be
134: * <tt>null</tt> if the WMS uses an internal mechanism to access a layers data.
135: *
136: * @param dataService
137: */
138: public void setDataService(DataService dataService) {
139: this .dataService = dataService;
140: }
141:
142: /**
143: * returns true if a layer is one of the main layers of an application; returns false if it just
144: * provides background or additional informations.
145: *
146: * @return
147: */
148: public boolean isMasterLayer() {
149: return masterLayer;
150: }
151:
152: /**
153: * set to true if a layer is one of the main layers of an application; set to false if it just
154: * provides background or additional informations.
155: *
156: * @param masterLayer
157: */
158: public void setMasterLayer(boolean masterLayer) {
159: this .masterLayer = masterLayer;
160: }
161:
162: /**
163: * returns the maximum sclae the layer is valid
164: *
165: * @return maximum scale hint
166: */
167: public double getMaxScaleHint() {
168: return maxScaleHint;
169: }
170:
171: /**
172: * sets the maximum scale the layer is valid for
173: *
174: * @param maxScaleHint
175: */
176: public void setMaxScaleHint(double maxScaleHint) {
177: this .maxScaleHint = maxScaleHint;
178: }
179:
180: /**
181: * returns the minimum sclae the layer is valid
182: *
183: * @return minimum scale hint
184: */
185: public double getMinScaleHint() {
186: return minScaleHint;
187: }
188:
189: /**
190: * sets the minimum scale the layer is valid for
191: *
192: * @param minScaleHint
193: */
194: public void setMinScaleHint(double minScaleHint) {
195: this .minScaleHint = minScaleHint;
196: }
197:
198: /**
199: * returns true if a layer is currently selected for being active for feature info requests
200: *
201: * @return <code>true</code> if a layer is currently selected for being active for feature
202: * info requests
203: */
204: public boolean isSelectedForQuery() {
205: return selectedForQuery;
206: }
207:
208: /**
209: * sets a layer to active for feature info requests
210: *
211: * @param selectedForFI
212: */
213: public void setSelectedForQuery(boolean selectedForFI) {
214: this .selectedForQuery = selectedForFI;
215: }
216:
217: /**
218: * returns a code for authentication to be used for service requests
219: *
220: * @return a code for authentication to be used for service requests
221: */
222: public int getAuthentication() {
223: return authentication;
224: }
225:
226: /**
227: * @see #getAuthentication()
228: * @param authentication
229: */
230: public void setAuthentication(int authentication) {
231: this .authentication = authentication;
232: }
233:
234: /**
235: * returns true if the legendGraphic of the layer should be drawn in the layerlistview
236: *
237: * @return <code>true</code> if the legendGraphic of the layer should be drawn in the
238: * layerlistview
239: */
240: public boolean getShowLegendGraphic() {
241: return showLegendGraphic;
242: }
243:
244: /**
245: * returns true the id of the node to which the layer belongs in the layertree
246: *
247: * @return <code>true</code> the id of the node to which the layer belongs in the layertree
248: */
249: public int getParentNodeId() {
250: return parentNodeId;
251: }
252:
253: /**
254: *
255: * @param showLegendGraphic
256: */
257: public void setShowLegendGraphic(boolean showLegendGraphic) {
258: this .showLegendGraphic = showLegendGraphic;
259: }
260:
261: /**
262: *
263: * @param parentNodeId
264: */
265: public void setParentNodeId(int parentNodeId) {
266: this .parentNodeId = parentNodeId;
267: }
268:
269: /**
270: *
271: * @param name
272: * @param value
273: */
274: public void addVendorspecificParameter(String name, String value) {
275: vendorspecificParams.put(name, value);
276: }
277:
278: /**
279: *
280: * @param name
281: * @return
282: */
283: public String getVendorspecificParameter(String name) {
284: return vendorspecificParams.get(name);
285: }
286:
287: /**
288: *
289: * @return
290: */
291: public Iterator<String> getVendorspecificParameterNames() {
292: return vendorspecificParams.keySet().iterator();
293: }
294:
295: }
|