Salome HOME
Issue #1860: fix end lines with spaces
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Arc.cpp
index ef74d2d0496c34b910ccbcdc155e17a50e0046a1..90801362d927793da818c1628b5b191837e312f6 100644 (file)
@@ -150,10 +150,10 @@ void SketchPlugin_Arc::execute()
 
     std::shared_ptr<GeomAPI_Shape> aCircleShape;
     if(!isInversed->value()) {
-      aCircleShape = 
+      aCircleShape =
         GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
     } else {
-      aCircleShape = 
+      aCircleShape =
         GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal);
     }
 
@@ -195,15 +195,15 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
           bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
           if (aHasPlane) {
             std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
-            std::shared_ptr<GeomAPI_Pnt> 
+            std::shared_ptr<GeomAPI_Pnt>
               aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
             std::shared_ptr<GeomAPI_Pnt> aEndPoint = aStartPoint;
             if (aTypeAttr && aTypeAttr->isInitialized() &&
                 aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
-              if (aEndAttr->isInitialized() && // 
+              if (aEndAttr->isInitialized() && //
                   aEndAttr->pnt()->distance(aStartAttr->pnt()) > tolerance) {
                 aEndPoint = aSketch->to3D(aEndAttr->x(), aEndAttr->y());
-                std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr = 
+                std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
                   std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
                   data()->attribute(PASSED_POINT_ID()));
                 if (!aPassedAttr->isInitialized()) {
@@ -211,10 +211,10 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
                   // check that center is bad for the current start and end and must be recomputed
                   std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(new GeomAPI_Circ2d(
                     aCenterAttr->pnt(), aStartAttr->pnt()));
-                  std::shared_ptr<GeomAPI_Pnt2d> aProjection = 
+                  std::shared_ptr<GeomAPI_Pnt2d> aProjection =
                     aCircleForArc->project(aEndAttr->pnt());
                   if (!aProjection.get() || aEndAttr->pnt()->distance(aProjection) > tolerance) {
-                    std::shared_ptr<GeomAPI_XY> aDir = 
+                    std::shared_ptr<GeomAPI_XY> aDir =
                       aEndAttr->pnt()->xy()->decreased(aStartAttr->pnt()->xy())->multiplied(0.5);
                     double x = aDir->x();
                     double y = aDir->y();
@@ -231,7 +231,7 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
             AttributeBooleanPtr isInversed =
               std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(attribute(INVERSED_ID()));
 
-            std::shared_ptr<GeomAPI_Shape> aCircleShape = 
+            std::shared_ptr<GeomAPI_Shape> aCircleShape =
               (isInversed->isInitialized() && isInversed->value()) ?
                 GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aEndPoint, aStartPoint, aNormal) :
                 GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
@@ -241,7 +241,7 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
           }
         }
         // make a visible point
-        std::shared_ptr<GeomAPI_Shape> aCenterPointShape = 
+        std::shared_ptr<GeomAPI_Shape> aCenterPointShape =
           GeomAlgoAPI_PointBuilder::vertex(aCenter);
         aShapes.push_back(aCenterPointShape);
       }
@@ -319,10 +319,10 @@ bool SketchPlugin_Arc::isFeatureValid()
 
   bool isValid = false;
   if (anArcType == ARC_TYPE_THREE_POINTS())
-    isValid = aStartAttr->isInitialized() && 
+    isValid = aStartAttr->isInitialized() &&
       anEndAttr->isInitialized() && aPassedAttr->isInitialized();
   else
-    isValid = aCenterAttr->isInitialized() && 
+    isValid = aCenterAttr->isInitialized() &&
       aStartAttr->isInitialized() && anEndAttr->isInitialized();
 
   return isValid;
@@ -375,7 +375,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
       std::dynamic_pointer_cast<ModelAPI_AttributeString>(attribute(ARC_TYPE()));
 
   // this is before others since here end attribute may be changed, but with the special behavior
-  if (aTypeAttr->value() == ARC_TYPE_TANGENT() && 
+  if (aTypeAttr->value() == ARC_TYPE_TANGENT() &&
      (theID == TANGENT_POINT_ID() || theID == END_ID())) {
     SketchPlugin_Sketch* aSketch = sketch();
     AttributeRefAttrPtr aTangPtAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
@@ -412,7 +412,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
       std::shared_ptr<GeomAPI_Pnt2d> aMidPnt(
           new GeomAPI_Pnt2d(aEndPntCoord->added(aTangPnt2d->xy())->multiplied(0.5)));
 
-      // compute center of arc by calculating intersection of 
+      // compute center of arc by calculating intersection of
       // orthogonal line and middle perpendicular
       std::shared_ptr<GeomAPI_Lin2d> anOrthoLine(new GeomAPI_Lin2d(aTangPnt2d, anOrthoDir));
       std::shared_ptr<GeomAPI_Lin2d> aMiddleLine(new GeomAPI_Lin2d(aMidPnt, aMidDir));
@@ -452,7 +452,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
       }
     }
     // update all other attributes due to the base attributes values
-    if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) { 
+    if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
       // update passed point due to start, end and center
       if (aCenter->distance(aStart) > tolerance && aCenter->distance(anEnd) > tolerance) {
         // project passed point t othe circle
@@ -477,7 +477,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
           std::shared_ptr<GeomAPI_Dir2d> aMidDir(new GeomAPI_Dir2d(aMidDirXY));
           if ((aStartDir->cross(aMidDir) > 0) ^ !isReversed())
             aMidDir->reverse();
-          std::shared_ptr<GeomAPI_XY> aPassedPnt = 
+          std::shared_ptr<GeomAPI_XY> aPassedPnt =
             aCenter->xy()->added(aMidDir->xy()->multiplied(aCenter->distance(aStart)));
           std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()))->
             setValue(aPassedPnt->x(), aPassedPnt->y());
@@ -497,7 +497,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
     adjustPeriod(aStartParam);
     adjustPeriod(aEndParam);
     // use the passed point for the angle calculation
-    if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) { 
+    if (aTypeAttr->value() == ARC_TYPE_THREE_POINTS()) {
       std::shared_ptr<GeomDataAPI_Point2D> aPassedAttr =
         std::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(PASSED_POINT_ID()));
       double aPassedParam;
@@ -558,7 +558,7 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
   }
 
   if (theID == RADIUS_ID()) {
-    if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() || 
+    if (!aStartAttr->isInitialized() || !anEndAttr->isInitialized() ||
         !aCenterAttr->isInitialized())
       return;
     // move center and passed point
@@ -572,14 +572,14 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
     double aRadius = aRadiusAttr->value();
 
     data()->blockSendAttributeUpdated(true);
-    std::shared_ptr<GeomAPI_Dir2d> 
+    std::shared_ptr<GeomAPI_Dir2d>
       aStartDir(new GeomAPI_Dir2d(aStart->xy()->decreased(aCenter->xy())));
-    std::shared_ptr<GeomAPI_XY> 
+    std::shared_ptr<GeomAPI_XY>
       aNewStart = aStartDir->xy()->multiplied(aRadius)->added(aCenter->xy());
     aStartAttr->setValue(aNewStart->x(), aNewStart->y());
-    std::shared_ptr<GeomAPI_Dir2d> 
+    std::shared_ptr<GeomAPI_Dir2d>
       anEndDir(new GeomAPI_Dir2d(anEnd->xy()->decreased(aCenter->xy())));
-    std::shared_ptr<GeomAPI_XY> 
+    std::shared_ptr<GeomAPI_XY>
       aNewEnd = anEndDir->xy()->multiplied(aRadius)->added(aCenter->xy());
     anEndAttr->setValue(aNewEnd->x(), aNewEnd->y());
     data()->blockSendAttributeUpdated(false);