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