Salome HOME
refs #1813 ... lot 14 combined commit : parts : 1 - 16
[modules/hydro.git] / src / HYDROData / HYDROData_ShapeFile.cxx
index 2a38a86d1401211f791bddbcf949b289fb6d1c47..eef771c39552054b76c89b17c8e81f236e441431 100644 (file)
@@ -706,7 +706,7 @@ void HYDROData_ShapeFile::GetFreeIndices(std::vector<int>& theAllowedIndexes, QS
 }
 
 int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, const QString& theFileName, 
-  NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities, int& theShapeTypeOfFile)
+  NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities, int& theShapeTypeOfFile, ImportShapeType theShapeTypesToImport)
 {
   //Free();
   int aStat = TryOpenShapeFile(theFileName);
@@ -728,7 +728,12 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument,
 
   if (!Parse(aHSHP, HYDROData_ShapeFile::ShapeType_Polyline, theShapeTypeOfFile))
     return 0;
-  if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23)
+
+  int sh_type = aHSHP->nShapeType;
+
+  if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
+    theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline) 
+    && (sh_type == 3 || sh_type == 23))
   {
     size_t anObjsSize = mySHPObjects.size();
     GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName);
@@ -739,7 +744,8 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument,
     }
     aStat = 1;
   }
-  else if (aHSHP->nShapeType == 13)
+  else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
+    theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13)
   {
     anInd = 0;
     for (;anAllowedIndexes.size() < mySHPObjects.size();)
@@ -760,7 +766,8 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument,
     }
     aStat = 1;
   }
-  else if (aHSHP->nShapeType == 5)
+  else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || 
+    theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polygon) && sh_type == 5)
   {
     //import polygon's contours as polylines
     size_t anObjsSize = mySHPObjects.size();