X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ShapeFile.cxx;h=d372e18e5c02214e7b1497c905290be89ae10f58;hb=e2416eca5bf95eb9a8b84d3159ef37a6c4eff230;hp=fc09314676e99f62905d66bc3fc6a250454fc19b;hpb=b5fc99aa4b17cdf67926f83a63e8d485c6fb0c65;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index fc093146..d372e18e 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -66,11 +66,11 @@ #pragma warning( disable: 4996 ) #endif -//SHP->TFaces (Import) +//SHP->TFaces (Import) #define OSD_TIMER HYDROData_ShapeFile::HYDROData_ShapeFile() : myHSHP(NULL) -{ +{ } HYDROData_ShapeFile::~HYDROData_ShapeFile() @@ -87,7 +87,7 @@ void HYDROData_ShapeFile::Export(Handle(HYDROData_Document) theDocument, SHPHandle hSHPHandle; if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toLatin1().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()); @@ -150,8 +150,8 @@ int HYDROData_ShapeFile::WriteObjectPolyXY(Handle(HYDROData_Document) theDocumen SHPObject *aSHPObj; std::vector x, y; std::vector anPartStart; - - for (int i = 0; i < thePoly->NbSections(); i++) + + for (int i = 0; i < thePoly->NbSections(); i++) if (thePoly->GetSectionType(i) == HYDROData_IPolyline::SECTION_SPLINE) return -1; @@ -174,7 +174,7 @@ int HYDROData_ShapeFile::WriteObjectPolyXY(Handle(HYDROData_Document) theDocumen y.push_back( P.Y()); } } - + aSHPObj = SHPCreateObject (SHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL ); SHPWriteObject( theShpHandle, -1, aSHPObj ); SHPDestroyObject( aSHPObj ); @@ -191,7 +191,7 @@ int HYDROData_ShapeFile::WriteObjectPoly3D(Handle(HYDROData_Document) theDocumen anPartStart.push_back(0); //one section only if (thePoly->GetPolylineXY()->GetSectionType(0) == HYDROData_IPolyline::SECTION_SPLINE) - return -1; + return -1; HYDROData_Polyline3D::Polyline3DPoints aPointList3D = thePoly->GetProfilePoints3D(true); for (int j = 1; j <= aPointList3D.Size(); j++) @@ -232,9 +232,9 @@ int HYDROData_ShapeFile::WriteObjectPolygon(Handle(HYDROData_Document) theDocume else if (theInputShape.ShapeType() == TopAbs_COMPOUND) { TopExp_Explorer Ex(theInputShape, TopAbs_FACE); - for (; Ex.More(); Ex.Next()) + for (; Ex.More(); Ex.Next()) { - TopoDS_Face aF = TopoDS::Face(Ex.Current()); + TopoDS_Face aF = TopoDS::Face(Ex.Current()); if (aF.IsNull()) continue; ProcessFace(theDocument, aF, theShpHandle, bUseDiscr, theDefl); @@ -244,7 +244,7 @@ int HYDROData_ShapeFile::WriteObjectPolygon(Handle(HYDROData_Document) theDocume return 0; return 1; - + } void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument, @@ -261,26 +261,26 @@ void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument, NCollection_Sequence aWires; //write an outer wire first - aWires.Append(OuterW); - TopExp_Explorer Ex(theFace, TopAbs_WIRE); - for (; Ex.More(); Ex.Next()) + aWires.Append(OuterW); + TopExp_Explorer Ex(theFace, TopAbs_WIRE); + for (; Ex.More(); Ex.Next()) { TopoDS_Wire aW = TopoDS::Wire(Ex.Current()); if (aW.IsEqual(OuterW)) continue; - aWires.Append(aW); + aWires.Append(aW); } int NbWires = 0; - for (int k = 1; k <= aWires.Length(); k++) + for (int k = 1; k <= aWires.Length(); k++) { - TopoDS_Wire aW = aWires(k); + TopoDS_Wire aW = aWires(k); if (aW.IsNull()) continue; NbWires++; if (aW.Orientation() == TopAbs_INTERNAL) //cant write internal wires/edges - continue; + continue; // Try to reorder edges Handle(ShapeFix_Wire) aSFW = new ShapeFix_Wire( aW, theFace, Precision::Confusion() ); aSFW->ModifyTopologyMode() = Standard_False; @@ -339,7 +339,7 @@ void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument, aNPnts.Append(aPnts.First()); for (int j = 1; j <= aPnts.Size() - 1; j++) { - if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion())) + if (!aPnts(j).IsEqual(aPnts(j + 1), Precision::Confusion())) aNPnts.Append(aPnts(j + 1)); } @@ -348,7 +348,7 @@ void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument, //External wire will be written in clockwise direction //any other wires (holes) - in anticlockwise direction for (int j = aNPnts.Size(); j >= 1; j--) - { + { gp_XY P = gp_XY(aNPnts(j).X(), aNPnts(j).Y()); theDocument->Transform(P, false); x.push_back( P.X()); @@ -361,7 +361,7 @@ void HYDROData_ShapeFile::ProcessFace(Handle(HYDROData_Document) theDocument, y.push_back( P.Y()); } - + aSHPObj = SHPCreateObject( SHPT_POLYGON, -1, NbWires, &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL ); SHPWriteObject( theShpHandle, -1, aSHPObj ); SHPDestroyObject( aSHPObj ); @@ -374,12 +374,12 @@ bool HYDROData_ShapeFile::Parse(SHPHandle theHandle, ShapeType theType) mySHPObjects.clear(); SHPGetInfo( theHandle, NULL, &aShapeType, NULL, NULL ); //theShapeTypeOfFile = aShapeType; - bool ToRead = (theType == ShapeType_Polyline && + bool ToRead = (theType == ShapeType_Polyline && (aShapeType == 3 || aShapeType == 13 || aShapeType == 23 || aShapeType == 5)) || (theType == ShapeType_Polygon && aShapeType == 5); - if (ToRead) + if (ToRead) { - for (int i = 0; i < theHandle->nRecords; i++) + for (int i = 0; i < theHandle->nRecords; i++) mySHPObjects.push_back(SHPReadObject(theHandle, i)); return true; } @@ -391,7 +391,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, { if (!anObj) return; - TopoDS_Edge E; + TopoDS_Edge E; int nParts = anObj->nParts; Handle(Geom_Plane) aPlaneSur = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1)); @@ -402,7 +402,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, TopTools_SequenceOfShape aWires; for ( int i = 0 ; i < nParts ; i++ ) - { + { BRepBuilderAPI_MakeWire aBuilder; int StartIndex = anObj->panPartStart[i]; int EndIndex; @@ -414,7 +414,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, TopoDS_Wire W; BB.MakeWire(W); - //First point is same as the last point + //First point is same as the last point int NbPnts = EndIndex - StartIndex - 1; NCollection_Array1 VPoints(0, NbPnts); int j = NbPnts; @@ -425,7 +425,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, VPoints.ChangeValue(j) = BRepLib_MakeVertex(P).Vertex(); j--; } - + for ( int k = 0; k < VPoints.Size() - 1; k++ ) { gp_Pnt P1 = BRep_Tool::Pnt(VPoints(k)); @@ -471,7 +471,7 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, Standard_Real jXmax, jXmin, jYmax, jYmin; BBs(i).Get(iXmin, iYmin, z0, iXmax, iYmax, z1); BBs(j).Get(jXmin, jYmin, z0, jXmax, jYmax, z1); - if (!(iXmin > jXmin && + if (!(iXmin > jXmin && iYmin > jYmin && iXmax < jXmax && iYmax < jYmax)) @@ -496,20 +496,20 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, BB.UpdateFace(DF, aPlaneSur, TopLoc_Location(), Precision::Confusion()); // BRepTopAdaptor_FClass2d FClass(DF, Precision::PConfusion()); - if ( i == OutWIndex && FClass.PerformInfinitePoint() == TopAbs_IN) + if ( i == OutWIndex && FClass.PerformInfinitePoint() == TopAbs_IN) W.Reverse(); - if ( i != OutWIndex && FClass.PerformInfinitePoint() == TopAbs_OUT) + if ( i != OutWIndex && FClass.PerformInfinitePoint() == TopAbs_OUT) W.Reverse(); // BB.Add(F, W); } - + //Add surface to the face BB.UpdateFace(F, aPlaneSur, TopLoc_Location(), Precision::Confusion()); F.Closed(Standard_True); } -int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName, +int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName, QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces) { Free(); @@ -521,7 +521,7 @@ int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, return 0; for (size_t i = 0; i < mySHPObjects.size(); i++) thePolygonsList.append("polygon_" + QString::number(i + 1)); - + TopoDS_Face aF; if (myHSHP->nShapeType == 5) { @@ -529,7 +529,7 @@ int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, OSD_Timer timer; timer.Start(); #endif - for (size_t i = 0; i < mySHPObjects.size(); i++) + for (size_t i = 0; i < mySHPObjects.size(); i++) { ReadSHPPolygon(theDocument, mySHPObjects[i], i, aF); theFaces.Append(aF); @@ -545,7 +545,7 @@ int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, } void HYDROData_ShapeFile::Free() -{ +{ for (size_t i = 0; i < mySHPObjects.size(); i++ ) free (mySHPObjects[i]); @@ -553,16 +553,16 @@ void HYDROData_ShapeFile::Free() if (myHSHP != NULL) { SHPClose(myHSHP); - myHSHP = NULL; + myHSHP = NULL; } } -void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, +void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, int theInd, NCollection_Sequence& theEntities, bool bReadAsPolyline) { Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) ); - + int nParts = anObj->nParts; for ( int i = 0 ; i < nParts ; i++ ) { @@ -573,7 +573,7 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, else EndIndex = anObj->nVertices; - HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; + HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; if (!bReadAsPolyline) { bool IsClosed = false; @@ -603,17 +603,17 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, } } - + aPolylineXY->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() ); aPolylineXY->SetName( theFileName + "_PolyXY_" + QString::number(theInd) ); - + aPolylineXY->Update(); theEntities.Append(aPolylineXY); } -void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, - const Handle(HYDROData_PolylineXY)& aPolylineXY, +void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, + const Handle(HYDROData_PolylineXY)& aPolylineXY, NCollection_Sequence& theEntities) { Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( theDocument->CreateObject( KIND_POLYLINE ) ); @@ -632,10 +632,10 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, else EndIndex = anObj->nVertices; - HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; + HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] && anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] && - anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1]) + anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1]) EndIndex--; for ( int k = StartIndex ; k < EndIndex ; k++ ) { @@ -645,7 +645,7 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, p.X = xyz.X(); p.Y = xyz.Y(); p.Z = xyz.Z(); - aAPoints.push_back(p); + aAPoints.push_back(p); } } @@ -653,7 +653,7 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, QString aPoly3DName = PolyXYName, aBathyName = PolyXYName; aPoly3DName.replace(PolyXYName.lastIndexOf("_PolyXY_"), 8, "_Poly3D_"); aBathyName.replace(PolyXYName.lastIndexOf("_Bath_"), 6, "_Poly3D_"); - + aBath->SetAltitudePoints(aAPoints); aBath->SetName( aBathyName ); @@ -669,7 +669,7 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, } /* -void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, +void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, int theInd, bool XYOnly, NCollection_Sequence& theEntities) { Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) ); @@ -696,7 +696,7 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, EndIndex = anObj->nVertices; bool IsClosed = false; - HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; + HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] && anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] && anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1]) @@ -706,7 +706,7 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, } else aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false ); - + if (IsClosed) EndIndex--; for ( int k = StartIndex ; k < EndIndex ; k++ ) @@ -785,14 +785,14 @@ int HYDROData_ShapeFile::OpenAndParse(const QString& theFileName) if (!Parse(myHSHP, HYDROData_ShapeFile::ShapeType_Polyline)) return -1; - + return 1; //sh_type = aHSHP->nShapeType; } -int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, - const QString& theFileName, - NCollection_IndexedDataMap& theEntitiesToSHPObj, +int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, + const QString& theFileName, + NCollection_IndexedDataMap& theEntitiesToSHPObj, ImportShapeType theShapeTypesToImport) { int aStat = -1; @@ -807,13 +807,13 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, anExistingNames.push_back(anIter.Current()->GetName()); NCollection_Sequence Ents; - if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || - theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline) + 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); - + for (size_t i = 0; i < mySHPObjects.size(); i++ ) { ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); @@ -822,7 +822,7 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, } aStat = 1; } - else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || + else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13) { anInd = 0; @@ -840,20 +840,20 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, } for (size_t i = 0; i < mySHPObjects.size(); i++ ) { - //ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], false, theEntities); - ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); //TODO check Z coord on closeness + //ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], false, theEntities); + ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, false); //TODO check Z coord on closeness for (int k=1;k<=Ents.Size();k++) theEntitiesToSHPObj.Add(Ents(k), mySHPObjects[i]); } aStat = 1; } - else if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || + 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(); GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName); - + for (size_t i = 0; i < mySHPObjects.size(); i++ ) { ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], Ents, true); @@ -862,11 +862,11 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, } aStat = 2; } - else + else { aStat = 0; } - + return aStat; } @@ -874,31 +874,31 @@ int HYDROData_ShapeFile::GetShapeType() const { if (myHSHP != NULL) return myHSHP->nShapeType; - else + else return -1; } -int HYDROData_ShapeFile::ImportPolylines3D(Handle(HYDROData_Document) theDocument, - NCollection_IndexedDataMap thePolyXYToObj, +int HYDROData_ShapeFile::ImportPolylines3D(Handle(HYDROData_Document) theDocument, + NCollection_IndexedDataMap thePolyXYToObj, NCollection_Sequence& theEntities, ImportShapeType theShapeTypesToImport) { int aStat = -1; int sh_type = myHSHP->nShapeType; - if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || + if ((theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_All || theShapeTypesToImport == HYDROData_ShapeFile::ImportShapeType_Polyline3D) && sh_type == 13) { //for (size_t i = 0; i < mySHPObjects.size(); i++ ) for (int i = 1; i <= thePolyXYToObj.Extent(); i++ ) { Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( thePolyXYToObj.FindKey(i) ); - ReadSHPPoly3D(theDocument, thePolyXYToObj(i), aPolylineXY, theEntities); + ReadSHPPoly3D(theDocument, thePolyXYToObj(i), aPolylineXY, theEntities); } aStat = 1; } - else + else aStat = 0; - + return aStat; } @@ -961,7 +961,7 @@ int HYDROData_ShapeFile::TryOpenShapeFile(QString theFileName) if (pFileSHX == NULL) return -2; } - + fclose (pFileSHP); fclose (pFileSHX); return 0; @@ -979,7 +979,7 @@ bool HYDROData_ShapeFile::CheckDBFFileExisting(const QString& theSHPFilePath, QS { return false; } - + fclose (pFileDBF); thePathToDBFFile = aDBFfile; return true; @@ -1058,9 +1058,9 @@ void HYDROData_ShapeFile::DBF_GetAttributeList(int theIndexOfField, std::vector< { int nWidth, nDecimals; char chField[12]; - + for( int i = 0; i < DBFGetRecordCount(myHDBF); i++ ) - { + { DBFFieldType eType; DBF_AttrValue anAttr; eType = DBFGetFieldInfo( myHDBF, theIndexOfField, chField, &nWidth, &nDecimals ); @@ -1092,7 +1092,7 @@ void HYDROData_ShapeFile::DBF_GetAttributeList(int theIndexOfField, std::vector< anAttr.myStrVal = QString(chAttr); break; } - + case FTInteger: { int iAttr = DBFReadIntegerAttribute( myHDBF, i, theIndexOfField ); @@ -1102,7 +1102,7 @@ void HYDROData_ShapeFile::DBF_GetAttributeList(int theIndexOfField, std::vector< anAttr.myIntVal = iAttr; break; } - + case FTDouble: { double dAttr = DBFReadDoubleAttribute( myHDBF, i, theIndexOfField ); @@ -1134,8 +1134,8 @@ bool HYDROData_ShapeFile::DBF_WriteFieldAndValues(const QString& theFileName, co hDBF = DBFCreate( theFileName.toStdString().c_str() ); if( hDBF == NULL ) return false; - - if (theType != DBF_FieldType_String && theType != DBF_FieldType_Integer && theType != DBF_FieldType_Double) + + if (theType != DBF_FieldType_String && theType != DBF_FieldType_Integer && theType != DBF_FieldType_Double) { DBFClose( hDBF ); return false; //cant handle any other cases @@ -1149,13 +1149,13 @@ bool HYDROData_ShapeFile::DBF_WriteFieldAndValues(const QString& theFileName, co DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTString, nWidth, 0); break; } - + case DBF_FieldType_Integer: { DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTInteger, nWidth, 0); break; } - + case DBF_FieldType_Double: { DBFAddField (hDBF, theFieldName.toStdString().c_str(), FTDouble, nWidth, 0); @@ -1165,7 +1165,7 @@ bool HYDROData_ShapeFile::DBF_WriteFieldAndValues(const QString& theFileName, co break; } - if (DBFGetFieldCount( hDBF ) != 1) + if (DBFGetFieldCount( hDBF ) != 1) { DBFClose( hDBF ); return false; @@ -1205,13 +1205,13 @@ bool HYDROData_ShapeFile::DBF_WriteFieldAndValues(const QString& theFileName, co stat = DBFWriteStringAttribute(hDBF, (int)i, 0, theAttrV[i].myStrVal.toStdString().c_str()); break; } - + case DBF_FieldType_Integer: { stat = DBFWriteIntegerAttribute(hDBF, (int)i, 0, theAttrV[i].myIntVal); break; } - + case DBF_FieldType_Double: { stat = DBFWriteDoubleAttribute(hDBF, (int)i, 0, theAttrV[i].myDoubleVal);