~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to ogr/ogrsf_frmts/arcobjects/ogr_ao.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 *
 
3
 * Project:  OpenGIS Simple Features Reference Implementation
 
4
 * Purpose:  Standard includes and class definitions ArcObjects OGR driver.
 
5
 * Author:   Ragi Yaser Burhum, ragi@burhum.com
 
6
 *
 
7
 ******************************************************************************
 
8
 * Copyright (c) 2009, Ragi Yaser Burhum
 
9
 *
 
10
 * Permission is hereby granted, free of charge, to any person obtaining a
 
11
 * copy of this software and associated documentation files (the "Software"),
 
12
 * to deal in the Software without restriction, including without limitation
 
13
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
14
 * and/or sell copies of the Software, and to permit persons to whom the
 
15
 * Software is furnished to do so, subject to the following conditions:
 
16
 *
 
17
 * The above copyright notice and this permission notice shall be included
 
18
 * in all copies or substantial portions of the Software.
 
19
 *
 
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
21
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
22
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 
23
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
24
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
25
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
26
 * DEALINGS IN THE SOFTWARE.
 
27
 ****************************************************************************/
 
28
 
 
29
#ifndef _OGR_AO_H_INCLUDED
 
30
#define _OGR_AO_H_INCLUDED
 
31
 
 
32
#include "ogrsf_frmts.h"
 
33
 
 
34
#include <vector>
 
35
#include "cpl_string.h"
 
36
 
 
37
//COM ATL Includes
 
38
#include <atlbase.h> 
 
39
#include <atlcom.h>
 
40
#include <atlctl.h>
 
41
#include <atlstr.h> //CString
 
42
 
 
43
using namespace ATL;
 
44
 
 
45
// ArcGIS COM Includes
 
46
#import "C:\Program Files (x86)\ArcGIS\com\esriSystem.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids, exclude("OLE_COLOR", "OLE_HANDLE", "VARTYPE"), rename("min", "esrimin"), rename("max", "esrimax")
 
47
#import "C:\Program Files (x86)\ArcGIS\com\esriGeometry.olb" raw_interfaces_only, raw_native_types, named_guids, exclude("ISegment")
 
48
#import "C:\Program Files (x86)\ArcGIS\com\esriGeoDatabase.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
 
49
#import "C:\Program Files (x86)\ArcGIS\com\esriDataSourcesGDB.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
 
50
 
 
51
 
 
52
 
 
53
/************************************************************************/
 
54
/*                            AOLayer                                  */
 
55
/************************************************************************/
 
56
 
 
57
class AODataSource;
 
58
 
 
59
class AOLayer : public OGRLayer
 
60
{
 
61
public:
 
62
 
 
63
  AOLayer();
 
64
  virtual ~AOLayer();
 
65
 
 
66
  bool Initialize(ITable* pTable);
 
67
 
 
68
  const char* GetFIDFieldName() const { return m_strOIDFieldName.c_str(); }
 
69
  const char* GetShapeFieldName() const { return m_strShapeFieldName.c_str(); }
 
70
 
 
71
  virtual void        ResetReading();
 
72
  virtual OGRFeature* GetNextFeature();
 
73
  virtual OGRFeature* GetFeature( long nFeatureId );
 
74
 
 
75
  HRESULT GetTable(ITable** ppTable);
 
76
 
 
77
 
 
78
  virtual OGRErr      GetExtent( OGREnvelope *psExtent, int bForce );
 
79
  virtual int         GetFeatureCount( int bForce );
 
80
  virtual OGRErr      SetAttributeFilter( const char *pszQuery );
 
81
  virtual void        SetSpatialFilterRect (double dfMinX, double dfMinY, double dfMaxX, double dfMaxY);
 
82
  virtual void        SetSpatialFilter( OGRGeometry * );
 
83
 
 
84
/*
 
85
  virtual OGRErr      CreateField( OGRFieldDefn *poFieldIn,
 
86
  int bApproxOK );
 
87
 
 
88
  virtual OGRErr      SetFeature( OGRFeature *poFeature );
 
89
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
 
90
  virtual OGRErr      DeleteFeature( long nFID );
 
91
*/
 
92
   OGRFeatureDefn *    GetLayerDefn() { return m_pFeatureDefn; }
 
93
 
 
94
   virtual OGRSpatialReference *GetSpatialRef() { return m_pSRS; }
 
95
 
 
96
  virtual int         TestCapability( const char * );
 
97
 
 
98
protected:
 
99
    bool OGRFeatureFromAORow(IRow* pRow, OGRFeature** ppFeature);
 
100
    void SwitchToAttributeOnlyFilter();
 
101
    void SwitchToSpatialFilter();
 
102
 
 
103
    ITablePtr m_ipTable;
 
104
    OGRFeatureDefn* m_pFeatureDefn;
 
105
    OGRSpatialReference* m_pSRS;
 
106
 
 
107
    std::string m_strOIDFieldName;
 
108
    std::string m_strShapeFieldName;
 
109
 
 
110
    ICursorPtr m_ipCursor;
 
111
    IQueryFilterPtr m_ipQF;
 
112
 
 
113
    std::vector<long> m_OGRFieldToESRIField; //OGR Field Index to ESRI Field Index Mapping
 
114
 
 
115
    //buffers are used for avoiding constant reallocation of temp memory
 
116
    unsigned char* m_pBuffer;
 
117
    long  m_bufferSize; //in bytes
 
118
    bool  m_supressColumnMappingError;
 
119
    bool  m_forceMulti;
 
120
};
 
121
 
 
122
/************************************************************************/
 
123
/*                           AODataSource                            */
 
124
/************************************************************************/
 
125
class AODataSource : public OGRDataSource
 
126
{
 
127
 
 
128
public:
 
129
  AODataSource();
 
130
  virtual ~AODataSource();
 
131
 
 
132
 
 
133
  int         Open(IWorkspace* pWorkspace, const char *, int );
 
134
  
 
135
  const char* GetName() { return m_pszName; }
 
136
  int         GetLayerCount() { return static_cast<int>(m_layers.size()); }
 
137
  
 
138
  OGRLayer*   GetLayer( int );
 
139
 
 
140
  
 
141
  /*
 
142
  virtual OGRLayer* CreateLayer( const char *,
 
143
                                 OGRSpatialReference* = NULL,
 
144
                                 OGRwkbGeometryType = wkbUnknown,
 
145
                                 char** = NULL );
 
146
 
 
147
 */
 
148
  virtual OGRErr DeleteLayer( int );
 
149
 
 
150
  int TestCapability( const char * );
 
151
 
 
152
  /*
 
153
protected:
 
154
 
 
155
  void EnumerateSpatialTables();
 
156
  void OpenSpatialTable( const char* pszTableName );
 
157
*/
 
158
protected:
 
159
  bool LoadLayers(IEnumDataset* pEnumDataset);
 
160
 
 
161
  char* m_pszName;
 
162
  std::vector <AOLayer*> m_layers;
 
163
  IWorkspacePtr m_ipWorkspace;
 
164
 
 
165
};
 
166
 
 
167
/************************************************************************/
 
168
/*                              AODriver                                */
 
169
/************************************************************************/
 
170
 
 
171
class AODriver : public OGRSFDriver
 
172
{
 
173
 
 
174
public:
 
175
  AODriver();
 
176
  virtual ~AODriver();
 
177
 
 
178
  bool Init();
 
179
 
 
180
  const char *GetName();
 
181
  virtual OGRDataSource *Open( const char *, int );
 
182
  int TestCapability( const char * );
 
183
  virtual OGRDataSource *CreateDataSource( const char *pszName, char ** = NULL);
 
184
 
 
185
  void OpenWorkspace(std::string, IWorkspace** ppWorkspace);
 
186
 
 
187
private:
 
188
  bool m_licensedCheckedOut;
 
189
  int  m_productCode;
 
190
  bool m_initialized;
 
191
};
 
192
 
 
193
CPL_C_START
 
194
void CPL_DLL RegisterOGRao();
 
195
CPL_C_END
 
196
 
 
197
#endif /* ndef _OGR_PG_H_INCLUDED */
 
198
 
 
199