Salome HOME
Explicit initialization of myDisabled and myConcealed fields of base objects (to...
[modules/shaper.git] / src / Model / Model_ResultConstruction.cpp
index 17b20df98dc4eff497b1eb03ed3bfbbbbaf72e09..990dee11e474b2739eb4d24cd5da321c5d28817e 100644 (file)
@@ -15,7 +15,7 @@ void Model_ResultConstruction::initAttributes()
 {
   // append the color attribute. It is empty, the attribute will be filled by a request
   DataPtr aData = data();
-  aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::type());
+  aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId());
 }
 
 void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::string& theName,
@@ -28,9 +28,9 @@ void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::str
 
 void Model_ResultConstruction::setShape(std::shared_ptr<GeomAPI_Shape> theShape)
 {
-  if (myShape != theShape) {
+  if (myShape != theShape && (!theShape.get() || !theShape->isEqual(myShape))) {
     myShape = theShape;
-    if (theShape.get() && (!myShape.get() || !theShape->isEqual(myShape))) {
+    if (theShape.get()) {
       myFacesUpToDate = false;
       myFaces.clear();
     }
@@ -45,8 +45,8 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape()
 Model_ResultConstruction::Model_ResultConstruction()
 {
   myIsInHistory = true;
+  myIsInfinite = false;
   myFacesUpToDate = false;
-  setIsConcealed(false);
 }
 
 void Model_ResultConstruction::setIsInHistory(const bool isInHistory)
@@ -59,14 +59,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->dirY(), 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 +79,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;
+}