1 // HOMARD HOMARD : implementaion of HOMARD idl descriptions
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : HOMARD_Zone.cxx
25 // Author : Paul RASCLE, EDF
28 #include "HOMARD_Zone.hxx"
29 #include "utilities.h"
31 //=============================================================================
33 * default constructor:
35 //=============================================================================
36 HOMARD_Zone::HOMARD_Zone():
37 _NomZone( "" ),_ZoneType( 2 ),
38 _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ),
39 _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ),
40 _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 )
42 MESSAGE("HOMARD_Zone");
45 //=============================================================================
46 HOMARD_Zone::~HOMARD_Zone()
48 MESSAGE("~HOMARD_Zone");
51 //=============================================================================
52 void HOMARD_Zone::SetName( const char* NomZone )
54 _NomZone = std::string( NomZone );
57 //=============================================================================
58 std::string HOMARD_Zone::GetName() const
63 //=============================================================================
64 std::string HOMARD_Zone::GetDumpPython() const
66 std::ostringstream aScript;
67 aScript << "\n# Creation of the ";
68 if ( _ZoneType == 2 ) { aScript << "box " << _NomZone << "\n";}
69 if ( _ZoneType == 4 ) { aScript << "sphere " << _NomZone << "\n"; }
71 aScript << "\t" << _NomZone << " = homard.CreateZone('" << _NomZone ;
72 aScript << "', " << _ZoneType << ")\n";
78 aScript << "\t" << _NomZone << ".SetBox(" ;
79 aScript << _Xmin << ", " << _Xmax << ", " << _Ymin << ", " << _Ymax << ", " << _Zmin << ", " << _Zmax << ")\n";
85 aScript << "\t" << _NomZone << ".SetSphere(" ;
86 aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n";
95 //=============================================================================
96 void HOMARD_Zone::SetZoneType( int ZoneType )
101 //=============================================================================
102 int HOMARD_Zone::GetZoneType() const
107 //======================================================================
108 void HOMARD_Zone::SetLimit( double X0, double X1, double X2 )
110 _Xincr = X0; _Yincr = X1; _Zincr = X2;
112 //=======================================================================================
113 void HOMARD_Zone::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
115 _Xmin = X0; _Xmax = X1;
116 _Ymin = X2; _Ymax = X3;
117 _Zmin = X4; _Zmax = X5;
120 //======================================================================
121 void HOMARD_Zone::SetSphere( double X0, double X1, double X2, double X3 )
123 _Xcentre = X0; _Ycentre = X1; _Zcentre = X2;
127 //=======================================================================================
128 std::vector<double> HOMARD_Zone::GetLimit() const
130 std::vector<double> mesLimit;
131 mesLimit.push_back( _Xincr );
132 mesLimit.push_back( _Yincr );
133 mesLimit.push_back( _Zincr );
137 //=======================================================================================
138 std::vector<double> HOMARD_Zone::GetBox() const
140 std::vector<double> mesCoor;
141 mesCoor.push_back( _Xmin ); mesCoor.push_back( _Xmax );
142 mesCoor.push_back( _Ymin ); mesCoor.push_back( _Ymax );
143 mesCoor.push_back( _Zmin ); mesCoor.push_back( _Zmax );
147 //=======================================================================================
148 std::vector<double> HOMARD_Zone::GetSphere() const
150 std::vector<double> mesCoor;
151 mesCoor.push_back( _Xcentre );
152 mesCoor.push_back( _Ycentre );
153 mesCoor.push_back( _Zcentre );
154 mesCoor.push_back( _rayon );
158 //=============================================================================
159 void HOMARD_Zone::AddHypo( const char* NomHypo )
161 _ListHypo.push_back( std::string( NomHypo ) );
164 //=============================================================================
165 void HOMARD_Zone::SupprHypo( const char* NomHypo )
167 std::list<std::string>::iterator it = find( _ListHypo.begin(), _ListHypo.end(), NomHypo );
168 if ( it != _ListHypo.end() )
170 MESSAGE ("Dans SupprHypo pour " << NomHypo);
171 _ListHypo.erase( it );
175 //=============================================================================
176 const std::list<std::string>& HOMARD_Zone::GetHypo() const
181 //=============================================================================
182 void HOMARD_Zone::SupprHypos()