13#ifndef OGRUNIONLAYER_H_INCLUDED
14#define OGRUNIONLAYER_H_INCLUDED
31 int bGeomTypeSet =
false;
37 OGRUnionLayerGeomFieldDefn(
const OGRUnionLayerGeomFieldDefn &oSrc);
38 OGRUnionLayerGeomFieldDefn(OGRUnionLayerGeomFieldDefn &&) =
default;
39 ~OGRUnionLayerGeomFieldDefn()
override;
41 OGRUnionLayerGeomFieldDefn &
42 operator=(
const OGRUnionLayerGeomFieldDefn &) =
delete;
43 OGRUnionLayerGeomFieldDefn &
44 operator=(OGRUnionLayerGeomFieldDefn &&) =
delete;
53 FIELD_FROM_FIRST_LAYER,
54 FIELD_UNION_ALL_LAYERS,
55 FIELD_INTERSECTION_ALL_LAYERS,
59class CPL_DLL OGRUnionLayer final :
public OGRLayer
66 std::unique_ptr<OGRLayer> poLayerKeeper{};
68 bool bModified =
false;
69 bool bCheckIfAutoWrap =
false;
73 Layer(
OGRLayer *poLayerIn,
bool bOwnedIn)
74 : poLayerKeeper(bOwnedIn ? poLayerIn : nullptr),
75 poLayer(bOwnedIn ? poLayerKeeper.get() : poLayerIn)
79 Layer(Layer &&) =
default;
80 Layer &operator=(Layer &&) =
default;
92 std::pair<OGRLayer *, bool> release()
94 const bool bOwnedBackup = poLayerKeeper !=
nullptr;
96 poLayerKeeper ? poLayerKeeper.release() : poLayer;
97 poLayerKeeper.reset();
98 return std::make_pair(poLayerBackup, bOwnedBackup);
101 void reset(std::unique_ptr<OGRLayer> poLayerIn)
103 poLayerKeeper = std::move(poLayerIn);
104 poLayer = poLayerKeeper.get();
110 std::vector<Layer> m_apoSrcLayers{};
113 std::vector<std::unique_ptr<OGRFieldDefn>> apoFields{};
114 std::vector<std::unique_ptr<OGRUnionLayerGeomFieldDefn>> apoGeomFields{};
115 bool bUseGeomFields =
true;
116 FieldUnionStrategy eFieldStrategy = FIELD_UNION_ALL_LAYERS;
119 int bPreserveSrcFID =
false;
124 bool m_bHasAlreadyIteratedOverFeatures =
false;
125 char *pszAttributeFilter =
nullptr;
127 int *panMap =
nullptr;
129 mutable int bAttrFilterPassThroughValue = -1;
132 std::mutex m_oMutex{};
143 std::vector<FIDRange> m_fidRanges{};
144 bool m_fidRangesInvalid =
false;
145 bool m_fidRangesComplete =
false;
147 void AutoWarpLayerIfNecessary(
int iSubLayer);
148 std::unique_ptr<OGRFeature> TranslateFromSrcLayer(
OGRFeature *poSrcFeature,
150 void ApplyAttributeFilterToSrcLayer(
int iSubLayer);
151 int GetAttrFilterPassThroughValue()
const;
152 void ConfigureActiveLayer();
153 void SetSpatialFilterToSourceLayer(
OGRLayer *poSrcLayer);
157 const char *pszName,
int nSrcLayers,
161 int bTakeLayerOwnership);
163 ~OGRUnionLayer()
override;
169 FieldUnionStrategy eFieldStrategy,
int nFields,
172 const OGRUnionLayerGeomFieldDefn
174 void SetFields(FieldUnionStrategy eFieldStrategy,
177 void SetSourceLayerFieldName(
const char *pszSourceLayerFieldName);
178 void SetPreserveSrcFID(
int bPreserveSrcFID);
179 void SetFeatureCount(
int nFeatureCount);
181 const char *GetName()
const override
183 return osName.c_str();
188 void ResetReading()
override;
200 const int *panUpdatedFieldsIdx,
201 int nUpdatedGeomFieldsCount,
202 const int *panUpdatedGeomFieldsIdx,
203 bool bUpdateStyleString)
override;
209 GIntBig GetFeatureCount(
int)
override;
211 OGRErr SetAttributeFilter(
const char *)
override;
213 int TestCapability(
const char *)
const override;
216 bool bForce)
override;
218 virtual OGRErr ISetSpatialFilter(
int iGeomField,
223 OGRErr SyncToDisk()
override;
String list class designed around our use of C "char**" string lists.
Definition cpl_string.h:476
Convenient string class based on std::string.
Definition cpl_string.h:338
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
Definition of an attribute of an OGRFeatureDefn.
Definition ogr_feature.h:72
Definition of a geometry field of an OGRFeatureDefn.
Definition ogr_feature.h:335
OGRGeomFieldDefn & operator=(const OGRGeomFieldDefn &oOther)
Copy assignment operator.
Definition ogrgeomfielddefn.cpp:156
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch spatial reference system of this field.
Definition ogrgeomfielddefn.cpp:520
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
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:423
int OGRErr
Type for a OGR error.
Definition ogr_core.h:388
Classes related to registration of format support, and opening datasets.