+ 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:
parent
e9bc1bfff8
commit
5df128b21f
|
@ -247,16 +247,22 @@ int SketchObject::delGeometry(int GeoNbr)
|
|||
for (std::vector<Constraint *>::const_iterator it = constraints.begin();
|
||||
it != constraints.end(); ++it) {
|
||||
if ((*it)->First != GeoNbr && (*it)->Second != GeoNbr) {
|
||||
if ((*it)->First > GeoNbr)
|
||||
(*it)->First -= 1;
|
||||
if ((*it)->Second > GeoNbr)
|
||||
(*it)->Second -= 1;
|
||||
newConstraints.push_back(*it);
|
||||
Constraint *copiedConstr = (*it)->clone();
|
||||
if (copiedConstr->First > GeoNbr)
|
||||
copiedConstr->First -= 1;
|
||||
if (copiedConstr->Second > GeoNbr)
|
||||
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->Constraints.setValues(newConstraints);
|
||||
rebuildVertexIndex();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1483,6 +1483,7 @@ float ViewProviderSketch::getScaleFactor()
|
|||
return 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderSketch::draw(bool temp)
|
||||
{
|
||||
assert(edit);
|
||||
|
@ -1669,7 +1670,7 @@ Restart:
|
|||
// get the geometry
|
||||
const Part::Geometry *geo = (*geomlist)[Constr->First];
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
bool ViewProviderSketch::onDelete(const std::vector<std::string> &subList)
|
||||
{
|
||||
//FIXME use the selection subelements instead of the Sel Sets...
|
||||
|
|
Loading…
Reference in New Issue
Block a user