Salome HOME
Merge from V6_4_BR 05/12/2011
[modules/smesh.git] / src / StdMeshers / StdMeshers_QuadrangleParams.cxx
index 0169fc3546d9423b9d25800c17b32e590b8a5a05..d5816da9940612261e64b707d6fbd145042e9049 100644 (file)
@@ -1,29 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//  SMESH SMESH : implementaion of SMESH idl descriptions
 //  File   : StdMeshers_QuadrangleParams.cxx
 //  Author : Sergey KUUL, OCC
 //  Module : SMESH
-//
+
 #include "StdMeshers_QuadrangleParams.hxx"
 
 #include "SMESH_Algo.hxx"
@@ -43,38 +39,36 @@ using namespace std;
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
 StdMeshers_QuadrangleParams::StdMeshers_QuadrangleParams(int hypId, int studyId,
                                                          SMESH_Gen * gen)
-  :SMESH_Hypothesis(hypId, studyId, gen)
+  : SMESH_Hypothesis(hypId, studyId, gen)
 {
   _name = "QuadrangleParams";
   _param_algo_dim = 2;
   _triaVertexID = -1;
+  _quadType = QUAD_STANDARD;
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
 StdMeshers_QuadrangleParams::~StdMeshers_QuadrangleParams()
 {
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
-void StdMeshers_QuadrangleParams::SetTriaVertex(int id)
+void StdMeshers_QuadrangleParams::SetTriaVertex (int id)
 {
-  if ( id != _triaVertexID ) {
+  if (id != _triaVertexID) {
     _triaVertexID = id;
     NotifySubMeshesHypothesisModification();
   }
@@ -82,22 +76,36 @@ void StdMeshers_QuadrangleParams::SetTriaVertex(int id)
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
+void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type)
+{
+  if (type != _quadType) {
+    _quadType = type;
+    NotifySubMeshesHypothesisModification();
+  }
+}
 
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
 ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
 {
-  save << _triaVertexID << " " << _objEntry;
+  if (_objEntry.size() == 0)
+    save << _triaVertexID << " UNDEFINED " << int(_quadType);
+  else
+    save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
   return save;
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
 istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
 {
   bool isOK = true;
@@ -106,16 +114,22 @@ istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
     load.clear(ios::badbit | load.rdstate());
 
   isOK = (load >> _objEntry);
+  if (!isOK)
+    load.clear(ios::badbit | load.rdstate());
+
+  int type;
+  isOK = (load >> type);
+  if (isOK)
+    _quadType = StdMeshers_QuadType(type);
 
   return load;
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
 ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
 {
   return hyp.SaveTo( save );
@@ -123,10 +137,9 @@ ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
 istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
 {
   return hyp.LoadFrom( load );
@@ -140,7 +153,6 @@ istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
  * \retval bool - true if parameter values have been successfully defined
  */
 //================================================================================
-
 bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
                                                       const TopoDS_Shape& theShape)
 {
@@ -156,10 +168,8 @@ bool StdMeshers_QuadrangleParams::SetParametersByMesh(const SMESH_Mesh* theMesh,
  *  \retval bool - true if parameter values have been successfully defined
  */
 //================================================================================
-
 bool StdMeshers_QuadrangleParams::SetParametersByDefaults(const TDefaults&  dflts,
                                                           const SMESH_Mesh* /*mesh*/)
 {
   return true;
 }
-