return KIND_LAND_COVER_MAP;
}
+int HYDROData_LandCoverMap::GetLCCount() const
+{
+ Iterator anIt( *this );
+ int i = 0;
+ for( ; anIt.More(); anIt.Next() )
+ i++;
+ return i;
+}
+
+bool HYDROData_LandCoverMap::IsEmpty() const
+{
+ Iterator anIt( *this );
+ if ( anIt.More() )
+ return true;
+ else
+ return false;
+}
+
/**
Load attributes from DBF File
///
HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+ HYDRODATA_EXPORT int GetLCCount() const;
+ HYDRODATA_EXPORT bool IsEmpty() const;
+
protected:
void SetShape( const TopoDS_Shape& );
#include <HYDROData_Bathymetry.h>
#include <HYDROData_Profile.h>
#include <HYDROData_Iterator.h>
+#include <HYDROData_LandCoverMap.h>
#include <QFile>
#include <QFileInfo>
void HYDROData_ShapeFile::Export(const QString& aFileName,
NCollection_Sequence<Handle_HYDROData_PolylineXY> aPolyXYSeq,
NCollection_Sequence<Handle_HYDROData_Polyline3D> aPoly3DSeq,
- const Handle_HYDROData_LandCoverMap& aLCSeq,
+ const Handle_HYDROData_LandCoverMap& aLCM,
QStringList& aNonExpList)
{
- /*TODO
SHPHandle hSHPHandle;
if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty())
{
if (WriteObjectPoly3D(hSHPHandle, aPoly3DSeq(i)) != 1)
aNonExpList.append(aPoly3DSeq(i)->GetName());
}
- else if (aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty() && !aLCSeq.IsEmpty())
+ else if (aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty() && !aLCM->IsEmpty())
{
hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_POLYGON );
- for (int i = 1; i <= aLCSeq.Size(); i++)
+ HYDROData_LandCoverMap::Iterator It( aLCM );
+ for( ; It.More(); It.Next() )
+ {
+ TopoDS_Face aFace = It.Face();
+ if (WriteObjectPolygon(hSHPHandle, aFace) != 1)
+ aNonExpList.append(aLCM->GetName() + "_" + QString::number(It.Index()));
+ }
+ /*for (int i = 1; i <= aLCSeq.Size(); i++)
if (WriteObjectLC(hSHPHandle, aLCSeq(i)) != 1)
- aNonExpList.append(aLCSeq(i)->GetName());
+ aNonExpList.append(aLCSeq(i)->GetName());*/
}
if (hSHPHandle->nRecords > 0)
SHPClose( hSHPHandle );
QString aFN = aFileName.simplified();
remove (aFN.toStdString().c_str());
remove (aFN.replace( ".shp", ".shx", Qt::CaseInsensitive).toStdString().c_str());
- }*/
+ }
}
int HYDROData_ShapeFile::WriteObjectPolyXY(SHPHandle theShpHandle, Handle_HYDROData_PolylineXY thePoly )
return 1;
}
-/*TODO:int HYDROData_ShapeFile::WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC )
+int HYDROData_ShapeFile::WriteObjectPolygon(SHPHandle theShpHandle, const TopoDS_Shape& theInputShape )
{
- TopoDS_Shape aSh = theLC->GetShape();
- if (aSh.IsNull())
+ if (theInputShape.IsNull())
return 0;
- TopExp_Explorer anEdgeEx(aSh, TopAbs_EDGE);
+ TopExp_Explorer anEdgeEx(theInputShape, TopAbs_EDGE);
for (; anEdgeEx.More(); anEdgeEx.Next())
{
TopoDS_Edge E = TopoDS::Edge(anEdgeEx.Current());
}
}
- if (aSh.ShapeType() == TopAbs_FACE)
+ if (theInputShape.ShapeType() == TopAbs_FACE)
{
- ProcessFace(TopoDS::Face(aSh), theShpHandle);
+ ProcessFace(TopoDS::Face(theInputShape), theShpHandle);
}
- else if (aSh.ShapeType() == TopAbs_COMPOUND)
+ else if (theInputShape.ShapeType() == TopAbs_COMPOUND)
{
- TopExp_Explorer Ex(aSh, TopAbs_FACE);
+ TopExp_Explorer Ex(theInputShape, TopAbs_FACE);
for (; Ex.More(); Ex.Next())
{
TopoDS_Face aF = TopoDS::Face(Ex.Current());
return 1;
}
-*/
+
void HYDROData_ShapeFile::ProcessFace(TopoDS_Face theFace, SHPHandle theShpHandle)
{
SHPObject *aSHPObj;
}
//x.push_back( aNPnts(1).X());
//y.push_back( aNPnts(1).Y());
-
}
aSHPObj = SHPCreateObject( SHPT_POLYGON, -1, NbWires, &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
BRepBuilderAPI_MakeFace aFBuilder(pln, TopoDS::Wire(aWires(1)));
for (int i = 2; i <= aWires.Length(); i++)
aFBuilder.Add(TopoDS::Wire(aWires(i)));
- TopoDS_Face DF = TopoDS::Face(aFBuilder.Shape());
+ F = TopoDS::Face(aFBuilder.Shape());
- BRepLib::BuildCurves3d(DF);
- if(!DF.IsNull())
- {
- //sfs->Init ( DF );
- //sfs->Perform();
- F = DF; //TopoDS::Face(sfs->Shape());
- }
+ BRepLib::BuildCurves3d(F);
}
int HYDROData_ShapeFile::ImportLandCovers(const QString theFileName, QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces, int& theShapeTypeOfFile)
class Handle(HYDROData_Document);
class TopTools_SequenceOfShape;
class TopoDS_Face;
+class TopoDS_Shape;
class Handle_HYDROData_Entity;
class Handle_HYDROData_LandCoverMap;
HYDRODATA_EXPORT void Export(const QString& aFileName,
NCollection_Sequence<Handle_HYDROData_PolylineXY> aPolyXYSeq,
NCollection_Sequence<Handle_HYDROData_Polyline3D> aPoly3DSeq,
- const Handle_HYDROData_LandCoverMap& aLCSeq,
+ const Handle_HYDROData_LandCoverMap& aLCM,
QStringList& aNonExpList);
int WriteObjectPolyXY(SHPHandle theShpHandle, Handle_HYDROData_PolylineXY thePoly );
int WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROData_Polyline3D thePoly );
- //TODO:int WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC );
+ int WriteObjectPolygon(SHPHandle theShpHandle, const TopoDS_Shape& theInputShape );
//Import
bool Parse(SHPHandle theHandle, ShapeType theType, int& theShapeTypeOfFile);
//Import Landcover
HYDROGUI_ImportBathymetryOp.h
HYDROGUI_ImportImageDlg.h
HYDROGUI_ImportImageOp.h
+ HYDROGUI_ImportLandCoverMapOp.h
+ HYDROGUI_ImportLandCoverMapDlg.h
HYDROGUI_ImportPolylineOp.h
HYDROGUI_ImportSinusXOp.h
HYDROGUI_ExportSinusXOp.h
HYDROGUI_ImportBathymetryOp.cxx
HYDROGUI_ImportImageDlg.cxx
HYDROGUI_ImportImageOp.cxx
+ HYDROGUI_ImportLandCoverMapOp.cxx
+ HYDROGUI_ImportLandCoverMapDlg.cxx
HYDROGUI_ImportPolylineOp.cxx
HYDROGUI_ImportSinusXOp.cxx
HYDROGUI_ExportSinusXOp.cxx
+++ /dev/null
-// 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 "HYDROGUI_ImportLandCoverDlg.h"
-
-#include <QGroupBox>
-#include <QLabel>
-#include <QLineEdit>
-#include <QListWidget>
-#include <QVBoxLayout>
-#include <QToolButton>
-#include <QCheckBox>
-#include <SUIT_ResourceMgr.h>
-#include <SUIT_Session.h>
-#include <SUIT_FileDlg.h>
-
-
-HYDROGUI_ImportLandCoverDlg::HYDROGUI_ImportLandCoverDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-: HYDROGUI_Wizard( theModule, theTitle )
-{
- addPage( createPage1() );
- addPage( createPage2() );
-}
-
-QWizardPage* HYDROGUI_ImportLandCoverDlg::createPage1() {
- QWizardPage* aPage = new QWizardPage( mainFrame() );
- QFrame* aFrame = new QFrame( aPage );
-
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-
- myFileNameGroup = new QGroupBox( tr( "IMPORT_LANDCOVER_FROM_FILE" ) );
-
- QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
-
- myFileName = new QLineEdit( myFileNameGroup );
- myFileName->setReadOnly( true );
-
- QToolButton* aBrowseBtn = new QToolButton( myFileNameGroup );
- aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) );
-
- QBoxLayout* aFileNameLayout = new QHBoxLayout( myFileNameGroup );
- aFileNameLayout->setMargin( 5 );
- aFileNameLayout->setSpacing( 5 );
- aFileNameLayout->addWidget( aFileNameLabel );
- aFileNameLayout->addWidget( myFileName );
- aFileNameLayout->addWidget( aBrowseBtn );
-
- myObjectNameGroup = new QGroupBox( tr( "LANDCOVER_NAME" ) );
-
- QLabel* aLandcoverNameLabel = new QLabel( tr( "NAME" ), myObjectNameGroup );
- myObjectName = new QLineEdit( myObjectNameGroup );
-
- QBoxLayout* aLandcoverNameLayout = new QHBoxLayout( myObjectNameGroup );
- aLandcoverNameLayout->setMargin( 5 );
- aLandcoverNameLayout->setSpacing( 5 );
- aLandcoverNameLayout->addWidget( aLandcoverNameLabel );
- aLandcoverNameLayout->addWidget( myObjectName );
-
- QGroupBox* aPolygonsGroup = new QGroupBox( tr( "FOUNDED_POLYGONS" ) );
- myPolygons = new QListWidget( aPolygonsGroup );
- myPolygons->setSelectionMode( QListWidget::ExtendedSelection );
- myPolygons->setEditTriggers( QListWidget::NoEditTriggers );
- myPolygons->setViewMode( QListWidget::ListMode );
- myPolygons->setSortingEnabled( false );
-
- QBoxLayout* aPolygonsLayout = new QVBoxLayout;
- aPolygonsLayout->addWidget( myPolygons );
- aPolygonsGroup->setLayout( aPolygonsLayout );
-
- // Layout
- QVBoxLayout* aPageLayout = new QVBoxLayout;
- aPageLayout->setMargin( 5 );
- aPageLayout->setSpacing( 5 );
- aPageLayout->addWidget( myFileNameGroup );
- aPageLayout->addWidget( myObjectNameGroup );
- aPageLayout->addWidget( aPolygonsGroup );
- aPage->setLayout( aPageLayout );
-
- // Conections
- connect( myPolygons, SIGNAL( itemSelectionChanged() ), this, SLOT( onItemSelectionChanged() ) );
- connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
-
- return aPage;
-}
-
-QWizardPage* HYDROGUI_ImportLandCoverDlg::createPage2() {
- QWizardPage* aPage = new QWizardPage( mainFrame() );
- QFrame* aFrame = new QFrame( aPage );
-
- myAttrNameGroup = new QGroupBox( "Available attributes" );
-
- QCheckBox* anAttrCheckBox = new QCheckBox( "Use dBase attributes as a Strickler Types", myAttrNameGroup );
-
- QBoxLayout* aFileNameLayout = new QHBoxLayout( myAttrNameGroup );
- aFileNameLayout->setMargin( 5 );
- aFileNameLayout->setSpacing( 5 );
- aFileNameLayout->addWidget( anAttrCheckBox );
-
-
- myDBFAttr = new QListWidget( aPage );
- myDBFAttr->setSelectionMode( QListWidget::ExtendedSelection );
- myDBFAttr->setEditTriggers( QListWidget::NoEditTriggers );
- myDBFAttr->setViewMode( QListWidget::ListMode );
- myDBFAttr->setSortingEnabled( false );
-
- // Layout
- QVBoxLayout* aPageLayout = new QVBoxLayout;
- aPageLayout->setMargin( 5 );
- aPageLayout->setSpacing( 5 );
- aPageLayout->addWidget( myAttrNameGroup );
- aPageLayout->addWidget( myDBFAttr );
- aPage->setLayout( aPageLayout );
- return aPage;
-}
-
-
-
-HYDROGUI_ImportLandCoverDlg::~HYDROGUI_ImportLandCoverDlg()
-{
-}
-
-void HYDROGUI_ImportLandCoverDlg::reset()
-{
- myPolygons->clear();
-}
-
-void HYDROGUI_ImportLandCoverDlg::setPolygonNames( const QStringList& theNames )
-{
- myPolygons->clear();
- myPolygons->addItems( theNames );
-}
-
-void HYDROGUI_ImportLandCoverDlg::removePolygonNames( const QStringList& theNames )
-{
- QList<QListWidgetItem*> aFoundItems;
-
- foreach ( const QString& aName, theNames ) {
- aFoundItems = myPolygons->findItems( aName, Qt::MatchExactly );
- foreach ( QListWidgetItem* anItem, aFoundItems ) {
- anItem = myPolygons->takeItem( myPolygons->row( anItem ) );
- delete anItem;
- }
- }
-}
-
-void HYDROGUI_ImportLandCoverDlg::setSelectedPolygonNames( const QStringList& theNames )
-{
- myPolygons->clearSelection();
-
- foreach( const QString aName, theNames ) {
- QList<QListWidgetItem*> anItems = myPolygons->findItems( aName, Qt::MatchExactly );
- if ( anItems.count() == 1 ) {
- anItems.first()->setSelected( true );
- }
- }
-}
-
-void HYDROGUI_ImportLandCoverDlg::onItemSelectionChanged()
-{
- emit selectionChanged( getSelectedPolygonNames() );
-}
-
-QStringList HYDROGUI_ImportLandCoverDlg::getSelectedPolygonNames() const
-{
- QStringList aSelectedNames;
-
- QList<QListWidgetItem*> aSelectedItems = myPolygons->selectedItems();
- foreach( const QListWidgetItem* anItem, aSelectedItems ) {
- aSelectedNames << anItem->text();
- }
-
- return aSelectedNames;
-}
-
-
-void HYDROGUI_ImportLandCoverDlg::onBrowse()
-{
- QString aFilter( tr( "LANDCOVER_FILTER" ) );
- QString aFileName = SUIT_FileDlg::getFileName( this, "", aFilter, tr( "IMPORT_LANDCOVER_FROM_FILE" ), true );
-
- if( !aFileName.isEmpty() )
- {
- setFileName( aFileName );
- emit FileSelected( aFileName );
- }
-}
-
-void HYDROGUI_ImportLandCoverDlg::setObjectName( const QString& theName )
-{
- myObjectName->setText( theName );
- myObjectNameGroup->setEnabled( !theName.isEmpty() || !myFileName->text().isEmpty() );
-}
-
-QString HYDROGUI_ImportLandCoverDlg::getObjectName() const
-{
- return myObjectName->text();
-}
-
-void HYDROGUI_ImportLandCoverDlg::setFileName( const QString& theFileName )
-{
- myFileName->setText( theFileName );
-
- if ( !myObjectNameGroup->isEnabled() )
- myObjectNameGroup->setEnabled( !theFileName.isEmpty() );
-}
-
-QString HYDROGUI_ImportLandCoverDlg::getFileName() const
-{
- return myFileName->text();
-}
\ No newline at end of file
+++ /dev/null
-// 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 HYDROGUI_ImportLandCoverDlg_H
-#define HYDROGUI_ImportLandCoverDlg_H
-
-#include "HYDROGUI_Wizard.h"
-
-class QListWidget;
-class QLineEdit;
-class QGroupBox;
-
-class HYDROGUI_ImportLandCoverDlg : public HYDROGUI_Wizard
-{
- Q_OBJECT
-
-public:
- HYDROGUI_ImportLandCoverDlg( HYDROGUI_Module* theModule, const QString& theTitle );
- virtual ~HYDROGUI_ImportLandCoverDlg();
-
- void reset();
-
- void setPolygonNames( const QStringList& theNames );
- void removePolygonNames( const QStringList& theNames );
-
- void setSelectedPolygonNames( const QStringList& theNames );
-
- QStringList getSelectedPolygonNames() const;
-
- void setObjectName( const QString& theName );
- QString getObjectName() const;
-
- void setFileName( const QString& theFileName );
- QString getFileName() const;
-
-signals:
- void FileSelected( const QString& theFileName );
-
-protected slots:
- void onBrowse();
-
-signals:
- void selectionChanged( const QStringList& );
-
-public slots:
- void onItemSelectionChanged();
-
-private:
-
- QWizardPage* createPage1();
- QWizardPage* createPage2();
-
- QLineEdit* myFileName;
- QGroupBox* myFileNameGroup;
- QListWidget* myPolygons;
-
- QGroupBox* myObjectNameGroup;
- QLineEdit* myObjectName;
-
- //second page
- QGroupBox* myAttrNameGroup;
- QListWidget* myDBFAttr;
-
-
-};
-
-#endif
--- /dev/null
+// 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 "HYDROGUI_ImportLandCoverMapDlg.h"
+
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QListWidget>
+#include <QVBoxLayout>
+#include <QToolButton>
+#include <QCheckBox>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_FileDlg.h>
+
+#include <QTableWidget>
+#include <QHeaderView>
+#include <QComboBox>
+
+HYDROGUI_ImportLandCoverMapDlg::HYDROGUI_ImportLandCoverMapDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_Wizard( theModule, theTitle )
+{
+ addPage( createPage1() );
+ addPage( createPage2() );
+ addPage( createPage3() );
+}
+
+QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() {
+ QWizardPage* aPage = new QWizardPage( mainFrame() );
+ QFrame* aFrame = new QFrame( aPage );
+
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+
+ myFileNameGroup = new QGroupBox( tr( "IMPORT_LANDCOVERMAP_FROM_FILE" ) );
+
+ QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
+
+ myFileName = new QLineEdit( myFileNameGroup );
+ myFileName->setReadOnly( true );
+
+ QToolButton* aBrowseBtn = new QToolButton( myFileNameGroup );
+ aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) );
+
+ QBoxLayout* aFileNameLayout = new QHBoxLayout( myFileNameGroup );
+ aFileNameLayout->setMargin( 5 );
+ aFileNameLayout->setSpacing( 5 );
+ aFileNameLayout->addWidget( aFileNameLabel );
+ aFileNameLayout->addWidget( myFileName );
+ aFileNameLayout->addWidget( aBrowseBtn );
+
+ myObjectNameGroup = new QGroupBox( tr( "LANDCOVERMAP_NAME" ) );
+
+ QLabel* aLandcoverNameLabel = new QLabel( tr( "NAME" ), myObjectNameGroup );
+ myObjectName = new QLineEdit( myObjectNameGroup );
+
+ QBoxLayout* aLandcoverNameLayout = new QHBoxLayout( myObjectNameGroup );
+ aLandcoverNameLayout->setMargin( 5 );
+ aLandcoverNameLayout->setSpacing( 5 );
+ aLandcoverNameLayout->addWidget( aLandcoverNameLabel );
+ aLandcoverNameLayout->addWidget( myObjectName );
+
+ QGroupBox* aPolygonsGroup = new QGroupBox( tr( "FOUNDED_POLYGONS" ) );
+ myPolygons = new QListWidget( aPolygonsGroup );
+ myPolygons->setSelectionMode( QListWidget::ExtendedSelection );
+ myPolygons->setEditTriggers( QListWidget::NoEditTriggers );
+ myPolygons->setViewMode( QListWidget::ListMode );
+ myPolygons->setSortingEnabled( false );
+
+ QBoxLayout* aPolygonsLayout = new QVBoxLayout;
+ aPolygonsLayout->addWidget( myPolygons );
+ aPolygonsGroup->setLayout( aPolygonsLayout );
+
+ // Layout
+ QVBoxLayout* aPageLayout = new QVBoxLayout;
+ aPageLayout->setMargin( 5 );
+ aPageLayout->setSpacing( 5 );
+ aPageLayout->addWidget( myFileNameGroup );
+ aPageLayout->addWidget( myObjectNameGroup );
+ aPageLayout->addWidget( aPolygonsGroup );
+ aPage->setLayout( aPageLayout );
+
+ // Conections
+ connect( myPolygons, SIGNAL( itemSelectionChanged() ), this, SLOT( onItemSelectionChanged() ) );
+ connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
+
+ return aPage;
+}
+
+QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage2() {
+ QWizardPage* aPage = new QWizardPage( mainFrame() );
+ QFrame* aFrame = new QFrame( aPage );
+
+ myAttrNameGroup = new QGroupBox( "Available attributes" );
+
+ QCheckBox* anAttrCheckBox = new QCheckBox( "Use dBase attributes as a Strickler Types", myAttrNameGroup );
+
+ QBoxLayout* aFileNameLayout = new QHBoxLayout( myAttrNameGroup );
+ aFileNameLayout->setMargin( 5 );
+ aFileNameLayout->setSpacing( 5 );
+ aFileNameLayout->addWidget( anAttrCheckBox );
+
+
+ myDBFAttr = new QListWidget( aPage );
+ myDBFAttr->setSelectionMode( QListWidget::ExtendedSelection );
+ myDBFAttr->setEditTriggers( QListWidget::NoEditTriggers );
+ myDBFAttr->setViewMode( QListWidget::ListMode );
+ myDBFAttr->setSortingEnabled( false );
+
+ // Layout
+ QVBoxLayout* aPageLayout = new QVBoxLayout;
+ aPageLayout->setMargin( 5 );
+ aPageLayout->setSpacing( 5 );
+ aPageLayout->addWidget( myAttrNameGroup );
+ aPageLayout->addWidget( myDBFAttr );
+ aPage->setLayout( aPageLayout );
+ return aPage;
+}
+
+QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage3() {
+
+ QWizardPage* aPage = new QWizardPage( mainFrame() );
+ QFrame* aFrame = new QFrame( aPage );
+ myCLabel = new QLabel();
+ myCLabel->setText("Correspondence");
+
+ myTableW = new QTableWidget();
+
+ myTableW->setRowCount(5);
+ myTableW->setColumnCount(2);
+
+ QStringList list;
+ list << "1" << "2" << "3";
+
+ for (int i = 0; i < 5; i++)
+ for (int j = 0; j < 2; j++)
+ {
+ QComboBox* CB = new QComboBox();
+ CB->addItems(list);
+ myTableW->setCellWidget(i,j,CB);
+ }
+
+ // Layout
+ QVBoxLayout* aPageLayout = new QVBoxLayout;
+ aPageLayout->setMargin( 5 );
+ aPageLayout->setSpacing( 5 );
+ aPageLayout->addWidget( myCLabel );
+ aPageLayout->addWidget( myTableW );
+ aPage->setLayout( aPageLayout );
+ return aPage;
+}
+
+
+HYDROGUI_ImportLandCoverMapDlg::~HYDROGUI_ImportLandCoverMapDlg()
+{
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::reset()
+{
+ myPolygons->clear();
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setPolygonNames( const QStringList& theNames )
+{
+ myPolygons->clear();
+ myPolygons->addItems( theNames );
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::removePolygonNames( const QStringList& theNames )
+{
+ QList<QListWidgetItem*> aFoundItems;
+
+ foreach ( const QString& aName, theNames ) {
+ aFoundItems = myPolygons->findItems( aName, Qt::MatchExactly );
+ foreach ( QListWidgetItem* anItem, aFoundItems ) {
+ anItem = myPolygons->takeItem( myPolygons->row( anItem ) );
+ delete anItem;
+ }
+ }
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setSelectedPolygonNames( const QStringList& theNames )
+{
+ myPolygons->clearSelection();
+
+ foreach( const QString aName, theNames ) {
+ QList<QListWidgetItem*> anItems = myPolygons->findItems( aName, Qt::MatchExactly );
+ if ( anItems.count() == 1 ) {
+ anItems.first()->setSelected( true );
+ }
+ }
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::onItemSelectionChanged()
+{
+ emit selectionChanged( getSelectedPolygonNames() );
+}
+
+QStringList HYDROGUI_ImportLandCoverMapDlg::getSelectedPolygonNames() const
+{
+ QStringList aSelectedNames;
+
+ QList<QListWidgetItem*> aSelectedItems = myPolygons->selectedItems();
+ foreach( const QListWidgetItem* anItem, aSelectedItems ) {
+ aSelectedNames << anItem->text();
+ }
+
+ return aSelectedNames;
+}
+
+
+void HYDROGUI_ImportLandCoverMapDlg::onBrowse()
+{
+ QString aFilter( tr( "LANDCOVERMAP_FILTER" ) );
+ QString aFileName = SUIT_FileDlg::getFileName( this, "", aFilter, tr( "IMPORT_LANDCOVERMAP_FROM_FILE" ), true );
+
+ if( !aFileName.isEmpty() )
+ {
+ setFileName( aFileName );
+ emit FileSelected( aFileName );
+ }
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setObjectName( const QString& theName )
+{
+ myObjectName->setText( theName );
+ myObjectNameGroup->setEnabled( !theName.isEmpty() || !myFileName->text().isEmpty() );
+}
+
+QString HYDROGUI_ImportLandCoverMapDlg::getObjectName() const
+{
+ return myObjectName->text();
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setFileName( const QString& theFileName )
+{
+ myFileName->setText( theFileName );
+
+ if ( !myObjectNameGroup->isEnabled() )
+ myObjectNameGroup->setEnabled( !theFileName.isEmpty() );
+}
+
+QString HYDROGUI_ImportLandCoverMapDlg::getFileName() const
+{
+ return myFileName->text();
+}
+
--- /dev/null
+// 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 HYDROGUI_ImportLandCoverMapDlg_H
+#define HYDROGUI_ImportLandCoverMapDlg_H
+
+#include "HYDROGUI_Wizard.h"
+
+class QListWidget;
+class QLineEdit;
+class QGroupBox;
+class QComboBox;
+class QLabel;
+class QTableWidget;
+
+class HYDROGUI_ImportLandCoverMapDlg : public HYDROGUI_Wizard
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ImportLandCoverMapDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+ virtual ~HYDROGUI_ImportLandCoverMapDlg();
+
+ void reset();
+
+ void setPolygonNames( const QStringList& theNames );
+ void removePolygonNames( const QStringList& theNames );
+
+ void setSelectedPolygonNames( const QStringList& theNames );
+
+ QStringList getSelectedPolygonNames() const;
+
+ void setObjectName( const QString& theName );
+ QString getObjectName() const;
+
+ void setFileName( const QString& theFileName );
+ QString getFileName() const;
+
+signals:
+ void FileSelected( const QString& theFileName );
+
+protected slots:
+ void onBrowse();
+
+
+signals:
+ void selectionChanged( const QStringList& );
+
+public slots:
+ void onItemSelectionChanged();
+
+private:
+
+ QWizardPage* createPage1();
+ QWizardPage* createPage2();
+ QWizardPage* createPage3();
+
+ QLineEdit* myFileName;
+ QGroupBox* myFileNameGroup;
+ QListWidget* myPolygons;
+
+ QGroupBox* myObjectNameGroup;
+ QLineEdit* myObjectName;
+
+ //second page
+ QGroupBox* myAttrNameGroup;
+ QListWidget* myDBFAttr;
+ QGroupBox* myCorrNameGroup;
+
+ //third page
+ QLabel* myCLabel;
+ QTableWidget* myTableW;
+
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2015 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, 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 "HYDROGUI_ImportLandCoverMapOp.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_UpdateFlags.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_ImportLandCoverMapDlg.h"
+#include "HYDROGUI_Shape.h"
+#include <HYDROData_LandCoverMap.h>
+#include <HYDROGUI_ZLayers.h>
+
+#include <HYDROGUI_DataObject.h>
+#include <HYDROData_Iterator.h>
+#include <HYDROData_ShapeFile.h>
+#include <HYDROData_Profile.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_FileDlg.h>
+#include <LightApp_Application.h>
+
+#include <QApplication>
+#include <QFile>
+#include <QFileInfo>
+#include <SUIT_MessageBox.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+
+#include <SalomeApp_Study.h>
+
+#include <LightApp_Application.h>
+#include <LightApp_DataOwner.h>
+#include <LightApp_Displayer.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_ViewManager.h>
+
+#include <BRep_Builder.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Wire.hxx>
+
+
+#include <BRepTools.hxx>
+
+
+HYDROGUI_ImportLandCoverMapOp::HYDROGUI_ImportLandCoverMapOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+ setName( tr( "IMPORT_LANDCOVER" ) );
+}
+
+HYDROGUI_ImportLandCoverMapOp::~HYDROGUI_ImportLandCoverMapOp()
+{
+ erasePreview();
+}
+
+void HYDROGUI_ImportLandCoverMapOp::startOperation()
+{
+ HYDROGUI_Operation::startOperation();
+
+ if ( !getPreviewManager() ) {
+ setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>(
+ module()->getApp()->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+ }
+
+ if ( !isApplyAndClose() ) {
+ return;
+ }
+
+ HYDROGUI_ImportLandCoverMapDlg* aPanel =
+ ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return;
+ }
+
+ aPanel->reset();
+}
+
+void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
+{
+ HYDROGUI_ImportLandCoverMapDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ QString anObjectName = aPanel->getObjectName().simplified();
+ anObjectName = aPanel->getFileName();
+ if ( !anObjectName.isEmpty() )
+ anObjectName = QFileInfo( anObjectName ).baseName();
+
+ if ( anObjectName.isEmpty() )
+ anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_LANDCOVERMAP_NAME" ) );
+ aPanel->setObjectName( anObjectName );
+
+ QString aFileName = aPanel->getFileName();
+ if ( aFileName.isEmpty() )
+ {
+ abort();
+ return;
+ }
+
+ QString anExt = aFileName.split('.', QString::SkipEmptyParts).back();
+
+ if (anExt == "shp")
+ {
+ startDocOperation();
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ QStringList aPolygonsList;
+ TopTools_SequenceOfShape aFaces;
+ HYDROData_ShapeFile anImporter;
+
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
+ if ( !aStudy )
+ return;
+
+ erasePreview();
+
+ Handle(AIS_InteractiveContext) aCtx = NULL;
+ int aShapeTypeOfFile = -1;
+ int aStat = anImporter.ImportLandCovers(aFileName, aPolygonsList, aFaces, aShapeTypeOfFile);
+ if (aStat == 1)
+ {
+ aPanel->setPolygonNames(aPolygonsList);
+
+ LightApp_Application* anApp = module()->getApp();
+ if ( !getPreviewManager() )
+ setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
+
+ if ( aViewManager )
+ {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
+ {
+ aCtx = aViewer->getAISContext();
+ connect( aViewer, SIGNAL( selectionChanged() ), this, SLOT( onViewerSelectionChanged() ) );
+ }
+ }
+
+ for ( int i = 1; i <= aFaces.Length(); i++ )
+ {
+ TopoDS_Face aFace = TopoDS::Face(aFaces.Value( i ));
+ if ( aViewManager && !aCtx.IsNull() )
+ {
+ HYDROGUI_Shape* aShape = new HYDROGUI_Shape( aCtx, NULL, getPreviewZLayer() );
+ //Green color for now..
+ aShape->setFillingColor(QColor(0,255,0), false, false);
+ aShape->setBorderColor(QColor(0,255,0), false, false);
+ if( !aFace.IsNull() )
+ aShape->setShape( aFace);
+
+ myPolygonName2PrsShape.insert( "polygon_" + QString::number(i), aShape);
+ }
+ }
+ if ( !aCtx.IsNull() )
+ {
+ UpdateZLayersOfHilightPresentationsOfDisplayedObjects( aCtx, Graphic3d_ZLayerId_TopOSD );
+ aCtx->UpdateCurrentViewer();
+ }
+
+ QApplication::restoreOverrideCursor();
+ commitDocOperation();
+ }
+ else
+ {
+ erasePreview();
+ aPanel->setPolygonNames(QStringList());
+ aPanel->setObjectName("");
+ QApplication::restoreOverrideCursor();
+ QString aMess = "Cannot import land cover;\n";
+ if (aStat == -1)
+ aMess += "Cannot open SHP file";
+ else if (aStat == -2)
+ aMess += "Cannot open SHX file";
+ else
+ aMess += "The shape type of file is " + anImporter.GetShapeTypeName(aShapeTypeOfFile);
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "IMPORT_LANDCOVER" ), aMess);
+ commitDocOperation();
+ //abort();
+ }
+ anImporter.Free();
+
+ }
+
+}
+
+HYDROGUI_InputPanel* HYDROGUI_ImportLandCoverMapOp::createInputPanel() const
+{
+ HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportLandCoverMapDlg( module(), getName() );
+
+ connect( aPanel, SIGNAL( FileSelected( const QString& ) ), SLOT( onFileSelected() ) );
+
+ connect( aPanel, SIGNAL( selectionChanged( const QStringList& ) ), this, SLOT( onSelectionChanged( const QStringList& ) ) );
+
+ connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onNext( const int ) ) );
+ connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onBack( const int ) ) );
+ connect( aPanel, SIGNAL( Finish( const int ) ), SLOT( onFinish( const int ) ) );
+
+ return aPanel;
+}
+
+bool HYDROGUI_ImportLandCoverMapOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+
+ HYDROGUI_ImportLandCoverMapDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return false;
+ }
+
+ QStringList aSelectedtPolygons = aPanel->getSelectedPolygonNames();
+ aPanel->removePolygonNames( aSelectedtPolygons );
+
+ if (!aSelectedtPolygons.empty())
+ {
+ Handle(HYDROData_LandCoverMap) aLCM = Handle(HYDROData_LandCoverMap)::DownCast( doc()->CreateObject( KIND_LAND_COVER_MAP ) );
+ TopoDS_Shape aResShape;
+ if (aSelectedtPolygons.size() > 1)
+ {
+ TopoDS_Compound cmp;
+ BRep_Builder BB;
+ BB.MakeCompound(cmp);
+
+ foreach ( QString aName, aSelectedtPolygons ) {
+ TopoDS_Shape aShape = myPolygonName2PrsShape.value( aName )->getTopoShape();
+ if ( aShape.IsNull() )
+ continue;
+ BB.Add(cmp, aShape);
+ HYDROGUI_Shape* aShapeToDelete = myPolygonName2PrsShape.take( aName );
+ delete aShapeToDelete;
+ }
+ aResShape = cmp;
+ }
+ else
+ {
+ TopoDS_Shape aShape = myPolygonName2PrsShape.value( aSelectedtPolygons.first() )->getTopoShape();
+ if ( !aShape.IsNull() )
+ {
+ HYDROGUI_Shape* aShapeToDelete = myPolygonName2PrsShape.take( aSelectedtPolygons.first() );
+ delete aShapeToDelete;
+ aResShape = aShape;
+ }
+ }
+ if( !aLCM.IsNull() )
+ {
+ QString aLCName = aPanel->getObjectName() + "_polygon";
+ int i = 0;
+ for( ;HYDROGUI_Tool::FindObjectByName(module(), aLCName); i++)
+ aLCName = aPanel->getObjectName() + "_polygon_" + QString::number(i);
+ aLCM->SetName( aLCName );
+ //TODO add color
+ //aLCM->SetFillingColor( aLCM->DefaultFillingColor() );
+ //aLCM->SetBorderColor( aLCM->DefaultBorderColor() );
+
+ //aLCM->SetShape(aResShape);
+ aLCM->Show();
+
+ //erasePreview();
+
+ module()->setIsToUpdate( aLCM );
+
+ }
+ }
+
+ module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
+
+ if ( isApplyAndClose() )
+ erasePreview();
+
+ return true;
+}
+
+void HYDROGUI_ImportLandCoverMapOp::onSelectionChanged( const QStringList& theSelectedNames )
+{
+ Handle(AIS_InteractiveContext) aCtx = NULL;
+
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
+ if ( aViewManager ) {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
+ aCtx = aViewer->getAISContext();
+ }
+ }
+
+ if ( !aCtx.IsNull() ) {
+ foreach ( QString aName, myPolygonName2PrsShape.keys() ) {
+ Handle(AIS_InteractiveObject) anObject =
+ myPolygonName2PrsShape.value(aName)->getAISObject();
+
+ bool isSelected = theSelectedNames.contains( aName );
+ if ( ( isSelected && !aCtx->IsSelected( anObject) ) ||
+ ( !isSelected && aCtx->IsSelected( anObject) ) ) {
+ aCtx->AddOrRemoveSelected( anObject, Standard_False );
+ }
+ /*if (isSelected)
+ {
+ HYDROGUI_Shape* aHydroSh = myPolygonName2PrsShape.value( aName );
+ aHydroSh->setFillingColor(QColor(0,255,255), true, true);
+ }*/
+ }
+ aCtx->UpdateCurrentViewer();
+ }
+}
+
+
+void HYDROGUI_ImportLandCoverMapOp::onViewerSelectionChanged()
+{
+ // Get panel
+ HYDROGUI_ImportLandCoverMapDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return;
+ }
+
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
+ Handle(AIS_InteractiveContext) aCtx = NULL;
+ if ( aViewManager ) {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
+ aCtx = aViewer->getAISContext();
+ }
+ }
+
+ if ( !aCtx.IsNull() )
+ {
+ QStringList aSelectedNames;
+ foreach ( QString aName, myPolygonName2PrsShape.keys() ) {
+ bool isSelected = aCtx->IsSelected( myPolygonName2PrsShape.value(aName)->getAISObject() );
+ if ( isSelected ) {
+ aSelectedNames << aName;
+ }
+ }
+ aPanel->setSelectedPolygonNames( aSelectedNames );
+ }
+}
+
+
+void HYDROGUI_ImportLandCoverMapOp::erasePreview()
+{
+ foreach ( HYDROGUI_Shape* aShape, myPolygonName2PrsShape ) {
+ delete aShape;
+ }
+
+ myPolygonName2PrsShape.clear();
+}
+
+
+void HYDROGUI_ImportLandCoverMapOp::abortOperation()
+{
+ LightApp_Application* anApp = module()->getApp();
+ if ( anApp ) {
+ anApp->disconnect( this );
+ }
+
+ erasePreview();
+
+ HYDROGUI_Operation::abortOperation();
+}
+
+
+void HYDROGUI_ImportLandCoverMapOp::onNext( const int theIndex )
+{
+
+}
+
+void HYDROGUI_ImportLandCoverMapOp::onBack( const int theIndex )
+{
+
+}
--- /dev/null
+// Copyright (C) 2007-2015 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, 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 HYDROGUI_IMPORTLANDCOVERMAP_H
+#define HYDROGUI_IMPORTLANDCOVERMAP_H
+
+#include "HYDROGUI_Operation.h"
+#include <vector>
+#include <QMap>
+
+class SUIT_FileDlg;
+class HYDROGUI_Shape;
+class TopoDS_Face;
+
+
+class HYDROGUI_ImportLandCoverMapOp : public HYDROGUI_Operation
+{
+ Q_OBJECT
+
+public:
+ HYDROGUI_ImportLandCoverMapOp( HYDROGUI_Module* theModule );
+ virtual ~HYDROGUI_ImportLandCoverMapOp();
+
+protected:
+ virtual void startOperation();
+ virtual void abortOperation();
+
+ virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries );
+ HYDROGUI_InputPanel* createInputPanel() const;
+
+ void erasePreview();
+
+protected slots:
+ void onFileSelected();
+ void onSelectionChanged( const QStringList& theSelectedNames );
+ void onViewerSelectionChanged ();
+ void onNext( const int theIndex );
+ void onBack( const int theIndex );
+
+private:
+ QMap<QString, HYDROGUI_Shape*> myPolygonName2PrsShape;
+};
+
+#endif
#include "HYDROGUI_MergePolylinesOp.h"
#include "HYDROGUI_SplitPolylinesOp.h"
#include "HYDROGUI_LandCoverColoringOp.h"
-// TODO
-//#include "HYDROGUI_ImportLandCoverMapOp.h"
+
+#include "HYDROGUI_ImportLandCoverMapOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.h>
anOp = new HYDROGUI_ExportFileOp( aModule );
break;
case ImportLandCoverMapId:
- // TODO
- //anOp = new HYDROGUI_ImportLandCoverMapOp( aModule );
+ anOp = new HYDROGUI_ImportLandCoverMapOp( aModule );
break;
case RemoveImageRefsId:
anOp = new HYDROGUI_RemoveImageRefsOp( aModule );
</context>
<context>
- <name>HYDROGUI_ImportLandCoverDlg</name>
+ <name>HYDROGUI_ImportLandCoverMapDlg</name>
<message>
- <source>LANDCOVER_FILTER</source>
+ <source>LANDCOVERMAP_FILTER</source>
<translation>Shape files (*.shp)</translation>
</message>
<message>
- <source>IMPORT_LANDCOVER_FROM_FILE</source>
- <translation>Import land cover from file</translation>
+ <source>IMPORT_LANDCOVERMAP_FROM_FILE</source>
+ <translation>Import land cover map from file</translation>
</message>
<message>
<source>FILE_NAME</source>
<translation>File name</translation>
</message>
<message>
- <source>LANDCOVER_NAME</source>
- <translation>Land cover name</translation>
+ <source>LANDCOVERMAP_NAME</source>
+ <translation>Land cover map name</translation>
</message>
<message>
<source>NAME</source>
<translation>Founded polygons:</translation>
</message>
<message>
- <source>BAD_IMPORTED_LANDCOVER_FILES</source>
- <translation>Land cover import error</translation>
+ <source>BAD_IMPORTED_LANDCOVERMAP_FILES</source>
+ <translation>Land cover map import error</translation>
</message>
<message>
- <source>NO_ONE_LANDCOVER_IMPORTED</source>
- <translation>Land cover cannot be read from seleted file</translation>
+ <source>NO_ONE_LANDCOVERMAP_IMPORTED</source>
+ <translation>Land cover map cannot be read from seleted file</translation>
</message>
</context>
<context>
- <name>HYDROGUI_ImportLandCoverOp</name>
+ <name>HYDROGUI_ImportLandCoverMapOp</name>
<message>
- <source>IMPORT_LANDCOVER</source>
- <translation>Import land cover</translation>
+ <source>IMPORT_LANDCOVER_MAP</source>
+ <translation>Import land cover map</translation>
</message>
<message>
- <source>DEFAULT_LANDCOVER_NAME</source>
- <translation>Landcover_0</translation>
+ <source>DEFAULT_LANDCOVER_MAP_NAME</source>
+ <translation>Landcovermap_0</translation>
</message>
</context>