GDAL
ogrwarpedlayer.h
1/******************************************************************************
2 *
3 * Project: OpenGIS Simple Features Reference Implementation
4 * Purpose: Defines OGRWarpedLayer class
5 * Author: Even Rouault, even dot rouault at spatialys.com
6 *
7 ******************************************************************************
8 * Copyright (c) 2012-2014, Even Rouault <even dot rouault at spatialys.com>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef OGRWARPEDLAYER_H_INCLUDED
14#define OGRWARPEDLAYER_H_INCLUDED
15
16#ifndef DOXYGEN_SKIP
17
18#include "ogrlayerdecorator.h"
19#include "ogrlayerwithtranslatefeature.h"
20
21#include <memory>
22
23#if defined(_MSC_VER)
24#pragma warning(push)
25// Silence warnings of the type warning C4250: 'OGRWarpedLayer': inherits 'OGRLayerDecorator::OGRLayerDecorator::GetMetadata' via dominance
26#pragma warning(disable : 4250)
27#endif
28
29/************************************************************************/
30/* OGRWarpedLayer */
31/************************************************************************/
32
33class CPL_DLL OGRWarpedLayer final : public OGRLayerDecorator,
34 public OGRLayerWithTranslateFeature
35{
36 CPL_DISALLOW_COPY_ASSIGN(OGRWarpedLayer)
37
38 protected:
39 OGRFeatureDefn *m_poFeatureDefn = nullptr;
40 int m_iGeomField = 0;
41
42 OGRGeometryFactory::TransformWithOptionsCache m_transformCacheForward{};
43 OGRGeometryFactory::TransformWithOptionsCache m_transformCacheReverse{};
44 std::unique_ptr<OGRCoordinateTransformation> m_poCT{};
45 /* may be NULL */
46 std::unique_ptr<OGRCoordinateTransformation> m_poReversedCT{};
47 OGRSpatialReference *m_poSRS = nullptr;
48
49 OGREnvelope sStaticEnvelope{};
50
51 static int ReprojectEnvelope(OGREnvelope *psEnvelope,
53
54 std::unique_ptr<OGRFeature>
55 SrcFeatureToWarpedFeature(std::unique_ptr<OGRFeature> poFeature);
56 std::unique_ptr<OGRFeature>
57 WarpedFeatureToSrcFeature(std::unique_ptr<OGRFeature> poFeature);
58
59 public:
60 OGRWarpedLayer(OGRLayer *poDecoratedLayer, int iGeomField,
61 int bTakeLayerOwnership,
62 /* must NOT be NULL */
63 std::unique_ptr<OGRCoordinateTransformation> poCT,
64 /* may be NULL */
65 std::unique_ptr<OGRCoordinateTransformation> poReversedCT);
66 ~OGRWarpedLayer() override;
67
68 void TranslateFeature(
69 std::unique_ptr<OGRFeature> poSrcFeature,
70 std::vector<std::unique_ptr<OGRFeature>> &apoOutFeatures) override;
71
72 void SetExtent(double dfXMin, double dfYMin, double dfXMax, double dfYMax);
73
74 virtual OGRErr ISetSpatialFilter(int iGeomField,
75 const OGRGeometry *) override;
76
77 OGRFeature *GetNextFeature() override;
78 OGRFeature *GetFeature(GIntBig nFID) override;
79 OGRErr ISetFeature(OGRFeature *poFeature) override;
80 OGRErr ISetFeatureUniqPtr(std::unique_ptr<OGRFeature> poFeature) override;
81 OGRErr ICreateFeature(OGRFeature *poFeature) override;
82 OGRErr ICreateFeatureUniqPtr(std::unique_ptr<OGRFeature> poFeature,
83 GIntBig *pnFID) override;
84 OGRErr IUpsertFeature(OGRFeature *poFeature) override;
85 OGRErr IUpdateFeature(OGRFeature *poFeature, int nUpdatedFieldsCount,
86 const int *panUpdatedFieldsIdx,
87 int nUpdatedGeomFieldsCount,
88 const int *panUpdatedGeomFieldsIdx,
89 bool bUpdateStyleString) override;
90
91 const OGRFeatureDefn *GetLayerDefn() const override;
92
93 const OGRSpatialReference *GetSpatialRef() const override;
94
95 GIntBig GetFeatureCount(int bForce = TRUE) override;
96 OGRErr IGetExtent(int iGeomField, OGREnvelope *psExtent,
97 bool bForce = true) override;
98
99 int TestCapability(const char *) const override;
100
101 virtual bool GetArrowStream(struct ArrowArrayStream *out_stream,
102 CSLConstList papszOptions = nullptr) override;
103};
104
105#if defined(_MSC_VER)
106#pragma warning(pop)
107#endif
108
109#endif /* #ifndef DOXYGEN_SKIP */
110
111#endif // OGRWARPEDLAYER_H_INCLUDED
Interface for transforming between coordinate systems.
Definition ogr_spatialref.h:867
Simple container for a bounding region (rectangle)
Definition ogr_core.h:44
Definition of a feature class or feature layer.
Definition ogr_feature.h:521
A simple feature, including geometry and attributes.
Definition ogr_feature.h:1041
Opaque class used as argument to transformWithOptions()
Definition ogr_geometry.h:4316
Abstract base class for all geometry classes.
Definition ogr_geometry.h:357
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:61
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
#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:1101
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1252
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:195
int OGRErr
Type for a OGR error.
Definition ogr_core.h:388