Source Code Cross Referenced for GeoMouseEvent.java in  » GIS » GeoTools-2.4.1 » org » geotools » gui » swing » event » 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 » GeoTools 2.4.1 » org.geotools.gui.swing.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Geotools 2 - OpenSource mapping toolkit
003:         * (C) 2003, Geotools Project Management Committee (PMC)
004:         *
005:         *    This library is free software; you can redistribute it and/or
006:         *    modify it under the terms of the GNU Lesser General Public
007:         *    License as published by the Free Software Foundation; either
008:         *    version 2.1 of the License, or (at your option) any later version.
009:         *
010:         *    This library is distributed in the hope that it will be useful,
011:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         *    Lesser General Public License for more details.
014:         *
015:         *    You should have received a copy of the GNU Lesser General Public
016:         *    License along with this library; if not, write to the Free Software
017:         *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018:         */
019:        package org.geotools.gui.swing.event;
020:
021:        import java.awt.event.MouseEvent;
022:
023:        //import java.awt.geom.AffineTransform;
024:        import java.awt.geom.Point2D;
025:
026:        //import org.geotools.ct.MathTransform;
027:        import org.opengis.referencing.operation.MathTransform;
028:
029:        // OpenGIS dependencies
030:        import org.opengis.referencing.operation.TransformException;
031:
032:        //import org.geotools.pt.CoordinatePoint;
033:        import org.geotools.geometry.GeneralDirectPosition;
034:
035:        //import org.geotools.cs.CoordinateSystem;
036:        import org.geotools.referencing.crs.AbstractCRS;
037:
038:        /**
039:         * A MouseEvent which contains methods to obtain coordinates in real world
040:         * CoordinateSystem as well as Screen Coordinates.
041:         * All {@link MouseListener}s that have registered for
042:         * {@link org.geotools.gui.swing.MapPaneImpl} mouseEvents will receive
043:         * events of this class.
044:         * Listeners implementations can implements their code as below:
045:         *
046:         * <blockquote><pre>
047:         * &nbsp;public void mouseClicked(MouseEvent e) {
048:         * &nbsp;    GeoMouseEvent event = (GeoMouseEvent) e;
049:         * &nbsp;    // Process event here...
050:         * &nbsp;}
051:         * </pre></blockquote>
052:         *
053:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/mappane/src/main/java/org/geotools/gui/swing/event/GeoMouseEvent.java $
054:         * @version $Id: GeoMouseEvent.java 25694 2007-05-30 23:33:52Z ianturton $
055:         * @author Cameron Shorter
056:         */
057:        public final class GeoMouseEvent extends MouseEvent {
058:            /**
059:             * The transform which will convert screenCoordinates
060:             * to CoordinateSystem coordinates.
061:             */
062:            final MathTransform transform;
063:
064:            /**
065:             * The coordinate system for ({@link #x},{@link #y}) or <code>null</code>
066:             * if the coordinate has not yet been computed. This coordinate system
067:             * must be two-dimensional.
068:             */
069:
070:            //private transient AbstractCRS coordinateSystem;
071:            /**
072:             * A mouseClick event which also contains methods to transform from
073:             * pixels to the Coordinate System of the Renderer.
074:             * @param event    The original mouse event.
075:             * @param transform The transform which will convert screenCoordinates
076:             * to CoordinateSystem coordinates.
077:             */
078:            public GeoMouseEvent(final MouseEvent event,
079:                    final MathTransform transform) {
080:                super (event.getComponent(), // the Component that originated the event
081:                        event.getID(), // the integer that identifies the event
082:                        event.getWhen(), // a long int that gives the time the
083:                        // event occurred
084:                        event.getModifiers(), // the modifier keys down during event
085:                        // (shift, ctrl, alt, meta)
086:                        event.getX(), // the horizontal x coordinate for the
087:                        // mouse location
088:                        event.getY(), // the vertical y coordinate for the mouse
089:                        // location
090:                        event.getClickCount(), // the number of mouse clicks associated
091:                        // with event
092:                        event.isPopupTrigger(), // a boolean, true if this event is a
093:                        // trigger for a popup-menu
094:                        event.getButton()); // which of the mouse buttons has changed
095:                // state (JDK 1.4 only).
096:
097:                this .transform = transform;
098:            }
099:
100:            /**
101:             * Returns the "real world" mouse's position. The coordinates are expressed
102:             * in Context's CoordinateSystem.
103:             *
104:             * @param  dest A pre-allocated variable to store the mouse's location
105:             * in CoordinateSystems, can be set to <code>null</code>.
106:             * @return The mouse's location in CoordinateSystem coordinates.
107:             * @throws TransformException when transform is invalid.
108:             */
109:            public GeneralDirectPosition getMapCoordinate(
110:                    GeneralDirectPosition dest) throws TransformException {
111:                if (dest == null) {
112:                    dest = new GeneralDirectPosition(getX(), getY());
113:                } else {
114:                    dest.setLocation(new Point2D.Double(getX(), getY()));
115:                }
116:
117:                transform.transform(dest, dest);
118:
119:                return dest;
120:            }
121:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.