es.prodevelop.gvsig.mobile.fmap.util.graph2d
Class Graph2DUtilities

java.lang.Object
  extended byes.prodevelop.gvsig.mobile.fmap.util.graph2d.Graph2DUtilities

public class Graph2DUtilities
extends java.lang.Object

Utility class for graphic purposes.

Author:
jldominguez
See Also:
GeneralPath, AffineTransform, PathIterator, FSymbol

Constructor Summary
Graph2DUtilities()
           
 
Method Summary
static java.awt.geom.AffineTransform createAffineTransform(java.awt.geom.Rectangle2D srcRegion, java.awt.geom.Rectangle2D dstRegion)
          Computes the affine transform needed to go from one rectangle to another
static void drawDot(java.awt.Graphics2D g2d, FDot dot)
          Draws a dot on the graphics object
static void drawGeneralPath(java.awt.Graphics2D g, java.awt.geom.GeneralPath gp, java.awt.geom.AffineTransform at)
          Draws the general path on the graphics object with the given affine transformation
static void drawMultiPoint(java.awt.Graphics2D g2d, FMultiPoint2D mp)
          Draws a multipoint on the graphics object
static void drawPathIterator(java.awt.Graphics2D g, java.awt.geom.PathIterator piter, java.awt.geom.AffineTransform at)
          Draws the path iterator on the graphics object with the given affine transformation
static void drawPoint(java.awt.Graphics2D g2d, FPoint2D point2D)
          Draws a point on the graphics object
static void drawPolygon(java.awt.Graphics2D g2d, FPolygon2D polygon2D, FSymbol symbol)
          Draws a polygon on the graphics object with the given symbol
static void drawPolyLine(java.awt.Graphics2D g2d, FPolyline2D polyline2D)
          Draws a polyline on the graphics object
static void drawShape(java.awt.Graphics2D g2d, java.awt.Shape shp, FSymbol symbol)
          Draws a shape on the graphics object with the given affine transform
static double getPathIteratorArea(java.awt.geom.PathIterator piter)
          Gets the area of the path iterator
static double getSphericalPathIteratorArea(java.awt.geom.PathIterator piter)
          Gets the area of a given spherical path iterator
static int[] integerArrayListToIntArray(java.util.ArrayList l)
          Converts array list of Integer objects into array of int
static void simplifyArrayList(java.util.ArrayList xs, java.util.ArrayList ys)
          Tries to simplify an array of x and y coordinates.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph2DUtilities

public Graph2DUtilities()
Method Detail

drawGeneralPath

public static void drawGeneralPath(java.awt.Graphics2D g,
                                   java.awt.geom.GeneralPath gp,
                                   java.awt.geom.AffineTransform at)
Draws the general path on the graphics object with the given affine transformation

Parameters:
g - the graphics object
gp - the general path
at - the affine transformation

drawPathIterator

public static void drawPathIterator(java.awt.Graphics2D g,
                                    java.awt.geom.PathIterator piter,
                                    java.awt.geom.AffineTransform at)
Draws the path iterator on the graphics object with the given affine transformation

Parameters:
g - the graphics object
piter - the path iterator
at - the affine transformation

integerArrayListToIntArray

public static int[] integerArrayListToIntArray(java.util.ArrayList l)
Converts array list of Integer objects into array of int

Parameters:
l -
Returns:
array of int

simplifyArrayList

public static void simplifyArrayList(java.util.ArrayList xs,
                                     java.util.ArrayList ys)
Tries to simplify an array of x and y coordinates.

Parameters:
xs -
ys -

createAffineTransform

public static java.awt.geom.AffineTransform createAffineTransform(java.awt.geom.Rectangle2D srcRegion,
                                                                  java.awt.geom.Rectangle2D dstRegion)
Computes the affine transform needed to go from one rectangle to another

Parameters:
srcRegion - source rectangle
dstRegion - destination rectangle
Returns:
the affine transform

drawShape

public static void drawShape(java.awt.Graphics2D g2d,
                             java.awt.Shape shp,
                             FSymbol symbol)
Draws a shape on the graphics object with the given affine transform

Parameters:
g2d -
shp -
symbol -

drawMultiPoint

public static void drawMultiPoint(java.awt.Graphics2D g2d,
                                  FMultiPoint2D mp)
Draws a multipoint on the graphics object

Parameters:
g2d -
mp -

drawPoint

public static void drawPoint(java.awt.Graphics2D g2d,
                             FPoint2D point2D)
Draws a point on the graphics object

Parameters:
g2d -
point2D -

drawDot

public static void drawDot(java.awt.Graphics2D g2d,
                           FDot dot)
Draws a dot on the graphics object

Parameters:
g2d -
dot -

drawPolygon

public static void drawPolygon(java.awt.Graphics2D g2d,
                               FPolygon2D polygon2D,
                               FSymbol symbol)
Draws a polygon on the graphics object with the given symbol

Parameters:
g2d -
polygon2D -
symbol -

drawPolyLine

public static void drawPolyLine(java.awt.Graphics2D g2d,
                                FPolyline2D polyline2D)
Draws a polyline on the graphics object

Parameters:
g2d -
polyline2D -

getPathIteratorArea

public static double getPathIteratorArea(java.awt.geom.PathIterator piter)
Gets the area of the path iterator

Parameters:
piter - the path iterator
Returns:
the area of the path iterator

getSphericalPathIteratorArea

public static double getSphericalPathIteratorArea(java.awt.geom.PathIterator piter)
Gets the area of a given spherical path iterator

Parameters:
piter -
Returns:
the area