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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
005:         *    (C) 2001, Institut de Recherche pour le Développement
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation; either
010:         *    version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.resources.geometry;
018:
019:        // J2SE dependencies
020:        import java.awt.geom.Line2D;
021:        import java.awt.geom.Point2D;
022:        import java.awt.geom.Rectangle2D;
023:        import java.io.ObjectStreamException;
024:        import java.io.Serializable;
025:
026:        /**
027:         * An immutable subclass of a {@link Rectangle2D} with bounds extending toward infinities.
028:         * The {@link #getMinX} and {@link #getMinY} methods return always
029:         * {@link java.lang.Double#NEGATIVE_INFINITY},  while the {@link #getMaxX} and
030:         * {@link #getMaxY} methods return always {@link java.lang.Double#POSITIVE_INFINITY}.
031:         * This rectangle can be used as argument in the {@link XRectangle2D} constructor for
032:         * initializing a new {@code XRectangle2D} to infinite bounds.
033:         *
034:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/resources/geometry/InfiniteRectangle2D.java $
035:         * @version $Id: InfiniteRectangle2D.java 22482 2006-10-31 02:58:00Z desruisseaux $
036:         * @author Martin Desruisseaux
037:         */
038:        final class InfiniteRectangle2D extends Rectangle2D implements 
039:                Serializable {
040:            /**
041:             * Serial number for interoperability with different versions.
042:             */
043:            private static final long serialVersionUID = 5281254268988984523L;
044:
045:            /**
046:             * A singleton instance of {@code InfiniteRectangle2D}.
047:             */
048:            public static final Rectangle2D INFINITY = new InfiniteRectangle2D();
049:
050:            /**
051:             * Private constructor for the {@link #INFINITY} singleton only.
052:             */
053:            private InfiniteRectangle2D() {
054:            }
055:
056:            /**
057:             * Returns the minimum value, which is negative infinity.
058:             */
059:            public double getX() {
060:                return java.lang.Double.NEGATIVE_INFINITY;
061:            }
062:
063:            /**
064:             * Returns the minimum value, which is negative infinity.
065:             */
066:            public double getY() {
067:                return java.lang.Double.NEGATIVE_INFINITY;
068:            }
069:
070:            /**
071:             * Returns the minimum value, which is negative infinity.
072:             */
073:            public double getMinX() {
074:                return java.lang.Double.NEGATIVE_INFINITY;
075:            }
076:
077:            /**
078:             * Returns the minimum value, which is negative infinity.
079:             */
080:            public double getMinY() {
081:                return java.lang.Double.NEGATIVE_INFINITY;
082:            }
083:
084:            /**
085:             * Returns the maximum value, which is positive infinity.
086:             */
087:            public double getMaxX() {
088:                return java.lang.Double.POSITIVE_INFINITY;
089:            }
090:
091:            /**
092:             * Returns the maximum value, which is positive infinity.
093:             */
094:            public double getMaxY() {
095:                return java.lang.Double.POSITIVE_INFINITY;
096:            }
097:
098:            /**
099:             * Returns the width, which is positive infinity.
100:             */
101:            public double getWidth() {
102:                return java.lang.Double.POSITIVE_INFINITY;
103:            }
104:
105:            /**
106:             * Returns the height, which is positive infinity.
107:             */
108:            public double getHeight() {
109:                return java.lang.Double.POSITIVE_INFINITY;
110:            }
111:
112:            /**
113:             * Returns the center, which is NaN since we can't compute a center from infinite bounds.
114:             */
115:            public double getCenterX() {
116:                return java.lang.Double.NaN;
117:            }
118:
119:            /**
120:             * Returns the center, which is NaN since we can't compute a center from infinite bounds.
121:             */
122:            public double getCenterY() {
123:                return java.lang.Double.NaN;
124:            }
125:
126:            /**
127:             * Do nothing, since we can't extends an infinite rectangle.
128:             */
129:            public void add(Rectangle2D rect) {
130:            }
131:
132:            /**
133:             * Do nothing, since we can't extends an infinite rectangle.
134:             */
135:            public void add(Point2D point) {
136:            }
137:
138:            /**
139:             * Do nothing, since we can't extends an infinite rectangle.
140:             */
141:            public void add(double x, double y) {
142:            }
143:
144:            /**
145:             * Returns 0, since the specified point can't be outside this rectangle.
146:             */
147:            public int outcode(double x, double y) {
148:                return 0;
149:            }
150:
151:            /**
152:             * Returns 0, since the specified point can't be outside this rectangle.
153:             */
154:            public int outcode(Point2D point) {
155:                return 0;
156:            }
157:
158:            /**
159:             * Returns {@code true} since this rectangle contains all points.
160:             */
161:            public boolean contains(Point2D point) {
162:                return true;
163:            }
164:
165:            /**
166:             * Returns {@code true} since this rectangle contains all points.
167:             */
168:            public boolean contains(Rectangle2D rect) {
169:                return true;
170:            }
171:
172:            /**
173:             * Returns {@code true} since this rectangle contains all points.
174:             */
175:            public boolean contains(double x, double y) {
176:                return true;
177:            }
178:
179:            /**
180:             * Returns {@code true} since this rectangle contains all points.
181:             */
182:            public boolean contains(double x, double y, double w, double h) {
183:                return true;
184:            }
185:
186:            /**
187:             * Returns {@code true} since this rectangle contains all points.
188:             */
189:            public boolean intersects(Rectangle2D rect) {
190:                return true;
191:            }
192:
193:            /**
194:             * Returns {@code true} since this rectangle contains all points.
195:             */
196:            public boolean intersects(double x, double y, double w, double h) {
197:                return true;
198:            }
199:
200:            /**
201:             * Returns {@code true} since this rectangle contains all points.
202:             */
203:            public boolean intersectsLine(double x, double y, double u, double v) {
204:                return true;
205:            }
206:
207:            /**
208:             * Returns {@code true} since this rectangle contains all points.
209:             */
210:            public boolean intersectsLine(Line2D line) {
211:                return true;
212:            }
213:
214:            /**
215:             * Returns {@code false} since an infinite rectangle is far from empty.
216:             */
217:            public boolean isEmpty() {
218:                return false;
219:            }
220:
221:            /**
222:             * Returns {@code this}.
223:             * No need to returns a clone, since this rectangle is immutable.
224:             */
225:            public Rectangle2D getFrame() {
226:                return this ;
227:            }
228:
229:            /**
230:             * Returns {@code this}.
231:             * No need to returns a clone, since this rectangle is immutable.
232:             */
233:            public Rectangle2D getBounds2D() {
234:                return this ;
235:            }
236:
237:            /**
238:             * Returns {@code this}, since this rectangle can't be extended.
239:             * No need to returns a clone, since this rectangle is immutable.
240:             */
241:            public Rectangle2D createUnion(Rectangle2D rect) {
242:                return this ;
243:            }
244:
245:            /**
246:             * Returns a clone of the specified rectangle.
247:             */
248:            public Rectangle2D createIntersection(Rectangle2D rect) {
249:                return (Rectangle2D) rect.clone();
250:            }
251:
252:            /**
253:             * Always throws an exception, since this rectangle is immutable.
254:             *
255:             * @todo Throws UnmodifiableGeometryException instead?
256:             *       (defined in renderer module for now)
257:             */
258:            public void setRect(double x, double y, double w, double h) {
259:                throw new UnsupportedOperationException();
260:            }
261:
262:            /**
263:             * Returns the singleton instance of {@code InfiniteRectangle2D}.
264:             */
265:            private Object readResolve() throws ObjectStreamException {
266:                return INFINITY;
267:            }
268:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.