-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMiApi.cs
More file actions
553 lines (472 loc) · 24.1 KB
/
MiApi.cs
File metadata and controls
553 lines (472 loc) · 24.1 KB
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
// $Id: MiApi.cs,v 1.2 2005/03/24 17:02:06 dmorissette Exp $
//
using System;
using System.Runtime.InteropServices;
using System.IO;
using System.Collections;
namespace EBop.MapObjects.MapInfo {
// feature type values
public enum FeatureType {
TABFC_NoGeom = 0,
TABFC_Point = 1,
TABFC_FontPoint = 2,
TABFC_CustomPoint = 3,
TABFC_Text = 4,
TABFC_Polyline = 5,
TABFC_Arc = 6,
TABFC_Region = 7,
TABFC_Rectangle = 8,
TABFC_Ellipse = 9,
TABFC_MultiPoint = 10};
public enum FieldType {
TABFT_Char = 1,
TABFT_Integer = 2,
TABFT_SmallInt = 3,
TABFT_Decimal = 4,
TABFT_Float = 5,
TABFT_Date = 6,
TABFT_Logical = 7};
public enum Justification {
TABTJ_Left = 0,
TABTJ_Center = 1,
TABTJ_Right = 2};
public enum TextSpacing {
TABTS_Single = 0,
TABTS_1_5 = 1,
TABTS_Double = 2};
// test linetype
public enum LineSpacing {
TABTL_NoLine = 0,
TABTL_Simple = 1,
TABTL_Arrow = 2};
/// <summary>
/// Wrapper functions for the version 1.3.0 of the MapInfo Tab API.
/// </summary>
/// <remarks>
/// Requires mitab.dll (www.maptools.org)
/// See http://mitab.maptools.org/
///
/// Graham Sims
/// Environment Bay of Plenty, Whakatane, New Zealand
/// http://www.envbop.govt.nz
/// </remarks>
public class MiApi {
private MiApi() {
}
/// <summary>
/// Returns the version of the library.
/// </summary>
/// <returns>An integer representing the current version of the MITAB library in the
/// format xxxyyyzzz, e.g. returns 1002004 for v1.2.4.
/// </returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_getlibversion();
/// <summary>
/// Get the last error message.
/// </summary>
/// <remarks>
/// Fetches the last error message posted with CPLError(), that hasn't been cleared by CPLErrorReset().
/// The returned pointer is to an internal string that should not be altered or freed.
/// </remarks>
/// <returns>A pointer to the last error message, or an empty string if there is no posted error message</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_getlasterrormsg")]
private static extern IntPtr _mitab_c_getlasterrormsg();
public static string mitab_c_getlasterrormsg() {
return Marshal.PtrToStringAnsi(_mitab_c_getlasterrormsg());
}
// [DllImport("mitab.dll")]
// public static extern int mitab_c_getlasterrormsg_vb (
// [MarshalAs(UnmanagedType.LPStr, SizeConst = 260)] string errormsg, int l);
/// <summary>
/// Fetch the last error number.
/// </summary>
/// <remarks>This is the error number, not the error class. </remarks>
/// <returns>The error number of the last error to occur, or CPLE_None (0) if there are no posted errors</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_getlasterrorno();
/// <summary>
/// Open an existing .TAB or .MIF dataset for read access.
/// </summary>
/// <remarks>The function automatically detects the format (.MIF or .TAB) of the specified file.
/// Note that it is not possible to open a file for update (i.e. read+write) with the current
/// version of the library.</remarks>
/// <param name="filename">The complete filename (including extension .TAB or .MIF) of the file to open.</param>
/// <returns>A valid mitab_handle, or NULL if the file could not be opened.</returns>
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_open([MarshalAs(UnmanagedType.LPStr)] string filename);
/// <summary>
/// Close a dataset previously opened using mitab_c_open() or created using mitab_c_create().
/// </summary>
/// <param name="mitab_handle">The mitab_handle of the dataset to close.</param>
[DllImport("mitab.dll")]
public static extern void mitab_c_close(IntPtr mitab_handle);
/// <summary>
/// Create a new .TAB or .MIF dataset.
/// </summary>
/// <remarks>
/// Note that it is not possible to open a file for update (i.e. read+write) with the current version
/// of the library.
/// </remarks>
/// <param name="filename">The complete filename (including extension .TAB or .MIF) of the file to create.</param>
/// <param name="mif_or_tab">One of "mif" to create a .MIF dataset or "tab" to create a .TAB dataset.
/// The default is to create a TAB dataset if this parameter's value is NULL or an empty string.</param>
/// <param name="mif_projectiondef">The projection to use for the dataset, in the same format that is
/// used in the "CoordSys" line of a MIF file header. If this parameter's value is NULL or empty then
/// a LAT/LON coordsys is assumed. See also mitab_c_get_mif_coordsys().</param>
/// <param name="north">The upper dataset bound. Note that valid bounds are required for a .TAB dataset
/// otherwise data may not be stored properly in the file. MITAB knows the default bounds only for the
/// most common MapInfo coordinate systems, passing north,south,east,west as 0,0,0,0 will instruct MITAB
/// to attempt to use the default bounds for that projection. If no default bounds are found for this
/// projection then your data may not be stored properly in the file unless you provide valid bounds
/// via the north,south,east,west parameters.</param>
/// <param name="south">The lower dataset bound.</param>
/// <param name="east">The right dataset bound. </param>
/// <param name="west">The left dataset bound.</param>
/// <returns>A valid mitab_handle, or NULL if the file could not be created.</returns>
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_create(
[MarshalAs(UnmanagedType.LPStr)] string filename,
[MarshalAs(UnmanagedType.LPStr)] string mif_or_tab,
[MarshalAs(UnmanagedType.LPStr)] string mif_projectiondef,
double north, double south,
double east, double west );
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_add_field( IntPtr handle,
[MarshalAs(UnmanagedType.LPStr)] string field_name,
int field_type, int width, int precision,
int indexed, int unique );
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_write_feature(IntPtr handle, IntPtr feature );
/// <summary>
/// Iterator to get the next valid feature id when reading a dataset opened with mitab_c_open().
/// </summary>
/// <param name="handle">the mitab_handle of the file opened for read access.</param>
/// <param name="last_feature_id">The id of the last feature that was read.
/// Use -1 to get first feature id in the dataset.</param>
/// <returns>The next valid feature id in the dataset, or -1 when there are no more feature ids.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_next_feature_id(IntPtr handle, int last_feature_id );
/// <summary>
/// Read a mitab_feature object from the file.
/// </summary>
/// <remarks>Works only with datasets opened with mitab_c_open().</remarks>
/// <param name="handle">The mitab_handle of the file opened for read access.</param>
/// <param name="feature_id">The id of the feature to read, obtained by calling mitab_c_next_feature_id()</param>
/// <returns>The mitab_feature object that was read.
/// The object will have to be destroyed using mitab_c_destroy_feature() once you are done with it.</returns>
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_read_feature( IntPtr handle, int feature_id );
/// <summary>
/// Destroy a mitab_feature object and release all memory associated with it.
/// </summary>
/// <param name="feature">The mitab_feature to destroy.</param>
[DllImport("mitab.dll")]
public static extern void mitab_c_destroy_feature( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_feature_id( IntPtr feature );
/// <summary>
/// Create a new mitab_feature object to be written to a dataset created using mitab_c_create().
/// </summary>
/// <param name="handle">The handle of the dataset opened for write access.</param>
/// <param name="feature_type">A member of the feature type enumeration. At this point, only the following
/// types can be created by this C API function: TABFC_NoGeom (0), TABFC_Point (1), TABFC_FontPoint (2),
/// TABFC_CustomPoint (3), TABFC_Text (4), TABFC_Polyline (5), TABFC_Arc (6), TABFC_Region (7),
/// TABFC_Rectangle (8), TABFC_Ellipse (9) and TABFC_MultiPoint (10)</param>
/// <returns>The new mitab_feature object, or NULL if creation failed. Note that the new object will
/// have to be released using mitab_c_destroy_feature().</returns>
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_create_feature( IntPtr handle, int feature_type );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_field( IntPtr feature, int field_index,
[MarshalAs(UnmanagedType.LPStr)] string value );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_text( IntPtr feature,
[MarshalAs(UnmanagedType.LPStr)] string text );
/// <summary>
/// Get the text string on a TABFC_Text object.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>A pointer to the text string in the object.</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_get_text")]
public static extern IntPtr _mitab_c_get_text( IntPtr feature );
public static string mitab_c_get_text( IntPtr feature ) {
return Marshal.PtrToStringAnsi(_mitab_c_get_text(feature));
}
// [DllImport("mitab.dll")]
// public static extern int mitab_c_get_text_vb( IntPtr feature,
// [MarshalAs(UnmanagedType.LPStr)] string text, int l );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_text_display( IntPtr feature,
double angle, double height, double width,
int fg_color, int bg_color,
int justification, int spacing, int linetype );
[DllImport("mitab.dll")]
public static extern double mitab_c_get_text_angle( IntPtr feature );
[DllImport("mitab.dll")]
public static extern double mitab_c_get_text_height( IntPtr feature );
[DllImport("mitab.dll")]
public static extern double mitab_c_get_text_width( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_text_fgcolor( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_text_bgcolor( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_text_justification( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_text_spacing( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_text_linetype( IntPtr feature );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_pen( IntPtr feature, int width, int pattern, int color );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_pen_color( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_pen_width( IntPtr feature );
[DllImport("mitab.dll")]
public static extern int mitab_c_get_pen_pattern( IntPtr feature );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_brush( IntPtr feature,
int fg_color, int bg_color, int pattern,
int transparent );
/// <summary>
/// Get an object's brush foreground color property. Applies to region, ellipse and rectangle objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The brush foreground color (24 bits RGB value).</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_brush_fgcolor( IntPtr feature );
/// <summary>
/// Get an object's brush background color property. Applies to region, ellipse and rectangle objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The brush foreground color (24 bits RGB value).</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_brush_bgcolor( IntPtr feature );
/// <summary>
/// Get an object's brush pattern property. Applies to region, ellipse and rectangle objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The brush pattern number (1 is none, 2 is solid fill, etc.).</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_brush_pattern( IntPtr feature );
/// <summary>
/// Get an object's brush transparency property. Applies to region, ellipse and rectangle objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The brush transparency value, either 0 for an opaque brush (using bg color) or 1 for
/// transparent (ignore bg color).</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_brush_transparent( IntPtr feature );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_font( IntPtr feature,
[MarshalAs(UnmanagedType.LPStr)] string font_name );
/// <summary>
/// Get the font name from a TABFC_Text or TABFC_FontPoint object, or the symbol name from a
/// TABFC_CustomPoint.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The text font name.</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_get_font")]
private static extern IntPtr _mitab_c_get_font( IntPtr feature );
public static string mitab_c_get_font( IntPtr feature ) {
return Marshal.PtrToStringAnsi(_mitab_c_get_font( feature ));
}
// [DllImport("mitab.dll")]
// public static extern int mitab_c_get_font_vb( IntPtr feature,
// [MarshalAs(UnmanagedType.LPStr, SizeConst = 80)] string font, int l );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_symbol( IntPtr feature, int symbol_no,
int symbol_size, int symbol_color );
/// <summary>
/// Get an object's symbol color property. Applies only to point and multipoint objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The symbol color (24 bits RGB value).</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_symbol_color( IntPtr feature );
/// <summary>
/// Get an object's symbol number property. Applies only to point and multipoint objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The symbol number (valid range: 32 to 67)</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_symbol_no( IntPtr feature );
/// <summary>
/// Get an object's symbol size property. Applies only to point and multipoint objects.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The symbol size in pixels (valid range 1 to 48)</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_symbol_size( IntPtr feature );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_points( IntPtr feature, int part,
int vertex_count, ref double x, ref double y );
[DllImport("mitab.dll")]
public static extern void mitab_c_set_arc( IntPtr feature,
double center_x, double center_y,
double x_radius, double y_radius,
double start_angle, double end_angle);
/// <summary>
/// Return a mitab_feature's object type.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>A member of the FeatureType enumeration, one of TABFC_NoGeom (0), TABFC_Point (1),
/// TABFC_FontPoint (2), TABFC_CustomPoint (3), TABFC_Text (4), TABFC_Polyline (5), TABFC_Arc (6),
/// TABFC_Region (7), TABFC_Rectangle (8), TABFC_Ellipse (9) or TABFC_MultiPoint (10).</returns>
[DllImport("mitab.dll")]
public static extern FeatureType mitab_c_get_type( IntPtr feature );
/// <summary>
/// Return the number of parts (rings or polyline segments) in an object.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <returns>The number of parts (in a region or polyline) or 0 if the object's
/// geometry was not set. For all object types other than polyline region, returns 1
/// if object geometry is set.
/// </returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_parts( IntPtr feature );
/// <summary>
/// Return the number of points in a part of a mitab_feature object.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <param name="part">The part number we are interested in.
/// Use 0 for objects which cannot have multiple parts.</param>
/// <returns>The number of points in that feature's part or 0 if the object has no
/// geometry or the part number is invalid.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_vertex_count( IntPtr feature, int part );
/// <summary>
/// Return the X coordinate of a point in a part of a mitab_feature object.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <param name="part">The part number we are interested in. Use 0 for objects which cannot have multiple parts.</param>
/// <param name="vertex">The point number, with 0 being the first point.</param>
/// <returns>The X coordinate of the specified point or null if the object has no geometry or the part or the point number is invalid.</returns>
[DllImport("mitab.dll")]
public static extern double mitab_c_get_vertex_x( IntPtr feature, int part, int vertex );
/// <summary>
/// Return the Y coordinate of a point in a part of a mitab_feature object.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <param name="part">The part number we are interested in. Use 0 for objects which cannot have multiple parts.</param>
/// <param name="vertex">The point number, with 0 being the first point.</param>
/// <returns>The Y coordinate of the specified point or null if the object has no geometry or the part or the point number is invalid.</returns>
[DllImport("mitab.dll")]
public static extern double mitab_c_get_vertex_y( IntPtr feature, int part, int vertex );
/// <summary>
/// Return the number of features in a dataset.
/// </summary>
/// <param name="handle">The dataset's handle.</param>
/// <returns>The number of features in the dataset.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_feature_count( IntPtr handle );
/// <summary>
/// Return the number of attribute fields in a dataset's schema.
/// </summary>
/// <param name="handle">The dataset's handle.</param>
/// <returns>The number of attribute fields defined in the dataset.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_field_count( IntPtr handle );
/// <summary>
/// Return the type of an attribute field in a dataset's schema.
/// </summary>
/// <param name="handle">The dataset's handle.</param>
/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
/// <returns>The field type, one of TABFT_Char (1), TABFT_Integer (2), TABFT_SmallInt (3),
/// TABFT_Decimal (4), TABFT_Float (5), TABFT_Date (6), or TABFT_Logical (7)</returns>
[DllImport("mitab.dll")]
public static extern FieldType mitab_c_get_field_type( IntPtr handle, int field );
/// <summary>
/// Return the name of an attribute field in a dataset's schema.
/// </summary>
/// <param name="handle">The dataset's handle.</param>
/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
/// <returns>A pointer to the field name. The returned string pointer is a reference to an
/// internal buffer and should not be modified or freed by the caller.</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_get_field_name")]
private static extern IntPtr _mitab_c_get_field_name(IntPtr handle, int field);
public static string mitab_c_get_field_name(IntPtr handle, int field) {
return Marshal.PtrToStringAnsi( _mitab_c_get_field_name(handle, field) );
}
// [DllImport("mitab.dll")]
// public static extern int mitab_c_get_field_name_vb( IntPtr handle, int field,
// [MarshalAs(UnmanagedType.LPStr, SizeConst = 80)] string name, int l );
/// <summary>
/// Return the width of an attribute field in a dataset's schema.
/// </summary>
/// <param name="handle">The dataset's handle.</param>
/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
/// <returns>The field width.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_field_width( IntPtr handle, int field );
/// <summary>
/// Return the precision of an attribute field in a dataset's schema.
/// </summary>
/// <param name="handle">The dataset's handle.</param>
/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
/// <returns>The field precision.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_get_field_precision( IntPtr handle, int field );
/// <summary>
/// Fetch an attribute field value in a mitab_feature as a string.
/// </summary>
/// <remarks>The function returns a reference to an internal string buffer that contains the string
/// representation of the attribute field's value (integer and floating point values are converted
/// to string using sprintf()).</remarks>
/// <param name="feature">The mitab_feature object</param>
/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
/// <returns>A pointer to a string containing the value of the field. The returned string pointer
/// is a reference to an internal buffer and should not be modified or freed by the caller.
/// Its value will be valid only until the next call to mitab_c_get_field().</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_get_field_as_string")]
private static extern IntPtr _mitab_c_get_field_as_string( IntPtr feature, int field );
public static string mitab_c_get_field_as_string( IntPtr feature, int field ) {
return Marshal.PtrToStringAnsi( _mitab_c_get_field_as_string( feature, field ));
}
/// <summary>
/// Fetch an attribute field value in a mitab_feature as a double.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
/// <returns>The value of the field converted to double.</returns>
[DllImport("mitab.dll")]
public static extern double mitab_c_get_field_as_double( IntPtr feature, int field);
// [DllImport("mitab.dll")]
// public static extern int mitab_c_get_field_as_string_vb( IntPtr feature, int field,
// [MarshalAs(UnmanagedType.LPStr, SizeConst = 80)] string value, int l );
[DllImport("mitab.dll")]
public static extern IntPtr mitab_c_get_projinfo( IntPtr dataset );
[DllImport("mitab.dll")]
public static extern int mitab_c_set_projinfo( IntPtr dataset, IntPtr projinfo );
/// <returns>A pointer to a string</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_get_mif_coordsys")]
private static extern IntPtr _mitab_c_get_mif_coordsys(IntPtr dataset);
public static string mitab_c_get_mif_coordsys(IntPtr dataset) {
return Marshal.PtrToStringAnsi(_mitab_c_get_mif_coordsys(dataset));
}
///<returns>A pointer to a string</returns>
[DllImport("mitab.dll", EntryPoint="mitab_c_get_extended_mif_coordsys")]
private static extern IntPtr _mitab_c_get_extended_mif_coordsys(IntPtr dataset);
public static string mitab_c_get_extended_mif_coordsys(IntPtr dataset) {
return Marshal.PtrToStringAnsi(_mitab_c_get_extended_mif_coordsys(dataset));
}
// [DllImport("mitab.dll")]
// public static extern int mitab_c_get_mif_coordsys_vb( IntPtr dataset,
// [MarshalAs(UnmanagedType.LPStr)] string coordsys, int l);
// [DllImport("mitab.dll")]
// public static extern int mitab_c_get_extended_mif_coordsys_vb( IntPtr dataset,
// [MarshalAs(UnmanagedType.LPStr)] string coordsys, int l);
[DllImport("mitab.dll")]
public static extern int mitab_c_load_coordsys_table(
[MarshalAs(UnmanagedType.LPStr)] string filename);
/// <summary>
/// Return a false if the ring is the first of a polygon.
/// </summary>
/// <param name="feature">The mitab_feature object.</param>
/// <param name="requestedringindex">The requested ring index</param>
/// <returns>True or false depends on the part number of the ring in the polygon, true if it's not the
/// first part of a polygon. If the feature is not a region the return value will be false.</returns>
[DllImport("mitab.dll")]
public static extern int mitab_c_is_interior_ring( IntPtr feature, int requestedringindex );
}
}