[TD]Simplify Cosmetic List & PyObject handling
This commit is contained in:
@@ -63,8 +63,6 @@ PropertyCosmeticVertexList::PropertyCosmeticVertexList()
|
||||
|
||||
PropertyCosmeticVertexList::~PropertyCosmeticVertexList()
|
||||
{
|
||||
for (std::vector<CosmeticVertex*>::iterator it = _lValueList.begin(); it != _lValueList.end(); ++it)
|
||||
if (*it) delete *it;
|
||||
}
|
||||
|
||||
void PropertyCosmeticVertexList::setSize(int newSize)
|
||||
@@ -79,15 +77,12 @@ int PropertyCosmeticVertexList::getSize(void) const
|
||||
return static_cast<int>(_lValueList.size());
|
||||
}
|
||||
|
||||
void PropertyCosmeticVertexList::setValue(const CosmeticVertex* lValue)
|
||||
void PropertyCosmeticVertexList::setValue(CosmeticVertex* lValue)
|
||||
{
|
||||
if (lValue) {
|
||||
aboutToSetValue();
|
||||
CosmeticVertex* newVal = lValue->clone();
|
||||
for (unsigned int i = 0; i < _lValueList.size(); i++)
|
||||
delete _lValueList[i];
|
||||
_lValueList.resize(1);
|
||||
_lValueList[0] = newVal;
|
||||
_lValueList[0] = lValue;
|
||||
hasSetValue();
|
||||
}
|
||||
}
|
||||
@@ -95,13 +90,9 @@ void PropertyCosmeticVertexList::setValue(const CosmeticVertex* lValue)
|
||||
void PropertyCosmeticVertexList::setValues(const std::vector<CosmeticVertex*>& lValue)
|
||||
{
|
||||
aboutToSetValue();
|
||||
std::vector<CosmeticVertex*> 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[i] = lValue[i];
|
||||
hasSetValue();
|
||||
}
|
||||
|
||||
@@ -134,8 +125,6 @@ void PropertyCosmeticVertexList::setPyObject(PyObject *value)
|
||||
}
|
||||
|
||||
setValues(values);
|
||||
// if (part2d)
|
||||
// part2d->acceptCosmeticVertex();
|
||||
}
|
||||
else if (PyObject_TypeCheck(value, &(CosmeticVertexPy::Type))) {
|
||||
CosmeticVertexPy *pcObject = static_cast<CosmeticVertexPy*>(value);
|
||||
|
||||
Reference in New Issue
Block a user