]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultPart.h
Salome HOME
Make the movement, placement and rotation 3D features may be applied to the Part...
[modules/shaper.git] / src / Model / Model_ResultPart.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_ResultPart.hxx
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_ResultPart_H_
8 #define Model_ResultPart_H_
9
10 #include "Model.h"
11 #include <ModelAPI_ResultPart.h>
12 #include <TopoDS_Shape.hxx>
13
14 /**\class Model_ResultPart
15  * \ingroup DataModel
16  * \brief The Part document, result of a creation of new part feature.
17  *
18  * This result leaves without feature: no parametricity for this element,
19  * only add/remove, undo/redo.
20  */
21 class Model_ResultPart : public ModelAPI_ResultPart
22 {
23   TopoDS_Shape myShape; ///< shape of this part created from bodies (updated only of Part deactivation)
24  public:
25   /// Request for initialization of data model of the result: adding all attributes
26   virtual void initAttributes();
27   /// Returns the part-document of this result
28   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> partDoc();
29   /// Part has no stored feature: this method returns NULL
30   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> owner();
31
32   /// Sets this document as current and if it is not loaded yet, loads it
33   MODEL_EXPORT virtual void activate();
34
35   /// disable all feature of the part on disable of the part result
36   MODEL_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
37     const bool theFlag);
38
39   /// Result shape of part document is compound of bodies inside of this part
40   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
41
42   /// Returns the name of the shape inside of the part
43   /// \param theShape selected shape in this document
44   /// \param theIndex is returned as one-based index if selection was required, "0" otherwise
45   /// \returns empty name is selection is not correct
46   MODEL_EXPORT virtual std::string nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
47     int& theIndex);
48
49   /// Updates the selection inside of the part by the selection index
50   MODEL_EXPORT virtual bool updateInPart(const int theIndex);
51   /// Returns the shape by the name in the part
52   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(const std::string& theName);
53   /// Updates the shape-result of the part (called on Part feature execution)
54   MODEL_EXPORT virtual void updateShape();
55   MODEL_EXPORT virtual void setShape(std::shared_ptr<ModelAPI_Result> theThis, 
56     const std::shared_ptr<GeomAPI_Shape>& theTransformed);
57
58   /// Returns the parameters of color definition in the resources config manager
59   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
60                                             std::string& theDefault);
61
62 protected:
63   /// makes a result on a temporary feature (an action)
64   Model_ResultPart();
65
66   /// Sets the data manager of an object (document does), here also attributes are initialized
67   virtual void setData(std::shared_ptr<ModelAPI_Data> theData);
68
69   /// Returns true if document is activated (loaded into the memory)
70   virtual bool isActivated();
71
72   friend class Model_Objects;
73 };
74
75 #endif