com.infoviz.geometry
Class PieGeometry2D

java.lang.Object
  extended bycom.infoviz.geometry.PieGeometry2D
All Implemented Interfaces:
PieGeometry
Direct Known Subclasses:
PieGeometry3D

public class PieGeometry2D
extends java.lang.Object
implements PieGeometry

Title : PieGeometry2D Description: A nested pie bound consists of 2 arcs and 2 lines. The angle bounds are the start and end angle of the upper and lower arcs and the radial bounds are the start and endPoints in the radius. The radial bounds take a value between 0 and 1. $Id$ $Revision$ $Author$


Field Summary
 double[] angleBounds
           
 java.awt.geom.Line2D.Double firstLine
          the line at one end of the node shape
 java.awt.geom.Arc2D.Double innerArc
          the arc closer to the center
 java.awt.Rectangle nestedPieBounds
           
 java.awt.geom.Arc2D.Double outerArc
          the outer arc
 double[] radialBounds
           
 java.awt.geom.Line2D.Double secondLine
          the line at another end of the node shape
 
Constructor Summary
PieGeometry2D(double startAngle, double endAngle, double startR, double endR)
           
 
Method Summary
protected  void calculateGeometry()
           
 boolean contains(double screenX, double screenY)
          returns true if the node shape contains the given coordinates otherwise returns false
 boolean containsAngleAndRadius(double angle, double radius)
          checks if the given angle and radius fall inside the shape of this node
 void draw(java.awt.Graphics g)
           
 void fill(java.awt.Graphics g)
           
protected  double getAngleAt(double x, double y)
           
 double[] getAngleBounds()
          returns the start and end angle of the node
protected  double[] getArcX(java.awt.geom.Arc2D arc, double screenY, double r)
           
protected  java.awt.geom.Point2D.Double getCartesianCoordinates(double r, double theta)
           
 java.awt.geom.Point2D getCenter()
           
protected  java.awt.Rectangle getEffectiveBounds()
          NestedPie bounds is the rectangle representing the Panel bounds of nested Pie.
protected  double getEquivAngle(double theta)
           
 double[] getIntersectingX(double screenY)
          returns the intersecting x points if y takes the value provided
 double[] getIntersectingY(double screenX)
          todo - fix this method by following the same logic used for getIntersectingX
protected  double getLineX(java.awt.geom.Line2D line, double screenY, double angle)
           
 double[] getRadialBounds()
           
protected  double getRadiusAtAngle(double theta)
           
protected  java.awt.geom.Point2D.Double getScreenCoordinates(double x, double y)
           
protected  java.awt.geom.Point2D.Double getScreenCoordinates(java.awt.geom.Point2D p)
           
protected  java.awt.geom.Point2D.Double getScreenCoordinatesByAngleAndRadiusFactor(double rFactor, double theta)
           
 void setNestedPieBounds(java.awt.Rectangle r)
          pass the rectangle occupied by the nested pie to this method
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

angleBounds

public double[] angleBounds

radialBounds

public double[] radialBounds

nestedPieBounds

public java.awt.Rectangle nestedPieBounds

firstLine

public java.awt.geom.Line2D.Double firstLine
the line at one end of the node shape


secondLine

public java.awt.geom.Line2D.Double secondLine
the line at another end of the node shape


innerArc

public java.awt.geom.Arc2D.Double innerArc
the arc closer to the center


outerArc

public java.awt.geom.Arc2D.Double outerArc
the outer arc

Constructor Detail

PieGeometry2D

public PieGeometry2D(double startAngle,
                     double endAngle,
                     double startR,
                     double endR)
Method Detail

setNestedPieBounds

public void setNestedPieBounds(java.awt.Rectangle r)
pass the rectangle occupied by the nested pie to this method

Specified by:
setNestedPieBounds in interface PieGeometry

getEffectiveBounds

protected java.awt.Rectangle getEffectiveBounds()
NestedPie bounds is the rectangle representing the Panel bounds of nested Pie. Effective bounds is the actual rectangle we use to calculate the geometry

Returns:

calculateGeometry

protected void calculateGeometry()

getAngleBounds

public double[] getAngleBounds()
returns the start and end angle of the node

Specified by:
getAngleBounds in interface PieGeometry

getRadialBounds

public double[] getRadialBounds()
Specified by:
getRadialBounds in interface PieGeometry

contains

public boolean contains(double screenX,
                        double screenY)
returns true if the node shape contains the given coordinates otherwise returns false

Specified by:
contains in interface PieGeometry

containsAngleAndRadius

public boolean containsAngleAndRadius(double angle,
                                      double radius)
checks if the given angle and radius fall inside the shape of this node

Specified by:
containsAngleAndRadius in interface PieGeometry
Parameters:
angle - is in radians

toString

public java.lang.String toString()

draw

public void draw(java.awt.Graphics g)
Specified by:
draw in interface PieGeometry

fill

public void fill(java.awt.Graphics g)
Specified by:
fill in interface PieGeometry

getCenter

public java.awt.geom.Point2D getCenter()
Specified by:
getCenter in interface PieGeometry

getIntersectingY

public double[] getIntersectingY(double screenX)
todo - fix this method by following the same logic used for getIntersectingX

Specified by:
getIntersectingY in interface PieGeometry

getIntersectingX

public double[] getIntersectingX(double screenY)
returns the intersecting x points if y takes the value provided

Specified by:
getIntersectingX in interface PieGeometry

getArcX

protected double[] getArcX(java.awt.geom.Arc2D arc,
                           double screenY,
                           double r)

getAngleAt

protected double getAngleAt(double x,
                            double y)

getLineX

protected double getLineX(java.awt.geom.Line2D line,
                          double screenY,
                          double angle)

getCartesianCoordinates

protected java.awt.geom.Point2D.Double getCartesianCoordinates(double r,
                                                               double theta)

getScreenCoordinates

protected java.awt.geom.Point2D.Double getScreenCoordinates(java.awt.geom.Point2D p)

getScreenCoordinates

protected java.awt.geom.Point2D.Double getScreenCoordinates(double x,
                                                            double y)

getScreenCoordinatesByAngleAndRadiusFactor

protected java.awt.geom.Point2D.Double getScreenCoordinatesByAngleAndRadiusFactor(double rFactor,
                                                                                  double theta)

getRadiusAtAngle

protected double getRadiusAtAngle(double theta)

getEquivAngle

protected double getEquivAngle(double theta)