|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.database.geometry.PolyBase
public class PolyBase
The Poly class describes an extended set of points that can be outlines, filled shapes, curves, text, and more. The Poly also contains a Layer and some connectivity information.
Nested Class Summary | |
---|---|
static class |
PolyBase.PolyBaseTree
|
Field Summary | |
---|---|
protected java.awt.geom.Rectangle2D |
bounds
the bounds of the points |
protected java.awt.geom.Point2D[] |
points
the points |
static int |
X
represents X axis |
static int |
XY
represents on the plane XY |
static int |
Y
represents Y axis |
static int |
Z
represents Z axis |
Constructor Summary | |
---|---|
PolyBase(double cX,
double cY,
double width,
double height)
The constructor creates a new Poly that describes a rectangle. |
|
PolyBase(java.awt.geom.Point2D[] points)
The constructor creates a new Poly given an array of points. |
|
PolyBase(java.awt.geom.Rectangle2D rect)
The constructor creates a new Poly that describes a rectangle. |
Method Summary | |
---|---|
void |
clipArc(double lx,
double hx,
double ly,
double hy)
Method to clip a curved polygon (CIRCLE, THICKCIRCLE, DISC, CIRCLEARC, or THICKCIRCLEARC) against the rectangle lx <= X <= hx and ly <= Y <= hy. |
java.awt.geom.Point2D |
closestPoint(java.awt.geom.Point2D pt)
Method to find the point on this polygon closest to a given point. |
boolean |
compare(java.lang.Object obj,
java.lang.StringBuffer buffer)
Initiative CrossLibCopy. |
boolean |
contains(double x,
double y)
Method to tell whether a point is inside of this Poly. |
boolean |
contains(double lX,
double lY,
double w,
double h)
Method to tell whether a rectangle is inside of this Poly. |
boolean |
contains(java.awt.geom.Point2D p)
Method to tell whether a point is inside of this Poly. |
boolean |
contains(java.awt.geom.Rectangle2D r)
Method to tell whether a rectangle is inside of this Poly. |
static int |
cropBox(java.awt.geom.Rectangle2D bounds,
java.awt.geom.Rectangle2D PUBox)
Method to crop the box in the reference parameters (lx-hx, ly-hy) against the box in (bx-ux, by-uy). |
static int |
cropBoxComplete(java.awt.geom.Rectangle2D bounds,
java.awt.geom.Rectangle2D PUBox)
Method to crop the box in the reference parameters (lx-hx, ly-hy) against the box in (bx-ux, by-uy). |
double |
getArea()
Method to compute the area of this Poly. |
java.awt.Rectangle |
getBounds()
Deprecated. this is only implemented because Poly extends Shape. You should be using getBounds2D() instead. |
java.awt.geom.Rectangle2D |
getBounds2D()
Method to return the bounds of this Poly. |
java.awt.geom.Rectangle2D |
getBox()
Method to return a Rectangle that describes the orthogonal box in this Poly. |
EPoint |
getCenter()
Method to return the center of the bounding box containing this PolyBase |
double |
getCenterX()
Method to return the X center coordinate of this Poly. |
double |
getCenterY()
Method to return the Y center coordinate of this Poly. |
Layer |
getLayer()
Method to return the layer associated with this Poly. |
Layer |
getLayerOrPseudoLayer()
Method to return the layer or pseudo-layer associated with this Poly. |
static java.util.List<PolyBase> |
getLoopsFromArea(java.awt.geom.Area area,
Layer layer)
|
double |
getMaxLength()
Method to compute longest edge. |
double |
getMaxSize()
Method to compute the maximum size of this Polygon. |
double |
getMinSize()
Method to compute the minimum size of this Polygon. |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
Method to return a PathIterator for this Poly after a transformation. |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
Method to return a PathIterator with a particular flatness for this Poly after a transformation. |
double |
getPerimeter()
Method to compute the perimeter of this Poly. |
java.awt.geom.Point2D[] |
getPoints()
Method to return the points associated with this Poly. |
static java.util.List<PolyBase> |
getPointsInArea(java.awt.geom.Area area,
Layer layer,
boolean simple,
boolean includeLastPoint)
Static method to get PolyBase elements associated with an Area. |
PolyBase |
getPolygon()
Method to satisfy the PolyMerge interface by return the polygon (this object). |
static java.util.List<PolyBase.PolyBaseTree> |
getPolyTrees(java.awt.geom.Area area,
Layer layer)
|
PortProto |
getPort()
Method to return the PortProto associated with this Poly. |
Poly.Type |
getStyle()
Method to return the style associated with this Poly. |
protected double |
getTextScale(EditWindow0 wnd,
java.awt.font.GlyphVector gv,
Poly.Type style,
double lX,
double hX,
double lY,
double hY)
Method to return the scaling factor between database and screen for the given text. |
static java.util.List<PolyBase.PolyBaseTree> |
getTreesFromLoops(java.util.List<PolyBase> list)
|
void |
gridToLambda()
Method to convert points from grid units to lambda units. |
static int |
halfCropBox(java.awt.geom.Rectangle2D bounds,
java.awt.geom.Rectangle2D limit)
Method to crop the box in the reference parameters (lx-hx, ly-hy) against the box in (bx-ux, by-uy). |
boolean |
intersects(double x,
double y,
double w,
double h)
Method to tell whether a rectangle intersects this Poly. |
boolean |
intersects(PolyBase polyOther)
Method to tell whether this Poly intersects another one. |
boolean |
intersects(java.awt.geom.Rectangle2D r)
Method to tell whether a rectangle intersects this Poly. |
boolean |
isInside(java.awt.geom.Point2D pt)
Method to tell whether a coordinate is inside of this Poly. |
boolean |
isInside(java.awt.geom.Rectangle2D bounds)
Method to tell whether a coordinates of this Poly are inside of a Rectangle2D. |
boolean |
isPointOnCorner(java.awt.geom.Point2D point)
Method to check if point is part of the point set that defines the polygon |
boolean |
isPseudoLayer()
Method to tell if the layer associated with this Poly is a pseudo-layer. |
void |
lambdaToGrid()
Method to convert points from lambda units to grid units. |
static java.awt.geom.Point2D[] |
makePoints(double lX,
double hX,
double lY,
double hY)
Method to create an array of Points that describes a Rectangle. |
static java.awt.geom.Point2D[] |
makePoints(java.awt.geom.Rectangle2D rect)
Method to create an array of Points that describes a Rectangle. |
double |
polyDistance(double x,
double y)
Method to report the distance of a point to this Poly. |
double |
polyDistance(java.awt.geom.Rectangle2D otherBounds)
Method to report the distance of a rectangle or point to this Poly. |
boolean |
polySame(PolyBase polyOther)
Method to compare this Poly to another. |
void |
reducePortPoly(PortInst pi,
double wid,
int angle)
Method to reduce this Poly by the proper amount presuming that it describes a port connected to an arc. |
static Poly.Type |
rotateType(Poly.Type origType,
ElectricObject eObj)
Method to rotate a text Type according to the rotation of the object on which it resides. |
void |
roundPoints()
Attempt to control rounding errors in input libraries |
double |
separation(PolyBase polyOther)
Method to return the distance between this Poly and another. |
double |
separationBox(PolyBase polyOther)
Method to calculate fast distance between two manhattan polygons that do not intersect |
void |
setLayer(Layer layer)
Method to set the layer associated with this Poly. |
void |
setPoint(int pt,
double x,
double y)
Method to change the value of a point in the PolyBase. |
void |
setPort(PortProto pp)
Method to set the PortProto associated with this Poly. |
void |
setStyle(Poly.Type style)
Method to set the style associated with this Poly. |
void |
transform(java.awt.geom.AffineTransform af)
Method to transformed the points in this Poly. |
static Poly.Type |
unRotateType(Poly.Type origType,
ElectricObject eObj)
Method to unrotate a text Type according to the rotation of the object on which it resides. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.geom.Point2D[] points
protected java.awt.geom.Rectangle2D bounds
public static final int X
public static final int Y
public static final int Z
public static final int XY
Constructor Detail |
---|
public PolyBase(java.awt.geom.Point2D[] points)
points
- the array of coordinates.public PolyBase(double cX, double cY, double width, double height)
cX
- the center X coordinate of the rectangle.cY
- the center Y coordinate of the rectangle.width
- the width of the rectangle.height
- the height of the rectangle.public PolyBase(java.awt.geom.Rectangle2D rect)
rect
- the Rectangle2D of the rectangle.Method Detail |
---|
public static java.awt.geom.Point2D[] makePoints(double lX, double hX, double lY, double hY)
lX
- the low X coordinate of the rectangle.hX
- the high X coordinate of the rectangle.lY
- the low Y coordinate of the rectangle.hY
- the high Y coordinate of the rectangle.
public static java.awt.geom.Point2D[] makePoints(java.awt.geom.Rectangle2D rect)
rect
- the Rectangle.
public Poly.Type getStyle()
public void setStyle(Poly.Type style)
style
- the style associated with this Poly.public java.awt.geom.Point2D[] getPoints()
public Layer getLayer()
public Layer getLayerOrPseudoLayer()
public void setLayer(Layer layer)
layer
- the layer associated with this Poly.public boolean isPseudoLayer()
public PortProto getPort()
public void setPort(PortProto pp)
pp
- the PortProto associated with this Poly.public void transform(java.awt.geom.AffineTransform af)
af
- transformation to apply.public void lambdaToGrid()
public void gridToLambda()
public java.awt.geom.Rectangle2D getBox()
public double getMinSize()
public double getMaxSize()
public boolean polySame(PolyBase polyOther)
polyOther
- the other Poly to compare.
public boolean isInside(java.awt.geom.Point2D pt)
pt
- the point in question.
public boolean isInside(java.awt.geom.Rectangle2D bounds)
bounds
- the Rectangle2D in question.
public boolean isPointOnCorner(java.awt.geom.Point2D point)
point
-
public void reducePortPoly(PortInst pi, double wid, int angle)
pi
- the PortInst that describes this Poly.wid
- the width of the arc connected to this port-poly.
This should be the base width, not the actual width stored in memory.angle
- the angle of the arc connected to this port-poly.
If negative, do not consider arc angle.public static Poly.Type rotateType(Poly.Type origType, ElectricObject eObj)
origType
- the original text Type.eObj
- the ElectricObject on which the text resides.
public static Poly.Type unRotateType(Poly.Type origType, ElectricObject eObj)
origType
- the original text Type.eObj
- the ElectricObject on which the text resides.
protected double getTextScale(EditWindow0 wnd, java.awt.font.GlyphVector gv, Poly.Type style, double lX, double hX, double lY, double hY)
wnd
- the window with the text.gv
- the GlyphVector describing the text.style
- the anchor information for the text.lX
- the low X bound of the polygon containing the text.hX
- the high X bound of the polygon containing the text.lY
- the low Y bound of the polygon containing the text.hY
- the high Y bound of the polygon containing the text.
public double polyDistance(double x, double y)
x
- coordinate of a point.y
- coordinate of a point.
public double polyDistance(java.awt.geom.Rectangle2D otherBounds)
otherBounds
- the area to test for distance to the Poly.
public double separationBox(PolyBase polyOther)
polyOther
- the other polygon being examined with this.
public double separation(PolyBase polyOther)
polyOther
- the other Poly to consider.
public java.awt.geom.Point2D closestPoint(java.awt.geom.Point2D pt)
pt
- the given point
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
x
- the X coordinate of the point.y
- the Y coordinate of the point.
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
p
- the point.
public boolean contains(double lX, double lY, double w, double h)
contains
in interface java.awt.Shape
lX
- the X corner of the rectangle.lY
- the Y corner of the rectangle.w
- the width of the rectangle.h
- the height of the rectangle.
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
r
- the rectangle.
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
x
- the X corner of the rectangle.y
- the Y corner of the rectangle.w
- the width of the rectangle.h
- the height of the rectangle.
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
r
- the rectangle.
public boolean intersects(PolyBase polyOther)
polyOther
- the other Poly to test.
public double getPerimeter()
public double getMaxLength()
public double getArea()
public double getCenterX()
public double getCenterY()
public EPoint getCenter()
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface PolyNodeMerge
getBounds2D
in interface java.awt.Shape
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public void setPoint(int pt, double x, double y)
pt
- the index of the point to change.x
- the new X value.y
- the new Y value.public void roundPoints()
public static java.util.List<PolyBase> getPointsInArea(java.awt.geom.Area area, Layer layer, boolean simple, boolean includeLastPoint)
area
- Java2D structure containing the geometrical informationlayer
- the Layer to examine.simple
- if true, polygons with inner loops will return in sample Poly.includeLastPoint
- true to include the last point.
public static java.util.List<PolyBase.PolyBaseTree> getPolyTrees(java.awt.geom.Area area, Layer layer)
public static java.util.List<PolyBase.PolyBaseTree> getTreesFromLoops(java.util.List<PolyBase> list)
public static java.util.List<PolyBase> getLoopsFromArea(java.awt.geom.Area area, Layer layer)
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
at
- the transformation to apply.
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
at
- the transformation to apply.flatness
- the required flatness.
public boolean compare(java.lang.Object obj, java.lang.StringBuffer buffer)
public static int cropBox(java.awt.geom.Rectangle2D bounds, java.awt.geom.Rectangle2D PUBox)
public static int cropBoxComplete(java.awt.geom.Rectangle2D bounds, java.awt.geom.Rectangle2D PUBox)
public static int halfCropBox(java.awt.geom.Rectangle2D bounds, java.awt.geom.Rectangle2D limit)
public void clipArc(double lx, double hx, double ly, double hy)
public PolyBase getPolygon()
getPolygon
in interface PolyNodeMerge
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |