]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Model/Model_ResultBody.cpp
Salome HOME
Copyright update 2022
[modules/shaper.git] / src / Model / Model_ResultBody.cpp
index c58ed7b065c3ed05a6826cc93ef713979d03dfe5..5cbc3e4196962fee7650c787156d3b8b34af4af7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
@@ -26,6 +26,7 @@
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Tools.h>
+#include <ModelAPI_AttributeImage.h>
 #include <Model_Data.h>
 #include <Events_Loop.h>
 #include <GeomAPI_ShapeIterator.h>
@@ -56,6 +57,13 @@ Model_ResultBody::~Model_ResultBody()
   delete myBuilder;
 }
 
+void Model_ResultBody::initAttributes()
+{
+  ModelAPI_Result::initAttributes();
+  // append the image attribute. It is empty, the attribute will be filled by a request
+  data()->addAttribute(IMAGE_ID(), ModelAPI_AttributeImage::typeId())->setIsArgument(false);
+}
+
 bool Model_ResultBody::generated(const GeomShapePtr& theNewShape,
   const std::string& theName, const bool theCheckIsInResult)
 {
@@ -408,7 +416,6 @@ void Model_ResultBody::updateSubs(
   myHistoryCash.Clear();
 }
 
-
 bool Model_ResultBody::isConnectedTopology()
 {
   TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
@@ -438,6 +445,16 @@ void Model_ResultBody::cleanCash()
   }
 }
 
+bool Model_ResultBody::hasTexture()
+{
+  AttributeImagePtr anImageAttr =
+    data()->image(ModelAPI_ResultBody::IMAGE_ID());
+  if (anImageAttr.get()) {
+    return anImageAttr->hasTexture();
+  }
+  return false;
+}
+
 // adds to the theSubSubs map all sub-shapes of theSub if it is compound of compsolid
 static void collectSubs(
   const GeomShapePtr theSub, TopTools_MapOfShape& theSubSubs, const bool theOneLevelMore)