Salome HOME
ad6e7491766c8b15d8a9606d2810de74ab01eb52
[modules/geom.git] / src / ShHealOper / ShHealOper_ShapeProcess.hxx
1 //  Copyright (C) 2007-2008  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.
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 // File:      ShHealOper_ShapeProcess.hxx
23 // Created:   13.04.04 11:45:20
24 // Author:    Galina KULIKOVA
25 //
26 #ifndef ShHealOper_ShapeProcess_HeaderFile
27 #define ShHealOper_ShapeProcess_HeaderFile
28
29 #include <Resource_Manager.hxx>
30 #include <TopoDS_Shape.hxx>
31 #include <TopTools_DataMapOfShapeShape.hxx>
32 #include <TColStd_SequenceOfAsciiString.hxx>
33 #include <TCollection_AsciiString.hxx>
34 #include <ShapeProcessAPI_ApplySequence.hxx>
35 #include <ShapeProcess_ShapeContext.hxx>
36
37 ///  Class ShHealOper_ShapeProcess
38 //Class for performing Shape healing operations on the shape.
39
40 class ShHealOper_ShapeProcess 
41 {
42  public:
43   // ---------- PUBLIC METHODS ----------
44
45   /// Empty constructor
46   Standard_EXPORT ShHealOper_ShapeProcess();
47   //Constuctor initializes by defaults parameters 
48   // (name of resource file - ShHealing, prefix - ShapeProcess, 
49   // SaveHistory = Standard_False, level = TopAbs_FACE)
50
51   /// Copy constructor
52   Standard_EXPORT ShHealOper_ShapeProcess 
53     (const TCollection_AsciiString& theNameResource,
54      const TCollection_AsciiString& thePrefix = "ShapeProcess");
55   //Constuctor initializes by specified name of resource file and prefix
56   
57   Standard_EXPORT void Perform(const TopoDS_Shape& theOldShape, 
58                                            TopoDS_Shape& theNewShape);
59   //Perform modifications of specified shape.
60   
61   Standard_EXPORT void SetOperators(const TColStd_SequenceOfAsciiString& theSeqOperators);
62   //Set sequence of operatotrs different than sequence written in the resourse file.
63   
64   Standard_EXPORT Standard_Boolean GetOperators(TColStd_SequenceOfAsciiString& theSeqOperators);
65   //Get sequence of operators.
66
67   Standard_EXPORT void SetParameter(const TCollection_AsciiString& theNameParam,
68                                     const TCollection_AsciiString& theVal);
69   //Set value of specified parameter different than value written in the resourse file.
70   
71   Standard_EXPORT Standard_Boolean GetParameter(const TCollection_AsciiString& theNameParam,
72                                        TCollection_AsciiString& theVal);
73   //Get value of parameter by it's name.
74
75  inline void SetSaveHistoryMode(const Standard_Boolean theSaveHistory,
76                                 TopAbs_ShapeEnum theuntil = TopAbs_FACE)
77  {
78    mySaveHistoryMode = theSaveHistory;
79    myLevel = theuntil;
80  }
81   //Set SaveHistoryMode nnd level of the shapes until history will be saved to the
82   //specified values.
83
84
85   inline Standard_Boolean GetSaveHistoryMode()
86   {
87     return mySaveHistoryMode;
88   }
89   //Returns SaveHistoryMode.
90   
91   inline Standard_Boolean GetModifiedShape(const TopoDS_Shape& theOldShape,
92                                            TopoDS_Shape& theNewShape)
93   {
94     Standard_Boolean isModif = (!myMapModifications.IsEmpty() && 
95                                 myMapModifications.IsBound(theOldShape));
96     if(isModif)
97       theNewShape = myMapModifications.Find(theOldShape);
98     else
99       theNewShape = theOldShape;
100     return isModif;
101   }
102   //Get modified shape for any specified shape
103   
104   inline Standard_Boolean isDone()
105   {
106     return myDone;
107   }
108   //returns status of operation.
109  protected:
110   // ---------- PROTECTED METHODS ----------
111
112
113
114  private:
115   // ---------- PRIVATE FIELDS ----------
116
117   //Handle(Resource_Manager) myResource;
118   ShapeProcessAPI_ApplySequence myOperations;
119   TCollection_AsciiString myPrefix;
120   TopTools_DataMapOfShapeShape myMapModifications;
121   Standard_Boolean mySaveHistoryMode;
122   TopAbs_ShapeEnum myLevel;
123   Standard_Boolean myDone;
124  public:
125 // Declaration of CASCADE RTTI
126 //DEFINE_STANDARD_RTTI (ShHealOper_ShapeProcess)
127 };
128
129 // Definition of HANDLE object using Standard_DefineHandle.hxx
130 //DEFINE_STANDARD_HANDLE (ShHealOper_ShapeProcess, )
131
132
133 #endif