001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/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 17:39:07 +0100 (Do, 27 Dez 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, double minScaleHint, 107 double maxScaleHint, boolean selectedForQuery, int authentication, 108 int parentNodeId, boolean showLegendGraphic ) { 109 setDataService( dataService ); 110 setMasterLayer( masterLayer ); 111 setMinScaleHint( minScaleHint ); 112 setMaxScaleHint( maxScaleHint ); 113 setSelectedForQuery( selectedForQuery ); 114 setAuthentication( authentication ); 115 setParentNodeId( parentNodeId ); 116 setShowLegendGraphic( showLegendGraphic ); 117 118 } 119 120 /** 121 * returns a description of the service/server behind a WMS layer. The returned value will be 122 * <tt>null</tt> if the WMS uses an internal mechanism to access a layers data. 123 * 124 * @return instance of <tt>DataService</tt> 125 */ 126 public DataService getDataService() { 127 return this.dataService; 128 // return null; 129 } 130 131 /** 132 * sets a description of the service/server behind a WMS layer. The returned value will be 133 * <tt>null</tt> if the WMS uses an internal mechanism to access a layers data. 134 * 135 * @param dataService 136 */ 137 public void setDataService( DataService dataService ) { 138 this.dataService = dataService; 139 } 140 141 /** 142 * returns true if a layer is one of the main layers of an application; returns false if it just 143 * provides background or additional informations. 144 * 145 * @return 146 */ 147 public boolean isMasterLayer() { 148 return masterLayer; 149 } 150 151 /** 152 * set to true if a layer is one of the main layers of an application; set to false if it just 153 * provides background or additional informations. 154 * 155 * @param masterLayer 156 */ 157 public void setMasterLayer( boolean masterLayer ) { 158 this.masterLayer = masterLayer; 159 } 160 161 /** 162 * returns the maximum sclae the layer is valid 163 * 164 * @return maximum scale hint 165 */ 166 public double getMaxScaleHint() { 167 return maxScaleHint; 168 } 169 170 /** 171 * sets the maximum scale the layer is valid for 172 * 173 * @param maxScaleHint 174 */ 175 public void setMaxScaleHint( double maxScaleHint ) { 176 this.maxScaleHint = maxScaleHint; 177 } 178 179 /** 180 * returns the minimum sclae the layer is valid 181 * 182 * @return minimum scale hint 183 */ 184 public double getMinScaleHint() { 185 return minScaleHint; 186 } 187 188 /** 189 * sets the minimum scale the layer is valid for 190 * 191 * @param minScaleHint 192 */ 193 public void setMinScaleHint( double minScaleHint ) { 194 this.minScaleHint = minScaleHint; 195 } 196 197 /** 198 * returns true if a layer is currently selected for being active for feature info requests 199 * 200 * @return <code>true</code> if a layer is currently selected for being active for feature 201 * info requests 202 */ 203 public boolean isSelectedForQuery() { 204 return selectedForQuery; 205 } 206 207 /** 208 * sets a layer to active for feature info requests 209 * 210 * @param selectedForFI 211 */ 212 public void setSelectedForQuery( boolean selectedForFI ) { 213 this.selectedForQuery = selectedForFI; 214 } 215 216 /** 217 * returns a code for authentication to be used for service requests 218 * 219 * @return a code for authentication to be used for service requests 220 */ 221 public int getAuthentication() { 222 return authentication; 223 } 224 225 /** 226 * @see #getAuthentication() 227 * @param authentication 228 */ 229 public void setAuthentication( int authentication ) { 230 this.authentication = authentication; 231 } 232 233 /** 234 * returns true if the legendGraphic of the layer should be drawn in the layerlistview 235 * 236 * @return <code>true</code> if the legendGraphic of the layer should be drawn in the 237 * layerlistview 238 */ 239 public boolean getShowLegendGraphic() { 240 return showLegendGraphic; 241 } 242 243 /** 244 * returns true the id of the node to which the layer belongs in the layertree 245 * 246 * @return <code>true</code> the id of the node to which the layer belongs in the layertree 247 */ 248 public int getParentNodeId() { 249 return parentNodeId; 250 } 251 252 /** 253 * 254 * @param showLegendGraphic 255 */ 256 public void setShowLegendGraphic( boolean showLegendGraphic ) { 257 this.showLegendGraphic = showLegendGraphic; 258 } 259 260 /** 261 * 262 * @param parentNodeId 263 */ 264 public void setParentNodeId( int parentNodeId ) { 265 this.parentNodeId = parentNodeId; 266 } 267 268 /** 269 * 270 * @param name 271 * @param value 272 */ 273 public void addVendorspecificParameter(String name, String value){ 274 vendorspecificParams.put( name, value ); 275 } 276 277 /** 278 * 279 * @param name 280 * @return 281 */ 282 public String getVendorspecificParameter(String name){ 283 return vendorspecificParams.get( name ); 284 } 285 286 /** 287 * 288 * @return 289 */ 290 public Iterator<String> getVendorspecificParameterNames(){ 291 return vendorspecificParams.keySet().iterator(); 292 } 293 294 295 296 }