]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultBody.cpp
Salome HOME
Issue #1112 tab key doesn't work on the last field of left panels
[modules/shaper.git] / src / Model / Model_ResultBody.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_ResultBody.cpp
4 // Created:     08 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include <Model_ResultBody.h>
8 #include <Model_BodyBuilder.h>
9 #include <ModelAPI_AttributeIntArray.h>
10 #include <ModelAPI_Tools.h>
11 #include <Config_PropManager.h>
12 // DEB
13 //#include <TCollection_AsciiString.hxx>
14 //#include <TDF_Tool.hxx>
15 //#define DEB_IMPORT 1
16
17 Model_ResultBody::Model_ResultBody()
18 {
19   myBuilder = new Model_BodyBuilder(this);
20 }
21
22 void Model_ResultBody::initAttributes()
23 {
24   // append the color attribute. It is empty, the attribute will be filled by a request
25   DataPtr aData = data();
26   aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId());
27 }
28
29 void Model_ResultBody::colorConfigInfo(std::string& theSection, std::string& theName,
30   std::string& theDefault)
31 {
32   theSection = "Visualization";
33   theName = "result_body_color";
34   theDefault = DEFAULT_COLOR();
35 }
36
37 bool Model_ResultBody::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag)
38 {
39   bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
40   if (aChanged) { // state is changed, so modifications are needed
41     myBuilder->evolutionToSelection(theFlag);
42   }
43   return aChanged;
44 }
45
46 bool Model_ResultBody::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
47 {
48   return myBuilder->isLatestEqual(theShape);
49 }
50
51 bool Model_ResultBody::isConcealed()
52 {
53   if (ModelAPI_ResultBody::isConcealed())
54     return true;
55   ResultPtr aThis = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
56   if (aThis.get()) {
57     ResultCompSolidPtr aParent = ModelAPI_Tools::compSolidOwner(aThis);
58     if (aParent.get()) {
59       if (aParent->isConcealed())
60         return true;
61     }
62   }
63   return false;
64 }