+ if (!aPolyXYSeq.IsEmpty() || !aPolyXYSeq.IsEmpty())
+ //Export polylines
+ anExporter.Export(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
+ if (aDoc)
+ {
+ HYDROData_Iterator anIt( aDoc, KIND_STRICKLER_TABLE );
+ for( ; anIt.More(); anIt.Next() )
+ {
+ Handle(HYDROData_StricklerTable) aStricklerTableObj = Handle(HYDROData_StricklerTable)::DownCast( anIt.Current() );
+ if ( !aStricklerTableObj.IsNull())
+ anAttrNames << aStricklerTableObj->GetAttrName();
+ }
+ }
+ else
+ return;
+
+ //
+ HYDROGUI_ExportLandCoverMapDlg aDlg( module()->getApp()->desktop(), anAttrNames.toList());
+ 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;
+ {
+ HYDROData_Iterator anIt( aDoc, KIND_STRICKLER_TABLE );
+ for( ; anIt.More(); anIt.Next() )
+ {
+ aStricklerTableObj = Handle(HYDROData_StricklerTable)::DownCast( anIt.Current() );
+ if ( !aStricklerTableObj.IsNull() && aStricklerTableObj->GetAttrName() == aCItem)
+ break;
+ }
+ }
+
+ //export shape-data
+ anExporter.Export(aFileName, aLCM, aNonExpList);
+ 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();
+ if (bToSaveAttrInfo)
+ {
+ //export attribute info
+ QStringList anAttrValues;
+ QStringList aStricklerTypes;
+ if (aNonExpList.empty())
+ {
+ HYDROData_LandCoverMap::Explorer aLCMIt( aLCM );
+ for( ; aLCMIt.More(); aLCMIt.Next() )
+ {
+ QString aST = aLCMIt.StricklerType();
+ anAttrValues << aStricklerTableObj->GetAttrValue(aST);
+ aStricklerTypes << aST;
+ }
+ }
+ aLCM->ExportDBF(aDBFFileName, aCItem, anAttrValues, aStricklerTypes);
+ }
+ }
+ else
+ {
+ abort();
+ return;
+ }
+
+ }
+