WIP: some little refactoring.

This commit is contained in:
Matthias Koefferlein 2020-08-30 01:36:17 +02:00
parent d762074bc0
commit 9a4cd629fc
2 changed files with 87 additions and 0 deletions

View File

@ -35,6 +35,9 @@
#include "dbEdgePairs.h"
#include "dbEdges.h"
#include "dbTexts.h"
#include "dbCellMapping.h"
#include "dbLayerMapping.h"
#include "dbLayoutUtils.h"
#include "tlTimer.h"
#include "tlLog.h"
#include "tlInternational.h"
@ -1171,6 +1174,60 @@ Layout::topological_sort ()
}
void
Layout::copy_tree_shapes (const db::Layout &source_layout, const db::CellMapping &cm)
{
if (this == &source_layout) {
throw tl::Exception (tl::to_string (tr ("Cannot copy shapes within the same layout")));
}
db::ICplxTrans trans (source_layout.dbu () / dbu ());
db::LayerMapping lm;
lm.create_full (*this, source_layout);
db::copy_shapes (*this, source_layout, trans, cm.source_cells (), cm.table (), lm.table ());
}
void
Layout::copy_tree_shapes (const db::Layout &source_layout, const db::CellMapping &cm, const db::LayerMapping &lm)
{
if (this == &source_layout) {
throw tl::Exception (tl::to_string (tr ("Cannot copy shapes within the same layout")));
}
db::ICplxTrans trans (source_layout.dbu () / dbu ());
db::copy_shapes (*this, source_layout, trans, cm.source_cells (), cm.table (), lm.table ());
}
void
Layout::move_tree_shapes (db::Layout &source_layout, const db::CellMapping &cm)
{
if (this == &source_layout) {
throw tl::Exception (tl::to_string (tr ("Cannot copy shapes within the same layout")));
}
db::ICplxTrans trans (source_layout.dbu () / dbu ());
db::LayerMapping lm;
lm.create_full (*this, source_layout);
db::move_shapes (*this, source_layout, trans, cm.source_cells (), cm.table (), lm.table ());
}
void
Layout::move_tree_shapes (db::Layout &source_layout, const db::CellMapping &cm, const db::LayerMapping &lm)
{
if (this == &source_layout) {
throw tl::Exception (tl::to_string (tr ("Cannot copy shapes within the same layout")));
}
db::ICplxTrans trans (source_layout.dbu () / dbu ());
db::move_shapes (*this, source_layout, trans, cm.source_cells (), cm.table (), lm.table ());
}
bool
Layout::is_valid_cell_index (cell_index_type ci) const
{

View File

@ -67,6 +67,8 @@ class Region;
class Edges;
class EdgePairs;
class Texts;
class CellMapping;
class LayerMapping;
template <class Coord> class generic_repository;
typedef generic_repository<db::Coord> GenericRepository;
@ -1257,6 +1259,34 @@ public:
*/
void delete_layer (unsigned int n);
/**
* @brief Copies the shapes of certain cells from the given source layout into this layout
*
* The affected cells are derived from the cell mapping object.
*/
void copy_tree_shapes (const db::Layout &source_layout, const db::CellMapping &cm);
/**
* @brief Copies the shapes of certain cells from the given source layout into this layout using the given layer mapping
*
* The affected cells are derived from the cell mapping object.
*/
void copy_tree_shapes (const db::Layout &source_layout, const db::CellMapping &cm, const db::LayerMapping &lm);
/**
* @brief Moves the shapes of certain cells from the given source layout into this layout
*
* The affected cells are derived from the cell mapping object.
*/
void move_tree_shapes (db::Layout &source_layout, const db::CellMapping &cm);
/**
* @brief Moves the shapes of certain cells from the given source layout into this layout using the given layer mapping
*
* The affected cells are derived from the cell mapping object.
*/
void move_tree_shapes (db::Layout &source_layout, const db::CellMapping &cm, const db::LayerMapping &lm);
/**
* @brief Return true, if the cell index is a valid one
*/