PropertyGeometryList: move setValue and refactor
This commit is contained in:
committed by
abdullahtahiriyo
parent
5119513488
commit
7a3e26dc5a
@@ -94,15 +94,23 @@ void PropertyGeometryList::setValue(const Geometry* lValue)
|
||||
}
|
||||
|
||||
void PropertyGeometryList::setValues(const std::vector<Geometry*>& lValue)
|
||||
{
|
||||
auto copy = lValue;
|
||||
for(auto &geo : copy) // copy of the individual geometry pointers
|
||||
geo = geo->clone();
|
||||
|
||||
setValues(std::move(copy));
|
||||
}
|
||||
|
||||
void PropertyGeometryList::setValues(const std::vector<Geometry*>&& rValue)
|
||||
{
|
||||
aboutToSetValue();
|
||||
std::vector<Geometry*> oldVals(_lValueList);
|
||||
_lValueList.resize(lValue.size());
|
||||
// copy all objects
|
||||
for (unsigned int i = 0; i < lValue.size(); i++)
|
||||
_lValueList[i] = lValue[i]->clone();
|
||||
for (unsigned int i = 0; i < oldVals.size(); i++)
|
||||
delete oldVals[i];
|
||||
_lValueList = std::move(rValue);
|
||||
|
||||
for(auto &ov : oldVals)
|
||||
delete ov;
|
||||
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
*/
|
||||
void setValue(const Geometry*);
|
||||
void setValues(const std::vector<Geometry*>&);
|
||||
void setValues(const std::vector<Geometry*>&&);
|
||||
|
||||
/// index operator
|
||||
const Geometry *operator[] (const int idx) const {
|
||||
|
||||
Reference in New Issue
Block a user