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_StdMeshers.hxx"
34 #include "SMESH_Hypothesis.hxx"
35 #include "Utils_SALOME_Exception.hxx"
37 #include <TopoDS_Face.hxx>
38 #include <TopoDS_Vertex.hxx>
42 // =========================================================
44 * This hypothesis specifies a meshed face to take a mesh pattern from
45 * and optionally association of vertices between the source face and a
46 * target one (where a hipothesis is assigned to)
48 // =========================================================
50 class STDMESHERS_EXPORT StdMeshers_ProjectionSource2D: public SMESH_Hypothesis
54 StdMeshers_ProjectionSource2D( int hypId, int studyId, SMESH_Gen * gen );
56 virtual ~StdMeshers_ProjectionSource2D();
59 * Sets a source <face> to take a mesh pattern from
61 void SetSourceFace(const TopoDS_Shape& face)
62 throw ( SALOME_Exception );
65 * Returns the source face
67 TopoDS_Face GetSourceFace() const;
70 * Sets source <mesh> to take a mesh pattern from
72 void SetSourceMesh(SMESH_Mesh* mesh);
77 SMESH_Mesh* GetSourceMesh() const { return _sourceMesh; }
80 * Sets vertex association between the source face and the target one.
81 * This parameter is optional.
82 * Two vertices must belong to one edge of a face
84 void SetVertexAssociation(const TopoDS_Shape& sourceVertex1,
85 const TopoDS_Shape& sourceVertex2,
86 const TopoDS_Shape& targetVertex1,
87 const TopoDS_Shape& targetVertex2)
88 throw ( SALOME_Exception );
91 * Returns the <i>-th source vertex associated with the <i>-th target vertex.
92 * Result may be nil if association not set.
93 * Valid indices are 1 and 2
95 TopoDS_Vertex GetSourceVertex(int i) const throw ( SALOME_Exception );
98 * Returns the <i>-th target vertex associated with the <i>-th source vertex.
99 * Result may be nil if association not set.
100 * Valid indices are 1 and 2
102 TopoDS_Vertex GetTargetVertex(int i) const throw ( SALOME_Exception );
105 * \brief Test if vertex association defined
106 * \retval bool - test result
108 bool HasVertexAssociation() const
109 { return ( !_sourceVertex1.IsNull() && !_targetVertex1.IsNull() &&
110 !_sourceVertex2.IsNull() && !_targetVertex2.IsNull()); }
113 * \brief Return all parameters
115 void GetStoreParams(TopoDS_Shape& s1,
119 TopoDS_Shape& s5) const;
122 * \brief Set all parameters without notifying on modification
124 void RestoreParams(const TopoDS_Shape& s1,
125 const TopoDS_Shape& s2,
126 const TopoDS_Shape& s3,
127 const TopoDS_Shape& s4,
128 const TopoDS_Shape& s5,
131 virtual std::ostream & SaveTo(std::ostream & save);
132 virtual std::istream & LoadFrom(std::istream & load);
133 friend std::ostream & operator <<(std::ostream & save, StdMeshers_ProjectionSource2D & hyp);
134 friend std::istream & operator >>(std::istream & load, StdMeshers_ProjectionSource2D & hyp);
137 * \brief Initialize parameters by the mesh built on the geometry
138 * \param theMesh - the built mesh
139 * \param theShape - the geometry of interest
140 * \retval bool - true if parameter values have been successfully defined
142 * Implementation does noting
144 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
148 TopoDS_Face _sourceFace;
149 SMESH_Mesh* _sourceMesh;
150 TopoDS_Vertex _sourceVertex1;
151 TopoDS_Vertex _sourceVertex2;
152 TopoDS_Vertex _targetVertex1;
153 TopoDS_Vertex _targetVertex2;