]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Revert unsuitable changes in the Middle point constraint
authorazv <azv@opencascade.com>
Tue, 31 May 2016 05:32:54 +0000 (08:32 +0300)
committerazv <azv@opencascade.com>
Tue, 31 May 2016 05:33:14 +0000 (08:33 +0300)
src/SketchSolver/SketchSolver_ConstraintMiddle.cpp
src/SketchSolver/SketchSolver_ConstraintMiddle.h
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp

index 5c1a98604aa781cb60ad09099d8fbc34f2b40b03..545fa468716157c323ccdbf7cbc92b6762b6666b 100644 (file)
@@ -44,31 +44,3 @@ void SketchSolver_ConstraintMiddle::notifyCoincidenceChanged(
     process();
   }
 }
-
-void SketchSolver_ConstraintMiddle::adjustConstraint()
-{
-  BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder();
-
-  ConstraintWrapperPtr aConstraint = myStorage->constraint(myBaseConstraint).front();
-  const std::list<EntityWrapperPtr>& aSubs = aConstraint->entities();
-  std::shared_ptr<GeomAPI_Pnt2d> aMidPoint, aStart, aEnd;
-  std::list<EntityWrapperPtr>::const_iterator aSIt = aSubs.begin();
-  for (; aSIt != aSubs.end(); ++aSIt) {
-    if ((*aSIt)->type() == ENTITY_POINT)
-      aMidPoint = aBuilder->point(*aSIt);
-    else if ((*aSIt)->type() == ENTITY_LINE) {
-      const std::list<EntityWrapperPtr>& aLinePoints = (*aSIt)->subEntities();
-      aStart = aBuilder->point(aLinePoints.front());
-      aEnd = aBuilder->point(aLinePoints.back());
-    }
-  }
-
-  if (aMidPoint && aStart && aEnd) {
-    std::shared_ptr<GeomAPI_XY> aMP = aMidPoint->xy();
-    double aDot = aMP->decreased(aStart->xy())->dot(aMP->decreased(aEnd->xy()));
-    if (aDot > 0.0) {
-      aBuilder->adjustConstraint(aConstraint);
-      myStorage->addConstraint(myBaseConstraint, aConstraint);
-    }
-  }
-}
index fadcadab295093a42f59c7a696feb116f180ce89..b86e714f5b756816a56d5de6db9c86e76cf64157 100644 (file)
@@ -23,10 +23,6 @@ public:
 
   /// \brief Notify constraint, that coincidence appears or removed
   virtual void notifyCoincidenceChanged(EntityWrapperPtr theCoincAttr1, EntityWrapperPtr theCoincAttr2);
-
-protected:
-  /// \brief This method is used in derived objects to check consistence of constraint.
-  virtual void adjustConstraint();
 };
 
 #endif
index d5d039040be23a3354008b70b67892ca1af86c92..9792467c1d4375ad36885561270bb5c8851ecf55 100644 (file)
@@ -56,8 +56,6 @@ static void adjustAngle(ConstraintWrapperPtr theConstraint);
 static void adjustMirror(ConstraintWrapperPtr theConstraint);
 /// \brief Update a sign of the point-line distance constraint
 static void adjustPtLineDistance(ConstraintWrapperPtr theConstraint);
-/// \brief Update point to be a middle of a line
-static void adjustMiddlePoint(ConstraintWrapperPtr theConstraint);
 
 /// \brief Transform points to be symmetric regarding to the mirror line
 static void makeMirrorPoints(EntityWrapperPtr theOriginal,
@@ -299,8 +297,6 @@ void SolveSpaceSolver_Builder::adjustConstraint(ConstraintWrapperPtr theConstrai
     adjustMirror(theConstraint);
   else if (aType == CONSTRAINT_PT_LINE_DISTANCE)
     adjustPtLineDistance(theConstraint);
-  else if (aType == CONSTRAINT_MIDDLE_POINT)
-    adjustMiddlePoint(theConstraint);
 }
 
 EntityWrapperPtr SolveSpaceSolver_Builder::createFeature(
@@ -831,26 +827,3 @@ void adjustPtLineDistance(ConstraintWrapperPtr theConstraint)
   if (aPtLineVec->cross(aLineVec) * theConstraint->value() < 0.0)
     theConstraint->setValue(theConstraint->value() * (-1.0));
 }
-
-void adjustMiddlePoint(ConstraintWrapperPtr theConstraint)
-{
-  BuilderPtr aBuilder = SolveSpaceSolver_Builder::getInstance();
-
-  const std::list<EntityWrapperPtr>& aSubs = theConstraint->entities();
-  std::shared_ptr<GeomAPI_Pnt2d> aStart, aEnd;
-  std::shared_ptr<GeomDataAPI_Point2D> aMidPoint;
-  std::list<EntityWrapperPtr>::const_iterator aSIt = aSubs.begin();
-  for (; aSIt != aSubs.end(); ++aSIt) {
-    if ((*aSIt)->type() == ENTITY_POINT)
-      aMidPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>((*aSIt)->baseAttribute());
-    else if ((*aSIt)->type() == ENTITY_LINE) {
-      const std::list<EntityWrapperPtr>& aLinePoints = (*aSIt)->subEntities();
-      aStart = aBuilder->point(aLinePoints.front());
-      aEnd = aBuilder->point(aLinePoints.back());
-    }
-  }
-  if (aMidPoint && aStart && aEnd) {
-    std::shared_ptr<GeomAPI_XY> aMid = aStart->xy()->added(aEnd->xy())->multiplied(0.5);
-    aMidPoint->setValue(aMid->x(), aMid->y());
-  }
-}