|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.database.geometry.GeometryHandler
com.sun.electric.database.geometry.PolyMerge
public class PolyMerge
This is the Polygon Merging facility.
Initially, call:
PolyMerge merge = new PolyMerge();
The returned value is used in subsequent calls.
For every polygon, call:
merge.addPolygon(layer, poly);
where "layer" is a layer and "poly" is a polygon to be added.
You can also subtract a polygon by calling:
merge.subtract(layer, poly);
To combine two different merges, use:
merge.addMerge(addmerge, trans)
to add the merge information in "addmerge" (transformed by "trans")
At end of merging, call:
merge.getMergedPoints(layer)
for each layer, and it returns an array of PolyBases on that layer.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.sun.electric.database.geometry.GeometryHandler |
---|
GeometryHandler.GHMode |
Field Summary |
---|
Fields inherited from class com.sun.electric.database.geometry.GeometryHandler |
---|
areaSort, shapeSort |
Constructor Summary | |
---|---|
PolyMerge()
Method to create a new "merge" object. |
Method Summary | |
---|---|
void |
add(Layer key,
java.lang.Object value)
Method to add a PolyBase to the merged collection. |
void |
addAll(GeometryHandler subMerge,
java.awt.geom.AffineTransform trans)
Method to add another Merge to this one. |
void |
addLayer(Layer fromLayer,
Layer toLayer)
Method to add one Layer to another in this merge. |
void |
addMerge(PolyMerge other,
java.awt.geom.AffineTransform trans)
Method to add another Merge to this one. |
void |
addPolygon(Layer layer,
PolyBase poly)
Method to add a PolyBase to the merged collection. |
void |
addRectangle(Layer layer,
java.awt.geom.Rectangle2D rect)
Method to add a Rectangle to the merged collection. |
boolean |
arcPolyFits(Layer layer,
java.awt.geom.Point2D headLoc,
java.awt.geom.Point2D tailLoc,
double wid,
GenMath.MutableBoolean headExtend,
GenMath.MutableBoolean tailExtend)
Method to see if an arc fits in this merge with or without end extension. |
boolean |
contains(Layer layer,
java.awt.geom.Point2D pt)
Method to determine whether a point exists in the merge. |
boolean |
contains(Layer layer,
PolyBase poly)
Method to determine whether a polygon exists in the merge. |
boolean |
contains(Layer layer,
java.awt.geom.Rectangle2D rect)
Method to determine whether a rectangle exists in the merge. |
void |
deleteLayer(Layer layer)
Method to delete all geometry on a given layer. |
double |
getAreaOfLayer(Layer layer)
Method to return the area on a given layer. |
static java.util.List<PolyBase> |
getAreaPoints(java.awt.geom.Area area,
Layer layer,
boolean simple)
Method to return a list of polygons in this merge for a given layer. |
java.util.List<PolyBase> |
getMergedPoints(Layer layer,
boolean simple)
Method to return list of Polys on a given Layer in this Merge. |
java.util.Collection<PolyBase> |
getObjects(java.lang.Object layer,
boolean modified,
boolean simple)
To retrieve leave elements from internal structure |
void |
insetLayer(Layer source,
Layer dest,
double amount)
Method to inset one layer by a given amount and create a second layer. |
void |
intersectLayers(Layer sourceA,
Layer sourceB,
Layer dest)
Method to intersect two layers in this merge and produce a third. |
boolean |
intersects(Layer layer,
PolyBase poly)
Method to determine whether a polygon intersects a layer in the merge. |
boolean |
isEmpty(Layer layer)
Method to tell whether there is any valid geometry on a given layer of this merge. |
void |
subtract(java.lang.Object layer,
java.lang.Object poly)
Method to subtract a PolyBase from the merged collection. |
void |
subtractLayers(Layer sourceA,
Layer sourceB,
Layer dest)
Method to subtract one layer from another and produce a third. |
void |
subtractMerge(PolyMerge other)
Method to subtract another Merge to this one. |
Methods inherited from class com.sun.electric.database.geometry.GeometryHandler |
---|
createGeometryHandler, getKeySet, getTreeObjects, postProcess, subtractAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PolyMerge()
Method Detail |
---|
public void add(Layer key, java.lang.Object value)
add
in class GeometryHandler
key
- the layer that this PolyBase sits on.value
- the PolyBase to merge. If value is only Shape type
then it would take the bounding box. This might not be precise enough!.public void addRectangle(Layer layer, java.awt.geom.Rectangle2D rect)
layer
- the layer that this Poly sits on.rect
- the Rectangle to merge.public void addPolygon(Layer layer, PolyBase poly)
layer
- the layer that this Poly sits on.poly
- the PolyBase to merge.public void subtract(java.lang.Object layer, java.lang.Object poly)
subtract
in class GeometryHandler
layer
- the layer that this PolyBase sits on.poly
- the PolyBase to merge.public void addAll(GeometryHandler subMerge, java.awt.geom.AffineTransform trans)
addAll
in class GeometryHandler
subMerge
- the other Merge to add in.trans
- a transformation on the other Merge.public void addMerge(PolyMerge other, java.awt.geom.AffineTransform trans)
other
- the other Merge to add in.trans
- a transformation on the other Merge.public void addLayer(Layer fromLayer, Layer toLayer)
fromLayer
- the other Layer to add in.toLayer
- the destination layer that will contain the union of itself and "fromLayer".public boolean intersects(Layer layer, PolyBase poly)
layer
- the layer to test.poly
- the polygon to examine.
public void intersectLayers(Layer sourceA, Layer sourceB, Layer dest)
sourceA
- the first Layer to intersect.sourceB
- the second Layer to intersect.dest
- the destination layer to place the intersection of the first two.
If there is no intersection, all geometry on this layer is cleared.public void subtractLayers(Layer sourceA, Layer sourceB, Layer dest)
sourceA
- the first Layer.sourceB
- the second Layer, which gets subtracted from the first.dest
- the destination layer to place the sourceA - sourceB.
If there is nothing left, all geometry on the layer is cleared.public void subtractMerge(PolyMerge other)
other
- the other Merge to subtract.public void insetLayer(Layer source, Layer dest, double amount)
source
- the Layer to inset.dest
- the destination layer to place the inset geometry.amount
- the distance to inset the layer.public void deleteLayer(Layer layer)
layer
- the Layer to clear in this merge.public boolean isEmpty(Layer layer)
layer
- the layer to test.
public boolean contains(Layer layer, java.awt.geom.Rectangle2D rect)
layer
- the layer being tested.rect
- the rectangle being tested.
public boolean contains(Layer layer, PolyBase poly)
layer
- the layer being tested.poly
- the polygon being tested.
public boolean arcPolyFits(Layer layer, java.awt.geom.Point2D headLoc, java.awt.geom.Point2D tailLoc, double wid, GenMath.MutableBoolean headExtend, GenMath.MutableBoolean tailExtend)
layer
- the layer of the arc being examined.headLoc
- the head location of the arc.tailLoc
- the tail location of the arc.wid
- the width of the arc.headExtend
- the head extension of the arc (is set false if extension not possible).tailExtend
- the tail extension of the arc (is set false if extension not possible).
public double getAreaOfLayer(Layer layer)
layer
- the layer to query.
public boolean contains(Layer layer, java.awt.geom.Point2D pt)
layer
- the layer being tested.pt
- the point being tested.
public java.util.Collection<PolyBase> getObjects(java.lang.Object layer, boolean modified, boolean simple)
GeometryHandler
getObjects
in class GeometryHandler
layer
- current layer under analysismodified
- to avoid retrieving original polygonssimple
- to obtain simple polygonspublic java.util.List<PolyBase> getMergedPoints(Layer layer, boolean simple)
layer
- the layer in question.simple
-
public static java.util.List<PolyBase> getAreaPoints(java.awt.geom.Area area, Layer layer, boolean simple)
area
- the Area object that describes the merge.layer
- the desired Layer.simple
- true for simple polygons, false to allow complex ones.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |