Java Doc for ShapeUtilities.java in  » Graphic-Library » jcommon-components » org » jfree » util » 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 » Graphic Library » jcommon components » org.jfree.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jfree.util.ShapeUtilities

ShapeUtilities
public class ShapeUtilities (Code)
Utility methods for Shape objects.
author:
   David Gilbert




Method Summary
public static  Shapeclone(Shape shape)
     Returns a clone of the specified shape, or null.
public static  booleancontains(Rectangle2D rect1, Rectangle2D rect2)
     Checks, whether the given rectangle1 fully contains rectangle 2 (even if rectangle 2 has a height or width of zero!).
Parameters:
  rect1 - the first rectangle.
Parameters:
  rect2 - the second rectangle.
public static  ShapecreateDiagonalCross(float l, float t)
     Creates a diagonal cross shape.
Parameters:
  l - the length of each 'arm'.
Parameters:
  t - the thickness.
public static  ShapecreateDiamond(float s)
     Creates a diamond shape.
Parameters:
  s - the size factor (equal to half the height of the diamond).
public static  ShapecreateDownTriangle(float s)
     Creates a triangle shape that points downwards.
Parameters:
  s - the size factor (equal to half the height of the triangle).
public static  ShapecreateLineRegion(Line2D line, float width)
     Creates a region surrounding a line segment by 'widening' the line segment.
public static  ShapecreateRegularCross(float l, float t)
     Creates a diagonal cross shape.
Parameters:
  l - the length of each 'arm'.
Parameters:
  t - the thickness.
public static  ShapecreateTranslatedShape(Shape shape, double transX, double transY)
     Creates and returns a translated shape.
Parameters:
  shape - the shape (null not permitted).
Parameters:
  transX - the x translation (in Java2D space).
Parameters:
  transY - the y translation (in Java2D space).
public static  ShapecreateTranslatedShape(Shape shape, RectangleAnchor anchor, double locationX, double locationY)
     Translates a shape to a new location such that the anchor point (relative to the rectangular bounds of the shape) aligns with the specified (x, y) coordinate in Java2D space.
Parameters:
  shape - the shape (null not permitted).
Parameters:
  anchor - the anchor (null not permitted).
Parameters:
  locationX - the x-coordinate (in Java2D space).
Parameters:
  locationY - the y-coordinate (in Java2D space).
public static  ShapecreateUpTriangle(float s)
     Creates a triangle shape that points upwards.
Parameters:
  s - the size factor (equal to half the height of the triangle).
public static  voiddrawRotatedShape(Graphics2D g2, Shape shape, double angle, float x, float y)
     Draws a shape with the specified rotation about (x, y).
public static  booleanequal(Shape s1, Shape s2)
     Tests two shapes for equality.
public static  booleanequal(Line2D l1, Line2D l2)
     Compares two lines are returns true if they are equal or both null.
Parameters:
  l1 - the first line (null permitted).
Parameters:
  l2 - the second line (null permitted).
public static  booleanequal(Ellipse2D e1, Ellipse2D e2)
     Compares two ellipses and returns true if they are equal or both null.
Parameters:
  e1 - the first ellipse (null permitted).
Parameters:
  e2 - the second ellipse (null permitted).
public static  booleanequal(Arc2D a1, Arc2D a2)
     Compares two arcs and returns true if they are equal or both null.
Parameters:
  a1 - the first arc (null permitted).
Parameters:
  a2 - the second arc (null permitted).
public static  booleanequal(Polygon p1, Polygon p2)
     Tests two polygons for equality.
public static  booleanequal(GeneralPath p1, GeneralPath p2)
     Tests two polygons for equality.
public static  Point2DgetPointInRectangle(double x, double y, Rectangle2D area)
     Returns a point based on (x, y) but constrained to be within the bounds of a given rectangle.
Parameters:
  x - the x-coordinate.
Parameters:
  y - the y-coordinate.
Parameters:
  area - the constraining rectangle (null not permitted).
public static  booleanintersects(Rectangle2D rect1, Rectangle2D rect2)
     Checks, whether the given rectangle1 fully contains rectangle 2 (even if rectangle 2 has a height or width of zero!).
Parameters:
  rect1 - the first rectangle.
Parameters:
  rect2 - the second rectangle.
public static  ShaperotateShape(Shape base, double angle, float x, float y)
     Rotates a shape about the specified coordinates.
Parameters:
  base - the shape (null permitted, returns null).
Parameters:
  angle - the angle (in radians).
Parameters:
  x - the x coordinate for the rotation point (in Java2D space).
Parameters:
  y - the y coordinate for the rotation point (in Java2D space).



Method Detail
clone
public static Shape clone(Shape shape)(Code)
Returns a clone of the specified shape, or null. At the current time, this method supports cloning for instances of Line2D, RectangularShape, Area and GeneralPath.

RectangularShape includes Arc2D, Ellipse2D, Rectangle2D, RoundRectangle2D.
Parameters:
  shape - the shape to clone (null permitted, returns null). A clone or null.




contains
public static boolean contains(Rectangle2D rect1, Rectangle2D rect2)(Code)
Checks, whether the given rectangle1 fully contains rectangle 2 (even if rectangle 2 has a height or width of zero!).
Parameters:
  rect1 - the first rectangle.
Parameters:
  rect2 - the second rectangle. A boolean.



createDiagonalCross
public static Shape createDiagonalCross(float l, float t)(Code)
Creates a diagonal cross shape.
Parameters:
  l - the length of each 'arm'.
Parameters:
  t - the thickness. A diagonal cross shape.



createDiamond
public static Shape createDiamond(float s)(Code)
Creates a diamond shape.
Parameters:
  s - the size factor (equal to half the height of the diamond). A diamond shape.



createDownTriangle
public static Shape createDownTriangle(float s)(Code)
Creates a triangle shape that points downwards.
Parameters:
  s - the size factor (equal to half the height of the triangle). A triangle shape.



createLineRegion
public static Shape createLineRegion(Line2D line, float width)(Code)
Creates a region surrounding a line segment by 'widening' the line segment. A typical use for this method is the creation of a 'clickable' region for a line that is displayed on-screen.
Parameters:
  line - the line (null not permitted).
Parameters:
  width - the width of the region. A region that surrounds the line.



createRegularCross
public static Shape createRegularCross(float l, float t)(Code)
Creates a diagonal cross shape.
Parameters:
  l - the length of each 'arm'.
Parameters:
  t - the thickness. A diagonal cross shape.



createTranslatedShape
public static Shape createTranslatedShape(Shape shape, double transX, double transY)(Code)
Creates and returns a translated shape.
Parameters:
  shape - the shape (null not permitted).
Parameters:
  transX - the x translation (in Java2D space).
Parameters:
  transY - the y translation (in Java2D space). The translated shape.



createTranslatedShape
public static Shape createTranslatedShape(Shape shape, RectangleAnchor anchor, double locationX, double locationY)(Code)
Translates a shape to a new location such that the anchor point (relative to the rectangular bounds of the shape) aligns with the specified (x, y) coordinate in Java2D space.
Parameters:
  shape - the shape (null not permitted).
Parameters:
  anchor - the anchor (null not permitted).
Parameters:
  locationX - the x-coordinate (in Java2D space).
Parameters:
  locationY - the y-coordinate (in Java2D space). A new and translated shape.



createUpTriangle
public static Shape createUpTriangle(float s)(Code)
Creates a triangle shape that points upwards.
Parameters:
  s - the size factor (equal to half the height of the triangle). A triangle shape.



drawRotatedShape
public static void drawRotatedShape(Graphics2D g2, Shape shape, double angle, float x, float y)(Code)
Draws a shape with the specified rotation about (x, y).
Parameters:
  g2 - the graphics device (null not permitted).
Parameters:
  shape - the shape (null not permitted).
Parameters:
  angle - the angle (in radians).
Parameters:
  x - the x coordinate for the rotation point.
Parameters:
  y - the y coordinate for the rotation point.



equal
public static boolean equal(Shape s1, Shape s2)(Code)
Tests two shapes for equality. If both shapes are null, this method will return true.

In the current implementation, the following shapes are supported: Ellipse2D, Line2D and Rectangle2D (implicit).
Parameters:
  s1 - the first shape (null permitted).
Parameters:
  s2 - the second shape (null permitted). A boolean.




equal
public static boolean equal(Line2D l1, Line2D l2)(Code)
Compares two lines are returns true if they are equal or both null.
Parameters:
  l1 - the first line (null permitted).
Parameters:
  l2 - the second line (null permitted). A boolean.



equal
public static boolean equal(Ellipse2D e1, Ellipse2D e2)(Code)
Compares two ellipses and returns true if they are equal or both null.
Parameters:
  e1 - the first ellipse (null permitted).
Parameters:
  e2 - the second ellipse (null permitted). A boolean.



equal
public static boolean equal(Arc2D a1, Arc2D a2)(Code)
Compares two arcs and returns true if they are equal or both null.
Parameters:
  a1 - the first arc (null permitted).
Parameters:
  a2 - the second arc (null permitted). A boolean.



equal
public static boolean equal(Polygon p1, Polygon p2)(Code)
Tests two polygons for equality. If both are null this method returns true.
Parameters:
  p1 - polygon 1 (null permitted).
Parameters:
  p2 - polygon 2 (null permitted). A boolean.



equal
public static boolean equal(GeneralPath p1, GeneralPath p2)(Code)
Tests two polygons for equality. If both are null this method returns true.
Parameters:
  p1 - path 1 (null permitted).
Parameters:
  p2 - path 2 (null permitted). A boolean.



getPointInRectangle
public static Point2D getPointInRectangle(double x, double y, Rectangle2D area)(Code)
Returns a point based on (x, y) but constrained to be within the bounds of a given rectangle.
Parameters:
  x - the x-coordinate.
Parameters:
  y - the y-coordinate.
Parameters:
  area - the constraining rectangle (null not permitted). A point within the rectangle.
throws:
  NullPointerException - if area is null.



intersects
public static boolean intersects(Rectangle2D rect1, Rectangle2D rect2)(Code)
Checks, whether the given rectangle1 fully contains rectangle 2 (even if rectangle 2 has a height or width of zero!).
Parameters:
  rect1 - the first rectangle.
Parameters:
  rect2 - the second rectangle. A boolean.



rotateShape
public static Shape rotateShape(Shape base, double angle, float x, float y)(Code)
Rotates a shape about the specified coordinates.
Parameters:
  base - the shape (null permitted, returns null).
Parameters:
  angle - the angle (in radians).
Parameters:
  x - the x coordinate for the rotation point (in Java2D space).
Parameters:
  y - the y coordinate for the rotation point (in Java2D space). the rotated shape.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.