BUGFIX: db::Shapes::insert(db::Shapes) wasn't working correctly!

This commit is contained in:
Matthias Koefferlein 2020-11-03 00:13:28 +01:00
parent eb3600d620
commit 85869c329d
4 changed files with 19 additions and 3 deletions

View File

@ -174,9 +174,15 @@ Shapes::do_insert (const Shapes &d)
if (layout () == d.layout ()) {
// both shape containers reside in the same repository space - simply copy
m_layers.reserve (d.m_layers.size ());
for (tl::vector<LayerBase *>::const_iterator l = d.m_layers.begin (); l != d.m_layers.end (); ++l) {
m_layers.push_back ((*l)->clone (this, manager ()));
if (m_layers.empty ()) {
m_layers.reserve (d.m_layers.size ());
for (tl::vector<LayerBase *>::const_iterator l = d.m_layers.begin (); l != d.m_layers.end (); ++l) {
m_layers.push_back ((*l)->clone (this, manager ()));
}
} else {
for (tl::vector<LayerBase *>::const_iterator l = d.m_layers.begin (); l != d.m_layers.end (); ++l) {
(*l)->insert_into (this);
}
}
} else if (layout () == 0) {

View File

@ -493,6 +493,7 @@ public:
virtual void transform_into (Shapes *target, const Trans &trans, GenericRepository &rep, ArrayRepository &array_rep, pm_delegate_type &pm) const = 0;
virtual void transform_into (Shapes *target, const ICplxTrans &trans, GenericRepository &rep, ArrayRepository &array_rep) const = 0;
virtual void transform_into (Shapes *target, const ICplxTrans &trans, GenericRepository &rep, ArrayRepository &array_rep, pm_delegate_type &pm) const = 0;
virtual void insert_into (Shapes *target) = 0;
virtual void deref_into (Shapes *target) = 0;
virtual void deref_into (Shapes *target, pm_delegate_type &pm) = 0;
virtual void deref_and_transform_into (Shapes *target, const Trans &trans) = 0;

View File

@ -834,6 +834,13 @@ layer_class<Sh, StableTag>::transform_into (Shapes *target, const ICplxTrans &tr
}
}
template <class Sh, class StableTag>
void
layer_class<Sh, StableTag>::insert_into (Shapes *target)
{
target->insert (m_layer.begin (), m_layer.end ());
}
template <class Sh, class StableTag>
void
layer_class<Sh, StableTag>::deref_into (Shapes *target)
@ -870,6 +877,7 @@ layer_class<Sh, StableTag>::deref_and_transform_into (Shapes *target, const Tran
{
deref_and_transform_into_shapes deref_op (target);
for (typename layer_type::iterator s = m_layer.begin (); s != m_layer.end (); ++s) {
deref_op (*s, trans, pm);
}
}

View File

@ -149,6 +149,7 @@ public:
virtual void transform_into (Shapes *target, const Trans &trans, GenericRepository &rep, ArrayRepository &array_rep, pm_delegate_type &pm) const;
virtual void transform_into (Shapes *target, const ICplxTrans &trans, GenericRepository &rep, ArrayRepository &array_rep) const;
virtual void transform_into (Shapes *target, const ICplxTrans &trans, GenericRepository &rep, ArrayRepository &array_rep, pm_delegate_type &pm) const;
virtual void insert_into (Shapes *target);
virtual void deref_into (Shapes *target);
virtual void deref_into (Shapes *target, pm_delegate_type &pm);
virtual void deref_and_transform_into (Shapes *target, const Trans &trans);