#include <HYDROData_Bathymetry.h>
#include <HYDROData_Iterator.h>
#include <HYDROData_ShapeFile.h>
+#include <HYDROData_Tool.h>
#include <HYDROData_Profile.h>
#include <QFile>
#include <QFileInfo>
#include <SUIT_MessageBox.h>
+#include <gp_XY.hxx>
HYDROGUI_ImportPolylineOp::HYDROGUI_ImportPolylineOp( HYDROGUI_Module* theModule )
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;
UpdateView(module, theEntities);
if (theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All) //if other flag = > no need to show this messagebox
SUIT_MessageBox::information(module->getApp()->desktop(),
- tr( "IMPORT_POLYLINE" ), "Contour of the polygon(s) have been imported as polyline(s)");
+ tr( "IMPORT_POLYLINE" ), tr ("POLYGON_IMPORTED_AS_POLYLINE"));
}
else
{
- QString aMess = "Cannot import content of this file as polyline;\n";
+ QString aMess;
+ if (theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType::ImportShapeType_Polygon)
+ aMess += tr ("POLYLINE_IMPORT_FAILED_AS_POLYGON") + ";\n";
+ else
+ aMess += tr ("POLYLINE_IMPORT_FAILED_AS_POLYLINE") + ";\n";
+
if (aStat == -1)
- aMess += "Cannot open SHP file";
+ aMess += tr ("CANT_OPEN_SHP");
else if (aStat == -2)
- aMess += "Cannot open SHX file";
+ aMess += tr ("CANT_OPEN_SHX");
else
- aMess += "The shape type of file is " + anImporter.GetShapeTypeName(aShapeTypeOfFile);
+ aMess += tr ("SHAPE_TYPE_IS") + anImporter.GetShapeTypeName(aShapeTypeOfFile);
SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), aMess);
}
importedEntities.Append(theEntities);
}
+ else if ( anExt == "xy" || (importXY && anExt == "xyz"))
+ {
+ if (!HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, true, importedEntities))
+ SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), tr( "NO_ONE_POLYLINE_IMPORTED" ));
+ }
+ else if (anExt == "xyz")
+ {
+ if (!HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, false, importedEntities))
+ SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), tr( "NO_ONE_POLYLINE_IMPORTED" ));
+ }
}
return importedEntities;
}