001 //$$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/ogcwebservices/wpvs/configuration/WPVSDeegreeParams.java $$
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2006 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: rbezema $
063 *
064 * $Revision: 7953 $, $Date: 2007-08-09 11:57:56 +0200 (Do, 09 Aug 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 /**
108 *
109 *
110 * @param defaultOnlineResource
111 * @param cacheSize
112 * @param requestTimeLimit
113 * @param characterSet
114 * @param copyright
115 * @param watermarked
116 * @param maxLifeTime
117 * @param viewQuality
118 * @param backgroundMap
119 * a <code>Map</code> for background images. This Map contains image names as keys
120 * and image URL as values
121 * @param maxWidth
122 * @param maxHeight
123 * @param requestQualityPreferred
124 * @param maximumFarClippingPlane
125 * to which extend the request can set a farclippingplane
126 * @param nearClippingPlane of the viewport
127 * @param defaultSplitter
128 * What kind of splitter to use if the GetView request has no field named "splitter"
129 * @param minimalTerrainHeight
130 * the minimalheight of a terrain if no dgm is found.
131 * @param minimalWCS_DGMResolution
132 * the configured minimal resolution of a wcs dgm
133 * @param extendRequestPercentage
134 * the percentage to which wcs/wms request should be extended.
135 */
136 public WPVSDeegreeParams( OnlineResource defaultOnlineResource, int cacheSize,
137 int requestTimeLimit, String characterSet, String copyright,
138 boolean watermarked, int maxLifeTime, float viewQuality,
139 Map<String, URL> backgroundMap, int maxWidth, int maxHeight,
140 boolean requestQualityPreferred, double maximumFarClippingPlane, double nearClippingPlane,
141 String defaultSplitter, double minimalTerrainHeight,
142 double minimalWCS_DGMResolution, double extendRequestPercentage ) {
143
144 super( defaultOnlineResource, cacheSize, requestTimeLimit, characterSet );
145
146 this.copyright = copyright;
147 this.maxLifeTime = maxLifeTime;
148 this.viewQuality = viewQuality;
149 this.backgroundMap = backgroundMap;
150 this.isWatermarked = watermarked;
151 this.maxViewWidth = maxWidth;
152 this.maxViewHeight = maxHeight;
153 this.requestQualityPreferred = requestQualityPreferred;
154 this.maximumFarClippingPlane = maximumFarClippingPlane;
155 this.nearClippingPlane = nearClippingPlane;
156 this.minimalWCS_DGMResolution = minimalWCS_DGMResolution;
157 this.defaultSplitter = defaultSplitter.toUpperCase();
158 if ( !( "QUAD".equals( defaultSplitter ) || "BBOX".equals( defaultSplitter ) ) ) {
159 LOG.logWarning( "The configured defaultSplitter does not exist, setting to QUAD" );
160 this.defaultSplitter = "QUAD";
161 }
162
163 try {
164 URL url = new URL( this.copyright );
165 if ( url != null ) {
166 copyrightImage = ImageUtils.loadImage( url.getFile() );
167 }
168 } catch ( MalformedURLException murle ) {
169 // The Copyright is a String.
170 } catch ( IOException ioe ) {
171 // The Copyright is a String.
172 }
173 this.minimalTerrainHeight = minimalTerrainHeight;
174 this.extendRequestPercentage = extendRequestPercentage;
175 }
176
177 /**
178 * @return Returns the copyright.
179 */
180 public String getCopyright() {
181 return copyright;
182 }
183
184 /**
185 * @return Returns the maxLifeTime.
186 */
187 public int getMaxLifeTime() {
188 return maxLifeTime;
189 }
190
191 /**
192 * @return Returns the viewQuality.
193 */
194 public float getViewQuality() {
195 return viewQuality;
196 }
197
198 /**
199 * @return the configured different backgroundimages
200 */
201 public Map getBackgroundMap() {
202 return backgroundMap;
203 }
204
205 /**
206 * @return true if the image should be watermarked (with an image or text)
207 */
208 public boolean isWatermarked() {
209 return isWatermarked;
210 }
211
212 /**
213 * @return maximum value of the width of a request
214 */
215 public int getMaxViewWidth() {
216 return maxViewWidth;
217 }
218
219 /**
220 * @return maximum value of the height of a request
221 */
222 public int getMaxViewHeight() {
223 return maxViewHeight;
224 }
225
226 /**
227 * @return true if the splitter should use hight quality (lot of request quads) or false
228 * otherwise.
229 */
230 public boolean isRequestQualityPreferred() {
231 return requestQualityPreferred;
232 }
233
234 /**
235 * @return the maximumFarClippingPlane which a user can request.
236 */
237 public double getMaximumFarClippingPlane() {
238 return maximumFarClippingPlane;
239 }
240
241 /**
242 * @return the copyrightImage as a BufferedImage.
243 */
244 public BufferedImage getCopyrightImage() {
245 return copyrightImage;
246 }
247
248 /**
249 * @return the defaultSplitter.
250 */
251 public String getDefaultSplitter() {
252 return defaultSplitter;
253 }
254
255 /**
256 * @return the minimalTerrainHeight which is used as zValue of a terrain if no dgm is found
257 * (configured) for a request. The default value is 0d.
258 */
259 public double getMinimalTerrainHeight() {
260 return minimalTerrainHeight;
261 }
262
263 /**
264 * @return the minimalWCS_DGMResolution.
265 */
266 public double getMinimalWCS_DGMResolution() {
267 return minimalWCS_DGMResolution;
268 }
269
270 /**
271 * @return the percentage to which wcs-request should be extended
272 */
273 public double getExtendRequestPercentage() {
274 return extendRequestPercentage;
275 }
276
277 /**
278 * @return the configured nearclipping plane.
279 */
280 public double getNearClippingPlane() {
281 return nearClippingPlane;
282 }
283 }