Salome HOME
Merge remote-tracking branch 'remotes/origin/HigherLevelObjectsHistory'
[modules/shaper.git] / src / PartSet / PartSet_ResultSketchPrs.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 7e62e4b..380e4ac
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // 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_ResultSketchPrs.h"
@@ -25,7 +24,7 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultConstruction.h>
-#include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_ResultBody.h>
 #include <GeomAPI_PlanarEdges.h>
 
 #include <Events_InfoMessage.h>
@@ -74,8 +73,8 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult)
     aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
 
   // Activate individual repaintng if this is a part of compsolid
-  ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult);
-  SetAutoHilight(aCompSolid.get() == NULL);
+  ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(myResult);
+  SetAutoHilight(anOwner.get() == NULL);
 
   ModuleBase_Tools::setPointBallHighlighting(this);
 }
@@ -107,8 +106,12 @@ void PartSet_ResultSketchPrs::Compute(
 
   // change deviation coefficient to provide more precise circle
   //ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes());
-  AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
-
+  try {
+    AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
+  }
+  catch (...) {
+    return;
+  }
   if (!myAuxiliaryCompound.IsNull()) {
     setAuxiliaryPresentationStyle(true);
 
@@ -281,7 +284,8 @@ void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape,
   CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
                                                                           (aResultFeature);
   std::list<ResultPtr> anAuxiliaryResults;
-  for (int i = 0; i < aSketchFeature->numberOfSubs(); i++) {
+  int aNumberOfSubs = aSketchFeature->numberOfSubs();
+  for (int i = 0; i < aNumberOfSubs; i++) {
     FeaturePtr aFeature = aSketchFeature->subFeature(i);
     if (PartSet_Tools::isAuxiliarySketchEntity(aFeature)) {
       std::list<ResultPtr> aResults = aFeature->results();