SHAPER  9.15.0
ModelAPI_ResultPart.h
1 // Copyright (C) 2014-2025 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 #include <map>
28 
37 {
38  public:
40  MODELAPI_EXPORT virtual std::string groupName();
41 
43  inline static std::string group()
44  {
45  static std::string MY_GROUP = "Parts";
46  return MY_GROUP;
47  }
48 
50  inline static const std::string& DOC_REF()
51  {
52  static const std::string MY_DOC_REF("PartDocument");
53  return MY_DOC_REF;
54  }
55 
57  inline static const std::string& DEFAULT_COLOR()
58  {
59  static const std::string RESULT_BODY_COLOR("96,157,255");
60  return RESULT_BODY_COLOR;
61  }
62 
64  virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
65 
68  virtual std::shared_ptr<ModelAPI_ResultPart> original() = 0;
69 
71  virtual void activate() = 0;
72 
74  virtual bool isActivated() = 0;
75 
77  virtual std::wstring nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
78  int& theIndex) = 0;
80  virtual bool updateInPart(const int theIndex) = 0;
81 
83  virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
84  const std::shared_ptr<GeomAPI_Trsf>& theTransformation) = 0;
85 
87  virtual std::shared_ptr<GeomAPI_Trsf> summaryTrsf() = 0;
88 
90  virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
91  const std::wstring& theName, const std::string& theType, int& theIndex) = 0;
93  virtual void setSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
94  const std::vector<int>& theColor) = 0;
95 
97  virtual void getSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
98  std::vector<int>& theColor) = 0;
99 
101  virtual void getColoredSubShapes
102  (std::map<std::shared_ptr<GeomAPI_Shape>, std::vector<int>>&theColoredShapes) = 0;
103 
105  virtual void removeSubShapeColors() = 0;
106 
108  virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName) = 0;
109 
111  virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex) = 0;
112 
114  virtual void updateShape() = 0;
115 
117  virtual std::shared_ptr<ModelAPI_AttributeSelection> selection() = 0;
118 
120  virtual void loadPart() = 0;
121 };
122 
124 typedef std::shared_ptr<ModelAPI_ResultPart> ResultPartPtr;
125 
126 #endif
Keep the transformation matrix coefficients.
Definition: GeomAPI_Trsf.h:36
The Part document, result of a creation of new part feature.
Definition: ModelAPI_ResultPart.h:37
virtual bool updateInPart(const int theIndex)=0
Updates the selection inside of the part by the selection index.
virtual std::shared_ptr< ModelAPI_ResultPart > original()=0
Returns the original part result: for transformation features results this is the original Part featu...
virtual void getSubShapeColor(const std::shared_ptr< GeomAPI_Shape > &theShape, std::vector< int > &theColor)=0
Get subshape color.
static const std::string & DOC_REF()
part document reference attribute
Definition: ModelAPI_ResultPart.h:50
virtual std::wstring nameInPart(const std::shared_ptr< GeomAPI_Shape > &theShape, int &theIndex)=0
Returns the name of the shape inside of the part.
virtual std::string groupName()
Returns the group identifier of this result.
Definition: ModelAPI_ResultPart.cpp:24
virtual void activate()=0
Sets this document as current and if it is not loaded yet, loads it.
virtual bool isActivated()=0
Returns true if document is activated (loaded into the memory)
virtual std::shared_ptr< GeomAPI_Trsf > summaryTrsf()=0
Returns the summary transformations of all references to the origin.
virtual std::shared_ptr< GeomAPI_Shape > shapeInPart(const std::wstring &theName, const std::string &theType, int &theIndex)=0
Returns the shape by the name in the part.
virtual std::shared_ptr< GeomAPI_Shape > selectionValue(const int theIndex)=0
Returns the shape selected in the selection index.
virtual void getColoredSubShapes(std::map< std::shared_ptr< GeomAPI_Shape >, std::vector< int >> &theColoredShapes)=0
Get colored subshapes from result.
virtual void updateShape()=0
Updates the shape-result of the part (called on Part feature execution)
static std::string group()
Returns the group identifier of this result.
Definition: ModelAPI_ResultPart.h:43
static const std::string & DEFAULT_COLOR()
default color for a result body
Definition: ModelAPI_ResultPart.h:57
virtual void removeSubShapeColors()=0
Forget subshapes colors.
virtual std::shared_ptr< ModelAPI_AttributeSelection > selection()=0
Return Attribute selection.
virtual std::shared_ptr< ModelAPI_Document > partDoc()=0
Returns the part-document of this result.
virtual bool combineGeometrical(const int theIndex, std::wstring &theNewName)=0
Updates the selection inside of the part as a geometrical selection.
virtual void setSubShapeColor(const std::shared_ptr< GeomAPI_Shape > &theShape, const std::vector< int > &theColor)=0
Set color on subshape.
virtual void loadPart()=0
Loading the part from file.
virtual void setTrsf(std::shared_ptr< ModelAPI_Result > theThis, const std::shared_ptr< GeomAPI_Trsf > &theTransformation)=0
Applies the additional transformation of the part.
The result of a feature.
Definition: ModelAPI_Result.h:37