]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
draft version
authorasl <asl@opencascade.com>
Fri, 2 Oct 2015 05:42:34 +0000 (08:42 +0300)
committerasl <asl@opencascade.com>
Fri, 2 Oct 2015 05:42:34 +0000 (08:42 +0300)
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData_LandCoverMap.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_LandCoverMap.h [new file with mode: 0644]

index fd9899d428291a90221b1dbe83b150ef2d6c409a..0a7bfff509c4b921a68e802ee74c1cc2d67e784e 100644 (file)
@@ -56,6 +56,7 @@ set(PROJECT_HEADERS
     HYDROData_InterpolatorsFactory.h
     HYDROData_SinusX.h
     HYDROData_ShapeFile.h
+    HYDROData_LandCoverMap.h
 )
 
 set(PROJECT_SOURCES 
@@ -112,6 +113,7 @@ set(PROJECT_SOURCES
     HYDROData_InterpolatorsFactory.cxx
     HYDROData_SinusX.cxx
     HYDROData_ShapeFile.cxx
+    HYDROData_LandCoverMap.cxx
  )
 
 add_definitions(
diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx
new file mode 100644 (file)
index 0000000..7d8ee63
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// 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, or (at your option) any later version.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROData_LandCoverMap.h"
+#include <TDataStd_ExtStringArray.hxx>
+#include <QString>
+
+QString HYDROData_LandCoverMap::GetStricklerType( int theIndex ) const
+{
+  Handle(TDataStd_ExtStringArray) aTypesArray;
+  if( !myLab.FindChild( DataTag_Types ).FindAttribute( TDataStd_ExtStringArray::GetID(), aTypesArray ) )
+    return "";
+
+  TCollection_ExtendedString aType = aTypesArray->Value( theIndex );
+  TCollection_AsciiString anAscii = aType;
+  return anAscii.ToCString();
+}
+
+void HYDROData_LandCoverMap::SetStricklerType( int theIndex, const QString& theType )
+{
+  Handle(TDataStd_ExtStringArray) aTypesArray;
+  if( !myLab.FindChild( DataTag_Types ).FindAttribute( TDataStd_ExtStringArray::GetID(), aTypesArray ) )
+    return;
+
+  std::string aType = theType.toStdString();
+  aTypesArray->SetValue( theIndex, aType.c_str() );
+}
+
diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h
new file mode 100644 (file)
index 0000000..aa6e6a9
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// 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, or (at your option) any later version.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROData_LANDCOVER_MAP_HeaderFile
+#define HYDROData_LANDCOVER_MAP_HeaderFile
+
+#include <HYDROData_Entity.h>
+
+DEFINE_STANDARD_HANDLE( HYDROData_LandCoverMap, HYDROData_Entity )
+
+class TopoDS_Face;
+class TopoDS_Shell;
+class Handle( HYDROData_Polyline );
+class Handle( HYDROData_Object );
+
+class HYDROData_LandCoverMap : public HYDROData_Entity
+{
+protected:
+  friend class HYDROData_Iterator;
+
+  enum DataTag
+  {
+    DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+    DataTag_Shape,                                         ///< the shape presentation of the land cover map
+    DataTag_Types,
+  };
+
+  HYDROData_LandCoverMap();
+  ~HYDROData_LandCoverMap();
+
+  int GetNbFaces() const;
+  TopoDS_Face GetFace( int theIndex ) const;
+
+  QString GetStricklerType( int theIndex ) const;
+  void SetStricklerType( int theIndex, const QString& theType );
+
+  bool ImportQGIS( const QString& theFileName );
+  bool ExportQGIS( const QString& theFileName ) const;
+  bool ExportTelemac( const QString& theFileName ) const;
+
+  bool Add( const Handle( HYDROData_Object )&, const QString& theType );
+  bool Add( const Handle( HYDROData_Polyline )&, const QString& theType );
+
+  bool Remove( int theIndex );
+
+  bool Split( const Handle( HYDROData_Polyline )& );
+  bool Merge( const QList<int>&, const QString& theType );
+
+protected:
+  TopoDS_Shell GetShape() const;
+  void SetShape( const TopoDS_Shell& );
+
+public:
+  DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap );
+};
+
+#endif