|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.birt.chart.internal.computations.Polygon
PolyDefault
is a default Poly
implementation.
It provides support for both complex and simple polygons. A complex polygon
is a polygon that consists of more than one polygon. A simple polygon is a
more traditional polygon that contains of one inner polygon and is just a
collection of points.
Implementation Note: If a point is added to an empty PolyDefault
object, it will create an inner polygon of type PolySimple
.
PolySimple
Constructor Summary | |
Polygon()
Creates a new instance of PolyDefault |
|
Polygon(boolean isHole)
|
Method Summary | |
void |
add(double x,
double y)
Add a point to the first inner polygon. |
void |
add(IPolygon p)
Add an inner polygon to this polygon - assumes that adding polygon does not have any inner polygons. |
void |
add(Point p)
Add a point to the first inner polygon. |
void |
clear()
Remove all of the points. |
boolean |
contains(Point loc)
|
boolean |
equals(java.lang.Object obj)
Return true if the given object is equal to this one. |
double |
getArea()
Return the area of the polygon in square units. |
Rectangle |
getBounds()
Returns the bounding rectangle of this polygon. |
IPolygon |
getInnerPoly(int polyIndex)
Returns the polygon at this index. |
int |
getNumInnerPoly()
Returns the number of inner polygons - inner polygons are assumed to return one here. |
int |
getNumPoints()
Return the number points of the first inner polygon |
Point |
getPoint(int i)
|
java.util.List |
getPoints()
Returns the points |
double |
getX(int index)
Return the X value of the point at the index in the first inner polygon |
double |
getY(int index)
Return the Y value of the point at the index in the first inner polygon |
int |
hashCode()
Return the hashCode of the object. |
IPolygon |
intersection(IPolygon p)
Return a Poly that is the intersection of this polygon with the given polygon. |
boolean |
isContributing(int polyIndex)
Return true if the given inner polygon is contributing to the set operation. |
boolean |
isEmpty()
Return true if the polygon is empty |
boolean |
isHole()
Return true if this polygon is a hole. |
void |
setContributing(int polyIndex,
boolean contributes)
Set whether or not this inner polygon is constributing to the set operation. |
void |
setIsHole(boolean isHole)
Set whether or not this polygon is a hole. |
java.lang.String |
toString()
|
IPolygon |
union(IPolygon p)
Return a Poly that is the union of this polygon with the given polygon. |
IPolygon |
xor(IPolygon p)
Return a Poly that is the exclusive-or of this polygon with the given polygon. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Polygon()
public Polygon(boolean isHole)
Method Detail |
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
public void clear()
clear
in interface IPolygon
public void add(double x, double y)
Implementation Note: If a point is added to an empty Polygon object,
it will create an inner polygon of type PolySimple
.
add
in interface IPolygon
public void add(Point p)
Implementation Note: If a point is added to an empty Polygon object,
it will create an inner polygon of type PolySimple
.
add
in interface IPolygon
public void add(IPolygon p)
add
in interface IPolygon
java.lang.IllegalStateException
- if the number of inner polygons is greater than
zero and this polygon was designated a hole. This would break the assumption
that only simple polygons can be holes.public boolean isEmpty()
isEmpty
in interface IPolygon
public Rectangle getBounds()
getBounds
in interface IPolygon
public IPolygon getInnerPoly(int polyIndex)
getInnerPoly
in interface IPolygon
public int getNumInnerPoly()
getNumInnerPoly
in interface IPolygon
public int getNumPoints()
getNumPoints
in interface IPolygon
public java.util.List getPoints()
getPoints
in interface IPolygon
public Point getPoint(int i)
getPoint
in interface IPolygon
public double getX(int index)
getX
in interface IPolygon
public double getY(int index)
getY
in interface IPolygon
public boolean isHole()
isHole
in interface IPolygon
java.lang.IllegalStateException
- if called on a complex polygon.public void setIsHole(boolean isHole)
setIsHole
in interface IPolygon
java.lang.IllegalStateException
- if called on a complex polygon.public boolean isContributing(int polyIndex)
isContributing
in interface IPolygon
public void setContributing(int polyIndex, boolean contributes)
setContributing
in interface IPolygon
java.lang.IllegalStateException
- if called on a complex polygonpublic IPolygon intersection(IPolygon p)
intersection
in interface IPolygon
public IPolygon union(IPolygon p)
union
in interface IPolygon
public IPolygon xor(IPolygon p)
xor
in interface IPolygon
public double getArea()
getArea
in interface IPolygon
public boolean contains(Point loc)
contains
in interface IPolygon
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |