Sketcher: Bspline - SketchObject - Delete Unused geometry extended to knots
This commit is contained in:
@@ -3405,6 +3405,7 @@ int SketchObject::exposeInternalGeometry(int GeoId)
|
||||
case Sketcher::BSplineKnotPoint:
|
||||
knotpoints[(*it)->InternalAlignmentIndex] = true;
|
||||
knotgeoids[(*it)->InternalAlignmentIndex] = (*it)->First;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@@ -3731,12 +3732,20 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid)
|
||||
|
||||
// First we search existing IA
|
||||
std::vector<int> controlpointgeoids(bsp->countPoles());
|
||||
std::vector<int> associatedcontraints(bsp->countPoles());
|
||||
std::vector<int> cpassociatedcontraints(bsp->countPoles());
|
||||
|
||||
std::vector<int> knotgeoids(bsp->countKnots());
|
||||
std::vector<int> kassociatedcontraints(bsp->countKnots());
|
||||
|
||||
std::vector<int>::iterator it;
|
||||
std::vector<int>::iterator ita;
|
||||
|
||||
for (it=controlpointgeoids.begin(), ita=associatedcontraints.begin(); it!=controlpointgeoids.end() && ita!=associatedcontraints.end(); ++it, ++ita) {
|
||||
for (it=controlpointgeoids.begin(), ita=cpassociatedcontraints.begin(); it!=controlpointgeoids.end() && ita!=cpassociatedcontraints.end(); ++it, ++ita) {
|
||||
(*it) = -1;
|
||||
(*ita) = 0;
|
||||
}
|
||||
|
||||
for (it=knotgeoids.begin(), ita=kassociatedcontraints.begin(); it!=knotgeoids.end() && ita!=kassociatedcontraints.end(); ++it, ++ita) {
|
||||
(*it) = -1;
|
||||
(*ita) = 0;
|
||||
}
|
||||
@@ -3750,6 +3759,9 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid)
|
||||
case Sketcher::BSplineControlPoint:
|
||||
controlpointgeoids[(*jt)->InternalAlignmentIndex] = (*jt)->First;
|
||||
break;
|
||||
case Sketcher::BSplineKnotPoint:
|
||||
knotgeoids[(*jt)->InternalAlignmentIndex] = (*jt)->First;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@@ -3758,7 +3770,7 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid)
|
||||
|
||||
std::vector<int> delgeometries;
|
||||
|
||||
for (it=controlpointgeoids.begin(), ita=associatedcontraints.begin(); it!=controlpointgeoids.end() && ita!=associatedcontraints.end(); ++it, ++ita) {
|
||||
for (it=controlpointgeoids.begin(), ita=cpassociatedcontraints.begin(); it!=controlpointgeoids.end() && ita!=cpassociatedcontraints.end(); ++it, ++ita) {
|
||||
if ((*it) != -1) {
|
||||
// look for a circle at geoid index
|
||||
for (std::vector< Sketcher::Constraint * >::const_iterator itc= vals.begin(); itc != vals.end(); ++itc) {
|
||||
@@ -3795,6 +3807,22 @@ int SketchObject::deleteUnusedInternalGeometry(int GeoId, bool delgeoid)
|
||||
}
|
||||
}
|
||||
|
||||
for (it=knotgeoids.begin(), ita=kassociatedcontraints.begin(); it!=knotgeoids.end() && ita!=kassociatedcontraints.end(); ++it, ++ita) {
|
||||
if ((*it) != -1) {
|
||||
// look for a point at geoid index
|
||||
for (std::vector< Sketcher::Constraint * >::const_iterator itc= vals.begin(); itc != vals.end(); ++itc) {
|
||||
if ((*itc)->Second == (*it) || (*itc)->First == (*it) || (*itc)->Third == (*it)) {
|
||||
(*ita)++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (*ita) < 2 ) { // IA
|
||||
delgeometries.push_back((*it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(delgeoid)
|
||||
delgeometries.push_back(GeoId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user