SHAPER 9.16.0
Model_ResultPart.h
1// Copyright (C) 2014-2026 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 Model_ResultPart_H_
21#define Model_ResultPart_H_
22
23#include "Model.h"
24#include <ModelAPI_ResultPart.h>
25#include <TopoDS_Shape.hxx>
26#include <gp_Trsf.hxx>
27#include <map>
28
37{
39 TopoDS_Shape myShape;
41 std::shared_ptr<gp_Trsf> myTrsf;
42 public:
43
46 inline static const std::string& BASE_REF_ID()
47 {
48 static const std::string MY_BASE_REF("BaseReference");
49 return MY_BASE_REF;
50 }
52 virtual void initAttributes();
54 MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> partDoc();
55
58 MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> original();
59
61 MODEL_EXPORT virtual void activate();
62
64 MODEL_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
65 const bool theFlag);
66
68 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
69
74 MODEL_EXPORT virtual std::wstring nameInPart(const std::shared_ptr<GeomAPI_Shape>& theShape,
75 int& theIndex);
76
78 MODEL_EXPORT virtual bool updateInPart(const int theIndex);
80 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
81 const std::wstring& theName, const std::string& theType, int& theIndex);
82 MODEL_EXPORT virtual void setSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
83 const std::vector<int>& theColor);
84
86 MODEL_EXPORT virtual void getSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
87 std::vector<int>& theColor);
88
90 MODEL_EXPORT virtual void getColoredSubShapes
91 (std::map<std::shared_ptr<GeomAPI_Shape>, std::vector<int>>& theColoredSubShapes);
92
94 MODEL_EXPORT virtual void removeSubShapeColors();
95
97 MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName);
99 MODEL_EXPORT virtual void updateShape();
101 MODEL_EXPORT virtual void setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
102 const std::shared_ptr<GeomAPI_Trsf>& theTransformation);
104 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Trsf> summaryTrsf();
105
107 MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
108 std::string& theDefault);
109
111 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex);
112
114 MODEL_EXPORT virtual void loadPart();
115
117 MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> selection();
118
119protected:
122
124 gp_Trsf sumTrsf();
125
127 virtual bool isActivated();
128
129 friend class Model_Objects;
130};
131
132#endif
The Part document, result of a creation of new part feature.
Definition: ModelAPI_ResultPart.h:37
Manager of objects of the document.
Definition: Model_Objects.h:46
The Part document, result of a creation of new part feature.
Definition: Model_ResultPart.h:37
virtual std::shared_ptr< GeomAPI_Shape > shape()
Result shape of part document is compound of bodies inside of this part.
Definition: Model_ResultPart.cpp:221
virtual void loadPart()
Loading the part from file.
Definition: Model_ResultPart.cpp:129
virtual std::shared_ptr< ModelAPI_ResultPart > original()
Returns the original part result: for transformation features results this is the original Part featu...
Definition: Model_ResultPart.cpp:144
virtual std::shared_ptr< GeomAPI_Shape > selectionValue(const int theIndex)
Returns the shape selected in the selection index.
Definition: Model_ResultPart.cpp:479
virtual std::shared_ptr< GeomAPI_Trsf > summaryTrsf()
Returns the summary transformations of all references to the origin.
Definition: Model_ResultPart.cpp:527
virtual void activate()
Sets this document as current and if it is not loaded yet, loads it.
Definition: Model_ResultPart.cpp:89
virtual std::shared_ptr< ModelAPI_AttributeSelection > selection()
Return Attribute selection.
Definition: Model_ResultPart.cpp:374
virtual void setTrsf(std::shared_ptr< ModelAPI_Result > theThis, const std::shared_ptr< GeomAPI_Trsf > &theTransformation)
Applies the additional transformation of the part.
Definition: Model_ResultPart.cpp:514
virtual bool isActivated()
Returns true if document is activated (loaded into the memory)
Definition: Model_ResultPart.cpp:152
virtual void setSubShapeColor(const std::shared_ptr< GeomAPI_Shape > &theShape, const std::vector< int > &theColor)
Set color on subshape.
Definition: Model_ResultPart.cpp:442
virtual void removeSubShapeColors()
Forget subshape colors.
Definition: Model_ResultPart.cpp:473
virtual std::shared_ptr< GeomAPI_Shape > shapeInPart(const std::wstring &theName, const std::string &theType, int &theIndex)
Returns the shape by the name in the part.
Definition: Model_ResultPart.cpp:408
virtual void colorConfigInfo(std::string &theSection, std::string &theName, std::string &theDefault)
Returns the parameters of color definition in the resources config manager.
Definition: Model_ResultPart.cpp:500
virtual void initAttributes()
Request for initialization of data model of the result: adding all attributes.
Definition: Model_ResultPart.cpp:58
virtual void updateShape()
Updates the shape-result of the part (called on Part feature execution)
Definition: Model_ResultPart.cpp:508
virtual bool combineGeometrical(const int theIndex, std::wstring &theNewName)
Updates the selection inside of the part as a geometrical selection.
Definition: Model_ResultPart.cpp:390
virtual std::shared_ptr< ModelAPI_Document > partDoc()
Returns the part-document of this result.
Definition: Model_ResultPart.cpp:74
virtual void getSubShapeColor(const std::shared_ptr< GeomAPI_Shape > &theShape, std::vector< int > &theColor)
Get color on subshape.
Definition: Model_ResultPart.cpp:453
virtual std::wstring nameInPart(const std::shared_ptr< GeomAPI_Shape > &theShape, int &theIndex)
Returns the name of the shape inside of the part.
Definition: Model_ResultPart.cpp:286
virtual bool setDisabled(std::shared_ptr< ModelAPI_Result > theThis, const bool theFlag)
disable all feature of the part on disable of the part result
Definition: Model_ResultPart.cpp:164
gp_Trsf sumTrsf()
returns sum of transformations of the whole sequence of transformation-parts
Definition: Model_ResultPart.cpp:381
static const std::string & BASE_REF_ID()
the reference to the base result document, may be null if this is the root, others make sequence of r...
Definition: Model_ResultPart.h:46
Model_ResultPart()
makes a result on a temporary feature (an action)
Definition: Model_ResultPart.cpp:85
virtual bool updateInPart(const int theIndex)
Updates the selection inside of the part by the selection index.
Definition: Model_ResultPart.cpp:357
virtual void getColoredSubShapes(std::map< std::shared_ptr< GeomAPI_Shape >, std::vector< int > > &theColoredSubShapes)
Get colored shapes from result.
Definition: Model_ResultPart.cpp:467