ogrunionlayer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _OGRUNIONLAYER_H_INCLUDED
00031 #define _OGRUNIONLAYER_H_INCLUDED
00032
00033 #include "ogrsf_frmts.h"
00034
00035
00036
00037
00038
00039 typedef enum
00040 {
00041 FIELD_FROM_FIRST_LAYER,
00042 FIELD_UNION_ALL_LAYERS,
00043 FIELD_INTERSECTION_ALL_LAYERS,
00044 FIELD_SPECIFIED,
00045 } FieldUnionStrategy;
00046
00047 typedef enum
00048 {
00049 GEOMTYPE_FROM_FIRST_LAYER,
00050 GEOMTYPE_UNION_ALL_LAYERS,
00051 GEOMTYPE_SPECIFIED,
00052 } GeometryTypeUnionStrategy;
00053
00054 class OGRUnionLayer : public OGRLayer
00055 {
00056 protected:
00057 CPLString osName;
00058 int nSrcLayers;
00059 OGRLayer **papoSrcLayers;
00060 int bHasLayerOwnership;
00061
00062 OGRFeatureDefn *poFeatureDefn;
00063 int nFields;
00064 OGRFieldDefn **papoFields;
00065 FieldUnionStrategy eFieldStrategy;
00066 CPLString osSourceLayerFieldName;
00067
00068 OGRwkbGeometryType eGeomType;
00069 GeometryTypeUnionStrategy eGeometryTypeStrategy;
00070
00071 int bPreserveSrcFID;
00072
00073 OGRSpatialReference *poSRS;
00074 int bSRSSet;
00075
00076 int nFeatureCount;
00077 OGREnvelope sStaticEnvelope;
00078
00079 int iCurLayer;
00080 char *pszAttributeFilter;
00081 int nNextFID;
00082 int *panMap;
00083 char **papszIgnoredFields;
00084 int bAttrFilterPassThroughValue;
00085 int *pabModifiedLayers;
00086 int *pabCheckIfAutoWrap;
00087
00088 void AutoWarpLayerIfNecessary(int iSubLayer);
00089 OGRFeature *TranslateFromSrcLayer(OGRFeature* poSrcFeature);
00090 void ApplyAttributeFilterToSrcLayer(int iSubLayer);
00091 int GetAttrFilterPassThroughValue();
00092 void ConfigureActiveLayer();
00093
00094 public:
00095 OGRUnionLayer( const char* pszName,
00096 int nSrcLayers,
00097 OGRLayer** papoSrcLayers,
00098 int bTakeLayerOwnership);
00099
00100 virtual ~OGRUnionLayer();
00101
00102
00103
00104 void SetSRS(OGRSpatialReference *poSRS);
00105 void SetFields(FieldUnionStrategy eFieldStrategy,
00106 int nFields,
00107 OGRFieldDefn** papoFields);
00108 void SetGeometryType(GeometryTypeUnionStrategy eGeometryTypeStrategy,
00109 OGRwkbGeometryType eGeomType);
00110 void SetSourceLayerFieldName(const char* pszSourceLayerFieldName);
00111 void SetPreserveSrcFID(int bPreserveSrcFID);
00112 void SetFeatureCount(int nFeatureCount);
00113 void SetExtent(double dfXMin, double dfYMin, double dfXMax, double dfYMax);
00114
00115 virtual const char *GetName() { return osName.c_str(); }
00116 virtual OGRwkbGeometryType GetGeomType();
00117
00118 virtual void ResetReading();
00119 virtual OGRFeature *GetNextFeature();
00120
00121 virtual OGRFeature *GetFeature( long nFeatureId );
00122
00123 virtual OGRErr CreateFeature( OGRFeature* poFeature );
00124
00125 virtual OGRErr SetFeature( OGRFeature* poFeature );
00126
00127 virtual OGRFeatureDefn *GetLayerDefn();
00128
00129 virtual OGRSpatialReference *GetSpatialRef();
00130
00131 virtual int GetFeatureCount( int );
00132
00133 virtual OGRErr SetAttributeFilter( const char * );
00134
00135 virtual int TestCapability( const char * );
00136
00137 virtual OGRErr GetExtent( OGREnvelope *psExtent, int bForce );
00138
00139 virtual void SetSpatialFilter( OGRGeometry * poGeomIn );
00140
00141 virtual OGRErr SetIgnoredFields( const char **papszFields );
00142
00143 virtual OGRErr SyncToDisk();
00144 };
00145
00146 #endif // _OGRUNIONLAYER_H_INCLUDED