Source Code Cross Referenced for AbstractMapListener.java in  » GIS » deegree » org » deegree » portal » standard » wms » control » 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.portal.standard.wms.control 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/portal/standard/wms/control/AbstractMapListener.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.standard.wms.control;
045:
046:        import java.io.UnsupportedEncodingException;
047:        import java.net.URLDecoder;
048:        import java.util.HashMap;
049:        import java.util.StringTokenizer;
050:
051:        import javax.servlet.http.HttpServletRequest;
052:        import javax.servlet.http.HttpSession;
053:
054:        import org.deegree.enterprise.control.AbstractListener;
055:        import org.deegree.enterprise.control.FormEvent;
056:        import org.deegree.framework.util.CharsetUtils;
057:        import org.deegree.ogcwebservices.wms.operation.GetMap;
058:        import org.deegree.portal.context.ViewContext;
059:
060:        /**
061:         * Basic class for all listerens that shall be notified if a map cliented raises an action/event.
062:         * <p>
063:         * </p>
064:         * There are several predefined listeres for actions that most map clients support:
065:         * <ul>
066:         * <li><tt>ZoomInListener</tt> for handling zoomin actions. supported are zooming via point or
067:         * vie rectangle.
068:         * <li><tt>ZoomOutListener</tt> for handling zoomout action.
069:         * <li><tt>PanListener</tt> for handling of pan action. supported is panning to eight directions.
070:         * <li><tt>RecenterListener</tt> recenters the map to a specified point. This can be interpreted
071:         * as a special versio of zooming
072:         * <li><tt>RefreshListener</tt> reloads the map without any change
073:         * <li><tt>ResetListener</tt> recovers the initial status of the map
074:         * <li><tt>InfoListener</tt> will be notified if a feature info request should be send.
075:         * </ul>
076:         * The user can additional listeners/action by extending the <tt>AbstractActionListener</tt> class
077:         * or one of the predefined listener.
078:         * <p>
079:         * </p>
080:         * Each Listerner have to be registered to the <tt>MapListener</tt> which is the class that will
081:         * be informed about each event/action within a map client. To register a class as listener it has
082:         * to stored within the MapListener.ConfigurationFile.
083:         * 
084:         * <p>
085:         * ---------------------------------------------------------------------
086:         * </p>
087:         * 
088:         * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
089:         * @version $Revision: 9346 $ $Date: 2007-12-27 08:39:07 -0800 (Thu, 27 Dec 2007) $
090:         */
091:        abstract class AbstractMapListener extends AbstractListener {
092:
093:            /**
094:             * 
095:             * 
096:             * @param event
097:             */
098:            public void actionPerformed(FormEvent event) {
099:
100:                HttpSession session = ((HttpServletRequest) getRequest())
101:                        .getSession();
102:                // get configuration from the users session
103:                ViewContext vc = (ViewContext) session
104:                        .getAttribute("DefaultMapContext");
105:
106:                this .getRequest().setAttribute("MapContext", vc);
107:
108:            }
109:
110:            /**
111:             * maps a string representation of a request to a <tt>HashMap</tt>
112:             */
113:            protected HashMap<String, String> toMap(String request) {
114:                int p = request.indexOf('?');
115:                if (p >= 0) {
116:                    request = request.substring(p + 1, request.length());
117:                }
118:                StringTokenizer st = new StringTokenizer(request, "&");
119:                HashMap<String, String> map = new HashMap<String, String>();
120:
121:                while (st.hasMoreTokens()) {
122:                    String s = st.nextToken();
123:                    int pos = s.indexOf('=');
124:                    String s1 = s.substring(0, pos);
125:                    String s2 = s.substring(pos + 1, s.length());
126:                    try {
127:                        map.put(s1.toUpperCase(), URLDecoder.decode(s2,
128:                                CharsetUtils.getSystemCharset()));
129:                    } catch (UnsupportedEncodingException e) {
130:                        e.printStackTrace();
131:                    }
132:                }
133:
134:                return map;
135:            }
136:
137:            /**
138:             * the method returns the scale of the map defined as diagonal size of a pixel at the center of
139:             * the map.
140:             */
141:            protected double getScale(GetMap mrm) {
142:                double minx = mrm.getBoundingBox().getMin().getX();
143:                double maxx = mrm.getBoundingBox().getMax().getX();
144:                double miny = mrm.getBoundingBox().getMin().getY();
145:                double maxy = mrm.getBoundingBox().getMax().getY();
146:                double width = mrm.getWidth();
147:                double height = mrm.getHeight();
148:
149:                double sx = Math.sqrt(Math.pow(maxx - minx, 2)
150:                        + Math.pow(maxy - miny, 2));
151:                double px = Math.sqrt(width * width + height * height);
152:
153:                return sx / px;
154:            }
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.