diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx index d294d8465c0e295aa601f25941eda7f6a0262359..bf73dea0ec56c810f1fef70f28b4ed33d382b718 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.cxx @@ -61,8 +61,15 @@ otb::ogr::Feature otb::ogr::Feature::clone() const void otb::ogr::Feature::PrintSelf(std::ostream & os, itk::Indent indent) const { CheckInvariants(); + const itk::Indent one_indent = itk::Indent().GetNextIndent(); + const int nbFields = m_Feature->GetFieldCount(); os << indent << "+"; - os << " " << m_Feature->GetFieldCount() << " fields\n"; + os << " " << nbFields << " fields\n"; + for (int i=0; i!=nbFields; ++i) { + os << indent << "|" << one_indent << "+ "; + os << const_cast<Feature*>(this)->ogr().GetFieldDefnRef(i)->GetType() << ": " // << *this + << "\n"; + } } bool otb::ogr::operator==(otb::ogr::Feature const& lhs, otb::ogr::Feature const& rhs) @@ -76,6 +83,5 @@ bool otb::ogr::operator==(otb::ogr::Feature const& lhs, otb::ogr::Feature const& (l == r ) // incl. ==0 || (l && r && l->Equal(r)) // must be non-null to compare them with Equal - ; +; } - diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx b/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx index f48efca58d86792001999318d8c9395dae4b4286..288dfd412935af8a80da02a3b519d477dc07519d 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx @@ -131,15 +131,12 @@ void otb::ogr::Layer::PrintSelf(std::ostream& os, itk::Indent indent) const os << indent << "+"; if (m_Layer) // in case for odd reason the layer that should exist can't be found { - os << "Layer <" << GetName() << ">\n"; + os << "Layer <" << GetName() << "> of "<< OGRGeometryTypeToName(GetGeomType()) <<"\n"; indent = indent.GetNextIndent(); BOOST_FOREACH(Feature f, *this) { f.PrintSelf(os, indent); } - // boost::for_each( // for each feature - // *this, - // boost::bind(&Feature::PrintSelf, _1, boost::ref(os), indent.GetNextIndent())); } else { @@ -249,3 +246,13 @@ void otb::ogr::Layer::ReorderFields(int * map) } #endif } + +OGRwkbGeometryType otb::ogr::Layer::GetGeomType() const +{ + assert(m_Layer && "OGRLayer not initialized"); +#if GDAL_VERSION_NUM < 1800 + return GetLayerDefn().GetGeomType(); +#else + return m_Layer->GetGeomType(); +#endif +} diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h b/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h index c2f4170c9b8c110e8c1fdcbf4bc09485d28708ed..1b86974620d86920378eeb33ee706617338fa093 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.h @@ -25,6 +25,8 @@ PURPOSE. See the above copyright notices for more information. #include <boost/utility/enable_if.hpp> #include "itkIndent.h" #include "otbOGRFeatureWrapper.h" + +#include "ogr_core.h" // OGRwkbGeometryType class OGRLayer; // fwd declarations class OGRDataSource; class OGRGeometry; @@ -204,6 +206,8 @@ public: void ReorderFields(int *map); void SetIgnoredFields(int *); //@} + + OGRwkbGeometryType GetGeomType() const; private: /** * Internal encapsulation of \c OGRLayer::GetNextFeature().