Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_Hypothesis_2D.cxx
1 //  NETGENPlugin : C++ implementation
2 //
3 //  Copyright (C) 2006  OPEN CASCADE, CEA/DEN, EDF R&D
4 // 
5 //  This library is free software; you can redistribute it and/or 
6 //  modify it under the terms of the GNU Lesser General Public 
7 //  License as published by the Free Software Foundation; either 
8 //  version 2.1 of the License. 
9 // 
10 //  This library is distributed in the hope that it will be useful, 
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
13 //  Lesser General Public License for more details. 
14 // 
15 //  You should have received a copy of the GNU Lesser General Public 
16 //  License along with this library; if not, write to the Free Software 
17 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
18 // 
19 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
20 //
21 //
22 // File      : NETGENPlugin_Hypothesis_2D.cxx
23 // Author    : Michael Sazonov (OCN)
24 // Date      : 28/03/2006
25 // Project   : SALOME
26 // $Header$
27 //=============================================================================
28
29 using namespace std;
30 #include <NETGENPlugin_Hypothesis_2D.hxx>
31 #include <utilities.h>
32
33 //=============================================================================
34 /*!
35  *  
36  */
37 //=============================================================================
38 NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D (int hypId, int studyId,
39                                                         SMESH_Gen * gen)
40   : NETGENPlugin_Hypothesis(hypId, studyId, gen),
41     _quadAllowed (GetDefaultQuadAllowed())
42 {
43   _name = "NETGEN_Parameters_2D";
44   _param_algo_dim = 2;
45 }
46
47 //=============================================================================
48 /*!
49  *  
50  */
51 //=============================================================================
52 void NETGENPlugin_Hypothesis_2D::SetQuadAllowed(bool theVal)
53 {
54   if (theVal != _quadAllowed)
55   {
56     _quadAllowed = theVal;
57     NotifySubMeshesHypothesisModification();
58   }
59 }
60
61 //=============================================================================
62 /*!
63  *  
64  */
65 //=============================================================================
66 bool NETGENPlugin_Hypothesis_2D::GetDefaultQuadAllowed()
67 {
68   return false;
69 }
70
71 //=============================================================================
72 /*!
73  *  
74  */
75 //=============================================================================
76 ostream & NETGENPlugin_Hypothesis_2D::SaveTo(ostream & save)
77 {
78   NETGENPlugin_Hypothesis::SaveTo(save);
79
80   save << " " << (int)_quadAllowed;
81
82   return save;
83 }
84
85 //=============================================================================
86 /*!
87  *  
88  */
89 //=============================================================================
90 istream & NETGENPlugin_Hypothesis_2D::LoadFrom(istream & load)
91 {
92   NETGENPlugin_Hypothesis::LoadFrom(load);
93
94   bool isOK = true;
95   int is;
96
97   isOK = (load >> is);
98   if (isOK)
99     _quadAllowed = (bool) is;
100   else
101     load.clear(ios::badbit | load.rdstate());
102
103   return load;
104 }