From 4847ade0c0c1da342e6d9a7fb20a85d1f78e34ba Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 2 Oct 2015 08:42:34 +0300 Subject: [PATCH] draft version --- src/HYDROData/CMakeLists.txt | 2 + src/HYDROData/HYDROData_LandCoverMap.cxx | 43 ++++++++++++++ src/HYDROData/HYDROData_LandCoverMap.h | 72 ++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 src/HYDROData/HYDROData_LandCoverMap.cxx create mode 100644 src/HYDROData/HYDROData_LandCoverMap.h diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt index fd9899d4..0a7bfff5 100644 --- a/src/HYDROData/CMakeLists.txt +++ b/src/HYDROData/CMakeLists.txt @@ -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 index 00000000..7d8ee63f --- /dev/null +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -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 +#include + +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 index 00000000..aa6e6a92 --- /dev/null +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -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 + +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&, const QString& theType ); + +protected: + TopoDS_Shell GetShape() const; + void SetShape( const TopoDS_Shell& ); + +public: + DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap ); +}; + +#endif -- 2.39.2