001 //$$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/ogcwebservices/wpvs/configuration/WPVSDeegreeParams.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 Aennchenstraße 19 030 53177 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.ogcwebservices.wpvs.configuration; 045 046 import java.awt.image.BufferedImage; 047 import java.io.IOException; 048 import java.net.MalformedURLException; 049 import java.net.URL; 050 import java.util.Map; 051 052 import org.deegree.enterprise.DeegreeParams; 053 import org.deegree.framework.log.ILogger; 054 import org.deegree.framework.log.LoggerFactory; 055 import org.deegree.framework.util.ImageUtils; 056 import org.deegree.model.metadata.iso19115.OnlineResource; 057 058 /** 059 * 060 * 061 * @author <a href="mailto:mays@lat-lon.de">Judit Mays</a> 062 * @author last edited by: $Author: apoth $ 063 * 064 * $Revision: 9345 $, $Date: 2007-12-27 17:22:25 +0100 (Do, 27 Dez 2007) $ 065 * 066 */ 067 public class WPVSDeegreeParams extends DeegreeParams { 068 069 /** 070 * 071 */ 072 private static final long serialVersionUID = 4480667559177855009L; 073 074 private static final ILogger LOG = LoggerFactory.getLogger( WPVSDeegreeParams.class ); 075 076 private String copyright; // copyright is either text-string or url-string 077 078 // the configured copyrightImage to paint over the GetView response 079 private BufferedImage copyrightImage = null; 080 081 private float viewQuality = 0.95f; 082 083 private int maxLifeTime = 3600; 084 085 private final Map<String, URL> backgroundMap; 086 087 private final boolean isWatermarked; 088 089 private final int maxViewWidth; 090 091 private final int maxViewHeight; 092 093 private final boolean requestQualityPreferred; 094 095 private double maximumFarClippingPlane; 096 097 private String defaultSplitter; 098 099 private double minimalTerrainHeight; 100 101 private final double minimalWCS_DGMResolution; 102 103 private double extendRequestPercentage; 104 105 private double nearClippingPlane; 106 107 private final int maxTextureDimension; 108 109 private int quadMergeCount; 110 111 /** 112 * 113 * 114 * @param defaultOnlineResource 115 * @param cacheSize 116 * @param requestTimeLimit 117 * @param characterSet 118 * @param copyright 119 * @param watermarked 120 * @param maxLifeTime 121 * @param viewQuality 122 * @param backgroundMap 123 * a <code>Map</code> for background images. This Map contains image names as keys and image URL as 124 * values 125 * @param maxWidth 126 * @param maxHeight 127 * @param requestQualityPreferred 128 * @param maximumFarClippingPlane 129 * to which extend the request can set a farclippingplane 130 * @param nearClippingPlane 131 * of the viewport 132 * @param defaultSplitter 133 * What kind of splitter to use if the GetView request has no field named "splitter" 134 * @param minimalTerrainHeight 135 * the minimalheight of a terrain if no dgm is found. 136 * @param minimalWCS_DGMResolution 137 * the configured minimal resolution of a wcs dgm 138 * @param extendRequestPercentage 139 * the percentage to which wcs/wms request should be extended. 140 * @param maxTextureDimension 141 * the maximums request size of the textures 142 * @param quadMergeCount 143 * a value for the quadtree-splitter to tell at which amount the leaves should be merged. 144 */ 145 public WPVSDeegreeParams( OnlineResource defaultOnlineResource, int cacheSize, int requestTimeLimit, 146 String characterSet, String copyright, boolean watermarked, int maxLifeTime, 147 float viewQuality, Map<String, URL> backgroundMap, int maxWidth, int maxHeight, 148 boolean requestQualityPreferred, double maximumFarClippingPlane, 149 double nearClippingPlane, String defaultSplitter, double minimalTerrainHeight, 150 double minimalWCS_DGMResolution, double extendRequestPercentage, int maxTextureDimension, 151 int quadMergeCount ) { 152 153 super( defaultOnlineResource, cacheSize, requestTimeLimit, characterSet ); 154 155 this.copyright = copyright; 156 this.maxLifeTime = maxLifeTime; 157 this.viewQuality = viewQuality; 158 this.backgroundMap = backgroundMap; 159 this.isWatermarked = watermarked; 160 this.maxViewWidth = maxWidth; 161 this.maxViewHeight = maxHeight; 162 this.requestQualityPreferred = requestQualityPreferred; 163 this.maximumFarClippingPlane = maximumFarClippingPlane; 164 this.nearClippingPlane = nearClippingPlane; 165 this.minimalWCS_DGMResolution = minimalWCS_DGMResolution; 166 this.defaultSplitter = defaultSplitter.toUpperCase(); 167 if ( !( "QUAD".equals( defaultSplitter ) || "BBOX".equals( defaultSplitter ) ) ) { 168 LOG.logWarning( "The configured defaultSplitter does not exist, setting to QUAD" ); 169 this.defaultSplitter = "QUAD"; 170 } 171 172 if ( copyright != null && !"".equals( copyright.trim() ) ) { 173 try { 174 URL url = new URL( this.copyright ); 175 if ( url != null ) { 176 copyrightImage = ImageUtils.loadImage( url.getFile() ); 177 } 178 } catch ( MalformedURLException murle ) { 179 // The Copyright is a String. 180 } catch ( IOException ioe ) { 181 // The Copyright is a String. 182 } 183 } 184 this.minimalTerrainHeight = minimalTerrainHeight; 185 this.extendRequestPercentage = extendRequestPercentage; 186 this.maxTextureDimension = maxTextureDimension; 187 if ( quadMergeCount < 0 ) { 188 quadMergeCount = 0; 189 } 190 this.quadMergeCount = quadMergeCount; 191 } 192 193 /** 194 * @return Returns the copyright. 195 */ 196 public String getCopyright() { 197 return copyright; 198 } 199 200 /** 201 * @return Returns the maxLifeTime. 202 */ 203 public int getMaxLifeTime() { 204 return maxLifeTime; 205 } 206 207 /** 208 * @return Returns the viewQuality. 209 */ 210 public float getViewQuality() { 211 return viewQuality; 212 } 213 214 /** 215 * @return the configured different backgroundimages 216 */ 217 public Map getBackgroundMap() { 218 return backgroundMap; 219 } 220 221 /** 222 * @return true if the image should be watermarked (with an image or text) 223 */ 224 public boolean isWatermarked() { 225 return isWatermarked; 226 } 227 228 /** 229 * @return maximum value of the width of a request 230 */ 231 public int getMaxViewWidth() { 232 return maxViewWidth; 233 } 234 235 /** 236 * @return maximum value of the height of a request 237 */ 238 public int getMaxViewHeight() { 239 return maxViewHeight; 240 } 241 242 /** 243 * @return true if the splitter should use hight quality (lot of request quads) or false otherwise. 244 */ 245 public boolean isRequestQualityPreferred() { 246 return requestQualityPreferred; 247 } 248 249 /** 250 * @return the maximumFarClippingPlane which a user can request. 251 */ 252 public double getMaximumFarClippingPlane() { 253 return maximumFarClippingPlane; 254 } 255 256 /** 257 * @return the copyrightImage as a BufferedImage. 258 */ 259 public BufferedImage getCopyrightImage() { 260 return copyrightImage; 261 } 262 263 /** 264 * @return the defaultSplitter. 265 */ 266 public String getDefaultSplitter() { 267 return defaultSplitter; 268 } 269 270 /** 271 * @return the minimalTerrainHeight which is used as zValue of a terrain if no dgm is found (configured) for a 272 * request. The default value is 0d. 273 */ 274 public double getMinimalTerrainHeight() { 275 return minimalTerrainHeight; 276 } 277 278 /** 279 * @return the minimalWCS_DGMResolution. 280 */ 281 public double getMinimalWCS_DGMResolution() { 282 return minimalWCS_DGMResolution; 283 } 284 285 /** 286 * @return the percentage to which wcs-request should be extended 287 */ 288 public double getExtendRequestPercentage() { 289 return extendRequestPercentage; 290 } 291 292 /** 293 * @return the configured nearclipping plane. 294 */ 295 public double getNearClippingPlane() { 296 return nearClippingPlane; 297 } 298 299 /** 300 * @return the maxim dimension of a requested Texture. 301 */ 302 public final int getMaxTextureDimension() { 303 return maxTextureDimension; 304 } 305 306 /** 307 * @return the number of leaves a quadtree-splitter can have before it starts merging leaves together. 308 */ 309 public final int getQuadMergeCount() { 310 return quadMergeCount; 311 } 312 }