Class Reference booleanHandler

A module to perform boolean operations. More...

Member

void aExorB()
void aExorBDel()
void aExorBDelA()
void aExorBDelB()
void aMinusB()
void aMinusBDel()
void aMinusBDelA()
void aMinusBDelB()
void aMultiB()
void aMultiBDel()
void aMultiBDelA()
void aMultiBDelB()
void aPlusB()
void aPlusBDel()
void aPlusBDelA()
void aPlusBDelB()
void addA(pointArray pointarray)
void addA(rect rectangle)
void addA(element * e)
void addB(pointArray pointarray)
void addB(rect rectangle)
void addB(element * e)
void addLayerA(int layer)
void addLayerB(int layer)
void bMinusA()
void bMinusADel()
void bMinusADelA()
void bMinusADelB()
void boolOnLayer(int layerA,int layerB,int layerResult,string operation,int nx=0,int ny=0, int borderMerge=0)
void clear()
pointArray getResultingPolygon()
void mergeSelect(int layer)
void performAEorB()
void performAMinusB()
void performAMultiB()
void performAPlusB()
void performBMinusA()
void setA()
void setB()
void setResultToA()
void setResultToB()

Detailed Description

graph LR la(layout)--booleanTool-->bo(booleanHandler) click la "/layoutscript/api/layout" click bo "/layoutscript/api/booleanhandler" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class bo thisClas class la clas

Boolean operations live on layout->booleanTool, a booleanHandler. Fill group A and group B from the current selection with setA() and setB(), or add polygons, rectangles, elements or whole layers with addA and addB. Each union, difference, intersection or exclusive-or writes the result into the currentCell of the drawing, on the activeLayer unless you name another layer. The new shapes are selected so you can see them at once. After the operation both groups are cleared; methods whose names end with Del, DelA or DelB also delete the source shapes when they are still unmodified in that cell.

Example:

layout->drawing->currentCell->fSelect(rect1);
layout->booleanTool->setA();
layout->drawing->currentCell->fSelect(rect2);
layout->booleanTool->setB();
layout->drawing->activeLayer=1;
layout->booleanTool->aPlusB();

Member Function Documentation


void booleanHandler::aExorB()

The exor of A and B is added on the active Layer.


void booleanHandler::aExorBDel()

The exor of A and B is added on the active Layer. Shapes belonging to group A and group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aExorBDelA()

The exor of A and B is added on the active Layer. Shapes belonging to group A are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aExorBDelB()

The exor of A and B is added on the active Layer. Shapes belonging to group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aMinusB()

The difference of A and B is added on the active Layer.


void booleanHandler::aMinusBDel()

The difference of A and B is added on the active Layer. Shapes belonging to group A and group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aMinusBDelA()

The difference of A and B is added on the active Layer. Shapes belonging to group A are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aMinusBDelB()

The difference of A and B is added on the active Layer. Shapes belonging to group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aMultiB()

The intersection of A and B is added on the active Layer.


void booleanHandler::aMultiBDel()

The intersection of A and B is added on the active Layer. Shapes belonging to group A and group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aMultiBDelA()

The intersection of A and B is added on the active Layer. Shapes belonging to group A are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aMultiBDelB()

The intersection of A and B is added on the active Layer. Shapes belonging to group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aPlusB()

The sum of A and B is added on the active Layer.


void booleanHandler::aPlusBDel()

The sum of A and B is added on the active Layer. Shapes belonging to group A and B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aPlusBDelA()

The sum of A and B is added on the active Layer. Shapes belonging to group A are deleted, if it still exists unmodified in the current cell.


void booleanHandler::aPlusBDelB()

The sum of A and B is added on the active Layer. Shapes belonging to group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::addA(pointArray pointarray)

adds the polygon to group A.


void booleanHandler::addA(rect rectangle)

adds the rectangle to group A.


void booleanHandler::addA(element * e)

adds the e to group A. e can be a path, polygon or rect. Any references and array references will be ignored.


void booleanHandler::addB(pointArray pointarray)

adds the polygon to group B.


void booleanHandler::addB(rect rectangle)

adds the rectangle to group B.


void booleanHandler::addB(element * e)

adds the e to group B. e can be a path, polygon or rect. Any references and array references will be ignored.


void booleanHandler::addLayerA(int layer)

adds all element including hierarchical element on layer in the current cell to group A. Added shapes will never be deleted after the boolean operation.


void booleanHandler::addLayerB(int layer)

adds all element including hierarchical element on layer in the current cell to group B. Added shapes will never be deleted after the boolean operation.


void booleanHandler::bMinusA()

The difference of group B and group A is added on the active Layer.


void booleanHandler::bMinusADel()

The difference of B and A is added on the active Layer. Shapes belonging to group A and group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::bMinusADelA()

The difference of B and A is added on the active Layer. Shapes belonging to group A are deleted, if it still exists unmodified in the current cell.


void booleanHandler::bMinusADelB()

The difference of B and A is added on the active Layer. Shapes belonging to group B are deleted, if it still exists unmodified in the current cell.


void booleanHandler::boolOnLayer(int layerA,int layerB,int layerResult,string operation,int nx=0,int ny=0, int borderMerge=0)

Performs a Boolean operation between layerA and layerB and writes the result to layerResult. operation selects the operator (see the table). The work is split into frames: if nx and ny are 0, the frame count is chosen automatically, otherwise nx by ny frames are used. This call clears any previous setA / setB groups; those shapes are ignored.

Parameter:
layerA first layer
layerB second layer
layerResult layer that receives the result
operation Boolean operation string
nx count in x; 0 means automatic
ny count in y; 0 means automatic
borderMerge how frame borders are merged
operation description
A+B a merge of shapes on both layers
A-B shapes on layer B are subtracted from layer A
B-A shapes on layer A are subtracted from layer B
A*B area that exists on both layers
AxorB area that exists on just one layer
A merge a merge of all shapes on layer A
A xor area that is within an uneven number of shapes, so a shape will be output at location with 3 shapes over it, but not for location with 2 shapes over it
A invert an inversion of layer A, the bounding box of the cell will be used as outer boundry
A Invert (hierarchical) an inversion of layer A, the bounding box of the cell will be used as outer boundry, refered cells will be modified in a way that a minimum area in the main cell needs to be created
A-B (multi-shape) similar to 'A-B' but it respect the number of shape at one location. So it will out a shape at a location with two shapes on layer A and 1 shape on layer B, but it will not output at a location with two shapes on layer A and two shapes on layer B (introduced with release 20220416)

borderMerge will define how the borders of the frames are handled:

value boder handling
0 only small shapes are merged at the border
1 shapes at frame border are not merged
2 all border shapes are merged

void booleanHandler::clear()

Remove any previous set shapes from the handler. This method is only required when incorrect shapes were set. Any previous Boolean operation will remove any shape from the handler as well. (introduced with release 20221031)


pointArray booleanHandler::getResultingPolygon()

Returns: one pointarray of the previous boolean operation, if it was made with performAEorB(), performAMinusB(), performAMultiB(), performAPlusB(), performBMinusA(). If the boolean operation result in more polygons, consequent call will return the next pointarray. A empty pointarray is return, if no more pointarray are available or a other boolean operation as mentioned before was made.


void booleanHandler::mergeSelect(int layer)

Selected elements will be merged and added to layer.


void booleanHandler::performAEorB()

The operation A exclusive or B is performed. Use the result with getResultingPolygon(), setResultToA() or setResultToB().


void booleanHandler::performAMinusB()

The operation A minus B is performed. Use the result with getResultingPolygon(), setResultToA() or setResultToB().


void booleanHandler::performAMultiB()

The intersection of A nad B is performed. Use the result with getResultingPolygon(), setResultToA() or setResultToB().


void booleanHandler::performAPlusB()

The operation A and B is performed. Use the result with getResultingPolygon(), setResultToA() or setResultToB().


void booleanHandler::performBMinusA()

The operation B minus A is performed. Use the result with getResultingPolygon(), setResultToA() or setResultToB().


void booleanHandler::setA()

Selected elements will be added to the group A. All elements will be deselected.


void booleanHandler::setB()

Selected elements will be added to the group B. All elements will be deselected.


void booleanHandler::setResultToA()

The result of the previous boolean operation, if it was made with performAEorB(), performAMinusB(), performAMultiB(), performAPlusB(), performBMinusA(), is set to group A for a following operation.


void booleanHandler::setResultToB()

The resultof the previous boolean operation, if it was made with performAEorB(), performAMinusB(), performAMultiB(), performAPlusB(), performBMinusA(), is set to group B for a following operation.