Salome HOME
first part of the porting on OCCT 7.0
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportLandCoverMapOp.cxx
index 403a22634b0a72b8ccb03b995849078091a385cf..deba3d6c38232dba9b102e18ce3f624ece2b3890 100644 (file)
@@ -132,7 +132,7 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
   //Import polygons from SHP file as faces
   //This faces should be added to the new LCM object
 
-  int aStat = myImporter.ImportPolygons(myFileName, aPolygonsList, myPolygonFaces, aShapeTypeOfFile);
+  int aStat = myImporter.ImportPolygons(doc(), myFileName, aPolygonsList, myPolygonFaces, aShapeTypeOfFile);
   if (aStat == 1)
   {
     aPanel->setPolygonNames(aPolygonsList);
@@ -262,7 +262,7 @@ bool HYDROGUI_ImportLandCoverMapOp::processApply( int& theUpdateFlags,
   if ( !aPanel->getFileName().isEmpty() )
     anObjName = aPanel->getObjectName();
   
-  Handle_HYDROData_Document aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
 
   //check if name of LCM is already exists
   QSet<QString> aNameList;
@@ -337,18 +337,16 @@ void HYDROGUI_ImportLandCoverMapOp::onViewerSelectionChanged()
     return;
 
   int aCurIndex = -1;
-  aCurIndex = aPanel->GetCurrentWizardIndex();
+  aCurIndex = aPanel->getCurrentWizardIndex();
 
   if (aCurIndex != 0)
     return;
 
   OCCViewer_ViewManager* aViewManager = getPreviewManager();
   Handle(AIS_InteractiveContext) aCtx = NULL;
-  if ( aViewManager ) {
-    if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
+  if ( aViewManager )
+    if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
       aCtx = aViewer->getAISContext();
-    }
-  }
   
   if ( !aCtx.IsNull() )
   {
@@ -410,7 +408,7 @@ void HYDROGUI_ImportLandCoverMapOp::onNext( const int theIndex )
 
     //Collect all strickler_types
     QSet<QString> aSTSet;
-    Handle_HYDROData_Document aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
+    Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
     Handle(HYDROData_StricklerTable) DefStricklerTableObj;
     if ( aDoc )
     {
@@ -444,7 +442,7 @@ void HYDROGUI_ImportLandCoverMapOp::onNext( const int theIndex )
     aSTColors.prepend(QColor(Qt::gray));
     
     QVector<int> aCurCBIndices(aSetOfAttrValuesList.size());
-    if (DefStricklerTableObj->GetAttrName() == aPanel->getSelectedFieldName())
+    if (DefStricklerTableObj->GetAttrName().trimmed() == aPanel->getSelectedFieldName().trimmed())
       for (int i = 0; i < aSetOfAttrValuesList.size(); i++)
       {
         QString aST = DefStricklerTableObj->GetType(aSetOfAttrValuesList[i]);
@@ -464,6 +462,13 @@ void HYDROGUI_ImportLandCoverMapOp::onNext( const int theIndex )
 
 void HYDROGUI_ImportLandCoverMapOp::onApply()
 {
+  HYDROGUI_ImportLandCoverMapDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
+  if ( !aPanel )
+    return;
+
+  if (!aPanel->CheckFirstPageFilling())
+    return;
+  
   QApplication::setOverrideCursor( Qt::WaitCursor );
   int anUpdateFlags = 0;
   QString anErrorMsg;