File: Ogr.cs

package info (click to toggle)
gdal 1.10.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 84,320 kB
  • ctags: 74,726
  • sloc: cpp: 677,199; ansic: 162,820; python: 13,816; cs: 11,163; sh: 10,446; java: 5,279; perl: 4,429; php: 2,971; xml: 1,500; yacc: 934; makefile: 494; sql: 112
file content (239 lines) | stat: -rw-r--r-- 12,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.7
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace OSGeo.OGR {

using System;
using System.Runtime.InteropServices;

public class Ogr {

  internal class OgrObject : IDisposable {
	public virtual void Dispose() {
      
    }
  }
  internal static OgrObject theOgrObject = new OgrObject();
  protected static object ThisOwn_true() { return null; }
  protected static object ThisOwn_false() { return theOgrObject; }

  public static void UseExceptions() {
    OgrPINVOKE.UseExceptions();
  }

  public static void DontUseExceptions() {
    OgrPINVOKE.DontUseExceptions();
  }

  internal static void StringListDestroy(IntPtr buffer_ptr) {
    OgrPINVOKE.StringListDestroy(buffer_ptr);
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
  }

public delegate void GDALErrorHandlerDelegate(int eclass, int code, IntPtr msg);
  public static Geometry CreateGeometryFromWkb(int len, IntPtr bin_string, OSGeo.OSR.SpatialReference reference) {
    IntPtr cPtr = OgrPINVOKE.CreateGeometryFromWkb(len, bin_string, OSGeo.OSR.SpatialReference.getCPtr(reference));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry CreateGeometryFromWkt(ref string val, OSGeo.OSR.SpatialReference reference) {
    IntPtr cPtr = OgrPINVOKE.CreateGeometryFromWkt(ref val, OSGeo.OSR.SpatialReference.getCPtr(reference));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry CreateGeometryFromGML(string input_string) {
    IntPtr cPtr = OgrPINVOKE.CreateGeometryFromGML(input_string);
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry CreateGeometryFromJson(string input_string) {
    IntPtr cPtr = OgrPINVOKE.CreateGeometryFromJson(input_string);
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort, int bAutoClose, double dfTolerance) {
    IntPtr cPtr = OgrPINVOKE.BuildPolygonFromEdges(Geometry.getCPtr(hLineCollection), bBestEffort, bAutoClose, dfTolerance);
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis, double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees) {
    IntPtr cPtr = OgrPINVOKE.ApproximateArcAngles(dfCenterX, dfCenterY, dfZ, dfPrimaryRadius, dfSecondaryAxis, dfRotation, dfStartAngle, dfEndAngle, dfMaxAngleStepSizeDegrees);
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry ForceToPolygon(Geometry geom_in) {
    IntPtr cPtr = OgrPINVOKE.ForceToPolygon(Geometry.getCPtr(geom_in));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry ForceToLineString(Geometry geom_in) {
    IntPtr cPtr = OgrPINVOKE.ForceToLineString(Geometry.getCPtr(geom_in));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry ForceToMultiPolygon(Geometry geom_in) {
    IntPtr cPtr = OgrPINVOKE.ForceToMultiPolygon(Geometry.getCPtr(geom_in));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry ForceToMultiPoint(Geometry geom_in) {
    IntPtr cPtr = OgrPINVOKE.ForceToMultiPoint(Geometry.getCPtr(geom_in));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Geometry ForceToMultiLineString(Geometry geom_in) {
    IntPtr cPtr = OgrPINVOKE.ForceToMultiLineString(Geometry.getCPtr(geom_in));
    Geometry ret = (cPtr == IntPtr.Zero) ? null : new Geometry(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static int GetDriverCount() {
    int ret = OgrPINVOKE.GetDriverCount();
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static int GetOpenDSCount() {
    int ret = OgrPINVOKE.GetOpenDSCount();
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static int SetGenerate_DB2_V72_BYTE_ORDER(int bGenerate_DB2_V72_BYTE_ORDER) {
    int ret = OgrPINVOKE.SetGenerate_DB2_V72_BYTE_ORDER(bGenerate_DB2_V72_BYTE_ORDER);
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static void RegisterAll() {
    OgrPINVOKE.RegisterAll();
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
  }

  public static string GeometryTypeToName(wkbGeometryType eType) {
    string ret = OgrPINVOKE.GeometryTypeToName((int)eType);
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static string GetFieldTypeName(FieldType type) {
    string ret = OgrPINVOKE.GetFieldTypeName((int)type);
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static DataSource GetOpenDS(int ds_number) {
    IntPtr cPtr = OgrPINVOKE.GetOpenDS(ds_number);
    DataSource ret = (cPtr == IntPtr.Zero) ? null : new DataSource(cPtr, false, ThisOwn_false());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static DataSource Open(string utf8_path, int update) {
    IntPtr cPtr = OgrPINVOKE.Open(System.Text.Encoding.Default.GetString(System.Text.Encoding.UTF8.GetBytes(utf8_path)), update);
    DataSource ret = (cPtr == IntPtr.Zero) ? null : new DataSource(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static DataSource OpenShared(string utf8_path, int update) {
    IntPtr cPtr = OgrPINVOKE.OpenShared(System.Text.Encoding.Default.GetString(System.Text.Encoding.UTF8.GetBytes(utf8_path)), update);
    DataSource ret = (cPtr == IntPtr.Zero) ? null : new DataSource(cPtr, true, ThisOwn_true());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Driver GetDriverByName(string name) {
    IntPtr cPtr = OgrPINVOKE.GetDriverByName(name);
    Driver ret = (cPtr == IntPtr.Zero) ? null : new Driver(cPtr, false, ThisOwn_false());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static Driver GetDriver(int driver_number) {
    IntPtr cPtr = OgrPINVOKE.GetDriver(driver_number);
    Driver ret = (cPtr == IntPtr.Zero) ? null : new Driver(cPtr, false, ThisOwn_false());
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static string[] GeneralCmdLineProcessor(string[] papszArgv, int nOptions) {
        /* %typemap(csout) char**options */
        IntPtr cPtr = OgrPINVOKE.GeneralCmdLineProcessor((papszArgv != null)? new OgrPINVOKE.StringListMarshal(papszArgv)._ar : null, nOptions);
        IntPtr objPtr;
        int count = 0;
        if (cPtr != IntPtr.Zero) {
            while (Marshal.ReadIntPtr(cPtr, count*IntPtr.Size) != IntPtr.Zero)
                ++count;
        }
        string[] ret = new string[count];
        if (count > 0) {       
	        for(int cx = 0; cx < count; cx++) {
                objPtr = System.Runtime.InteropServices.Marshal.ReadIntPtr(cPtr, cx * System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)));
                ret[cx]= (objPtr == IntPtr.Zero) ? null : System.Runtime.InteropServices.Marshal.PtrToStringAnsi(objPtr);
            }
        }
        
    if (OgrPINVOKE.SWIGPendingException.Pending) throw OgrPINVOKE.SWIGPendingException.Retrieve();
        return ret;
}

  public static readonly int wkb25DBit = OgrPINVOKE.wkb25DBit_get();
  public static readonly int ogrZMarker = OgrPINVOKE.ogrZMarker_get();
  public static readonly int OGRNullFID = OgrPINVOKE.OGRNullFID_get();
  public static readonly int OGRUnsetMarker = OgrPINVOKE.OGRUnsetMarker_get();
  public static readonly string OLCRandomRead = OgrPINVOKE.OLCRandomRead_get();
  public static readonly string OLCSequentialWrite = OgrPINVOKE.OLCSequentialWrite_get();
  public static readonly string OLCRandomWrite = OgrPINVOKE.OLCRandomWrite_get();
  public static readonly string OLCFastSpatialFilter = OgrPINVOKE.OLCFastSpatialFilter_get();
  public static readonly string OLCFastFeatureCount = OgrPINVOKE.OLCFastFeatureCount_get();
  public static readonly string OLCFastGetExtent = OgrPINVOKE.OLCFastGetExtent_get();
  public static readonly string OLCCreateField = OgrPINVOKE.OLCCreateField_get();
  public static readonly string OLCDeleteField = OgrPINVOKE.OLCDeleteField_get();
  public static readonly string OLCReorderFields = OgrPINVOKE.OLCReorderFields_get();
  public static readonly string OLCAlterFieldDefn = OgrPINVOKE.OLCAlterFieldDefn_get();
  public static readonly string OLCTransactions = OgrPINVOKE.OLCTransactions_get();
  public static readonly string OLCDeleteFeature = OgrPINVOKE.OLCDeleteFeature_get();
  public static readonly string OLCFastSetNextByIndex = OgrPINVOKE.OLCFastSetNextByIndex_get();
  public static readonly string OLCStringsAsUTF8 = OgrPINVOKE.OLCStringsAsUTF8_get();
  public static readonly string ODsCCreateLayer = OgrPINVOKE.ODsCCreateLayer_get();
  public static readonly string ODsCDeleteLayer = OgrPINVOKE.ODsCDeleteLayer_get();
  public static readonly string ODrCCreateDataSource = OgrPINVOKE.ODrCCreateDataSource_get();
  public static readonly string ODrCDeleteDataSource = OgrPINVOKE.ODrCDeleteDataSource_get();
  public static readonly int OGRERR_NONE = OgrPINVOKE.OGRERR_NONE_get();
  public static readonly int OGRERR_NOT_ENOUGH_DATA = OgrPINVOKE.OGRERR_NOT_ENOUGH_DATA_get();
  public static readonly int OGRERR_NOT_ENOUGH_MEMORY = OgrPINVOKE.OGRERR_NOT_ENOUGH_MEMORY_get();
  public static readonly int OGRERR_UNSUPPORTED_GEOMETRY_TYPE = OgrPINVOKE.OGRERR_UNSUPPORTED_GEOMETRY_TYPE_get();
  public static readonly int OGRERR_UNSUPPORTED_OPERATION = OgrPINVOKE.OGRERR_UNSUPPORTED_OPERATION_get();
  public static readonly int OGRERR_CORRUPT_DATA = OgrPINVOKE.OGRERR_CORRUPT_DATA_get();
  public static readonly int OGRERR_FAILURE = OgrPINVOKE.OGRERR_FAILURE_get();
  public static readonly int OGRERR_UNSUPPORTED_SRS = OgrPINVOKE.OGRERR_UNSUPPORTED_SRS_get();
}

}