GDAL

ogrwarpedlayer.h
1/******************************************************************************
2 * $Id$
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Defines OGRWarpedLayer class
6 * Author: Even Rouault, even dot rouault at spatialys.com
7 *
8 ******************************************************************************
9 * Copyright (c) 2012-2014, Even Rouault <even dot rouault at spatialys.com>
10 *
11 * SPDX-License-Identifier: MIT
12 ****************************************************************************/
13
14#ifndef OGRWARPEDLAYER_H_INCLUDED
15#define OGRWARPEDLAYER_H_INCLUDED
16
17#ifndef DOXYGEN_SKIP
18
19#include "ogrlayerdecorator.h"
20#include <memory>
21
22/************************************************************************/
23/* OGRWarpedLayer */
24/************************************************************************/
25
26 class CPL_DLL OGRWarpedLayer : public OGRLayerDecorator
27{
28 CPL_DISALLOW_COPY_ASSIGN(OGRWarpedLayer)
29
30 protected:
31 OGRFeatureDefn *m_poFeatureDefn;
32 int m_iGeomField;
33
34 OGRCoordinateTransformation *m_poCT;
35 OGRCoordinateTransformation *m_poReversedCT; /* may be NULL */
36 OGRSpatialReference *m_poSRS;
37
38 OGREnvelope sStaticEnvelope{};
39
40 static int ReprojectEnvelope(OGREnvelope *psEnvelope,
41 OGRCoordinateTransformation *poCT);
42
43 std::unique_ptr<OGRFeature>
44 SrcFeatureToWarpedFeature(std::unique_ptr<OGRFeature> poFeature);
45 std::unique_ptr<OGRFeature>
46 WarpedFeatureToSrcFeature(std::unique_ptr<OGRFeature> poFeature);
47
48 public:
49 OGRWarpedLayer(
50 OGRLayer *poDecoratedLayer, int iGeomField, int bTakeOwnership,
51 OGRCoordinateTransformation
52 *poCT, /* must NOT be NULL, ownership acquired by OGRWarpedLayer */
53 OGRCoordinateTransformation *
54 poReversedCT /* may be NULL, ownership acquired by OGRWarpedLayer */);
55 virtual ~OGRWarpedLayer();
56
57 void SetExtent(double dfXMin, double dfYMin, double dfXMax, double dfYMax);
58
59 virtual void SetSpatialFilter(OGRGeometry *) override;
60 virtual void SetSpatialFilterRect(double dfMinX, double dfMinY,
61 double dfMaxX, double dfMaxY) override;
62 virtual void SetSpatialFilter(int iGeomField, OGRGeometry *) override;
63 virtual void SetSpatialFilterRect(int iGeomField, double dfMinX,
64 double dfMinY, double dfMaxX,
65 double dfMaxY) override;
66
67 virtual OGRFeature *GetNextFeature() override;
68 virtual OGRFeature *GetFeature(GIntBig nFID) override;
69 virtual OGRErr ISetFeature(OGRFeature *poFeature) override;
70 virtual OGRErr ICreateFeature(OGRFeature *poFeature) override;
71 virtual OGRErr IUpsertFeature(OGRFeature *poFeature) override;
72 OGRErr IUpdateFeature(OGRFeature *poFeature, int nUpdatedFieldsCount,
73 const int *panUpdatedFieldsIdx,
74 int nUpdatedGeomFieldsCount,
75 const int *panUpdatedGeomFieldsIdx,
76 bool bUpdateStyleString) override;
77
78 virtual OGRFeatureDefn *GetLayerDefn() override;
79
80 virtual OGRSpatialReference *GetSpatialRef() override;
81
82 virtual GIntBig GetFeatureCount(int bForce = TRUE) override;
83 virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
84 int bForce = TRUE) override;
85 virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE) override;
86
87 virtual int TestCapability(const char *) override;
88};
89
90#endif /* #ifndef DOXYGEN_SKIP */
91
92#endif // OGRWARPEDLAYER_H_INCLUDED
OGRCoordinateTransformation
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:773
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:45
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:501
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:877
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:361
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:58
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:153
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1030
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:199
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:371