X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultBody.cpp;h=d7e3f46c9fe0bf6336671aa5a4f3e1e83c62fbc4;hb=283433d9c2f39fbd332d6eba691b6a0cd875e29d;hp=967265f837880942854bc7446676a9b3eac60073;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 967265f83..d7e3f46c9 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -1,54 +1,43 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: Model_ResultBody.cpp // Created: 08 Jul 2014 // Author: Mikhail PONIKAROV #include -#include -#include -#include -#include -#include +#include +#include +#include +// DEB +//#include +//#include +//#define DEB_IMPORT 1 Model_ResultBody::Model_ResultBody() { + myBuilder = new Model_BodyBuilder(this); } -void Model_ResultBody::store(const boost::shared_ptr& theShape) +void Model_ResultBody::initAttributes() { - boost::shared_ptr aData = boost::dynamic_pointer_cast(data()); - if (aData) { - TDF_Label& aShapeLab = aData->shapeLab(); - // TODO: to add the naming mechanism for shape storage in the next iteration - TNaming_Builder aBuilder(aShapeLab); - if (!theShape) - return; // bad shape - TopoDS_Shape aShape = theShape->impl(); - if (aShape.IsNull()) - return; // null shape inside - - aBuilder.Generated(aShape); - } + // append the color attribute. It is empty, the attribute will be filled by a request + DataPtr aData = data(); + aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId()); } -boost::shared_ptr Model_ResultBody::shape() +void Model_ResultBody::colorConfigInfo(std::string& theSection, std::string& theName, + std::string& theDefault) { - boost::shared_ptr aData = boost::dynamic_pointer_cast(data()); - if (aData) { - TDF_Label& aShapeLab = aData->shapeLab(); - Handle(TNaming_NamedShape) aName; - if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) { - TopoDS_Shape aShape = aName->Get(); - if (!aShape.IsNull()) { - boost::shared_ptr aRes(new GeomAPI_Shape); - aRes->setImpl(new TopoDS_Shape(aShape)); - return aRes; - } - } - } - return boost::shared_ptr(); + theSection = "Visualization"; + theName = "result_body_color"; + theDefault = DEFAULT_COLOR(); } -boost::shared_ptr Model_ResultBody::owner() +bool Model_ResultBody::setDisabled(std::shared_ptr theThis, const bool theFlag) { - return myOwner; + bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag); + if (aChanged) { // state is changed, so modifications are needed + myBuilder->evolutionToSelection(theFlag); + } + return aChanged; }