Salome HOME
0c2660c212f5c062783ca9f5b2486c394b4652c9
[modules/geom.git] / src / ShHealOper / ShHealOper_ShapeProcess.hxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // File:      ShHealOper_ShapeProcess.hxx
24 // Created:   13.04.04 11:45:20
25 // Author:    Galina KULIKOVA
26 //
27 #ifndef ShHealOper_ShapeProcess_HeaderFile
28 #define ShHealOper_ShapeProcess_HeaderFile
29
30 #include <Resource_Manager.hxx>
31 #include <TopoDS_Shape.hxx>
32 #include <TopTools_DataMapOfShapeShape.hxx>
33 #include <TColStd_SequenceOfAsciiString.hxx>
34 #include <TCollection_AsciiString.hxx>
35 #include <ShapeProcessAPI_ApplySequence.hxx>
36 #include <ShapeProcess_ShapeContext.hxx>
37
38 #include "ShHealOper_Tool.hxx"
39
40 ///  Class ShHealOper_ShapeProcess
41 //Class for performing Shape healing operations on the shape.
42
43 class ShHealOper_ShapeProcess : public ShHealOper_Tool
44 {
45  public:
46   // ---------- PUBLIC METHODS ----------
47
48   /// Empty constructor
49   Standard_EXPORT ShHealOper_ShapeProcess();
50   //Constructor initializes by defaults parameters 
51   // (name of resource file - ShHealing, prefix - ShapeProcess, 
52   // SaveHistory = Standard_False, level = TopAbs_FACE)
53
54   /// Copy constructor
55   Standard_EXPORT ShHealOper_ShapeProcess 
56     (const TCollection_AsciiString& theNameResource,
57      const TCollection_AsciiString& thePrefix = "ShapeProcess");
58   //Constructor initializes by specified name of resource file and prefix
59   
60   Standard_EXPORT void Perform(const TopoDS_Shape& theOldShape, 
61                                            TopoDS_Shape& theNewShape);
62   //Perform modifications of specified shape.
63   
64   Standard_EXPORT void SetOperators(const TColStd_SequenceOfAsciiString& theSeqOperators);
65   //Set sequence of operatotrs different than sequence written in the resourse file.
66   
67   Standard_EXPORT Standard_Boolean GetOperators(TColStd_SequenceOfAsciiString& theSeqOperators);
68   //Get sequence of operators.
69
70   Standard_EXPORT void SetParameter(const TCollection_AsciiString& theNameParam,
71                                     const TCollection_AsciiString& theVal);
72   //Set value of specified parameter different than value written in the resourse file.
73   
74   Standard_EXPORT Standard_Boolean GetParameter(const TCollection_AsciiString& theNameParam,
75                                        TCollection_AsciiString& theVal);
76   //Get value of parameter by it's name.
77
78  inline void SetSaveHistoryMode(const Standard_Boolean theSaveHistory,
79                                 TopAbs_ShapeEnum theuntil = TopAbs_FACE)
80  {
81    mySaveHistoryMode = theSaveHistory;
82    myLevel = theuntil;
83  }
84   //Set SaveHistoryMode nnd level of the shapes until history will be saved to the
85   //specified values.
86
87
88   inline Standard_Boolean GetSaveHistoryMode()
89   {
90     return mySaveHistoryMode;
91   }
92   //Returns SaveHistoryMode.
93   
94   inline Standard_Boolean GetModifiedShape(const TopoDS_Shape& theOldShape,
95                                            TopoDS_Shape& theNewShape)
96   {
97     Standard_Boolean isModif = (!myMapModifications.IsEmpty() && 
98                                 myMapModifications.IsBound(theOldShape));
99     if(isModif)
100       theNewShape = myMapModifications.Find(theOldShape);
101     else
102       theNewShape = theOldShape;
103     return isModif;
104   }
105   //Get modified shape for any specified shape
106   
107   inline Standard_Boolean isDone()
108   {
109     return myDone;
110   }
111   //returns status of operation.
112  protected:
113   // ---------- PROTECTED METHODS ----------
114
115
116
117  private:
118   // ---------- PRIVATE FIELDS ----------
119
120   //Handle(Resource_Manager) myResource;
121   ShapeProcessAPI_ApplySequence myOperations;
122   TCollection_AsciiString myPrefix;
123   TopTools_DataMapOfShapeShape myMapModifications;
124   Standard_Boolean mySaveHistoryMode;
125   TopAbs_ShapeEnum myLevel;
126   Standard_Boolean myDone;
127  public:
128 // Declaration of CASCADE RTTI
129 //DEFINE_STANDARD_RTTI (ShHealOper_ShapeProcess)
130 };
131
132 // Definition of HANDLE object using Standard_DefineHandle.hxx
133 //DEFINE_STANDARD_HANDLE (ShHealOper_ShapeProcess, )
134
135
136 #endif