Salome HOME
refs #1832
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportPolylineOp.cxx
index bc83c0f2abe7506a9200f7a357e2a839c835c4f3..6697b42010576b0f68c513458fd002f654cf7009 100644 (file)
@@ -28,6 +28,7 @@
 #include <HYDROData_Bathymetry.h>
 #include <HYDROData_Iterator.h>
 #include <HYDROData_ShapeFile.h>
+#include <HYDROData_Tool.h>
 
 #include <HYDROData_Profile.h>
 
@@ -39,6 +40,7 @@
 #include <QFile>
 #include <QFileInfo>
 #include <SUIT_MessageBox.h>
+#include <gp_XY.hxx>
 
 
 HYDROGUI_ImportPolylineOp::HYDROGUI_ImportPolylineOp( HYDROGUI_Module* theModule )
@@ -77,7 +79,16 @@ NCollection_Sequence<Handle(HYDROData_Entity)> HYDROGUI_ImportPolylineOp::Import
       continue;
 
     QString anExt = aFileName.split('.', QString::SkipEmptyParts).back();
-
+    anExt.toLower();
+    bool importXY = false;
+    if (anExt == "xyz")
+    {
+      importXY = SUIT_MessageBox::question( module->getApp()->desktop(),
+        tr( "IMPORT_POLYLINE" ),
+        tr( "IMPORT_POLYLINE_XY_PART_ONLY" ),
+        QMessageBox::Yes | QMessageBox::No, 
+        SUIT_MessageBox::Yes) == SUIT_MessageBox::Yes;
+    }
     if (anExt == "shp")
     {
       HYDROData_ShapeFile anImporter;
@@ -186,6 +197,14 @@ NCollection_Sequence<Handle(HYDROData_Entity)> HYDROGUI_ImportPolylineOp::Import
       }
       importedEntities.Append(theEntities);
     }
+    else if ( anExt == "xy" || (importXY && anExt == "xyz"))
+    {
+      HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, true, importedEntities);   
+    }
+    else if (anExt == "xyz")
+    {
+      HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, false, importedEntities);
+    }
   }
   return importedEntities;
 }