]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Import of SHP polygons (draft)
authorisn <isn@opencascade.com>
Tue, 23 Jun 2015 12:17:54 +0000 (15:17 +0300)
committerisn <isn@opencascade.com>
Wed, 24 Jun 2015 10:17:30 +0000 (13:17 +0300)
src/HYDROData/HYDROData_LandCover.h
src/HYDROGUI/HYDROGUI_ImportLandCoverDlg.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverDlg.h
src/HYDROGUI/HYDROGUI_ImportLandcoverOp.cxx
src/HYDROGUI/HYDROGUI_ImportLandcoverOp.h

index 398d6cdd78db92a7cc0b193b2d48f96f85e8d82f..289e4bff1820b2778bac1190edd3312d107335c6 100644 (file)
@@ -132,12 +132,13 @@ public:
   HYDRODATA_EXPORT static TopoDS_Shape buildShape( const HYDROData_SequenceOfObjects& thePolylines,
                                                    TCollection_AsciiString& theErrorMsg );
 
-protected:
   /**
    * Sets the shape presentation of the land cover.
    */
   HYDRODATA_EXPORT virtual void setShape( const TopoDS_Shape& theShape );
 
+protected:
+
   /**
    * Removes the shape from data label of the land cover object.
    */
index b997bd4f084b329f724b4824b4fd7d14d7095b16..ed68774ed4a5cf2a5b257cec994f8fb3b90f229a 100644 (file)
@@ -34,8 +34,7 @@ HYDROGUI_ImportLandCoverDlg::HYDROGUI_ImportLandCoverDlg( HYDROGUI_Module* theMo
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
 
-  // Import bathymetry from file
-  myFileNameGroup = new QGroupBox( tr( "IMPORT_POLYGON_FROM_FILE" ) );
+  myFileNameGroup = new QGroupBox( tr( "IMPORT_LANDCOVER_FROM_FILE" ) );
 
   QLabel* aFileNameLabel = new QLabel( tr( "LANCOVER_NAME" ), myFileNameGroup );
 
@@ -52,7 +51,6 @@ HYDROGUI_ImportLandCoverDlg::HYDROGUI_ImportLandCoverDlg( HYDROGUI_Module* theMo
   aFileNameLayout->addWidget( myFileName );
   aFileNameLayout->addWidget( aBrowseBtn );
 
-  // Bathymetry name
   myObjectNameGroup = new QGroupBox( tr( "FILE_NAME" ) );
 
   QLabel* aBathymetryNameLabel = new QLabel( tr( "NAME" ), myObjectNameGroup );
@@ -64,25 +62,24 @@ HYDROGUI_ImportLandCoverDlg::HYDROGUI_ImportLandCoverDlg( HYDROGUI_Module* theMo
   aBathymetryNameLayout->addWidget( aBathymetryNameLabel );
   aBathymetryNameLayout->addWidget( myObjectName );
 
-  // List of recognized polylines
-  QGroupBox* aPolylinesGroup = new QGroupBox( tr( "FOUND_POLYGONS_OF_SHP_FILE" ), mainFrame() );
-  myPolylines = new QListWidget( aPolylinesGroup );
-  myPolylines->setSelectionMode( QListWidget::ExtendedSelection );
-  myPolylines->setEditTriggers( QListWidget::NoEditTriggers );
-  myPolylines->setViewMode( QListWidget::ListMode );
-  myPolylines->setSortingEnabled( false );
-
-  QBoxLayout* aPolylinesLayout = new QVBoxLayout;
-  aPolylinesLayout->addWidget( myPolylines );
-  aPolylinesGroup->setLayout( aPolylinesLayout );
+  QGroupBox* aPolygonsGroup = new QGroupBox( tr( "FOUND_POLYGONS_OF_SHP_FILE" ), mainFrame() );
+  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
   addWidget( myFileNameGroup );
   addWidget( myObjectNameGroup );  
-  addWidget( aPolylinesGroup );
+  addWidget( aPolygonsGroup );
 
   // Conections
-  connect( myPolylines, SIGNAL( itemSelectionChanged() ), this, SLOT( onItemSelectionChanged() ) );
+  connect( myPolygons, SIGNAL( itemSelectionChanged() ), this, SLOT( onItemSelectionChanged() ) );
   connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
 }
 
@@ -90,42 +87,36 @@ HYDROGUI_ImportLandCoverDlg::~HYDROGUI_ImportLandCoverDlg()
 {
 }
 
-void HYDROGUI_ImportLandCoverDlg::setImageName( const QString& theName )
-{
-  myImageName->setText( theName );
-}
-
 void HYDROGUI_ImportLandCoverDlg::reset()
 {
-  myImageName->clear();
-  myPolylines->clear();
+  myPolygons->clear();
 }
 
-void HYDROGUI_ImportLandCoverDlg::setPolylineNames( const QStringList& theNames )
+void HYDROGUI_ImportLandCoverDlg::setPolygonNames( const QStringList& theNames )
 {
-  myPolylines->clear();
-  myPolylines->addItems( theNames );
+  myPolygons->clear();
+  myPolygons->addItems( theNames );
 }
 
-void HYDROGUI_ImportLandCoverDlg::removePolylineNames( const QStringList& theNames )
+void HYDROGUI_ImportLandCoverDlg::removePolygonNames( const QStringList& theNames )
 {
   QList<QListWidgetItem*> aFoundItems;
 
   foreach ( const QString& aName, theNames ) {
-    aFoundItems = myPolylines->findItems( aName, Qt::MatchExactly );
+    aFoundItems = myPolygons->findItems( aName, Qt::MatchExactly );
     foreach ( QListWidgetItem* anItem, aFoundItems ) {
-      anItem = myPolylines->takeItem( myPolylines->row( anItem ) );
+      anItem = myPolygons->takeItem( myPolygons->row( anItem ) );
       delete anItem;
     }
   }
 }
 
-void HYDROGUI_ImportLandCoverDlg::setSelectedPolylineNames( const QStringList& theNames )
+void HYDROGUI_ImportLandCoverDlg::setSelectedPolygonNames( const QStringList& theNames )
 {
-  myPolylines->clearSelection();
+  myPolygons->clearSelection();
 
   foreach( const QString aName, theNames ) {
-    QList<QListWidgetItem*> anItems = myPolylines->findItems( aName, Qt::MatchExactly );
+    QList<QListWidgetItem*> anItems = myPolygons->findItems( aName, Qt::MatchExactly );
     if ( anItems.count() == 1 ) {
       anItems.first()->setSelected( true );
     }
@@ -134,14 +125,14 @@ void HYDROGUI_ImportLandCoverDlg::setSelectedPolylineNames( const QStringList& t
 
 void HYDROGUI_ImportLandCoverDlg::onItemSelectionChanged()
 {
-  emit selectionChanged( getSelectedtPolylineNames() );
+  emit selectionChanged( getSelectedPolygonNames() );
 }
 
-QStringList HYDROGUI_ImportLandCoverDlg::getSelectedtPolylineNames() const
+QStringList HYDROGUI_ImportLandCoverDlg::getSelectedPolygonNames() const
 {
   QStringList aSelectedNames;
 
-  QList<QListWidgetItem*> aSelectedItems = myPolylines->selectedItems();
+  QList<QListWidgetItem*> aSelectedItems = myPolygons->selectedItems();
   foreach( const QListWidgetItem* anItem, aSelectedItems ) {
     aSelectedNames << anItem->text();
   }
index c9df043252c853f9221dd517d7aae634220caec7..67482a903bb15e2cdab2610e0b18409a0608a884 100644 (file)
@@ -33,16 +33,15 @@ class HYDROGUI_ImportLandCoverDlg : public HYDROGUI_InputPanel
 public:
   HYDROGUI_ImportLandCoverDlg( HYDROGUI_Module* theModule, const QString& theTitle );
   virtual ~HYDROGUI_ImportLandCoverDlg();
-  void setImageName( const QString& theName );
 
   void reset();
 
-  void setPolylineNames( const QStringList& theNames );
-  void removePolylineNames( const QStringList& theNames );
+  void setPolygonNames( const QStringList& theNames );
+  void removePolygonNames( const QStringList& theNames );
 
-  void setSelectedPolylineNames( const QStringList& theNames );
+  void setSelectedPolygonNames( const QStringList& theNames );
 
-  QStringList getSelectedtPolylineNames() const;
+  QStringList getSelectedPolygonNames() const;
 
   void                       setObjectName( const QString& theName );
   QString                    getObjectName() const;
@@ -62,20 +61,14 @@ signals:
 public slots:
   void onItemSelectionChanged();
 
-public:
-  
-  QLineEdit*                 myFileName; //temp
 private:
-  QLineEdit*                 myImageName;
+  QLineEdit*                 myFileName; 
   QGroupBox*                 myFileNameGroup;
-//  QLineEdit*                 myFileName;
-
-  QListWidget* myPolylines;    
+  QListWidget*               myPolygons;       
 
   QGroupBox*                 myObjectNameGroup;
   QLineEdit*                 myObjectName;
 
-
 };
 
 #endif
index 56ca83951489b9fb50ce4201381885aef4dc6f8c..c67bd1adcd1037684fd5202567989c97470e7dc9 100644 (file)
@@ -27,6 +27,9 @@
 #include "HYDROGUI_UpdateFlags.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_ImportLandCoverDlg.h"
+#include "HYDROGUI_Shape.h"
+#include <HYDROData_LandCover.h>
+#include <HYDROGUI_ZLayers.h>
 
 #include <HYDROGUI_DataObject.h>
 #include <HYDROData_Bathymetry.h>
 #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 <BRepBuilderAPI_MakeEdge2d.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
-#include <gp_Pnt2d.hxx>
-#include <BRepTools.hxx>
 #include <gp_Pln.hxx>
-#include <QLineEdit>
+#include <BRepLib.hxx>
+#include <ShapeFix_Shape.hxx>
 
 
 HYDROGUI_ImportLandCoverOp::HYDROGUI_ImportLandCoverOp( HYDROGUI_Module* theModule )
@@ -64,21 +79,12 @@ HYDROGUI_ImportLandCoverOp::HYDROGUI_ImportLandCoverOp( HYDROGUI_Module* theModu
 
 HYDROGUI_ImportLandCoverOp::~HYDROGUI_ImportLandCoverOp()
 {
+
 }
 
 void HYDROGUI_ImportLandCoverOp::startOperation()
 {
   HYDROGUI_Operation::startOperation();
-
-  /*myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true );
-  myFileDlg->setWindowTitle( getName() );
-  myFileDlg->setFileMode( SUIT_FileDlg::ExistingFiles );
-  myFileDlg->setFilter( tr("LANDCOVER_FILTER") );
-
-  connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) );
-  connect( myFileDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) );
-
-  myFileDlg->exec();*/
 }
 
 
@@ -95,6 +101,61 @@ HYDROGUI_InputPanel* HYDROGUI_ImportLandCoverOp::createInputPanel() const
 
 void HYDROGUI_ImportLandCoverOp::onApply()
 {
+
+  HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( inputPanel() );
+  if ( !aPanel ) {
+    return;
+  }
+  
+  QStringList aSelectedtPolygons = aPanel->getSelectedPolygonNames();
+  aPanel->removePolygonNames( aSelectedtPolygons );
+    
+  if (!aSelectedtPolygons.empty())
+  {
+    Handle(HYDROData_LandCover) aLC =  Handle(HYDROData_LandCover)::DownCast( doc()->CreateObject( KIND_LAND_COVER ) );
+    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( !aLC.IsNull() ) 
+    {
+      aLC->SetName( aPanel->getFileName() + "_polygon_" );
+      aLC->SetFillingColor( HYDROData_LandCover::DefaultFillingColor() );
+      aLC->SetBorderColor( HYDROData_LandCover::DefaultBorderColor() );
+      
+      aLC->setShape(aResShape);
+      aLC->Show();
+            
+      //erasePreview();
+      
+      module()->setIsToUpdate( aLC );
+      
+    }
+  }
   module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
   
   QApplication::restoreOverrideCursor();
@@ -121,6 +182,10 @@ void HYDROGUI_ImportLandCoverOp::ProcessSHP(SHPObject* anObj, int i, TopoDS_Face
   int nParts = anObj->nParts;
   gp_Pln pln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
   BRepBuilderAPI_MakeFace aFBuilder(pln);
+
+  Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
+  sfs->FixFaceTool()->FixOrientationMode() = 1;
   for ( int i = 0 ; i < nParts ; i++ )
   { 
     BRepBuilderAPI_MakeWire aBuilder;
@@ -133,33 +198,27 @@ void HYDROGUI_ImportLandCoverOp::ProcessSHP(SHPObject* anObj, int i, TopoDS_Face
 
     for ( int k = StartIndex; k < EndIndex - 1  ; k++ )
     {
-      gp_Pnt2d P1 (anObj->padfX[k], anObj->padfY[k]);
-      gp_Pnt2d P2 (anObj->padfX[k+1], anObj->padfY[k+1]);
-      BRepBuilderAPI_MakeEdge2d aMakeEdge(P1, P2);
+      gp_Pnt P1 (anObj->padfX[k], anObj->padfY[k], 0);
+      gp_Pnt P2 (anObj->padfX[k+1], anObj->padfY[k+1], 0);
+      BRepBuilderAPI_MakeEdge aMakeEdge(P1, P2);
       aBuilder.Add(TopoDS::Edge(aMakeEdge.Shape()));
     }
+    
     aBuilder.Build();
     W = TopoDS::Wire(aBuilder.Shape());
+    W.Reverse();
     aFBuilder.Add(W);
   }
 
   aFBuilder.Build();
-  F = aFBuilder.Face();
-
-  //TODO build curve 3d
-
-  /*aPolylineXY->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
-  aPolylineXY->SetName( theFileName + "_PolyXY_" + QString::number(theInd) );
-  
-  aPolylineXY->Update();
-  
-  size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
-  if ( anActiveViewId == 0 )
-    anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
-  
-  module()->setObjectVisible( anActiveViewId, aPolylineXY, true );
-  
-  module()->setIsToUpdate( aPolylineXY );*/
+  TopoDS_Face DF = aFBuilder.Face();
+  BRepLib::BuildCurves3d(DF);
+  if(!DF.IsNull()) 
+  {
+    sfs->Init ( DF );
+    sfs->Perform();
+    F = TopoDS::Face(sfs->Shape());
+  }
 }
 
 void HYDROGUI_ImportLandCoverOp::onFileSelected()
@@ -179,7 +238,7 @@ void HYDROGUI_ImportLandCoverOp::onFileSelected()
    }
    aPanel->setObjectName( anObjectName );
 
-  QString aFileName = aPanel->myFileName->text();
+   QString aFileName = aPanel->getFileName();
   if ( aFileName.isEmpty() )
   {
     abort();
@@ -196,26 +255,73 @@ void HYDROGUI_ImportLandCoverOp::onFileSelected()
   
     startDocOperation();
     QStringList aPolygonsList;
-    for (int i = 0; i < mySHPObjects.size(); i++)
+    for (int i = 1; i < mySHPObjects.size(); i++)
       aPolygonsList.append("polygon_" + QString::number(i));
-    aPanel->setPolylineNames(aPolygonsList);
-    TopoDS_Compound cmp;
-    BRep_Builder BB;
-    BB.MakeCompound(cmp);
-    TopoDS_Face F;
+    aPanel->setPolygonNames(aPolygonsList);
+
+    SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
+    if ( !aStudy ) {
+      return;
+    }
+
+    erasePreview();
+
+    Handle(AIS_InteractiveContext) aCtx = NULL;
+
+    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() ) );
+      }
+    }
+
+    TopTools_SequenceOfShape aFaces;
+    TopoDS_Face aF;
     if (aHSHP->nShapeType == 5)
     {
-      for (int i = 0; i < 10/*mySHPObjects.size()*/; i++) {
-         ProcessSHP(mySHPObjects[i], i, F);
-         BB.Add(cmp, F);
+      for (int i = 1; i < 4 /*mySHPObjects.size()*/; i++) {   ///TODO temp
+         ProcessSHP(mySHPObjects[i], i, aF);
+         aFaces.Append(aF);
       }
-      ///to hydro_landcover
-      // BRepTools::Write(cmp, "d:/h1.brep");
     }
     else
       SUIT_MessageBox::warning( module()->getApp()->desktop(), "Import Land cover", "Cannot land cover;\nThe shape type is not polygon" );
     
+
+    Handle(HYDROData_LandCover) aLC = Handle(HYDROData_LandCover)::DownCast( doc()->CreateObject( KIND_LAND_COVER ) );
+    for ( int i = 1; i <= aFaces.Length(); i++ ) 
+    {
+      TopoDS_Face aFace = TopoDS::Face(aFaces.Value( i ));
+
+      aLC->setShape( aFace );      
+      
+      if ( aViewManager && !aCtx.IsNull() )
+      {
+        HYDROGUI_Shape* aShape = new HYDROGUI_Shape( aCtx, NULL, getPreviewZLayer() );
+
+        aShape->setFillingColor( HYDROData_LandCover::DefaultFillingColor(), false, false );
+        aShape->setBorderColor( HYDROData_LandCover::DefaultBorderColor(), false, false );
+        if( !aFace.IsNull() )
+          aShape->setShape( aLC->GetShape() );
+        myPolygonName2PrsShape.insert( "polygon_" + QString::number(i), aShape);
+
+      }
+
+    }
+    aLC->Remove();
+
+    if ( !aCtx.IsNull() ) {
+      UpdateZLayersOfHilightPresentationsOfDisplayedObjects( aCtx, Graphic3d_ZLayerId_TopOSD );
+      aCtx->UpdateCurrentViewer();
+    }
+
     commitDocOperation();
     
     for (size_t i = 0; i < mySHPObjects.size(); i++ )
@@ -227,5 +333,84 @@ void HYDROGUI_ImportLandCoverOp::onFileSelected()
   
 }
 
+void HYDROGUI_ImportLandCoverOp::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 );
+      }
+    }
+    aCtx->UpdateCurrentViewer();
+  }
+}
+
+
+void HYDROGUI_ImportLandCoverOp::onViewerSelectionChanged()
+{
+  // Get panel
+  HYDROGUI_ImportLandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverDlg*>( 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_ImportLandCoverOp::erasePreview()
+{
+  foreach ( HYDROGUI_Shape* aShape, myPolygonName2PrsShape ) {
+    delete aShape;
+  }
+
+  myPolygonName2PrsShape.clear();
+}
+
+
+void HYDROGUI_ImportLandCoverOp::abortOperation()
+{
+  LightApp_Application* anApp = module()->getApp();
+  if ( anApp ) {
+    anApp->disconnect( this );
+  }
+
+  erasePreview();
+
+  HYDROGUI_Operation::abortOperation();
+}
 
 
index f8b95c5eb637c2a7b14f07b424f32748cabc9e9d..181948a910ea82b4fd65e8f60d3d392242cd75f9 100644 (file)
 
 #include "HYDROGUI_Operation.h"
 #include <vector>
+#include <QMap>
 
 //extern "C" {
 #include <shapelib/shapefil.h> 
 //};
 
 class SUIT_FileDlg;
+class HYDROGUI_Shape;
 class TopoDS_Face;
 
 
@@ -44,17 +46,22 @@ public:
 
 protected:
   virtual void startOperation();
+  virtual void abortOperation();
+
   virtual void onApply();
   HYDROGUI_InputPanel* createInputPanel() const;
   void Parse(SHPHandle theHandle);
   void ProcessSHP(SHPObject* anObj, int i, TopoDS_Face& F);
+  void erasePreview();
  
 protected slots:
-  void                            onFileSelected();
+  void onFileSelected();
+  void onSelectionChanged( const QStringList& theSelectedNames );
+  void onViewerSelectionChanged ();
 
 private:
-  //SUIT_FileDlg* myFileDlg;
   std::vector<SHPObject*> mySHPObjects;
+  QMap<QString, HYDROGUI_Shape*> myPolygonName2PrsShape;
 };
 
 #endif