001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/portal/context/General.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.awt.Rectangle; 047 048 import org.deegree.model.crs.CoordinateSystem; 049 import org.deegree.model.metadata.iso19115.CitedResponsibleParty; 050 import org.deegree.model.spatialschema.Envelope; 051 import org.deegree.model.spatialschema.GeometryFactory; 052 import org.deegree.model.spatialschema.Point; 053 import org.deegree.ogcbase.BaseURL; 054 import org.deegree.ogcbase.ImageURL; 055 056 /** 057 * The class encapsulates the general informations common to all types of contexts 058 * 059 * @version $Revision: 9346 $ 060 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a> 061 */ 062 public class General { 063 private CitedResponsibleParty contactInformation = null; 064 065 private Point[] boundingBox = null; 066 067 private GeneralExtension extension = null; 068 069 private String abstract_ = null; 070 071 private String title = null; 072 073 private BaseURL descriptionURL = null; 074 075 private ImageURL logoURL = null; 076 077 private String[] keywords = null; 078 079 private Rectangle window = null; 080 081 /** 082 * Creates a new General object. 083 * 084 * @param title 085 * title of the context 086 * @param abstract_ 087 * short description 088 * @param contactInformation 089 * informations about creator of the context 090 * @param boundingBox 091 * bounding box of the map/data 092 * @param descriptionURL 093 * reference to a webpage which contains relevant information to the view. 094 * @param logoURL 095 * A reference to an image that might be attached to the context document. 096 * @param keywords 097 * @param extension 098 * The Extension element is a container tag in which arbitrary vendor specific 099 * information can be included without compromising the ability of other clients to 100 * enforce schema validation. 101 * 102 * @throws ContextException 103 */ 104 public General( String title, String abstract_, Rectangle window, CitedResponsibleParty contactInformation, 105 Point[] boundingBox, BaseURL descriptionURL, ImageURL logoURL, String[] keywords, 106 GeneralExtension extension ) throws ContextException { 107 setTitle( title ); 108 setAbstract( abstract_ ); 109 setWindow( window ); 110 setContactInformation( contactInformation ); 111 setBoundingBox( boundingBox ); 112 setDescriptionURL( descriptionURL ); 113 setLogoURL( logoURL ); 114 setKeywords( keywords ); 115 setExtension( extension ); 116 } 117 118 /** 119 * An element �Window� presenting the size in pixels of the map the Context document describes. 120 * Negotiation between Context defined aspect ratio and typical client aspect ratio (according 121 * to the client�s vendor) is left to the client. 122 * 123 * @param window 124 */ 125 public void setWindow( Rectangle window ) { 126 this.window = window; 127 } 128 129 /** 130 * �BoundingBox� formatted as defined in the WMS 1.1.1 Specification. It represents the 131 * geographic extent that should be presented by the client1. 132 * 133 * @param boundingBox 134 */ 135 public void setBoundingBox( Point[] boundingBox ) 136 throws ContextException { 137 if ( boundingBox == null ) { 138 throw new ContextException( "A context's bounding box isn't allowed to be null" ); 139 } 140 141 this.boundingBox = boundingBox; 142 } 143 144 /** 145 * �BoundingBox� formatted as defined in the WMS 1.1.1 Specification. It represents the 146 * geographic extent that should be presented by the client1. 147 * 148 * @param boundingBox 149 */ 150 public void setBoundingBox( Envelope boundingBox ) 151 throws ContextException { 152 if ( boundingBox == null ) { 153 throw new ContextException( "A context's bounding box isn't allowed to be null" ); 154 } 155 156 CoordinateSystem cs = this.boundingBox[0].getCoordinateSystem(); 157 Point p0 = GeometryFactory.createPoint( boundingBox.getMin().getX(), boundingBox.getMin().getY(), cs ); 158 Point p1 = GeometryFactory.createPoint( boundingBox.getMax().getX(), boundingBox.getMax().getY(), cs ); 159 this.boundingBox = new Point[] { p0, p1 }; 160 } 161 162 /** 163 * An element �KeywordList� that contains one or more Keyword elements which allow search across 164 * context collections. 165 * 166 * @param keywords 167 */ 168 public void setKeywords( String[] keywords ) { 169 this.keywords = keywords; 170 } 171 172 /** 173 * An element �Title� that contains a human readable title of the Context. 174 * 175 * @param title 176 */ 177 public void setTitle( String title ) 178 throws ContextException { 179 if ( title == null ) { 180 throw new ContextException( "A context's title isn't allowed to be null" ); 181 } 182 183 this.title = title; 184 } 185 186 /** 187 * An element �Abstract� that contains a description for the Context document describing its 188 * content. 189 * 190 * @param abstract_ 191 */ 192 public void setAbstract( String abstract_ ) { 193 this.abstract_ = abstract_; 194 } 195 196 /** 197 * A reference to an image that might be attached to the Context document. It can be, for 198 * instance, the logo of the project for which the context has been setup, or an overview of the 199 * map the context describes. This element contains a link to the image as well as the dimension 200 * of the image (in pixels) and its format. 201 * 202 * @param logoURL 203 */ 204 public void setLogoURL( ImageURL logoURL ) { 205 this.logoURL = logoURL; 206 } 207 208 /** 209 * A URL reference to a webpage which contains relevant information to the view. 210 * 211 * @param descriptionURL 212 */ 213 public void setDescriptionURL( BaseURL descriptionURL ) { 214 this.descriptionURL = descriptionURL; 215 } 216 217 /** 218 * An element �ContactInformation� that presents contact information of the creator of the 219 * Context document. Contact is described as defined in WMS 1.1.1 Specification. 220 * 221 * @param contactInformation 222 */ 223 public void setContactInformation( CitedResponsibleParty contactInformation ) { 224 this.contactInformation = contactInformation; 225 } 226 227 /** 228 * The Extension element is a container tag in which arbitrary vendor specific information can 229 * be included without compromising the ability of other clients to enforce schema validation.<p/> 230 * This tag should not be used to introduce new candidate elements that are intended to promote 231 * interoperability. Content in an <Extension> element should not be expected to be preserved in 232 * transfers of ViewContext documents between different systems. 233 * 234 * @param extension 235 */ 236 public void setExtension( GeneralExtension extension ) { 237 this.extension = extension; 238 } 239 240 /** 241 * 242 * 243 * @return 244 */ 245 public Rectangle getWindow() { 246 return window; 247 } 248 249 /** 250 * 251 * @return 252 */ 253 public Point[] getBoundingBox() { 254 return boundingBox; 255 } 256 257 /** 258 * 259 * @return 260 */ 261 public String[] getKeywords() { 262 return keywords; 263 } 264 265 /** 266 * 267 * @return 268 */ 269 public String getTitle() { 270 return title; 271 } 272 273 /** 274 * 275 * @return 276 */ 277 public String getAbstract() { 278 return abstract_; 279 } 280 281 /** 282 * 283 * @return 284 */ 285 public ImageURL getLogoURL() { 286 return logoURL; 287 } 288 289 /** 290 * 291 * @return 292 */ 293 public BaseURL getDescriptionURL() { 294 return descriptionURL; 295 } 296 297 /** 298 * 299 * @return 300 */ 301 public CitedResponsibleParty getContactInformation() { 302 return contactInformation; 303 } 304 305 /** 306 * 307 * @return 308 */ 309 public GeneralExtension getExtension() { 310 return extension; 311 } 312 313 }