Salome HOME
updated copyright message
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultPart.h
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef ModelAPI_ResultPart_H_
21 #define ModelAPI_ResultPart_H_
22
23 #include "ModelAPI_Result.h"
24 class GeomAPI_Trsf;
25
26 #include <string>
27
28 /**\class ModelAPI_ResultPart
29  * \ingroup DataModel
30  * \brief The Part document, result of a creation of new part feature.
31  *
32  * This result leaves without feature: no parametricity for this element,
33  * only add/remove, undo/redo.
34  */
35 class ModelAPI_ResultPart : public ModelAPI_Result
36 {
37  public:
38   /// Returns the group identifier of this result
39   MODELAPI_EXPORT virtual std::string groupName();
40
41   /// Returns the group identifier of this result
42   inline static std::string group()
43   {
44     static std::string MY_GROUP = "Parts";
45     return MY_GROUP;
46   }
47
48   /// part document reference attribute
49   inline static const std::string& DOC_REF()
50   {
51     static const std::string MY_DOC_REF("PartDocument");
52     return MY_DOC_REF;
53   }
54
55   /// default color for a result body
56   inline static const std::string& DEFAULT_COLOR()
57   {
58     static const std::string RESULT_BODY_COLOR("96,157,255");
59     return RESULT_BODY_COLOR;
60   }
61
62   /// Returns the part-document of this result
63   virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
64
65   /// Returns the original part result: for transformation features results this is
66   /// the original Part feature result
67   virtual std::shared_ptr<ModelAPI_ResultPart> original() = 0;
68
69   /// Sets this document as current and if it is not loaded yet, loads it
70   virtual void activate() = 0;
71
72   /// Returns true if document is activated (loaded into the memory)
73   virtual bool isActivated() = 0;
74
75   /// Returns the name of the shape inside of the part
76   virtual std::wstring nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
77     int& theIndex) = 0;
78   /// Updates the selection inside of the part by the selection index
79   virtual bool updateInPart(const int theIndex) = 0;
80
81   /// Applies the additional transformation of the part
82   virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
83     const std::shared_ptr<GeomAPI_Trsf>& theTransformation) = 0;
84
85   /// Returns the summary transformations of all references to the origin
86   virtual std::shared_ptr<GeomAPI_Trsf> summaryTrsf() = 0;
87
88   /// Returns the shape by the name in the part
89   virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
90     const std::wstring& theName, const std::string& theType, int& theIndex) = 0;
91
92   /// Updates the selection inside of the part as a geometrical selection
93   virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName) = 0;
94
95   /// Returns the shape selected in the selection index
96   virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex) = 0;
97
98   /// Updates the shape-result of the part (called on Part feature execution)
99   virtual void updateShape() = 0;
100
101   /// Loading the part from file
102   virtual void loadPart() = 0;
103 };
104
105 //! Pointer on feature object
106 typedef std::shared_ptr<ModelAPI_ResultPart> ResultPartPtr;
107
108 #endif