]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1649: Added "Reverse" flag handling.
authordbv <dbv@opencascade.com>
Tue, 2 Aug 2016 09:25:57 +0000 (12:25 +0300)
committerdbv <dbv@opencascade.com>
Wed, 3 Aug 2016 07:07:12 +0000 (10:07 +0300)
src/ConstructionPlugin/ConstructionPlugin_Plane.cpp
src/ConstructionPlugin/plane_widget.xml

index 29792e54bd808626b0532e4a2a0f7eb4e263627b..c95d450ad06d98e3856d29ad7e71d9d5f9e44d3c 100644 (file)
@@ -225,7 +225,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByLineAndPoint()
     std::shared_ptr<GeomAPI_Lin> aLin = anEdge->line();
     std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
     std::shared_ptr<GeomAPI_Pln> aNewPln(new GeomAPI_Pln(aPnt, aLin->direction()));
-    int aSize = aLin->distance(aPnt);
+    double aSize = aLin->distance(aPnt);
     aSize *= 2.0;
     aRes = GeomAlgoAPI_FaceBuilder::squareFace(aNewPln, aSize);
   } else {
@@ -248,6 +248,8 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByDistanceFromOth
       aFaceAttr->isInitialized() && aDistAttr->isInitialized()) {
 
     double aDist = aDistAttr->value();
+    bool anIsReverse = boolean(REVERSE())->value();
+    if(anIsReverse) aDist = -aDist;
     GeomShapePtr aShape = aFaceAttr->value();
     if (!aShape.get()) {
       aShape = aFaceAttr->context()->shape();
@@ -309,6 +311,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
     aFaceShape = aFaceSelection->context()->shape();
   }
   std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+  aFace = makeRectangularFace(aFace, aFace->getPlane());
 
   // Get axis.
   AttributeSelectionPtr anAxisSelection = selection(AXIS());
@@ -325,11 +328,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
   double anAngle = real(ANGLE())->value();
 
   GeomAlgoAPI_Rotation aRotationAlgo(aFace, anAxis, anAngle);
-
   std::shared_ptr<GeomAPI_Face> aRes(new GeomAPI_Face(aRotationAlgo.shape()));
-  std::shared_ptr<GeomAPI_Pln> aNewPln = aRes->getPlane();
-
-  aRes = makeRectangularFace(aRes, aNewPln);
 
   return aRes;
 }
index 5a9d746373c27181cb90e6741d1349a8df7ce2ed..5e216574cdcdbce38c613e42c861a34891e9602b 100644 (file)
                        label="Angle"
                        tooltip="Angle for rotation around axis."
                        icon="icons/Construction/angle.png"
-                       default="0"/>
+                       min="0"
+                       default="45">
+            <validator id="GeomValidators_Positive"/>
+          </doublevalue>
         </box>
       </toolbox>
     </box>