Salome HOME
Providing Action class to have a common approach to start/finish/abort model transact...
[modules/shaper.git] / src / Model / Model_ResultConstruction.cpp
index e614fd89ca4f73ece682dcf6ff20d9cdb039bf80..11cf883cd60908c0915e0fbf373948d640b0cf24 100644 (file)
@@ -44,7 +44,9 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape()
 
 Model_ResultConstruction::Model_ResultConstruction()
 {
+  myIsDisabled = true; // by default it is not initialized and false to be after created
   myIsInHistory = true;
+  myIsInfinite = false;
   myFacesUpToDate = false;
   setIsConcealed(false);
 }
@@ -59,14 +61,16 @@ int Model_ResultConstruction::facesNum()
   if (!myFacesUpToDate) {
     std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = 
       std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(myShape);
-    std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
-    GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
-      aWirePtr->norm(), aWirePtr, aFaces);
-    std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
-    for(; aFIter != aFaces.end(); aFIter++) {
-      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
-      if (aFace.get())
-        myFaces.push_back(aFace);
+    if (aWirePtr.get()) {
+      std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
+      GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
+        aWirePtr->norm(), aWirePtr, aFaces);
+      std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
+      for(; aFIter != aFaces.end(); aFIter++) {
+        std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
+        if (aFace.get() && !aFace->isNull())
+          myFaces.push_back(aFace);
+      }
     }
     myFacesUpToDate = true;
   }
@@ -77,3 +81,13 @@ std::shared_ptr<GeomAPI_Face> Model_ResultConstruction::face(const int theIndex)
 {
   return myFaces[theIndex];
 }
+
+bool Model_ResultConstruction::isInfinite()
+{
+  return myIsInfinite;
+}
+
+void Model_ResultConstruction::setInfinite(const bool theInfinite)
+{
+  myIsInfinite = theInfinite;
+}