Salome HOME
Issue #2250 Fatal error or sigsegv when I use the "Echap" key.
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchLabel.cpp
index 5464d078f641c9910a53557cee5a8a589a629c20..190b7e2a348435f0117c5fa28f9a050a2baa797b 100644 (file)
@@ -48,8 +48,6 @@
 #include <GeomDataAPI_Dir.h>
 #include <GeomAPI_XYZ.h>
 #include <GeomAPI_Face.h>
-#include <GeomAPI_Edge.h>
-#include <GeomAPI_ShapeExplorer.h>
 
 #include <SketchPlugin_Sketch.h>
 #include <SketcherPrs_Tools.h>
@@ -542,9 +540,6 @@ void PartSet_WidgetSketchLabel::activateSelection(bool toActivate)
     QIntList aModes;
     std::shared_ptr<GeomAPI_Pln> aPlane = plane();
     if (aPlane.get()) {
-      //QList<std::shared_ptr<ModuleBase_ViewerPrs>> aEdges = findCircularEdgesInPlane();
-      //foreach(std::shared_ptr<ModuleBase_ViewerPrs> aPrs, aEdges) {
-      //}
       myWorkshop->module()->activeSelectionModes(aModes);
     }
     else {
@@ -591,7 +586,7 @@ std::shared_ptr<GeomAPI_Dir>
   std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
   // X axis is preferable to be dirX on the sketch
   const double tol = Precision::Confusion();
-  bool isX = fabs(fabs(anA) - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol;
+  bool isX = fabs(anA - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol;
   std::shared_ptr<GeomAPI_Dir> aTempDir(
       isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
   std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
@@ -624,47 +619,3 @@ void PartSet_WidgetSketchLabel::onSetPlaneView()
       aModule->onViewTransformed();
   }
 }
-
-
-//******************************************************
-QList<std::shared_ptr<ModuleBase_ViewerPrs>> PartSet_WidgetSketchLabel::findCircularEdgesInPlane()
-{
-  QList<std::shared_ptr<ModuleBase_ViewerPrs>> aResult;
-  XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
-  XGUI_Displayer* aDisplayer = aWorkshop->displayer();
-  QObjectPtrList aDispObjects = aDisplayer->displayedObjects();
-
-  std::shared_ptr<GeomAPI_Pln> aPlane = plane();
-  foreach(ObjectPtr aObj, aDispObjects) {
-    ResultPtr aResObj = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
-    if (aResObj.get()) {
-      GeomShapePtr aShape = aResObj->shape();
-      if (aShape.get()) {
-        GeomAPI_ShapeExplorer aExplorer(aShape, GeomAPI_Shape::EDGE);
-        for(; aExplorer.more(); aExplorer.next()) {
-          GeomShapePtr aEdgeShape = aExplorer.current();
-          GeomAPI_Edge anEdge(aEdgeShape);
-          if ((anEdge.isCircle() || anEdge.isArc() || anEdge.isEllipse()) &&
-               anEdge.isInPlane(aPlane)) {
-            bool isContains = false;
-            // Check that edge is not used.
-            // It is possible that the same edge will be taken from different faces
-            foreach(std::shared_ptr<ModuleBase_ViewerPrs> aPrs, aResult) {
-              GeomAPI_Edge aUsedEdge(aPrs->shape());
-              if (aUsedEdge.isEqual(aEdgeShape)) {
-                isContains = true;
-                break;
-              }
-            }
-            if (!isContains) {
-              std::shared_ptr<ModuleBase_ViewerPrs>
-                aPrs(new ModuleBase_ViewerPrs(aResObj, aEdgeShape));
-              aResult.append(aPrs);
-            }
-          }
-        }
-      }
-    }
-  }
-  return aResult;
-}