Salome HOME
1d66dba1885b03b0d1e751aa403a26abd721de7d
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultPart.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_ResultPart.h
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelAPI_ResultPart_H_
8 #define ModelAPI_ResultPart_H_
9
10 #include "ModelAPI_Result.h"
11 #include <GeomAPI_Trsf.h>
12
13 #include <string>
14
15 /**\class ModelAPI_ResultPart
16  * \ingroup DataModel
17  * \brief The Part document, result of a creation of new part feature.
18  *
19  * This result leaves without feature: no parametricity for this element,
20  * only add/remove, undo/redo.
21  */
22 class ModelAPI_ResultPart : public ModelAPI_Result
23 {
24  public:
25   /// Returns the group identifier of this result
26   MODELAPI_EXPORT virtual std::string groupName();
27
28   /// Returns the group identifier of this result
29   inline static std::string group()
30   {
31     static std::string MY_GROUP = "Parts";
32     return MY_GROUP;
33   }
34
35   /// part document reference attribute
36   inline static const std::string& DOC_REF()
37   {
38     static const std::string MY_DOC_REF("PartDocument");
39     return MY_DOC_REF;
40   }
41
42   /// default color for a result body
43   inline static const std::string& DEFAULT_COLOR()
44   {
45     static const std::string RESULT_BODY_COLOR("96,157,255");
46     return RESULT_BODY_COLOR;
47   }
48
49   // Part result can not be cencealed, even by the movement features
50   MODELAPI_EXPORT virtual bool isConcealed();
51
52   /// Returns the part-document of this result
53   virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
54
55   /// Returns the original part result: for transfomration features results this is 
56   /// the original Part feature result
57   virtual std::shared_ptr<ModelAPI_ResultPart> original() = 0;
58
59   /// Sets this document as current and if it is not loaded yet, loads it
60   virtual void activate() = 0;
61
62   /// Returns true if document is activated (loaded into the memory)
63   virtual bool isActivated() = 0;
64
65   /// Returns the name of the shape inside of the part
66   virtual std::string nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
67     int& theIndex) = 0;
68   /// Updates the selection inside of the part by the selection index
69   virtual bool updateInPart(const int theIndex) = 0;
70
71   /// Applies the additional transformation of the part
72   virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis, 
73     const std::shared_ptr<GeomAPI_Trsf>& theTransformation) = 0;
74
75   /// Returns the shape by the name in the part
76   virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
77     const std::string& theName, const std::string& theType, int& theIndex) = 0;
78
79   /// Returns the shape selected in the selection index
80   virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex) = 0;
81
82   /// Updates the shape-result of the part (called on Part feature execution)
83   virtual void updateShape() = 0;
84 };
85
86 //! Pointer on feature object
87 typedef std::shared_ptr<ModelAPI_ResultPart> ResultPartPtr;
88
89 #endif