21 #ifndef otbOGRLayerWrapper_h
22 #define otbOGRLayerWrapper_h
25 #if defined(__GNUC__) || defined(__clang__)
26 #pragma GCC diagnostic push
27 #pragma GCC diagnostic ignored "-Wshadow"
28 #include <boost/iterator/iterator_facade.hpp>
29 #include <boost/utility/enable_if.hpp>
30 #pragma GCC diagnostic pop
32 #include <boost/iterator/iterator_facade.hpp>
33 #include <boost/utility/enable_if.hpp>
57 OTBGdalAdapters_EXPORT
bool operator==(Layer
const& lhs, Layer
const& rhs);
80 class OTBGdalAdapters_EXPORT
Layer
94 typedef itk::SmartPointer<DataSource> DataSourcePtr;
111 Layer(OGRLayer* layer,
bool modifiable);
127 Layer(OGRLayer* layer, GDALDataset& sourceInChargeOfLifeTime,
bool modifiable);
141 int GetFeatureCount(
bool doForceComputation)
const;
156 void CreateFeature(
Feature feature);
167 void DeleteFeature(
long nFID);
203 void SetFeature(
Feature feature);
208 std::string GetName()
const;
216 OGREnvelope GetExtent(
bool force =
false)
const;
227 void GetExtent(
double& ulx,
double& uly,
double& lrx,
double& lry,
bool force =
false)
const;
230 void PrintSelf(std::ostream& os, itk::Indent indent)
const;
248 return m_Layer ? &boolean::i :
nullptr;
279 OGRGeometry
const* GetSpatialFilter()
const;
295 void SetSpatialFilter(OGRGeometry
const* spatialFilter);
304 void SetSpatialFilterRect(
double dfMinX,
double dfMinY,
double dfMaxX,
double dfMaxY);
312 OGRSpatialReference
const* GetSpatialRef()
const;
317 std::string GetProjectionRef()
const;
347 template <
class Value>
348 class feature_iter :
public boost::iterator_facade<feature_iter<Value>, Value, boost::single_pass_traversal_tag>
362 template <
class OtherValue>
364 : m_Layer(other.m_Layer), m_Crt(other.m_Crt)
369 friend class boost::iterator_core_access;
373 template <
class OtherValue>
376 return other.
m_Crt == m_Crt;
380 assert(m_Layer &&
"cannot increment end()");
381 m_Crt = m_Layer->GetNextFeature();
437 const_iterator cstart_at(GIntBig index)
const;
442 return cstart_at(index);
446 iterator start_at(GIntBig index);
463 OGRFeatureDefn& GetLayerDefn()
const;
479 void CreateField(
FieldDefn const& field,
bool bApproxOK =
true);
492 void DeleteField(
int fieldIndex);
511 void AlterFieldDefn(
size_t fieldIndex,
FieldDefn const& newFieldDefn,
int nFlags);
525 void ReorderField(
size_t oldPos,
size_t newPos);
538 void ReorderFields(
int* map);
554 void SetIgnoredFields(
char const** fieldNames);
560 OGRwkbGeometryType GetGeomType()
const;
578 Feature GetNextFeature();
594 DataSourcePtr m_DataSource;
600 return !(lhs == rhs);
605 #ifndef OTB_MANUAL_INSTANTIATION
609 #endif // otbOGRLayerWrapper_h