return;
double aDist[2][2];
for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++)
+ for (int j = 0; j < 2; j++) {
aDist[i][j] = anIntersection->distance(aPoints[i][j]);
+ if (fabs(aDist[i][j]) <= tolerance)
+ aDist[i][j] = 0.0;
+ }
if (aDist[i][0] > tolerance && aDist[i][1] > tolerance &&
aDist[i][0] + aDist[i][1] < aPoints[i][0]->distance(aPoints[i][1]) + 2.0 * tolerance) {
// the intersection point is an inner point of the line,
aDir[i] = std::shared_ptr<GeomAPI_Dir2d>(new GeomAPI_Dir2d(
aPoints[i][0]->xy()->decreased(anIntersection->xy())));
// main direction is opposite => change signs
- aDist[i][0] *= -1.0;
- aDist[i][1] *= -1.0;
+ if (aDist[i][0] < 0.0) {
+ aDist[i][0] *= -1.0;
+ aDist[i][1] *= -1.0;
+ }
}
aConstraint.other = false;
if (!myFeatureStorage)
return aResult;
// Obtain regular constraints interacting with the feature and find its ID
- std::set<ConstraintPtr> aConstraints = myFeatureStorage->getConstraints(theFeature);
- if (aConstraints.empty())
- return aResult;
- std::set<ConstraintPtr>::iterator aConstrIter = aConstraints.begin();
- for (; aConstrIter != aConstraints.end(); ++aConstrIter) {
- ConstraintConstraintMap::const_iterator aCIter = myConstraints.find(*aConstrIter);
- if (aCIter == myConstraints.end())
- continue;
+ ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin();
+ for (; aCIter != myConstraints.end(); ++aCIter) {
aResult = aCIter->second->getId(theFeature);
if (aResult != SLVS_E_UNKNOWN)
return aResult;
if (!myFeatureStorage)
return aResult;
// Obtain regular constraints interacting with the attribute and find its ID
- std::set<ConstraintPtr> aConstraints = myFeatureStorage->getConstraints(theAttribute);
- std::set<ConstraintPtr>::iterator aConstrIter = aConstraints.begin();
- for (; aConstrIter != aConstraints.end(); aConstrIter++) {
- ConstraintConstraintMap::const_iterator aCIter = myConstraints.find(*aConstrIter);
- if (aCIter == myConstraints.end())
- continue;
+ ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin();
+ for (; aCIter != myConstraints.end(); ++aCIter) {
aResult = aCIter->second->getId(theAttribute);
if (aResult != SLVS_E_UNKNOWN)
return aResult;
if (aCIter == myConstraints.end())
return;
+ // Remove entities not used by constraints
+ myStorage->removeUnusedEntities();
+
if (isFullyRemoved)
myConstraints.erase(aCIter);
else if (aCIter != myConstraints.end() &&