Java Doc for XRectangle2D.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 Reference  Class Diagram Java Document (Java Doc) 


java.awt.geom.Rectangle2D
   org.geotools.resources.geometry.XRectangle2D

XRectangle2D
public class XRectangle2D extends Rectangle2D implements Serializable(Code)
Serializable, high-performance double-precision rectangle. Instead of using x , y , width and height , this class store rectangle's coordinates into the following fields: XRectangle2D.xmin , XRectangle2D.xmax , XRectangle2D.ymin et XRectangle2D.ymax . Methods likes contains and intersects are faster, which make this class more appropriate for using intensively inside a loop. Furthermore, this class work correctly with and values.
since:
   2.0
version:
   $Id: XRectangle2D.java 25779 2007-06-08 17:49:00Z desruisseaux $
author:
   Martin Desruisseaux


Field Summary
final public static  Rectangle2DINFINITY
     An immutable instance of a Rectangle2D with bounds extending toward infinities.
protected  doublexmax
     Maximal x coordinate.
protected  doublexmin
     Minimal x coordinate.
protected  doubleymax
     Maximal y coordinate.
protected  doubleymin
     Minimal y coordinate.

Constructor Summary
public  XRectangle2D()
     Construct a default rectangle.
public  XRectangle2D(double x, double y, double width, double height)
     Construct a rectangle with the specified location and dimension.
public  XRectangle2D(Rectangle2D rect)
     Construct a rectangle with the same coordinates than the supplied rectangle.
Parameters:
  rect - The rectangle, or null in none (in which case this constructoris equivalents to the no-argument constructor).

Method Summary
public  voidadd(double x, double y)
     Adds a point, specified by the double precision arguments x and y , to this Rectangle2D . The resulting Rectangle2D is the smallest Rectangle2D that contains both the original Rectangle2D and the specified point.

After adding a point, a call to contains with the added point as an argument does not necessarily return true .

public  voidadd(Rectangle2D rect)
     Adds a Rectangle2D object to this Rectangle2D .
public  booleancontains(double x, double y, double width, double height)
     Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.
public  booleancontains(Rectangle2D rect)
     Tests if the interior of this shape entirely contains the specified rectangle. This methods overrides the default Rectangle2D implementation in order to work correctly with and values.
Parameters:
  rect - the specified rectangle.
public  booleancontains(double x, double y)
     Tests if a specified coordinate is inside the boundary of this Rectangle2D .
Parameters:
  x - the x coordinates to test.
Parameters:
  y - the y coordinates to test.
public static  booleancontainsInclusive(Rectangle2D outter, Rectangle2D inner)
     Tests if the interior of the inner rectangle is contained in the interior and/or the edge of the outter rectangle.
public static  XRectangle2DcreateFromExtremums(double xmin, double ymin, double xmax, double ymax)
     Create a rectangle using maximal x and y values rather than width and height.
public  Rectangle2DcreateIntersection(Rectangle2D rect)
     Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D .
public  Rectangle2DcreateUnion(Rectangle2D rect)
     Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D .
public static  booleanequalsEpsilon(Rectangle2D rect1, Rectangle2D rect2)
     Returns true if the two rectangles are equals up to an epsilon value.
public  doublegetCenterX()
     Returns the X coordinate of the center of the rectangle.
public  doublegetCenterY()
     Returns the Y coordinate of the center of the rectangle.
public  doublegetHeight()
     Returns the height of the framing rectangle in double precision.
public  doublegetMaxX()
     Returns the largest X coordinate of the rectangle.
public  doublegetMaxY()
     Returns the largest Y coordinate of the rectangle.
public  doublegetMinX()
     Returns the smallest X coordinate of the rectangle.
public  doublegetMinY()
     Returns the smallest Y coordinate of the rectangle.
public  doublegetWidth()
     Returns the width of the framing rectangle in double precision.
public  doublegetX()
     Returns the X coordinate of the upper left corner of the framing rectangle in double precision.
public  doublegetY()
     Returns the Y coordinate of the upper left corner of the framing rectangle in double precision.
public static  booleanintersectInclusive(Rectangle2D rect1, Rectangle2D rect2)
     Tests if the interior and/or the edge of two rectangles intersect.
public static  booleanintersectInclusive(Shape shape, Rectangle2D rect)
     Tests if the interior of the Shape intersects the interior of a specified rectangle.
public  booleanintersects(double x, double y, double width, double height)
     Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.
public  booleanintersects(Rectangle2D rect)
     Tests if the interior of this shape intersects the interior of a specified rectangle.
public  booleanisEmpty()
     Determines whether the RectangularShape is empty.
public  intoutcode(double x, double y)
     Determines where the specified coordinates lie with respect to this Rectangle2D .
public  voidsetRect(double x, double y, double width, double height)
     Sets the location and size of this Rectangle2D to the specified double values.
public  voidsetRect(Rectangle2D r)
     Sets this Rectangle2D to be the same as the specified Rectangle2D .
public  StringtoString()
     Returns the String representation of this Rectangle2D .

Field Detail
INFINITY
final public static Rectangle2D INFINITY(Code)
An immutable instance of a Rectangle2D with bounds extending toward infinities. The XRectangle2D.getMinX and XRectangle2D.getMinY methods return always java.lang.Double.NEGATIVE_INFINITY , while the XRectangle2D.getMaxX and XRectangle2D.getMaxY methods return always java.lang.Double.POSITIVE_INFINITY . This rectangle can be used as argument in the XRectangle2D constructor for initializing a new XRectangle2D to infinite bounds.



xmax
protected double xmax(Code)
Maximal x coordinate.



xmin
protected double xmin(Code)
Minimal x coordinate.



ymax
protected double ymax(Code)
Maximal y coordinate.



ymin
protected double ymin(Code)
Minimal y coordinate.




Constructor Detail
XRectangle2D
public XRectangle2D()(Code)
Construct a default rectangle. Initial coordinates are (0,0,0,0) .



XRectangle2D
public XRectangle2D(double x, double y, double width, double height)(Code)
Construct a rectangle with the specified location and dimension. This constructor uses the same signature than Rectangle2D for consistency.



XRectangle2D
public XRectangle2D(Rectangle2D rect)(Code)
Construct a rectangle with the same coordinates than the supplied rectangle.
Parameters:
  rect - The rectangle, or null in none (in which case this constructoris equivalents to the no-argument constructor). Use XRectangle2D.INFINITY forinitializing this XRectangle2D with infinite bounds.




Method Detail
add
public void add(double x, double y)(Code)
Adds a point, specified by the double precision arguments x and y , to this Rectangle2D . The resulting Rectangle2D is the smallest Rectangle2D that contains both the original Rectangle2D and the specified point.

After adding a point, a call to contains with the added point as an argument does not necessarily return true . The contains method does not return true for points on the right or bottom edges of a rectangle. Therefore, if the added point falls on the left or bottom edge of the enlarged rectangle, contains returns false for that point.




add
public void add(Rectangle2D rect)(Code)
Adds a Rectangle2D object to this Rectangle2D . The resulting Rectangle2D is the union of the two Rectangle2D objects.
Parameters:
  rect - the Rectangle2D to add to this Rectangle2D .



contains
public boolean contains(double x, double y, double width, double height)(Code)
Tests if the interior of this Rectangle2D entirely contains the specified set of rectangular coordinates.
Parameters:
  x - the x coordinates of the upper left cornerof the specified set of rectangular coordinates
Parameters:
  y - the y coordinates of the upper left cornerof the specified set of rectangular coordinates
Parameters:
  width - the width of the specified set of rectangular coordinates
Parameters:
  height - the height of the specified set of rectangular coordinates true if this Rectangle2D entirely contains specified set of rectangularcoordinates; false otherwise.



contains
public boolean contains(Rectangle2D rect)(Code)
Tests if the interior of this shape entirely contains the specified rectangle. This methods overrides the default Rectangle2D implementation in order to work correctly with and values.
Parameters:
  rect - the specified rectangle. true if this shape entirely contains the specified rectangle.



contains
public boolean contains(double x, double y)(Code)
Tests if a specified coordinate is inside the boundary of this Rectangle2D .
Parameters:
  x - the x coordinates to test.
Parameters:
  y - the y coordinates to test. true if the specified coordinates areinside the boundary of this Rectangle2D ; false otherwise.



containsInclusive
public static boolean containsInclusive(Rectangle2D outter, Rectangle2D inner)(Code)
Tests if the interior of the inner rectangle is contained in the interior and/or the edge of the outter rectangle. This method is similar to XRectangle2D.contains(Rectangle2D) except for the following points:
  • This method doesn't test only the interiors of outter . It tests for the edges as well.
  • This method tests also rectangle with zero or (which are according Shape contract).
  • This method work correctly with and values.
This method is said inclusive because it tests bounds as closed interval rather then open interval (the default Java2D behavior). Usage of closed interval is required if at least one rectangle may be the bounding box of a perfectly horizontal or vertical line; such a bounding box has 0 width or height.
Parameters:
  outter - The first rectangle to test.
Parameters:
  inner - The second rectangle to test. true if the interior of inner is inside the interiorand/or the edge of outter . false



createFromExtremums
public static XRectangle2D createFromExtremums(double xmin, double ymin, double xmax, double ymax)(Code)
Create a rectangle using maximal x and y values rather than width and height. This factory avoid the problem of NaN values when extremums are infinite numbers.



createIntersection
public Rectangle2D createIntersection(Rectangle2D rect)(Code)
Returns a new Rectangle2D object representing the intersection of this Rectangle2D with the specified Rectangle2D .
Parameters:
  rect - the Rectangle2D to be intersected with this Rectangle2D the largest Rectangle2D contained in both the specified Rectangle2D and in this Rectangle2D .



createUnion
public Rectangle2D createUnion(Rectangle2D rect)(Code)
Returns a new Rectangle2D object representing the union of this Rectangle2D with the specified Rectangle2D .
Parameters:
  rect - the Rectangle2D to be combined withthis Rectangle2D the smallest Rectangle2D containing boththe specified Rectangle2D and this Rectangle2D .



equalsEpsilon
public static boolean equalsEpsilon(Rectangle2D rect1, Rectangle2D rect2)(Code)
Returns true if the two rectangles are equals up to an epsilon value.



getCenterX
public double getCenterX()(Code)
Returns the X coordinate of the center of the rectangle.



getCenterY
public double getCenterY()(Code)
Returns the Y coordinate of the center of the rectangle.



getHeight
public double getHeight()(Code)
Returns the height of the framing rectangle in double precision. the height of the framing rectangle.



getMaxX
public double getMaxX()(Code)
Returns the largest X coordinate of the rectangle.



getMaxY
public double getMaxY()(Code)
Returns the largest Y coordinate of the rectangle.



getMinX
public double getMinX()(Code)
Returns the smallest X coordinate of the rectangle.



getMinY
public double getMinY()(Code)
Returns the smallest Y coordinate of the rectangle.



getWidth
public double getWidth()(Code)
Returns the width of the framing rectangle in double precision. the width of the framing rectangle.



getX
public double getX()(Code)
Returns the X coordinate of the upper left corner of the framing rectangle in double precision. the x coordinate of the upper left corner of the framing rectangle.



getY
public double getY()(Code)
Returns the Y coordinate of the upper left corner of the framing rectangle in double precision. the y coordinate of the upper left corner of the framing rectangle.



intersectInclusive
public static boolean intersectInclusive(Rectangle2D rect1, Rectangle2D rect2)(Code)
Tests if the interior and/or the edge of two rectangles intersect. This method is similar to XRectangle2D.intersects(Rectangle2D) except for the following points:
  • This method doesn't test only if the interiors intersect. It tests for the edges as well.
  • This method tests also rectangle with zero or (which are according Shape contract). However, rectangle with negative width or height are still considered as empty.
  • This method work correctly with and values.
This method is said inclusive because it tests bounds as closed interval rather then open interval (the default Java2D behavior). Usage of closed interval is required if at least one rectangle may be the bounding box of a perfectly horizontal or vertical line; such a bounding box has 0 width or height.
Parameters:
  rect1 - The first rectangle to test.
Parameters:
  rect2 - The second rectangle to test. true if the interior and/or the edge of the two specified rectanglesintersects.



intersectInclusive
public static boolean intersectInclusive(Shape shape, Rectangle2D rect)(Code)
Tests if the interior of the Shape intersects the interior of a specified rectangle. This method might conservatively return true when there is a high probability that the rectangle and the shape intersect, but the calculations to accurately determine this intersection are prohibitively expensive. This is similar to Shape.intersects(Rectangle2D) , except that this method tests also rectangle with zero or (which are according Shape contract). However, rectangle with negative width or height are still considered as empty.

This method is said inclusive because it try to mimic XRectangle2D.intersectInclusive(Rectangle2D,Rectangle2D) behavior, at least for rectangle with zero width or height.
Parameters:
  shape - The shape.
Parameters:
  rect - The rectangle to test for inclusion. true if the interior of the shape and the interior of the specifiedrectangle intersect, or are both highly likely to intersect.



intersects
public boolean intersects(double x, double y, double width, double height)(Code)
Tests if the interior of this Rectangle2D intersects the interior of a specified set of rectangular coordinates.
Parameters:
  x - the x coordinates of the upper left cornerof the specified set of rectangular coordinates
Parameters:
  y - the y coordinates of the upper left cornerof the specified set of rectangular coordinates
Parameters:
  width - the width of the specified set of rectangular coordinates
Parameters:
  height - the height of the specified set of rectangular coordinates true if this Rectangle2D intersects the interior of a specified set of rectangularcoordinates; false otherwise.



intersects
public boolean intersects(Rectangle2D rect)(Code)
Tests if the interior of this shape intersects the interior of a specified rectangle. This methods overrides the default Rectangle2D implementation in order to work correctly with and values.
Parameters:
  rect - the specified rectangle. true if this shape and the specified rectangle intersect each other.
See Also:   XRectangle2D.intersectInclusive(Rectangle2D,Rectangle2D)



isEmpty
public boolean isEmpty()(Code)
Determines whether the RectangularShape is empty. When the RectangularShape is empty, it encloses no area. true if the RectangularShape is empty; false otherwise.



outcode
public int outcode(double x, double y)(Code)
Determines where the specified coordinates lie with respect to this Rectangle2D . This method computes a binary OR of the appropriate mask values indicating, for each side of this Rectangle2D , whether or not the specified coordinates are on the same side of the edge as the rest of this Rectangle2D . the logical OR of all appropriate out codes.
See Also:   XRectangle2D.OUT_LEFT
See Also:   XRectangle2D.OUT_TOP
See Also:   XRectangle2D.OUT_RIGHT
See Also:   XRectangle2D.OUT_BOTTOM



setRect
public void setRect(double x, double y, double width, double height)(Code)
Sets the location and size of this Rectangle2D to the specified double values.
Parameters:
  x - the x coordinates to which to set thelocation of the upper left corner of this Rectangle2D
Parameters:
  y - the y coordinates to which to set thelocation of the upper left corner of this Rectangle2D
Parameters:
  width - the value to use to set the width of this Rectangle2D
Parameters:
  height - the value to use to set the height of this Rectangle2D



setRect
public void setRect(Rectangle2D r)(Code)
Sets this Rectangle2D to be the same as the specified Rectangle2D .
Parameters:
  r - the specified Rectangle2D



toString
public String toString()(Code)
Returns the String representation of this Rectangle2D . a String representing this Rectangle2D .



Fields inherited from java.awt.geom.Rectangle2D
final public static int OUT_BOTTOM(Code)(Java Doc)
final public static int OUT_LEFT(Code)(Java Doc)
final public static int OUT_RIGHT(Code)(Java Doc)
final public static int OUT_TOP(Code)(Java Doc)

Methods inherited from java.awt.geom.Rectangle2D
public void add(double newx, double newy)(Code)(Java Doc)
public void add(Point2D pt)(Code)(Java Doc)
public void add(Rectangle2D r)(Code)(Java Doc)
public boolean contains(double x, double y)(Code)(Java Doc)
public boolean contains(double x, double y, double w, double h)(Code)(Java Doc)
abstract public Rectangle2D createIntersection(Rectangle2D r)(Code)(Java Doc)
abstract public Rectangle2D createUnion(Rectangle2D r)(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
public Rectangle2D getBounds2D()(Code)(Java Doc)
public PathIterator getPathIterator(AffineTransform at)(Code)(Java Doc)
public PathIterator getPathIterator(AffineTransform at, double flatness)(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public static void intersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)(Code)(Java Doc)
public boolean intersects(double x, double y, double w, double h)(Code)(Java Doc)
public boolean intersectsLine(double x1, double y1, double x2, double y2)(Code)(Java Doc)
public boolean intersectsLine(Line2D l)(Code)(Java Doc)
abstract public int outcode(double x, double y)(Code)(Java Doc)
public int outcode(Point2D p)(Code)(Java Doc)
public void setFrame(double x, double y, double w, double h)(Code)(Java Doc)
abstract public void setRect(double x, double y, double w, double h)(Code)(Java Doc)
public void setRect(Rectangle2D r)(Code)(Java Doc)
public static void union(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.