-// 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
#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>
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)
{
myHistoryCash.Clear();
}
-void Model_ResultBody::setTextureFile(const std::string & theTextureFile)
-{
- ModelAPI_Result::setTextureFile(theTextureFile);
- for( auto sub : mySubs){
- sub->setTextureFile(theTextureFile);
- }
- for(auto map : mySubsMap){
- map.first->setTextureFile(theTextureFile);
- }
-}
-
bool Model_ResultBody::isConnectedTopology()
{
TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
}
}
+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)