From: isn Date: Fri, 16 Oct 2015 14:26:21 +0000 (+0300) Subject: always store a field type of attribute even inside internal dbf-structure X-Git-Tag: v1.5~89^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=acecf4afbacc01753135b4fb2aae832d6157c64b;p=modules%2Fhydro.git always store a field type of attribute even inside internal dbf-structure --- diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 69c6a276..10b47b36 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -737,6 +737,16 @@ void HYDROData_ShapeFile::DBF_GetAttributeList(int theIndexOfField, std::vector< if( DBFIsAttributeNULL( myHDBF, i, theIndexOfField ) ) { anAttr.myIsNull = true; + DBF_FieldType FT = DBF_FieldType_None; + if( eType == FTString ) + FT = DBF_FieldType_String; + else if( eType == FTInteger ) + FT = DBF_FieldType_Integer; + else if( eType == FTDouble ) + FT = DBF_FieldType_Double; + else if( eType == FTInvalid ) + FT = DBF_FieldType_Invalid; + anAttr.myFieldType = FT; } else { diff --git a/src/HYDROData/HYDROData_ShapeFile.h b/src/HYDROData/HYDROData_ShapeFile.h index 11517a66..ad1df754 100644 --- a/src/HYDROData/HYDROData_ShapeFile.h +++ b/src/HYDROData/HYDROData_ShapeFile.h @@ -59,6 +59,7 @@ enum DBF_FieldType DBF_FieldType_Invalid }; + struct DBF_AttrValue { DBF_AttrValue() diff --git a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx index 035d6914..ccbb8fad 100644 --- a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx +++ b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx @@ -98,7 +98,7 @@ void test_HYDROData_ShapeFile::test_GetAttrListIndex() //Null attr CPPUNIT_ASSERT_EQUAL( true, theAttrV[35].myIsNull); CPPUNIT_ASSERT_EQUAL( true, theAttrV[35].myRawValue.empty()); - CPPUNIT_ASSERT_EQUAL( HYDROData_ShapeFile::DBF_FieldType_None, theAttrV[35].myFieldType); + CPPUNIT_ASSERT_EQUAL( HYDROData_ShapeFile::DBF_FieldType_String, theAttrV[35].myFieldType); theAttrV.clear(); aSHPFile.DBF_GetAttributeList(1, theAttrV ); //second field