+ fix crashes on deleting Sketcher geometries
+ whitespace improvements git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5006 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
@@ -247,16 +247,22 @@ int SketchObject::delGeometry(int GeoNbr)
|
|||||||
for (std::vector<Constraint *>::const_iterator it = constraints.begin();
|
for (std::vector<Constraint *>::const_iterator it = constraints.begin();
|
||||||
it != constraints.end(); ++it) {
|
it != constraints.end(); ++it) {
|
||||||
if ((*it)->First != GeoNbr && (*it)->Second != GeoNbr) {
|
if ((*it)->First != GeoNbr && (*it)->Second != GeoNbr) {
|
||||||
if ((*it)->First > GeoNbr)
|
Constraint *copiedConstr = (*it)->clone();
|
||||||
(*it)->First -= 1;
|
if (copiedConstr->First > GeoNbr)
|
||||||
if ((*it)->Second > GeoNbr)
|
copiedConstr->First -= 1;
|
||||||
(*it)->Second -= 1;
|
if (copiedConstr->Second > GeoNbr)
|
||||||
newConstraints.push_back(*it);
|
copiedConstr->Second -= 1;
|
||||||
|
newConstraints.push_back(copiedConstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Constraints.setValues(newConstraints);
|
// temporarily empty constraints list in order to avoid invalid constraints
|
||||||
|
// during manipulation of the geometry list
|
||||||
|
std::vector< Constraint * > emptyConstraints(0);
|
||||||
|
this->Constraints.setValues(emptyConstraints);
|
||||||
|
|
||||||
this->Geometry.setValues(newVals);
|
this->Geometry.setValues(newVals);
|
||||||
|
this->Constraints.setValues(newConstraints);
|
||||||
rebuildVertexIndex();
|
rebuildVertexIndex();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1483,6 +1483,7 @@ float ViewProviderSketch::getScaleFactor()
|
|||||||
return 1.f;
|
return 1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewProviderSketch::draw(bool temp)
|
void ViewProviderSketch::draw(bool temp)
|
||||||
{
|
{
|
||||||
assert(edit);
|
assert(edit);
|
||||||
@@ -1669,7 +1670,7 @@ Restart:
|
|||||||
// get the geometry
|
// get the geometry
|
||||||
const Part::Geometry *geo = (*geomlist)[Constr->First];
|
const Part::Geometry *geo = (*geomlist)[Constr->First];
|
||||||
// Vertical can only be a GeomLineSegment
|
// Vertical can only be a GeomLineSegment
|
||||||
assert(geo->getTypeId()== Part::GeomLineSegment::getClassTypeId());
|
assert(geo->getTypeId() == Part::GeomLineSegment::getClassTypeId());
|
||||||
const Part::GeomLineSegment *lineSeg = dynamic_cast<const Part::GeomLineSegment *>(geo);
|
const Part::GeomLineSegment *lineSeg = dynamic_cast<const Part::GeomLineSegment *>(geo);
|
||||||
|
|
||||||
// calculate the half distance between the start and endpoint
|
// calculate the half distance between the start and endpoint
|
||||||
@@ -2938,7 +2939,6 @@ Sketcher::SketchObject *ViewProviderSketch::getSketchObject(void) const
|
|||||||
return dynamic_cast<Sketcher::SketchObject *>(pcObject);
|
return dynamic_cast<Sketcher::SketchObject *>(pcObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||||
{
|
{
|
||||||
//FIXME use the selection subelements instead of the Sel Sets...
|
//FIXME use the selection subelements instead of the Sel Sets...
|
||||||
|
|||||||
Reference in New Issue
Block a user