Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_PreviewPlanes.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 379bd78..2fca720
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "PartSet_PreviewPlanes.h"
@@ -24,6 +23,7 @@
 
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultPart.h>
 
 #include <XGUI_Tools.h>
 #include <XGUI_Displayer.h>
@@ -49,7 +49,9 @@ bool PartSet_PreviewPlanes::hasVisualizedBodies(ModuleBase_IWorkshop* theWorksho
   foreach (ObjectPtr anObj, aDisplayed) {
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
     // result constructions should not be taken as a body
-    if (aResult.get() != NULL && aResult->groupName() == ModelAPI_ResultBody::group()) {
+    if (aResult.get() != NULL &&
+      ((aResult->groupName() == ModelAPI_ResultBody::group()) ||
+      ((aResult->groupName() == ModelAPI_ResultPart::group()))) ) {
       GeomShapePtr aShape = aResult->shape();
       if (aShape.get()) {
         // vertices, edges should not be taken as a body
@@ -137,9 +139,9 @@ void PartSet_PreviewPlanes::showPreviewPlanes(ModuleBase_IWorkshop* theWorkshop)
     myXYPlane = createPreviewPlane(anOrigin, aXYDir, aB);
   }
   XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer();
-  aDisp->displayAIS(myYZPlane, true, false);
-  aDisp->displayAIS(myXZPlane, true, false);
-  aDisp->displayAIS(myXYPlane, true, false);
+  aDisp->displayAIS(myYZPlane, true, 0, false);
+  aDisp->displayAIS(myXZPlane, true, 0, false);
+  aDisp->displayAIS(myXYPlane, true, 0, false);
   myPreviewDisplayed = true;
 }
 
@@ -147,12 +149,15 @@ AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr<GeomAPI_P
                                                        std::shared_ptr<GeomAPI_Dir> theNorm,
                                                        const int theRGB[3])
 {
-  double aSize = Config_PropManager::integer(SKETCH_TAB_NAME, "planes_size");
+  double aSize = Config_PropManager::real(SKETCH_TAB_NAME, "planes_size");
+  if (aSize <= Precision::Confusion())
+    aSize = 200;   // Set default value
+
   std::shared_ptr<GeomAPI_Shape> aFace =
     GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize);
   AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject());
   aAIS->createShape(aFace);
-  aAIS->setWidth(Config_PropManager::integer(SKETCH_TAB_NAME, "planes_thickness"));
+  aAIS->setWidth(Config_PropManager::real(SKETCH_TAB_NAME, "planes_thickness"));
   aAIS->setColor(theRGB[0], theRGB[1], theRGB[2]);
   return aAIS;
 }