GDAL

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

ogrunionlayer.h
1 /******************************************************************************
2 * $Id: ogrunionlayer.h 31777 2015-11-26 14:14:41Z rouault $
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Defines OGRUnionLayer class
6 * Author: Even Rouault, even dot rouault at mines dash paris dot org
7 *
8 ******************************************************************************
9 * Copyright (c) 2012-2014, Even Rouault <even dot rouault at mines-paris dot org>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ****************************************************************************/
29
30 #ifndef OGRUNIONLAYER_H_INCLUDED
31 #define OGRUNIONLAYER_H_INCLUDED
32
33 #include "ogrsf_frmts.h"
34
35 /************************************************************************/
36 /* OGRUnionLayerGeomFieldDefn */
37 /************************************************************************/
38
39 class OGRUnionLayerGeomFieldDefn: public OGRGeomFieldDefn
40 {
41 public:
42
43 int bGeomTypeSet;
44 int bSRSSet;
45 OGREnvelope sStaticEnvelope;
46
47 OGRUnionLayerGeomFieldDefn(const char* pszName, OGRwkbGeometryType eType);
48 OGRUnionLayerGeomFieldDefn(OGRGeomFieldDefn* poSrc);
49 OGRUnionLayerGeomFieldDefn(OGRUnionLayerGeomFieldDefn* poSrc);
50 ~OGRUnionLayerGeomFieldDefn();
51 };
52
53 /************************************************************************/
54 /* OGRUnionLayer */
55 /************************************************************************/
56
57 typedef enum
58 {
59 FIELD_FROM_FIRST_LAYER,
60 FIELD_UNION_ALL_LAYERS,
61 FIELD_INTERSECTION_ALL_LAYERS,
62 FIELD_SPECIFIED,
63 } FieldUnionStrategy;
64
65 class OGRUnionLayer : public OGRLayer
66 {
67 protected:
68 CPLString osName;
69 int nSrcLayers;
70 OGRLayer **papoSrcLayers;
71 int bHasLayerOwnership;
72
73 OGRFeatureDefn *poFeatureDefn;
74 int nFields;
75 OGRFieldDefn **papoFields;
76 int nGeomFields;
77 OGRUnionLayerGeomFieldDefn **papoGeomFields;
78 FieldUnionStrategy eFieldStrategy;
79 CPLString osSourceLayerFieldName;
80
81 int bPreserveSrcFID;
82
83 GIntBig nFeatureCount;
84
85 int iCurLayer;
86 char *pszAttributeFilter;
87 int nNextFID;
88 int *panMap;
89 char **papszIgnoredFields;
90 int bAttrFilterPassThroughValue;
91 int *pabModifiedLayers;
92 int *pabCheckIfAutoWrap;
93 OGRSpatialReference *poGlobalSRS;
94
95 void AutoWarpLayerIfNecessary(int iSubLayer);
96 OGRFeature *TranslateFromSrcLayer(OGRFeature* poSrcFeature);
97 void ApplyAttributeFilterToSrcLayer(int iSubLayer);
98 int GetAttrFilterPassThroughValue();
99 void ConfigureActiveLayer();
100 void SetSpatialFilterToSourceLayer(OGRLayer* poSrcLayer);
101
102 public:
103 OGRUnionLayer( const char* pszName,
104 int nSrcLayers, /* must be >= 1 */
105 OGRLayer** papoSrcLayers, /* array itself ownership always transferred, layer ownership depending on bTakeLayerOwnership */
106 int bTakeLayerOwnership);
107
108 virtual ~OGRUnionLayer();
109
110 /* All the following non virtual methods must be called just after the constructor */
111 /* and before any virtual method */
112 void SetFields(FieldUnionStrategy eFieldStrategy,
113 int nFields,
114 OGRFieldDefn** papoFields, /* duplicated by the method */
115 int nGeomFields, /* maybe -1 to explicitly disable geometry fields */
116 OGRUnionLayerGeomFieldDefn** papoGeomFields /* duplicated by the method */);
117 void SetSourceLayerFieldName(const char* pszSourceLayerFieldName);
118 void SetPreserveSrcFID(int bPreserveSrcFID);
119 void SetFeatureCount(int nFeatureCount);
120 virtual const char *GetName() { return osName.c_str(); }
121 virtual OGRwkbGeometryType GetGeomType();
122
123 virtual void ResetReading();
124 virtual OGRFeature *GetNextFeature();
125
126 virtual OGRFeature *GetFeature( GIntBig nFeatureId );
127
128 virtual OGRErr ICreateFeature( OGRFeature* poFeature );
129
130 virtual OGRErr ISetFeature( OGRFeature* poFeature );
131
132 virtual OGRFeatureDefn *GetLayerDefn();
133
134 virtual OGRSpatialReference *GetSpatialRef();
135
136 virtual GIntBig GetFeatureCount( int );
137
138 virtual OGRErr SetAttributeFilter( const char * );
139
140 virtual int TestCapability( const char * );
141
142 virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent, int bForce = TRUE);
143 virtual OGRErr GetExtent( OGREnvelope *psExtent, int bForce );
144
145 virtual void SetSpatialFilter( OGRGeometry * poGeomIn );
146 virtual void SetSpatialFilter( int iGeomField, OGRGeometry * );
147
148 virtual OGRErr SetIgnoredFields( const char **papszFields );
149
150 virtual OGRErr SyncToDisk();
151 };
152
153 #endif // OGRUNIONLAYER_H_INCLUDED
OGRUnionLayer
Definition: ogrunionlayer.h:65
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:143
OGRUnionLayer::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature)
Create and write a new feature within a layer.
Definition: ogrunionlayer.cpp:769
OGRUnionLayer::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn()
Fetch the schema information for this layer.
Definition: ogrunionlayer.cpp:254
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:283
OGRUnionLayer::GetName
virtual const char * GetName()
Return the layer name.
Definition: ogrunionlayer.h:120
OGRUnionLayer::SyncToDisk
virtual OGRErr SyncToDisk()
Flush pending changes to disk.
Definition: ogrunionlayer.cpp:1277
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:206
OGRUnionLayer::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef()
Fetch the spatial reference system for this layer.
Definition: ogrunionlayer.cpp:879
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:62
OGRUnionLayer::GetFeatureCount
virtual GIntBig GetFeatureCount(int)
Fetch the feature count in this layer.
Definition: ogrunionlayer.cpp:962
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:333
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:104
ogrsf_frmts.h
Classes related to registration of format support, and opening datasets.
OGRUnionLayer::GetExtent
virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent, int bForce=TRUE)
Fetch the extent of this layer, on the specified geometry field.
Definition: ogrunionlayer.cpp:1130
OGRUnionLayer::ResetReading
virtual void ResetReading()
Reset feature reading to start on the first feature.
Definition: ogrunionlayer.cpp:608
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:129
OGRUnionLayer::SetIgnoredFields
virtual OGRErr SetIgnoredFields(const char **papszFields)
Set which fields can be omitted when retrieving features from the layer.
Definition: ogrunionlayer.cpp:1261
OGRUnionLayer::SetAttributeFilter
virtual OGRErr SetAttributeFilter(const char *)
Set a new attribute query.
Definition: ogrunionlayer.cpp:989
OGRUnionLayer::TestCapability
virtual int TestCapability(const char *)
Test if this layer supported the named capability.
Definition: ogrunionlayer.cpp:1019
OGREnvelope
Simple container for a bounding region.
Definition: ogr_core.h:48
OGRUnionLayer::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature)
Rewrite an existing feature.
Definition: ogrunionlayer.cpp:821
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:66
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:274
OGRUnionLayer::SetSpatialFilter
virtual void SetSpatialFilter(OGRGeometry *poGeomIn)
Set a new spatial filter.
Definition: ogrunionlayer.cpp:1185
OGRUnionLayerGeomFieldDefn
Definition: ogrunionlayer.h:39
OGRUnionLayer::GetGeomType
virtual OGRwkbGeometryType GetGeomType()
Return the layer geometry type.
Definition: ogrunionlayer.cpp:462
OGRUnionLayer::GetFeature
virtual OGRFeature * GetFeature(GIntBig nFeatureId)
Fetch a feature by its identifier.
Definition: ogrunionlayer.cpp:726
OGRUnionLayer::GetNextFeature
virtual OGRFeature * GetNextFeature()
Fetch the next available feature from this layer.
Definition: ogrunionlayer.cpp:682

Generated for GDAL by 1.8.8.