1 // SMESH SMESH : idl implementation based on 'SMESH' unit's calsses
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : StdMeshers_ProjectionSource2D.hxx
25 // Author : Edward AGAPOV
29 #ifndef _SMESH_ProjectionSource2D_HXX_
30 #define _SMESH_ProjectionSource2D_HXX_
32 #include "SMESH_Hypothesis.hxx"
33 #include "Utils_SALOME_Exception.hxx"
35 #include <TopoDS_Face.hxx>
36 #include <TopoDS_Vertex.hxx>
40 // =========================================================
42 * This hypothesis specifies a meshed face to take a mesh pattern from
43 * and optionally association of vertices between the source face and a
44 * target one (where a hipothesis is assigned to)
46 // =========================================================
48 class StdMeshers_ProjectionSource2D: public SMESH_Hypothesis
52 StdMeshers_ProjectionSource2D( int hypId, int studyId, SMESH_Gen * gen );
54 virtual ~StdMeshers_ProjectionSource2D();
57 * Sets a source <face> to take a mesh pattern from
59 void SetSourceFace(const TopoDS_Shape& face)
60 throw ( SALOME_Exception );
63 * Returns the source face
65 TopoDS_Face GetSourceFace() const;
68 * Sets source <mesh> to take a mesh pattern from
70 void SetSourceMesh(SMESH_Mesh* mesh) { _sourceMesh = mesh; }
75 SMESH_Mesh* GetSourceMesh() const { return _sourceMesh; }
78 * Sets vertex association between the source face and the target one.
79 * This parameter is optional.
80 * Two vertices must belong to one edge of a face
82 void SetVertexAssociation(const TopoDS_Shape& sourceVertex1,
83 const TopoDS_Shape& sourceVertex2,
84 const TopoDS_Shape& targetVertex1,
85 const TopoDS_Shape& targetVertex2)
86 throw ( SALOME_Exception );
89 * Returns the <i>-th source vertex associated with the <i>-th target vertex.
90 * Result may be nil if association not set.
91 * Valid indices are 1 and 2
93 TopoDS_Vertex GetSourceVertex(int i) const throw ( SALOME_Exception );
96 * Returns the <i>-th target vertex associated with the <i>-th source vertex.
97 * Result may be nil if association not set.
98 * Valid indices are 1 and 2
100 TopoDS_Vertex GetTargetVertex(int i) const throw ( SALOME_Exception );
103 * \brief Test if vertex association defined
104 * \retval bool - test result
106 bool HasVertexAssociation() const
107 { return ( !_sourceVertex1.IsNull() && !_targetVertex1.IsNull() &&
108 !_sourceVertex2.IsNull() && !_targetVertex2.IsNull()); }
111 * \brief Return all parameters
113 void GetStoreParams(TopoDS_Shape& s1,
117 TopoDS_Shape& s5) const;
120 * \brief Set all parameters without notifying on modification
122 void RestoreParams(const TopoDS_Shape& s1,
123 const TopoDS_Shape& s2,
124 const TopoDS_Shape& s3,
125 const TopoDS_Shape& s4,
126 const TopoDS_Shape& s5,
129 virtual std::ostream & SaveTo(std::ostream & save);
130 virtual std::istream & LoadFrom(std::istream & load);
131 friend std::ostream & operator <<(std::ostream & save, StdMeshers_ProjectionSource2D & hyp);
132 friend std::istream & operator >>(std::istream & load, StdMeshers_ProjectionSource2D & hyp);
135 * \brief Initialize parameters by the mesh built on the geometry
136 * \param theMesh - the built mesh
137 * \param theShape - the geometry of interest
138 * \retval bool - true if parameter values have been successfully defined
140 * Implementation does noting
142 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
146 TopoDS_Face _sourceFace;
147 SMESH_Mesh* _sourceMesh;
148 TopoDS_Vertex _sourceVertex1;
149 TopoDS_Vertex _sourceVertex2;
150 TopoDS_Vertex _targetVertex1;
151 TopoDS_Vertex _targetVertex2;