Class Reference layerTranslator

Layer translator class for mapping layers. More...

Member

layerTranslator()
void clear()
void invert()
void mapAll(int to_layer)
void mapLayer(int from_layer, int to_layer)
int map(int from_layer)

Detailed Description

graph LR df(drawingField)--mapLayer-->lt(layerTranslator) ce(cell)--mapLayer-->lt click df "/layoutscript/api/drawingfield" click ce "/layoutscript/api/cell" click lt "/layoutscript/api/layertranslator" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class lt thisClas class df,ce clas

A layerTranslator is a mapping from every layer number to a destination layer. drawingField mapLayer and cell mapLayer take a pointer to this object and rewrite the shapes. After construction the mapping is identical: each layer maps to itself. mapLayer changes one pair, mapAll sends every layer to one destination, clear restores the identity map, and invert swaps the direction of the stored pairs. map looks up what a given source layer becomes. Build the translator first, then pass its address to the drawing or the cell; the translator itself does not walk the design.

Example:

layerTranslator t;
t.mapLayer(18, 19);
t.mapLayer(19, 18);
layout->drawing->mapLayer(&t);
int dest = t.map(18);

Member Function Documentation


layerTranslator::layerTranslator()

Creates a layerTranslator with an identical mapping for every layer.


void layerTranslator::clear()

Resets the mapping to an identical mapping for every layer.


void layerTranslator::invert()

Inverts the stored mapping. If the translator maps layer 1 to layer 2, the inverted translator maps layer 2 to layer 1.


void layerTranslator::mapAll(int to_layer)

Maps every source layer to to_layer.


void layerTranslator::mapLayer(int from_layer, int to_layer)

Maps from_layer to to_layer.


int layerTranslator::map(int from_layer)

Returns: the destination layer for from_layer.