Salome HOME
Merge branch 'BR_MULTI_BATHS' into HEAD
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ExportFileOp.cxx
index bd4825e3449723c3b465d359f484a6a9aa1c1f80..76cbf0dc732f91e297675c0ba3a0890dd2b056be 100644 (file)
@@ -21,7 +21,7 @@
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_UpdateFlags.h"
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_ExportLandCoverMapDlg.h"
 #include <HYDROData_PolylineXY.h>
 #include <HYDROData_Polyline3D.h>
@@ -107,14 +107,14 @@ void HYDROGUI_ExportFileOp::startOperation()
     {
       QStringList aNonExpList;
       HYDROData_ShapeFile anExporter;
+      Handle_HYDROData_Document aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
       if (!aPolyXYSeq.IsEmpty() || !aPolyXYSeq.IsEmpty())
         //Export polylines
-        anExporter.Export(aFileName, aPolyXYSeq, aPoly3DSeq, aNonExpList);
+        anExporter.Export(aDoc, aFileName, aPolyXYSeq, aPoly3DSeq, aNonExpList);
       else
       {
         //Export polygons
         //Extract all attribute names from all strickler tables
-        Handle_HYDROData_Document aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
         QSet<QString> anAttrNames;
         //use QSet to store attribute names. Yet it's not so good if the document contains two strickler types
         //with the same name
@@ -131,13 +131,16 @@ void HYDROGUI_ExportFileOp::startOperation()
         else
           return; 
 
+        QStringList SortedListOfAttr = anAttrNames.toList();
+        SortedListOfAttr.sort();
         //
-        HYDROGUI_ExportLandCoverMapDlg aDlg( module()->getApp()->desktop(), anAttrNames.toList());
+        Handle_HYDROData_LandCoverMap aLCM = Handle(HYDROData_LandCoverMap)::DownCast( aSeq(1) );
+        bool IsLinear = aLCM->CheckLinear();
+        HYDROGUI_ExportLandCoverMapDlg aDlg( module()->getApp()->desktop(), IsLinear, SortedListOfAttr);
         if ( aDlg.exec() == HYDROGUI_ExportLandCoverMapDlg::Accepted )
         { 
           //In our case :  aSeq.Size() == 1
           //Export of multiple landcover maps into the one shp-file is disallowed.
-          Handle_HYDROData_LandCoverMap aLCM = Handle(HYDROData_LandCoverMap)::DownCast( aSeq(1) );
           QString aCItem = aDlg.getCurrentItem();
           Handle(HYDROData_StricklerTable) aStricklerTableObj;
           {
@@ -151,12 +154,12 @@ void HYDROGUI_ExportFileOp::startOperation()
           }
 
           //export shape-data
-          anExporter.Export(aFileName, aLCM, aNonExpList);
+          anExporter.Export(aDoc, aFileName, aLCM, aNonExpList, false, !IsLinear, aDlg.getDeflValue());
           QString aDBFFileName = aFileName.replace( ".shp", ".dbf", Qt::CaseInsensitive);
           //Even if attribute-checkbox is unchecked, the .dbf-file should be removed. 
           //otherwise it may be used with wrong .shp-file. This is an incorrect behaivor.
           remove (aDBFFileName.toStdString().c_str());
-          bool bToSaveAttrInfo = aDlg.getAttrCheckBoxState();
+          bool bToSaveAttrInfo = aDlg.getAttrCheckBoxState() && !aDlg.getCurrentItem().isEmpty();
           if (bToSaveAttrInfo)
           {
             //export attribute info