From 7f2200cab5c12741961952e025c320f1a63dcd48 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 17 Jan 2023 01:37:10 +0100 Subject: [PATCH] WIP: Bug fixes, refactoring --- src/db/db/dbEdgePairs.h | 57 +---------------------------- src/db/db/dbEdges.h | 57 +---------------------------- src/db/db/dbFlatRegion.cc | 3 +- src/db/db/dbOriginalLayerRegion.cc | 5 ++- src/db/db/dbRegion.h | 57 +---------------------------- src/db/db/dbShapes.h | 2 +- src/db/db/dbTexts.h | 58 +----------------------------- 7 files changed, 11 insertions(+), 228 deletions(-) diff --git a/src/db/db/dbEdgePairs.h b/src/db/db/dbEdgePairs.h index 7fed916a4..7a0e07495 100644 --- a/src/db/db/dbEdgePairs.h +++ b/src/db/db/dbEdgePairs.h @@ -44,62 +44,7 @@ class DeepShapeStore; class TransformationReducer; class EdgeFilterBase; -/** - * @brief An edge pair set iterator - * - * The iterator delivers the edge pairs of the edge pair set - */ -class DB_PUBLIC EdgePairsIterator - : public generic_shape_iterator -{ -public: - /** - * @brief Default constructor - */ - EdgePairsIterator () - : generic_shape_iterator () - { - // .. nothing yet .. - } - - /** - * @brief Constructor from a delegate - * The iterator will take ownership over the delegate - */ - EdgePairsIterator (EdgePairsIteratorDelegate *delegate) - : generic_shape_iterator (delegate) - { - // .. nothing yet .. - } - - /** - * @brief Copy constructor and assignment - */ - EdgePairsIterator (const EdgePairsIterator &other) - : generic_shape_iterator (static_cast &> (other)) - { - // .. nothing yet .. - } - - /** - * @brief Assignment - */ - EdgePairsIterator &operator= (const EdgePairsIterator &other) - { - generic_shape_iterator::operator= (other); - return *this; - } - - /** - * @brief Increment - */ - EdgePairsIterator &operator++ () - { - generic_shape_iterator::operator++ (); - return *this; - } -}; - +typedef generic_shape_iterator EdgePairsIterator; typedef addressable_shape_delivery AddressableEdgePairDelivery; class EdgePairs; diff --git a/src/db/db/dbEdges.h b/src/db/db/dbEdges.h index ed1d3dbfc..d5bf8d116 100644 --- a/src/db/db/dbEdges.h +++ b/src/db/db/dbEdges.h @@ -39,62 +39,7 @@ class MutableEdges; class EmptyEdges; class DeepShapeStore; -/** - * @brief An edge set iterator - * - * The iterator delivers the edges of the edge set - */ -class DB_PUBLIC EdgesIterator - : public generic_shape_iterator -{ -public: - /** - * @brief Default constructor - */ - EdgesIterator () - : generic_shape_iterator () - { - // .. nothing yet .. - } - - /** - * @brief Constructor from a delegate - * The iterator will take ownership over the delegate - */ - EdgesIterator (EdgesIteratorDelegate *delegate) - : generic_shape_iterator (delegate) - { - // .. nothing yet .. - } - - /** - * @brief Copy constructor and assignment - */ - EdgesIterator (const EdgesIterator &other) - : generic_shape_iterator (static_cast &> (other)) - { - // .. nothing yet .. - } - - /** - * @brief Assignment - */ - EdgesIterator &operator= (const EdgesIterator &other) - { - generic_shape_iterator::operator= (other); - return *this; - } - - /** - * @brief Increment - */ - EdgesIterator &operator++ () - { - generic_shape_iterator::operator++ (); - return *this; - } -}; - +typedef generic_shape_iterator EdgesIterator; typedef addressable_shape_delivery AddressableEdgeDelivery; class Edges; diff --git a/src/db/db/dbFlatRegion.cc b/src/db/db/dbFlatRegion.cc index fdb07ca37..e96324c79 100644 --- a/src/db/db/dbFlatRegion.cc +++ b/src/db/db/dbFlatRegion.cc @@ -431,7 +431,8 @@ const db::PropertiesRepository *FlatRegion::properties_repository () const void FlatRegion::insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const { - layout->cell (into_cell).shapes (into_layer).insert (*mp_polygons); + db::PropertyMapper pm (layout->properties_repository (), *mp_properties_repository.get_const ()); + layout->cell (into_cell).shapes (into_layer).insert (*mp_polygons, pm); } void diff --git a/src/db/db/dbOriginalLayerRegion.cc b/src/db/db/dbOriginalLayerRegion.cc index 3c3de43ac..cb5c02737 100644 --- a/src/db/db/dbOriginalLayerRegion.cc +++ b/src/db/db/dbOriginalLayerRegion.cc @@ -153,6 +153,7 @@ OriginalLayerRegion::OriginalLayerRegion (const OriginalLayerRegion &other) OriginalLayerRegion::OriginalLayerRegion (const RecursiveShapeIterator &si, bool is_merged) : AsIfFlatRegion (), m_merged_polygons (false), m_iter (si) { + tl_assert (si.layout ()); init (); m_is_merged = is_merged; @@ -161,6 +162,7 @@ OriginalLayerRegion::OriginalLayerRegion (const RecursiveShapeIterator &si, bool OriginalLayerRegion::OriginalLayerRegion (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged) : AsIfFlatRegion (), m_merged_polygons (false), m_iter (si), m_iter_trans (trans) { + tl_assert (si.layout ()); init (); m_is_merged = is_merged; @@ -421,11 +423,12 @@ OriginalLayerRegion::insert_into (Layout *layout, db::cell_index_type into_cell, db::Shapes &sh = layout->cell (into_cell).shapes (into_layer); + db::PropertyMapper pm (*layout, *m_iter.layout ()); + // NOTE: if the source (r) is from the same layout than the shapes live in, we better // lock the layout against updates while inserting db::LayoutLocker locker (layout); for (db::RecursiveShapeIterator i = m_iter; !i.at_end (); ++i) { - tl::ident_map pm; sh.insert (*i, i.trans (), pm); } } diff --git a/src/db/db/dbRegion.h b/src/db/db/dbRegion.h index 4c3a312f1..e891e4af5 100644 --- a/src/db/db/dbRegion.h +++ b/src/db/db/dbRegion.h @@ -43,62 +43,7 @@ class DeepShapeStore; class TransformationReducer; class CompoundRegionOperationNode; -/** - * @brief A region iterator - * - * The iterator delivers the polygons of the region - */ -class DB_PUBLIC RegionIterator - : public generic_shape_iterator -{ -public: - /** - * @brief Default constructor - */ - RegionIterator () - : generic_shape_iterator () - { - // .. nothing yet .. - } - - /** - * @brief Constructor from a delegate - * The iterator will take ownership over the delegate - */ - RegionIterator (RegionIteratorDelegate *delegate) - : generic_shape_iterator (delegate) - { - // .. nothing yet .. - } - - /** - * @brief Copy constructor and assignment - */ - RegionIterator (const RegionIterator &other) - : generic_shape_iterator (static_cast &> (other)) - { - // .. nothing yet .. - } - - /** - * @brief Assignment - */ - RegionIterator &operator= (const RegionIterator &other) - { - generic_shape_iterator::operator= (other); - return *this; - } - - /** - * @brief Increment - */ - RegionIterator &operator++ () - { - generic_shape_iterator::operator++ (); - return *this; - } -}; - +typedef generic_shape_iterator RegionIterator; typedef addressable_shape_delivery AddressablePolygonDelivery; /** diff --git a/src/db/db/dbShapes.h b/src/db/db/dbShapes.h index 110646b54..e1c2d0e17 100644 --- a/src/db/db/dbShapes.h +++ b/src/db/db/dbShapes.h @@ -788,7 +788,7 @@ public: } else { // translate and transform into this for (tl::vector::const_iterator l = d.m_layers.begin (); l != d.m_layers.end (); ++l) { - (*l)->transform_into (this, shape_repository (), array_repository (), pm_delegate); + (*l)->translate_into (this, shape_repository (), array_repository (), pm_delegate); } } diff --git a/src/db/db/dbTexts.h b/src/db/db/dbTexts.h index 0e34ac77c..bc1882708 100644 --- a/src/db/db/dbTexts.h +++ b/src/db/db/dbTexts.h @@ -43,63 +43,7 @@ class Region; class DeepShapeStore; class TransformationReducer; -/** - * @brief An text set iterator - * - * The iterator delivers the texts of the text set - */ - -class DB_PUBLIC TextsIterator - : public generic_shape_iterator -{ -public: - /** - * @brief Default constructor - */ - TextsIterator () - : generic_shape_iterator () - { - // .. nothing yet .. - } - - /** - * @brief Constructor from a delegate - * The iterator will take ownership over the delegate - */ - TextsIterator (TextsIteratorDelegate *delegate) - : generic_shape_iterator (delegate) - { - // .. nothing yet .. - } - - /** - * @brief Copy constructor and assignment - */ - TextsIterator (const TextsIterator &other) - : generic_shape_iterator (static_cast &> (other)) - { - // .. nothing yet .. - } - - /** - * @brief Assignment - */ - TextsIterator &operator= (const TextsIterator &other) - { - generic_shape_iterator::operator= (other); - return *this; - } - - /** - * @brief Increment - */ - TextsIterator &operator++ () - { - generic_shape_iterator::operator++ (); - return *this; - } -}; - +typedef generic_shape_iterator TextsIterator; typedef addressable_shape_delivery AddressableTextDelivery; class Texts;