X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ShapeFile.cxx;h=2a38a86d1401211f791bddbcf949b289fb6d1c47;hb=8d4dba4a45855249f5eb022e9cc7dcff202bce3c;hp=a66bc81b960090322510265ec18a2ce52ad394d8;hpb=5a7f3687b5f4342d1cdce198de0e01e6558d1db4;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index a66bc81b..2a38a86d 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -35,9 +35,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -80,21 +80,21 @@ HYDROData_ShapeFile::~HYDROData_ShapeFile() void HYDROData_ShapeFile::Export(Handle(HYDROData_Document) theDocument, const QString& aFileName, - NCollection_Sequence aPolyXYSeq, - NCollection_Sequence aPoly3DSeq, + NCollection_Sequence aPolyXYSeq, + NCollection_Sequence aPoly3DSeq, QStringList& aNonExpList) { SHPHandle hSHPHandle; if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_ARC ); + hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARC ); for (int i = 1; i <= aPolyXYSeq.Size(); i++) if (WriteObjectPolyXY(theDocument, hSHPHandle, aPolyXYSeq(i)) != 1) aNonExpList.append(aPolyXYSeq(i)->GetName()); } else if (aPolyXYSeq.IsEmpty() && !aPoly3DSeq.IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_ARCZ ); + hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARCZ ); for (int i = 1; i <= aPoly3DSeq.Size(); i++) if (WriteObjectPoly3D(theDocument, hSHPHandle, aPoly3DSeq(i)) != 1) aNonExpList.append(aPoly3DSeq(i)->GetName()); @@ -112,7 +112,7 @@ void HYDROData_ShapeFile::Export(Handle(HYDROData_Document) theDocument, void HYDROData_ShapeFile::Export(Handle(HYDROData_Document) theDocument, const QString& aFileName, - const Handle_HYDROData_LandCoverMap& aLCM, + const Handle(HYDROData_LandCoverMap)& aLCM, QStringList& aNonExpList, bool bCheckLinear, bool bUseDiscr, double theDefl) { @@ -122,7 +122,7 @@ void HYDROData_ShapeFile::Export(Handle(HYDROData_Document) theDocument, SHPHandle hSHPHandle = NULL; if ( !aLCM.IsNull() && !aLCM->IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_POLYGON ); + hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_POLYGON ); HYDROData_LandCoverMap::Explorer It( aLCM ); for( ; It.More(); It.Next()) { @@ -145,7 +145,7 @@ void HYDROData_ShapeFile::Export(Handle(HYDROData_Document) theDocument, int HYDROData_ShapeFile::WriteObjectPolyXY(Handle(HYDROData_Document) theDocument, SHPHandle theShpHandle, - Handle_HYDROData_PolylineXY thePoly ) + Handle(HYDROData_PolylineXY) thePoly ) { SHPObject *aSHPObj; std::vector x, y; @@ -183,7 +183,7 @@ int HYDROData_ShapeFile::WriteObjectPolyXY(Handle(HYDROData_Document) theDocumen int HYDROData_ShapeFile::WriteObjectPoly3D(Handle(HYDROData_Document) theDocument, SHPHandle theShpHandle, - Handle_HYDROData_Polyline3D thePoly ) + Handle(HYDROData_Polyline3D) thePoly ) { SHPObject *aSHPObj; std::vector x, y, z; @@ -398,7 +398,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, return; TopoDS_Edge E; int nParts = anObj->nParts; - Handle_Geom_Plane aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1)); + Handle(Geom_Plane) aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1)); BRep_Builder BB; BB.MakeFace(F); @@ -437,7 +437,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, gp_Pnt P2 = BRep_Tool::Pnt(VPoints(k + 1)); if (P1.Distance(P2) < Precision::Confusion()) continue; - Handle_Geom_TrimmedCurve aTC = GC_MakeSegment(P1, P2).Value(); + Handle(Geom_TrimmedCurve) aTC = GC_MakeSegment(P1, P2).Value(); TopoDS_Edge E; if ( k != VPoints.Size() - 2) E = BRepLib_MakeEdge(aTC, VPoints(k), VPoints(k + 1)).Edge(); @@ -520,7 +520,7 @@ int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, int Stat = TryOpenShapeFile(theFileName); if (Stat != 0) return Stat; - myHSHP = SHPOpen( theFileName.toAscii().data(), "rb" ); + myHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" ); if (!Parse(myHSHP, HYDROData_ShapeFile::ShapeType_Polygon, theShapeTypeOfFile)) return 0; for (size_t i = 0; i < mySHPObjects.size(); i++) @@ -563,7 +563,7 @@ void HYDROData_ShapeFile::Free() void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, - int theInd, NCollection_Sequence& theEntities, bool bReadAsPolyline) + int theInd, NCollection_Sequence& theEntities, bool bReadAsPolyline) { Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) ); @@ -586,10 +586,10 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] ) { IsClosed = true; - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true); } else - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, false); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false); if (IsClosed) EndIndex--; @@ -597,7 +597,7 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, else { //polygon; contours always closed - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true); EndIndex--; } for ( int k = StartIndex; k < EndIndex ; k++ ) @@ -618,7 +618,7 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, } void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, - int theInd, NCollection_Sequence& theEntities) + int theInd, NCollection_Sequence& theEntities) { Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) ); @@ -645,10 +645,10 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1]) { IsClosed = true; - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true ); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true ); } else - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, false ); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false ); if (IsClosed) EndIndex--; @@ -706,7 +706,7 @@ void HYDROData_ShapeFile::GetFreeIndices(std::vector& theAllowedIndexes, QS } int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, const QString& theFileName, - NCollection_Sequence& theEntities, int& theShapeTypeOfFile) + NCollection_Sequence& theEntities, int& theShapeTypeOfFile) { //Free(); int aStat = TryOpenShapeFile(theFileName); @@ -721,7 +721,7 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, anExistingNames.push_back(anIter.Current()->GetName()); SHPHandle aHSHP; - aHSHP = SHPOpen( theFileName.toAscii().data(), "rb" ); + aHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" ); QFileInfo aFileInfo(theFileName); QString aBaseFileName = aFileInfo.baseName(); @@ -832,9 +832,9 @@ int HYDROData_ShapeFile::TryOpenShapeFile(QString theFileName) return -3; FILE* pFileSHP = NULL; - pFileSHP = fopen (aSHPfile.toAscii().data(), "r"); + pFileSHP = fopen (aSHPfile.toLatin1().data(), "r"); FILE* pFileSHX = NULL; - pFileSHX = fopen (aSHXfile.toAscii().data(), "r"); + pFileSHX = fopen (aSHXfile.toLatin1().data(), "r"); if (pFileSHP == NULL || pFileSHX == NULL) { @@ -855,7 +855,7 @@ bool HYDROData_ShapeFile::CheckDBFFileExisting(const QString& theSHPFilePath, QS QString aSHPfile = theSHPFilePath.simplified(); QString aDBFfile = theSHPFilePath.simplified().replace( theSHPFilePath.simplified().size() - 4, 4, ".dbf"); FILE* pFileDBF = NULL; - pFileDBF = fopen (aDBFfile.toAscii().data(), "r"); + pFileDBF = fopen (aDBFfile.toLatin1().data(), "r"); if (pFileDBF == NULL) { @@ -870,7 +870,7 @@ bool HYDROData_ShapeFile::CheckDBFFileExisting(const QString& theSHPFilePath, QS bool HYDROData_ShapeFile::DBF_OpenDBF(const QString& thePathToDBFFile) { - myHDBF = DBFOpen( thePathToDBFFile.toAscii().data(), "r" ); + myHDBF = DBFOpen( thePathToDBFFile.toLatin1().data(), "r" ); if(myHDBF != NULL) return true; else