Source Code Cross Referenced for GetView.java in  » GIS » deegree » org » deegree » ogcwebservices » wpvs » operation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » deegree » org.deegree.ogcwebservices.wpvs.operation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/ogcwebservices/wpvs/operation/GetView.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.operation;
045:
046:        import java.awt.Color;
047:        import java.awt.Dimension;
048:        import java.io.UnsupportedEncodingException;
049:        import java.net.URLDecoder;
050:        import java.util.ArrayList;
051:        import java.util.List;
052:        import java.util.Map;
053:
054:        import javax.vecmath.Point3d;
055:
056:        import org.deegree.framework.log.ILogger;
057:        import org.deegree.framework.log.LoggerFactory;
058:        import org.deegree.framework.util.CharsetUtils;
059:        import org.deegree.framework.util.MimeTypeMapper;
060:        import org.deegree.framework.util.StringTools;
061:        import org.deegree.framework.util.TimeTools;
062:        import org.deegree.i18n.Messages;
063:        import org.deegree.model.crs.CRSFactory;
064:        import org.deegree.model.crs.CoordinateSystem;
065:        import org.deegree.model.crs.UnknownCRSException;
066:        import org.deegree.model.spatialschema.Envelope;
067:        import org.deegree.model.spatialschema.GeometryFactory;
068:        import org.deegree.model.spatialschema.Position;
069:        import org.deegree.ogcwebservices.InconsistentRequestException;
070:        import org.deegree.ogcwebservices.InvalidParameterValueException;
071:
072:        /**
073:         * This Class handles a kvp request from a client and stores it's values.
074:         * 
075:         * @author <a href="mailto:taddei@lat-lon.de">Ugo Taddei</a>
076:         * @author last edited by: $Author: apoth $
077:         * 
078:         * @version 2.0, $Revision: 9345 $, $Date: 2007-12-27 08:22:25 -0800 (Thu, 27 Dec 2007) $
079:         * 
080:         * @since 2.0
081:         */
082:        public class GetView extends WPVSRequestBase {
083:
084:            /**
085:             * 
086:             */
087:            private static final long serialVersionUID = 3147456903146907261L;
088:
089:            private static final ILogger LOG = LoggerFactory
090:                    .getLogger(GetView.class);
091:
092:            private final List<String> datasets;
093:
094:            private double quality;
095:
096:            /**
097:             * using deegree's Position
098:             */
099:            private final Point3d pointOfInterest;
100:
101:            private double pitch;
102:
103:            private double yaw;
104:
105:            private double roll;
106:
107:            private double distance;
108:
109:            private double angleOfView;
110:
111:            private final boolean transparent;
112:
113:            private final Dimension imageDimension;
114:
115:            private final String outputFormat;
116:
117:            private final Color backgroundColor;
118:
119:            private final String exceptionFormat;
120:
121:            private final String elevationModel;
122:
123:            private final Envelope boundingBox;
124:
125:            private final CoordinateSystem crs;
126:
127:            private double farClippingPlane;
128:
129:            private GetView(String version, String id, List<String> datasets,
130:                    String elevationModel, double quality,
131:                    Position pointOfInterest, Envelope bbox,
132:                    CoordinateSystem crs, double pitch, double yaw,
133:                    double roll, double distance, double angleOfView,
134:                    String outputFormat, Color backgroundColor,
135:                    boolean transparent, Dimension imageDimension,
136:                    String exceptionFormat, double farClippingPlane,
137:                    Map<String, String> vendorSpecificParameter) {
138:                this (version, id, datasets, elevationModel, quality,
139:                        new Point3d(pointOfInterest.getX(), pointOfInterest
140:                                .getY(), pointOfInterest.getZ()), bbox, crs,
141:                        pitch, yaw, roll, distance, angleOfView, outputFormat,
142:                        backgroundColor, transparent, imageDimension,
143:                        exceptionFormat, farClippingPlane,
144:                        vendorSpecificParameter);
145:            }
146:
147:            /**
148:             * Trusted constructor. No parameter validity is performed. This is delegated to the factory
149:             * method createGeMap.
150:             * 
151:             * TODO the list of pars is too long, should break up into smaller classes, e.g. pars for
152:             * perspective output, etc.
153:             * 
154:             * @param version
155:             * @param id
156:             * @param datasets
157:             * @param elevationModel
158:             * @param quality
159:             * @param pointOfInterest
160:             * @param bbox
161:             * @param crs
162:             * @param pitch
163:             * @param yaw
164:             * @param roll
165:             * @param distance
166:             * @param angleOfView
167:             * @param outputFormat
168:             * @param backgroundColor
169:             * @param transparent
170:             * @param imageDimension
171:             * @param exceptionFormat
172:             * @param farClippingPlane
173:             * @param vendorSpecificParameter
174:             */
175:            private GetView(String version, String id, List<String> datasets,
176:                    String elevationModel, double quality,
177:                    Point3d pointOfInterest, Envelope bbox,
178:                    CoordinateSystem crs, double pitch, double yaw,
179:                    double roll, double distance, double angleOfView,
180:                    String outputFormat, Color backgroundColor,
181:                    boolean transparent, Dimension imageDimension,
182:                    String exceptionFormat, double farClippingPlane,
183:                    Map<String, String> vendorSpecificParameter) {
184:                super (version, id, vendorSpecificParameter);
185:                this .datasets = datasets;
186:                this .elevationModel = elevationModel;
187:
188:                this .quality = quality;
189:                this .pointOfInterest = pointOfInterest;
190:                this .boundingBox = bbox;
191:                this .crs = crs;
192:                this .pitch = pitch;
193:                this .yaw = yaw;
194:                this .roll = roll;
195:                this .distance = distance;
196:                this .angleOfView = angleOfView;
197:                this .outputFormat = outputFormat;
198:                this .backgroundColor = backgroundColor;
199:                this .transparent = transparent;
200:                this .imageDimension = imageDimension;
201:                this .exceptionFormat = exceptionFormat;
202:                this .farClippingPlane = farClippingPlane;
203:
204:            }
205:
206:            /**
207:             * Factory method to create an instance of GetView from teh parameters in <code>model</code>
208:             * 
209:             * @param requestParams
210:             *            a map containing request parameters and values
211:             * @return a new instance of GetView
212:             * @throws InconsistentRequestException
213:             *             if a mandatory parameter is missing
214:             * @throws InvalidParameterValueException
215:             *             if a parameter has an illegal value
216:             */
217:            public static GetView create(Map<String, String> requestParams)
218:                    throws InconsistentRequestException,
219:                    InvalidParameterValueException {
220:
221:                // TODO throw a proper exception, the InconsistentRequestException doesn't cover all cases
222:
223:                // not needed anymore
224:                requestParams.remove("REQUEST");
225:
226:                String id = requestParams.remove("ID");
227:
228:                /*
229:                 * TODO check if this is right WPVSConfiguration configuration = (WPVSConfiguration)
230:                 * model.remove( "CAPABILITIES" ); if ( configuration == null ){ throw new RuntimeException (
231:                 * "Working site: you forgot to add config to model -> " + "see how this is done in wms" ); }
232:                 */
233:
234:                String version = requestParams.remove("VERSION");
235:                if (version == null) {
236:                    throw new InconsistentRequestException(
237:                            "'VERSION' value must be set");
238:                }
239:
240:                // FORMAT
241:                String format = requestParams.remove("OUTPUTFORMAT");
242:                if (format == null) {
243:                    throw new InconsistentRequestException(
244:                            "OUTPUTFORMAT value must be set");
245:                }
246:                try {
247:                    format = URLDecoder.decode(format, CharsetUtils
248:                            .getSystemCharset());
249:                } catch (UnsupportedEncodingException e1) {
250:                    LOG.logError(e1.getLocalizedMessage(), e1);
251:                }
252:                if (!MimeTypeMapper.isKnownImageType(format)) {
253:                    throw new InvalidParameterValueException(StringTools
254:                            .concat(50, format,
255:                                    " is not a valid image/result format"));
256:                }
257:
258:                // TRANSPARENCY
259:                boolean transparency = false;
260:                String tp = requestParams.remove("TRANSPARENT");
261:                if (tp != null) {
262:                    transparency = tp.toUpperCase().trim().equals("TRUE");
263:                }
264:
265:                if (transparency
266:                        && (format.equals("image/jpg")
267:                                || format.equals("image/jpeg")
268:                                || format.equals("image/bmp")
269:                                || format.equals("image/tif") || format
270:                                .equals("image/tiff"))) {
271:
272:                    throw new InconsistentRequestException(
273:                            StringTools
274:                                    .concat(
275:                                            100,
276:                                            "TRANSPARENCY=true is inconsistent with OUTPUTFORMAT=",
277:                                            format,
278:                                            ".Valid transparent formats are 'image/gif' ",
279:                                            "and 'image/png'."));
280:                }
281:
282:                // width
283:                String tmp = requestParams.remove("WIDTH");
284:                if (tmp == null) {
285:                    throw new InconsistentRequestException(
286:                            "'WIDTH' value must be set");
287:                }
288:                int width = 0;
289:                try {
290:                    width = Integer.parseInt(tmp);
291:                } catch (NumberFormatException e) {
292:                    throw new InconsistentRequestException(
293:                            "WIDTH must be a valid integer number");
294:                }
295:
296:                tmp = requestParams.remove("HEIGHT");
297:                if (tmp == null) {
298:                    throw new InconsistentRequestException(
299:                            "'HEIGHT' value must be set");
300:                }
301:                int height = 0;
302:                try {
303:                    height = Integer.parseInt(tmp);
304:                } catch (NumberFormatException e) {
305:                    throw new InconsistentRequestException(
306:                            "HEIGHT must be a valid integer number");
307:                }
308:
309:                if (width < 0 || height < 0) {
310:                    throw new InconsistentRequestException(
311:                            "WIDTH and HEIGHT must be >= 0");
312:                }
313:                Dimension imgDimension = new Dimension(width, height);
314:
315:                Color bgColor = Color.white;
316:
317:                tmp = requestParams.remove("BACKGROUNDCOLOR");
318:                if (tmp != null) {
319:                    try {
320:                        bgColor = Color.decode(tmp);
321:                    } catch (NumberFormatException e) {
322:                        throw new InconsistentRequestException(
323:                                StringTools
324:                                        .concat(100, "The BACKGROUNDCOLOR '",
325:                                                tmp,
326:                                                "' does not denote a valid hexadecimal color."));
327:                    }
328:                }
329:
330:                String elevModel = requestParams.remove("ELEVATIONMODEL");
331:                /*
332:                 * if ( elevModel == null ) { throw new InconsistentRequestException( "'ELEVATIONMODEL'
333:                 * value must be set" ); }
334:                 */
335:                if (elevModel != null) {
336:                    elevModel = elevModel.trim();
337:                    if (elevModel.length() == 0) {
338:                        throw new InconsistentRequestException(
339:                                "ELEVATIONMODEL cannot contain space characters only or be empty");
340:                    }
341:                }
342:
343:                tmp = requestParams.remove("AOV");
344:                if (tmp == null) {
345:                    throw new InconsistentRequestException(
346:                            "'AOV' value must be set");
347:                }
348:
349:                double aov = 0;
350:                try {
351:                    aov = Math.toRadians(Double.parseDouble(tmp));
352:                    /**
353:                     * checking for > 0 || < 90
354:                     */
355:                    if ((aov <= 0) || (aov >= 1.5707963265)) {
356:                        throw new InvalidParameterValueException(
357:                                "AOV value must be a number between 0° and 180°");
358:                    }
359:                } catch (NumberFormatException e) {
360:                    LOG.logError(e.getLocalizedMessage(), e);
361:                    throw new InvalidParameterValueException(
362:                            "AOV couldn't parse the aov value");
363:                }
364:
365:                tmp = requestParams.remove("ROLL");
366:                if (tmp == null) {
367:                    throw new InconsistentRequestException(
368:                            "'ROLL' value must be set");
369:                }
370:                double roll;
371:                try {
372:                    /**
373:                     * checking for > 360 && < 360
374:                     */
375:                    roll = Double.parseDouble(tmp) % 360;
376:                    if (roll < 0)
377:                        roll += 360;
378:                    roll = Math.toRadians(roll);
379:                } catch (NumberFormatException e) {
380:                    LOG.logError(e.getLocalizedMessage(), e);
381:                    throw new InvalidParameterValueException(
382:                            "ROLL value must be a number");
383:                }
384:
385:                tmp = requestParams.remove("DISTANCE");
386:                if (tmp == null) {
387:                    throw new InconsistentRequestException(
388:                            "'DISTANCE' value must be set.");
389:                }
390:
391:                double distance;
392:                String mesg = "DISTANCE must be a number >= 0.";
393:                try {
394:                    distance = Double.parseDouble(tmp);
395:                    if (distance < 0) {
396:                        throw new InvalidParameterValueException(mesg);
397:                    }
398:                } catch (NumberFormatException e) {
399:                    LOG.logError(e.getLocalizedMessage(), e);
400:                    throw new InvalidParameterValueException(mesg);
401:                }
402:
403:                tmp = requestParams.remove("PITCH");
404:                if (tmp == null) {
405:                    throw new InconsistentRequestException(
406:                            "'PITCH' value must be set.");
407:                }
408:                double pitch = 0;
409:                try {
410:                    pitch = Math.toRadians(Double.parseDouble(tmp));
411:                    if ((pitch < -1.570796327) || (pitch > 1.570796327)) {
412:                        throw new InvalidParameterValueException(
413:                                "PITCH value must be a number between -90° and 90°");
414:                    }
415:                } catch (NumberFormatException e) {
416:                    LOG.logError(e.getLocalizedMessage(), e);
417:                    throw new InvalidParameterValueException(
418:                            "PITCH value must be a number between -90° and 90°");
419:                }
420:
421:                tmp = requestParams.remove("YAW");
422:                if (tmp == null) {
423:                    throw new InconsistentRequestException(
424:                            "'YAW' value must be set.");
425:                }
426:                double yaw;
427:                try {
428:                    double tmpYaw = Double.parseDouble(tmp) % 360;
429:                    if (tmpYaw < 0)
430:                        tmpYaw += 360;
431:                    // YAW == 270 -> OutOfMem Error
432:                    // if ( tmpYaw > 89.5 && tmpYaw < 90.5 ) {
433:                    // tmpYaw = 91;
434:                    // } else if ( tmpYaw > 269.5 && tmpYaw < 270.5 ) {
435:                    // tmpYaw = 271;
436:                    // }
437:                    // [UT] 06.06.2005 splitter doesn't work fine for 0 (or 360) and 180
438:                    // if ( tmpYaw % 180 == 0 ) {
439:                    // tmpYaw += 0.5;
440:                    // }
441:                    yaw = Math.toRadians(tmpYaw);
442:
443:                } catch (NumberFormatException e) {
444:                    LOG.logError(e.getLocalizedMessage(), e);
445:                    throw new InvalidParameterValueException(
446:                            "YAW value must be a number");
447:                }
448:
449:                tmp = requestParams.remove("POI");
450:                if (tmp == null) {
451:                    throw new InconsistentRequestException(
452:                            "POI value is missing.");
453:                }
454:                mesg = "POI value must denote a number tuple with valid x,y,z values, for example '123.45,678.90,456.123'";
455:
456:                try {
457:                    tmp = URLDecoder.decode(tmp, CharsetUtils
458:                            .getSystemCharset());
459:                } catch (UnsupportedEncodingException e) {
460:                    LOG.logError(e.getLocalizedMessage(), e);
461:                    throw new InconsistentRequestException(e
462:                            .getLocalizedMessage());
463:                }
464:                String[] xyz = tmp.split(",");
465:                if (xyz.length != 3) {
466:                    throw new InvalidParameterValueException(mesg);
467:                }
468:                Position poi;
469:                double[] p = new double[3];
470:                try {
471:                    p[0] = Double.parseDouble(xyz[0]);
472:                    p[1] = Double.parseDouble(xyz[1]);
473:                    p[2] = Double.parseDouble(xyz[2]);
474:
475:                } catch (NumberFormatException e) {
476:                    LOG.logError(e.getLocalizedMessage(), e);
477:                    throw new InvalidParameterValueException(mesg);
478:                }
479:                poi = GeometryFactory.createPosition(p);
480:
481:                String crsString = requestParams.remove("CRS");
482:                CoordinateSystem crs = null;
483:                if (crsString == null) {
484:                    throw new InconsistentRequestException(
485:                            "CRS parameter is missing.");
486:                }
487:                try {
488:                    crsString = URLDecoder.decode(crsString, CharsetUtils
489:                            .getSystemCharset());
490:                    crs = CRSFactory.create(crsString);
491:                } catch (UnsupportedEncodingException e) {
492:                    LOG.logError(e.getLocalizedMessage(), e);
493:                } catch (UnknownCRSException ucrse) {
494:                    LOG.logError(ucrse.getLocalizedMessage(), ucrse);
495:                    throw new InvalidParameterValueException(ucrse.getMessage());
496:                }
497:
498:                String datasetsString = requestParams.remove("DATASETS");
499:                if (datasetsString == null) {
500:                    throw new InconsistentRequestException(
501:                            "'DATASETS' value must be set");
502:                }
503:
504:                datasetsString = datasetsString.trim();
505:
506:                String[] datasets = datasetsString.split(",");
507:                if ("".equals(datasetsString) || datasets.length == 0) {
508:                    throw new InconsistentRequestException(
509:                            "'DATASETS' must contain at least one dataset name, and cannot be empty (i.e. only have spaces)");
510:                }
511:                List<String> datasetList = new ArrayList<String>(
512:                        datasets.length);
513:                for (String dataset : datasets) {
514:                    datasetList.add(dataset.trim());
515:                }
516:
517:                String boxstring = requestParams.remove("BOUNDINGBOX");
518:                Envelope boundingBox = null;
519:                if (boxstring == null) {
520:                    throw new InconsistentRequestException(
521:                            "BOUNDINGBOX value must be set");
522:                }
523:
524:                try {
525:                    boxstring = URLDecoder.decode(boxstring, CharsetUtils
526:                            .getSystemCharset());
527:                } catch (UnsupportedEncodingException e) {
528:                    LOG.logError(e.getLocalizedMessage(), e);
529:                    throw new InconsistentRequestException(StringTools.concat(
530:                            100, "Cannot decode BOUNDINGBOX: '", boxstring,
531:                            " using ", CharsetUtils.getSystemCharset()));
532:                }
533:
534:                String[] tokens = boxstring.split(",");
535:                if (tokens.length != 4) {
536:                    throw new InconsistentRequestException(
537:                            "BOUNDINGBOX value must have a value such as xmin,ymin,xmax,ymax");
538:                }
539:
540:                double minx;
541:                double maxx;
542:                double miny;
543:                double maxy;
544:                try {
545:                    minx = Double.parseDouble(tokens[0]);
546:                    miny = Double.parseDouble(tokens[1]);
547:                    maxx = Double.parseDouble(tokens[2]);
548:                    maxy = Double.parseDouble(tokens[3]);
549:                } catch (NumberFormatException e) {
550:                    LOG.logError(e.getLocalizedMessage(), e);
551:                    throw new InconsistentRequestException(
552:                            "BOUNDINGBOX has an illegal value: "
553:                                    + e.getMessage());
554:                }
555:
556:                if (minx >= maxx) {
557:                    throw new InvalidParameterValueException(
558:                            "minx must be less than maxx");
559:                }
560:
561:                if (miny >= maxy) {
562:                    throw new InvalidParameterValueException(
563:                            "miny must be less than maxy");
564:                }
565:
566:                boundingBox = GeometryFactory.createEnvelope(minx, miny, maxx,
567:                        maxy, crs);
568:
569:                /**
570:                 * Doing some checking of the given request parameters.
571:                 */
572:
573:                if (!boundingBox.contains(poi)) {
574:                    throw new InconsistentRequestException("POI (" + poi
575:                            + " )must be inside the Bounding box ("
576:                            + boundingBox + ")");
577:                }
578:
579:                tmp = requestParams.remove("FARCLIPPINGPLANE");
580:                double farClippingPlane = 150000;
581:                if (tmp != null) {
582:                    try {
583:                        farClippingPlane = Double.parseDouble(tmp);
584:                    } catch (NumberFormatException e) {
585:                        LOG.logError(e.getLocalizedMessage(), e);
586:                        throw new InvalidParameterValueException(
587:                                "FarClippingPlane must be a number");
588:                    }
589:                }
590:
591:                tmp = requestParams.remove("QUALITY");
592:                double quality = 1f;
593:                if (tmp != null) {
594:                    try {
595:                        quality = Double.parseDouble(tmp);
596:                    } catch (NumberFormatException e) {
597:                        LOG.logError(e.getLocalizedMessage(), e);
598:                        throw new InvalidParameterValueException(
599:                                "QUALITY must have a value between [0,1]");
600:                    }
601:                }
602:
603:                String exceptions = requestParams.remove("EXCEPTIONFORMAT");
604:                if (exceptions == null) {
605:                    exceptions = "XML";
606:                }
607:
608:                // Shouldn't this be checked for the right value ???
609:                tmp = requestParams.remove("DATETIME");
610:                if (tmp == null) {
611:                    // when the moon is in the second house,
612:                    // and jupiter aligns with mars.
613:                    // -> dawning of the age of the wpvs
614:                    tmp = "2007-03-21T12:00:00";
615:                } else {
616:                    try {
617:                        TimeTools.createCalendar(tmp);
618:                    } catch (NumberFormatException nfe) {
619:                        throw new InvalidParameterValueException(Messages
620:                                .getMessage("WPVS_GETVIEW_ILLEGAL_DATETIME",
621:                                        tmp));
622:                    }
623:                }
624:
625:                // org.deegree.framework.util.TimeTools.createCalendar( tmp );
626:
627:                requestParams.put("DATETIME", tmp);
628:
629:                tmp = requestParams.remove("SCALE");
630:                if (tmp != null) {
631:                    try {
632:                        Double.parseDouble(tmp);
633:                        requestParams.put("SCALE", tmp);
634:                    } catch (NumberFormatException e) {
635:                        LOG.logError(e.getLocalizedMessage(), e);
636:                        throw new InvalidParameterValueException(e);
637:                    }
638:                }
639:
640:                return new GetView(version, id, datasetList, elevModel,
641:                        quality, poi, boundingBox, crs, pitch, yaw, roll,
642:                        distance, aov, format, bgColor, transparency,
643:                        imgDimension, exceptions, farClippingPlane,
644:                        requestParams);
645:            }
646:
647:            /**
648:             * @return the requested angleOfView
649:             */
650:            public double getAngleOfView() {
651:                return angleOfView;
652:            }
653:
654:            /**
655:             * @return the requested distance to the poi
656:             */
657:            public double getDistance() {
658:                return distance;
659:            }
660:
661:            /**
662:             * @return the requested dimension of the resultimage
663:             */
664:            public Dimension getImageDimension() {
665:                return imageDimension;
666:            }
667:
668:            /**
669:             * @return the requested pitch (rotation around the x-axis)
670:             */
671:            public double getPitch() {
672:                return pitch;
673:            }
674:
675:            /**
676:             * 
677:             * @return the point of interest as Point3d
678:             */
679:            public Point3d getPointOfInterest() {
680:                return pointOfInterest;
681:            }
682:
683:            /**
684:             * @return the quality of the textures
685:             */
686:            public double getQuality() {
687:                return quality;
688:            }
689:
690:            /**
691:             * @return the requested roll (rotation around the y-axis)
692:             */
693:            public double getRoll() {
694:                return roll;
695:            }
696:
697:            /**
698:             * @return if the resultimage should be transparent
699:             */
700:            public boolean isTransparent() {
701:                return transparent;
702:            }
703:
704:            /**
705:             * @return the requested yaw (rotation around the z-axis)
706:             */
707:            public double getYaw() {
708:                return yaw;
709:            }
710:
711:            /**
712:             * @return the requested datasets (e.g. layers or features etc.)
713:             */
714:            public List<String> getDatasets() {
715:                return datasets;
716:            }
717:
718:            /**
719:             * @return the requested color of the background
720:             */
721:            public Color getBackgroundColor() {
722:                return backgroundColor;
723:            }
724:
725:            /**
726:             * @return the requested format of thrown exceptions
727:             */
728:            public String getExceptionFormat() {
729:                return exceptionFormat;
730:            }
731:
732:            /**
733:             * @return the mimetype of the resultimage
734:             */
735:            public String getOutputFormat() {
736:                return outputFormat;
737:            }
738:
739:            /**
740:             * @return the boundingbox of the request
741:             */
742:            public Envelope getBoundingBox() {
743:                return boundingBox;
744:            }
745:
746:            /**
747:             * @return the Coordinate System of the request
748:             */
749:            public CoordinateSystem getCrs() {
750:                return crs;
751:            }
752:
753:            /**
754:             * @return the elevationmodel to be used.
755:             */
756:            public String getElevationModel() {
757:                return elevationModel;
758:            }
759:
760:            /**
761:             * @return Returns the farClippingPlane.
762:             */
763:            public double getFarClippingPlane() {
764:                return farClippingPlane;
765:            }
766:
767:            /**
768:             * @param farClippingPlane
769:             *            another clippingPlane distance.
770:             */
771:            public void setFarClippingPlane(double farClippingPlane) {
772:                this .farClippingPlane = farClippingPlane;
773:            }
774:
775:            /**
776:             * @param pitch
777:             *            a new pitch value
778:             */
779:            public void setPitch(double pitch) {
780:                this .pitch = pitch;
781:            }
782:
783:            /**
784:             * @param distance
785:             *            An other distance value.
786:             */
787:            public void setDistance(double distance) {
788:                this .distance = distance;
789:            }
790:
791:            /**
792:             * @param yaw
793:             *            An other yaw value.
794:             */
795:            public void setYaw(double yaw) {
796:                this .yaw = yaw;
797:            }
798:
799:            /**
800:             * @param angleOfView
801:             *            An other angleOfView value.
802:             */
803:            public void setAngleOfView(double angleOfView) {
804:                this.angleOfView = angleOfView;
805:            }
806:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.