Merge pull request #479 from abdullahtahiriyo/bspline_stage1b_2017_firstdeliverable_fixes
Bspline stage1b 2017 firstdeliverable fixes
This commit is contained in:
commit
1e4b6ed00b
|
@ -644,13 +644,25 @@ int SketchObject::addGeometry(const Part::Geometry *geo, bool construction/*=fal
|
||||||
return Geometry.getSize()-1;
|
return Geometry.getSize()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SketchObject::delGeometry(int GeoId)
|
int SketchObject::delGeometry(int GeoId, bool deleteinternalgeo)
|
||||||
{
|
{
|
||||||
const std::vector< Part::Geometry * > &vals = getInternalGeometry();
|
const std::vector< Part::Geometry * > &vals = getInternalGeometry();
|
||||||
if (GeoId < 0 || GeoId >= int(vals.size()))
|
if (GeoId < 0 || GeoId >= int(vals.size()))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
this->DeleteUnusedInternalGeometry(GeoId);
|
const Part::Geometry *geo = getGeometry(GeoId);
|
||||||
|
// Only for supported types
|
||||||
|
if ((geo->getTypeId() == Part::GeomEllipse::getClassTypeId() ||
|
||||||
|
geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||||
|
geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() ||
|
||||||
|
geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ||
|
||||||
|
geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId())) {
|
||||||
|
|
||||||
|
if(deleteinternalgeo) {
|
||||||
|
this->DeleteUnusedInternalGeometry(GeoId, true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector< Part::Geometry * > newVals(vals);
|
std::vector< Part::Geometry * > newVals(vals);
|
||||||
newVals.erase(newVals.begin()+GeoId);
|
newVals.erase(newVals.begin()+GeoId);
|
||||||
|
@ -3474,7 +3486,7 @@ int SketchObject::ExposeInternalGeometry(int GeoId)
|
||||||
return -1; // not supported type
|
return -1; // not supported type
|
||||||
}
|
}
|
||||||
|
|
||||||
int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
int SketchObject::DeleteUnusedInternalGeometry(int GeoId, bool delgeoid)
|
||||||
{
|
{
|
||||||
if (GeoId < 0 || GeoId > getHighestCurveIndex())
|
if (GeoId < 0 || GeoId > getHighestCurveIndex())
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3552,11 +3564,14 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
||||||
if (majorconstraints<2)
|
if (majorconstraints<2)
|
||||||
delgeometries.push_back(majorelementindex);
|
delgeometries.push_back(majorelementindex);
|
||||||
|
|
||||||
|
if(delgeoid)
|
||||||
|
delgeometries.push_back(GeoId);
|
||||||
|
|
||||||
std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!!
|
std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!!
|
||||||
|
|
||||||
if (delgeometries.size()>0) {
|
if (delgeometries.size()>0) {
|
||||||
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
||||||
delGeometry(*it);
|
delGeometry(*it,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3637,11 +3652,14 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
||||||
if (majorelementindex == -1 && focus1elementindex !=-1 && focus1constraints<3) // focus has one coincident and one internal align
|
if (majorelementindex == -1 && focus1elementindex !=-1 && focus1constraints<3) // focus has one coincident and one internal align
|
||||||
delgeometries.push_back(focus1elementindex);
|
delgeometries.push_back(focus1elementindex);
|
||||||
|
|
||||||
|
if(delgeoid)
|
||||||
|
delgeometries.push_back(GeoId);
|
||||||
|
|
||||||
std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!!
|
std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!!
|
||||||
|
|
||||||
if (delgeometries.size()>0) {
|
if (delgeometries.size()>0) {
|
||||||
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
||||||
delGeometry(*it);
|
delGeometry(*it,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3700,11 +3718,14 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(delgeoid)
|
||||||
|
delgeometries.push_back(GeoId);
|
||||||
|
|
||||||
std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!!
|
std::sort(delgeometries.begin(), delgeometries.end()); // indices over an erased element get automatically updated!!
|
||||||
|
|
||||||
if (delgeometries.size()>0) {
|
if (delgeometries.size()>0) {
|
||||||
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
||||||
delGeometry(*it);
|
delGeometry(*it,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3727,7 +3748,7 @@ int SketchObject::DeleteUnusedInternalGeometry(int GeoId)
|
||||||
|
|
||||||
if (delgeometries.size()>0) {
|
if (delgeometries.size()>0) {
|
||||||
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
for (std::vector<int>::reverse_iterator it=delgeometries.rbegin(); it!=delgeometries.rend(); ++it) {
|
||||||
delGeometry(*it);
|
delGeometry(*it,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,13 @@ public:
|
||||||
int addGeometry(const Part::Geometry *geo, bool construction=false);
|
int addGeometry(const Part::Geometry *geo, bool construction=false);
|
||||||
/// add unspecified geometry
|
/// add unspecified geometry
|
||||||
int addGeometry(const std::vector<Part::Geometry *> &geoList, bool construction=false);
|
int addGeometry(const std::vector<Part::Geometry *> &geoList, bool construction=false);
|
||||||
/// delete geometry
|
/*!
|
||||||
int delGeometry(int GeoId);
|
\brief Deletes indicated geometry (by geoid).
|
||||||
|
\param GeoId - the geometry to delete
|
||||||
|
\param deleteinternalgeo - if true deletes the associated and unconstraint internal geometry, otherwise deletes only the GeoId
|
||||||
|
\retval int - 0 if successful
|
||||||
|
*/
|
||||||
|
int delGeometry(int GeoId, bool deleteinternalgeo = true);
|
||||||
/// add all constraints in the list
|
/// add all constraints in the list
|
||||||
int addConstraints(const std::vector<Constraint *> &ConstraintList);
|
int addConstraints(const std::vector<Constraint *> &ConstraintList);
|
||||||
/// add constraint
|
/// add constraint
|
||||||
|
@ -184,11 +189,13 @@ public:
|
||||||
* \return -1 on error
|
* \return -1 on error
|
||||||
*/
|
*/
|
||||||
int ExposeInternalGeometry(int GeoId);
|
int ExposeInternalGeometry(int GeoId);
|
||||||
/// Deletes all unused (not further constrained) internal geometry
|
|
||||||
/*!
|
/*!
|
||||||
* \return -1 on error
|
\brief Deletes all unused (not further constrained) internal geometry
|
||||||
|
\param GeoId - the geometry having the internal geometry to delete
|
||||||
|
\param delgeoid - if true in addition to the unused internal geometry also deletes the GeoId geometry
|
||||||
|
\retval int - returns -1 on error
|
||||||
*/
|
*/
|
||||||
int DeleteUnusedInternalGeometry(int GeoId);
|
int DeleteUnusedInternalGeometry(int GeoId, bool delgeoid=false);
|
||||||
|
|
||||||
/// retrieves for a Vertex number the corresponding GeoId and PosId
|
/// retrieves for a Vertex number the corresponding GeoId and PosId
|
||||||
void getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) const;
|
void getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user