Functions | |
int MITAB_STDCALL | mitab_c_getlasterrorno () |
Fetch the last error number. More... | |
const char* MITAB_STDCALL | mitab_c_getlasterrormsg () |
Get the last error message. More... | |
int MITAB_STDCALL | mitab_c_getlasterrormsg_vb (char * errormsg, int l) |
Get the last error message (VB Version). More... | |
mitab_handle MITAB_STDCALL | mitab_c_open ( const char * pszFilename ) |
Open an existing .TAB or .MIF dataset for read access. More... | |
void MITAB_STDCALL | mitab_c_close ( mitab_handle handle ) |
Close a dataset previously opened using mitab_c_open() or created using mitab_c_create(). More... | |
mitab_handle MITAB_STDCALL | mitab_c_create ( const char * filename, const char * mif_or_tab, const char * mif_projection, double north, double south, double east, double west ) |
Create a new .TAB or .MIF dataset. More... | |
int MITAB_STDCALL | mitab_c_add_field ( mitab_handle dataset, const char *field_name, int field_type, int width, int precision ) |
Add a new field to the dataset's schema. More... | |
void MITAB_STDCALL | mitab_c_destroy_feature ( mitab_feature feature ) |
Destroy a mitab_feature object and release all memory associated with it. More... | |
int MITAB_STDCALL | mitab_c_next_feature_id ( mitab_handle handle, int last_feature_id ) |
Iterator to get the next valid feature id when reading a dataset opened with mitab_c_open(). More... | |
mitab_feature MITAB_STDCALL | mitab_c_read_feature ( mitab_handle handle, int feature_id ) |
Read a mitab_feature object from the file. More... | |
int MITAB_STDCALL | mitab_c_write_feature ( mitab_handle handle, mitab_feature feature ) |
Write a new feature to a dataset. More... | |
mitab_feature MITAB_STDCALL | mitab_c_create_feature ( mitab_handle handle, int feature_type ) |
Create a new mitab_feature object to be written to a dataset created using mitab_c_create(). More... | |
void MITAB_STDCALL | mitab_c_set_field ( mitab_feature feature, int field_index, const char *field_value ) |
Set the value of specified field in a feature object. More... | |
void MITAB_STDCALL | mitab_c_set_points ( mitab_feature feature, int part, int vertex_count, double * x, double * y ) |
Set the feature's coordinates. More... | |
void MITAB_STDCALL | mitab_c_set_arc ( mitab_feature feature, double center_x, double center_y, double x_radius, double y_radius, double start_angle, double end_angle) |
Set an arc or ellipse feature parameters. More... | |
void MITAB_STDCALL | mitab_c_set_text ( mitab_feature feature, const char * text ) |
Set the text string on a TABFC_Text object. More... | |
const char* MITAB_STDCALL | mitab_c_get_text ( mitab_feature feature ) |
Get the text string on a TABFC_Text object. More... | |
int MITAB_STDCALL | mitab_c_get_text_vb ( mitab_feature feature, char * text, int l ) |
Get the text string on a TABFC_Text object (VB Version). More... | |
void MITAB_STDCALL | mitab_c_set_text_display ( mitab_feature feature, double angle, double height, double width, int fg_color, int bg_color, int justification, int spacing, int linetype ) |
Set a TABFC_Text object's display properties. More... | |
double MITAB_STDCALL | mitab_c_get_text_angle ( mitab_feature feature ) |
Fetch a TABFC_Text object's angle property. More... | |
double MITAB_STDCALL | mitab_c_get_text_height ( mitab_feature feature ) |
Fetch a TABFC_Text object's MBR height property. More... | |
double MITAB_STDCALL | mitab_c_get_text_width ( mitab_feature feature ) |
Fetch a TABFC_Text object's MBR width property. More... | |
int MITAB_STDCALL | mitab_c_get_text_fgcolor ( mitab_feature feature ) |
Fetch a TABFC_Text object's foreground color property. More... | |
int MITAB_STDCALL | mitab_c_get_text_bgcolor ( mitab_feature feature ) |
Fetch a TABFC_Text object's background color property. More... | |
int MITAB_STDCALL | mitab_c_get_text_justification ( mitab_feature feature ) |
Fetch a TABFC_Text object's justification property. More... | |
int MITAB_STDCALL | mitab_c_get_text_spacing ( mitab_feature feature ) |
Fetch a TABFC_Text object's spacing property. More... | |
int MITAB_STDCALL | mitab_c_get_text_linetype ( mitab_feature feature ) |
Fetch a TABFC_Text object's linetype property. More... | |
void MITAB_STDCALL | mitab_c_set_font ( mitab_feature feature, const char * fontname ) |
Set the font name in a a TABFC_Text or TABFC_FontPoint object, or set the symbol name in a TABFC_CustomPoint. More... | |
const char* MITAB_STDCALL | mitab_c_get_font ( mitab_feature feature ) |
Get the font name from a TABFC_Text or TABFC_FontPoint object, or the symbol name from a TABFC_CustomPoint. More... | |
int MITAB_STDCALL | mitab_c_get_font_vb ( mitab_feature feature, char * font, int l ) |
Get the font name from a TABFC_Text or TABFC_FontPoint object, or the symbol name from a TABFC_CustomPoint. More... | |
void MITAB_STDCALL | mitab_c_set_brush ( mitab_feature feature, int fg_color, int bg_color, int pattern, int transparent ) |
Set an object's brush properties. More... | |
int MITAB_STDCALL | mitab_c_get_brush_fgcolor ( mitab_feature feature ) |
Get an object's brush foreground color property. More... | |
int MITAB_STDCALL | mitab_c_get_brush_bgcolor ( mitab_feature feature ) |
Get an object's brush background color property. More... | |
int MITAB_STDCALL | mitab_c_get_brush_pattern ( mitab_feature feature ) |
Get an object's brush pattern property. More... | |
int MITAB_STDCALL | mitab_c_get_brush_transparent ( mitab_feature feature ) |
Get an object's brush transparency property. More... | |
void MITAB_STDCALL | mitab_c_set_pen ( mitab_feature feature, int width, int pattern, int color ) |
Set an object's pen properties. More... | |
int MITAB_STDCALL | mitab_c_get_pen_color ( mitab_feature feature ) |
Get an object's pen color property. More... | |
int MITAB_STDCALL | mitab_c_get_pen_width ( mitab_feature feature ) |
Get an object's pen width property. More... | |
int MITAB_STDCALL | mitab_c_get_pen_pattern ( mitab_feature feature ) |
Get an object's pen pattern property. More... | |
void MITAB_STDCALL | mitab_c_set_symbol ( mitab_feature feature, int symbol_no, int symbol_size, int symbol_color ) |
Set an object's symbol properties. More... | |
int MITAB_STDCALL | mitab_c_get_symbol_color ( mitab_feature feature ) |
Get an object's symbol color property. More... | |
int MITAB_STDCALL | mitab_c_get_symbol_no ( mitab_feature feature ) |
Get an object's symbol number property. More... | |
int MITAB_STDCALL | mitab_c_get_symbol_size ( mitab_feature feature ) |
Get an object's symbol size property. More... | |
int MITAB_STDCALL | mitab_c_get_type ( mitab_feature feature ) |
Return a mitab_feature's object type. More... | |
int MITAB_STDCALL | mitab_c_get_parts ( mitab_feature feature ) |
Return the number of parts (rings or polyline segments) in an object. More... | |
int MITAB_DLL MITAB_STDCALL | mitab_c_is_interior_ring ( mitab_feature feature, int requestedringindex ) |
Return a false if te ring is the first of a polygon. More... | |
int MITAB_STDCALL | mitab_c_get_vertex_count ( mitab_feature feature, int part ) |
Return the number of points in a part of a mitab_feature object. More... | |
double MITAB_STDCALL | mitab_c_get_vertex_x ( mitab_feature feature, int part, int vertex ) |
Return the X coordinate of a point in a part of a mitab_feature object. More... | |
double MITAB_STDCALL | mitab_c_get_vertex_y ( mitab_feature feature, int part, int vertex ) |
Return the Y coordinate of a point in a part of a mitab_feature object. More... | |
int MITAB_STDCALL | mitab_c_get_field_count ( mitab_handle handle ) |
Return the number of attribute fields in a dataset's schema. More... | |
int MITAB_STDCALL | mitab_c_get_field_type ( mitab_handle handle, int field ) |
Return the type of an attribute field in a dataset's schema. More... | |
const char* MITAB_STDCALL | mitab_c_get_field_name ( mitab_handle handle, int field ) |
Return the name of an attribute field in a dataset's schema. More... | |
int MITAB_STDCALL | mitab_c_get_field_name_vb ( mitab_handle handle, int field, char * name, int l ) |
Return the name of an attribute field in a dataset's schema (VB version). More... | |
int MITAB_STDCALL | mitab_c_get_field_width ( mitab_handle handle, int field ) |
Return the width of an attribute field in a dataset's schema. More... | |
int MITAB_STDCALL | mitab_c_get_field_precision ( mitab_handle handle, int field ) |
Return the precision of an attribute field in a dataset's schema. More... | |
const char* MITAB_STDCALL | mitab_c_get_field_as_string ( mitab_feature feature, int field ) |
Fetch an attribute field value in a mitab_feature as a string. More... | |
int MITAB_STDCALL | mitab_c_get_field_as_string_vb ( mitab_feature feature, int field, char * value, int l ) |
Fetch an attribute field value in a mitab_feature as a string (VB Version). More... | |
mitab_projinfo MITAB_STDCALL | mitab_c_get_projinfo ( mitab_handle dataset ) |
Get the projinfo handle from an opened dataset. More... | |
int MITAB_STDCALL | mitab_c_set_projinfo ( mitab_handle dataset, mitab_projinfo projinfo ) |
Set the projinfo on a newly created dataset. More... | |
const char* MITAB_STDCALL | mitab_c_get_mif_coordsys ( mitab_handle dataset) |
Get the MIF CoordSys string from an opened dataset. More... | |
int MITAB_STDCALL | mitab_c_get_mif_coordsys_vb ( mitab_handle dataset, char * coordsys, int l) |
Get the MIF CoordSys string from an opened dataset (VB Version). More... |
The C wrapper functions contained in mitab_capi.cpp provide a much simpler interface than the OGR-based C++ classes to the MITAB library to read and write .TAB and .MIF files.
To use the C API, simply include "mitab_capi.h" and use the functions defined in mitab_capi.cpp.
See also mitabc_test.cpp which for examples of use of the C API.
See contrib/README_VB.TXT in the MITAB source code distribution for informations on using the MITAB C API from VB, Pascal, or MapBasic.
|
Add a new field to the dataset's schema.
Adding fields MUST be done immediately after creating a new dataset and BEFORE creating the first feature.
dataset | the mitab_handle of the newly created dataset. |
field_name | the name of the new field to create. |
field_type | the new 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) |
width | the width of the new field, applies only to char and decimal types. |
precision | the number of digits after the decimal point, applies only to the decimal field type. |
|
Initial value:
handle | the mitab_handle of the dataset to close. |
|
Create a new .TAB or .MIF dataset.
Note that it is not possible to open a file for update (i.e. read+write) with the current version of the library.
filename | the complete filename (including extension .TAB or .MIF) of the file to create. |
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. |
mif_projection | 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(). |
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. |
south | the lower dataset bound. |
east | the right dataset bound. |
west | the left dataset bound. |
|
Create a new mitab_feature object to be written to a dataset created using mitab_c_create().
handle | the handle of the dataset opened for write access. |
feature_type | the type of feature object to create. At this point, only the following types can be created by this C API function: 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) |
|
Destroy a mitab_feature object and release all memory associated with it.
feature | the mitab_feature to destroy. |
|
Get an object's brush background color property.
Applies to region, ellipse and rectangle objects.
feature | the mitab_feature object. |
|
Get an object's brush foreground color property.
Applies to region, ellipse and rectangle objects.
feature | the mitab_feature object. |
|
Get an object's brush pattern property.
Applies to region, ellipse and rectangle objects.
feature | the mitab_feature object. |
|
Get an object's brush transparency property.
Applies to region, ellipse and rectangle objects.
feature | the mitab_feature object. |
|
Fetch an attribute field value in a mitab_feature as a string.
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()).
feature | the mitab_feature object. |
field | the index of the field to look at, with 0 being the first field. |
|
Fetch an attribute field value in a mitab_feature as a string (VB Version).
The function returns a reference to the string representation of the attribute field's value (integer and floating point values are converted to string using sprintf()).
feature | the mitab_feature object. |
field | the index of the field to look at, with 0 being the first field. |
value | string buffer to return the value of the field. |
l | the maximum lenght of the value string including terminating null. |
|
Return the number of attribute fields in a dataset's schema.
handle | the dataset's handle. |
|
Return the name of an attribute field in a dataset's schema.
handle | the dataset's handle. |
field | the index of the field to look at, with 0 being the first field. |
|
Return the name of an attribute field in a dataset's schema (VB version).
handle | the dataset's handle. |
field | the index of the field to look at, with 0 being the first field. |
name | string buffer to return the field name. |
l | the maximum lenght of the name string including terminating null. |
|
Return the precision of an attribute field in a dataset's schema.
handle | the dataset's handle. |
field | the index of the field to look at, with 0 being the first field. |
|
Return the type of an attribute field in a dataset's schema.
handle | the dataset's handle. |
field | the index of the field to look at, with 0 being the first field. |
|
Return the width of an attribute field in a dataset's schema.
handle | the dataset's handle. |
field | the index of the field to look at, with 0 being the first field. |
|
Get the font name from a TABFC_Text or TABFC_FontPoint object, or the symbol name from a TABFC_CustomPoint.
feature | the mitab_feature object. |
|
Get the font name from a TABFC_Text or TABFC_FontPoint object, or the symbol name from a TABFC_CustomPoint.
(VB Version)
feature | the mitab_feature object. |
font | string buffer to return the text font name. |
l | the maximum lentgh of the text string including terminating null. |
|
Get the MIF CoordSys string from an opened dataset.
dataset | the mitab_handle of the source dataset. |
|
Get the MIF CoordSys string from an opened dataset (VB Version).
dataset | the mitab_handle of the source dataset. |
coordsys | a string buffer to return the dataset coordinate system definition in MIF CoordSys format. This value can then be passed to mitab_c_create() to create new datasets with the same coordinate system. Returns empty string if the information could not be read. |
l | the maximum length of the coordsys string including terminating null. |
|
Return the number of parts (rings or polyline segments) in an object.
feature | the mitab_feature object. |
|
Get an object's pen color property.
Applies only to polyline, region, rectangle, arc and ellipse objects.
feature | the mitab_feature object. |
|
Get an object's pen pattern property.
Applies only to polyline, region, rectangle, arc and ellipse objects.
feature | the mitab_feature object. |
|
Get an object's pen width property.
Applies only to polyline, region, rectangle, arc and ellipse objects.
feature | the mitab_feature object. |
|
Get the projinfo handle from an opened dataset.
dataset | the mitab_handle of the source dataset. |
|
Get an object's symbol color property.
Applies only to point and multipoint objects.
feature | the mitab_feature object. |
|
Get an object's symbol number property.
Applies only to point and multipoint objects.
feature | the mitab_feature object. |
|
Get an object's symbol size property.
Applies only to point and multipoint objects.
feature | the mitab_feature object. |
|
Get the text string on a TABFC_Text object.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's angle property.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's background color property.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's foreground color property.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's MBR height property.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's justification property.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's linetype property.
feature | the mitab_feature object. |
|
Fetch a TABFC_Text object's spacing property.
feature | the mitab_feature object. |
|
Get the text string on a TABFC_Text object (VB Version).
feature | the mitab_feature object. |
text | string buffer to return the text string in the object. |
l | the maximum length of the text string including terminating null. |
|
Fetch a TABFC_Text object's MBR width property.
feature | the mitab_feature object. |
|
Return a mitab_feature's object type.
feature | the mitab_feature object. |
|
Return the number of points in a part of a mitab_feature object.
feature | the mitab_feature object. |
part | the part number we are interested in. Use 0 for objects which cannot have multiple parts. |
|
Return the X coordinate of a point in a part of a mitab_feature object.
feature | the mitab_feature object. |
part | the part number we are interested in. Use 0 for objects which cannot have multiple parts. |
point | the point number, with 0 being the first point. |
|
Return the Y coordinate of a point in a part of a mitab_feature object.
feature | the mitab_feature object. |
part | the part number we are interested in. Use 0 for objects which cannot have multiple parts. |
point | the point number, with 0 being the first point. |
|
Get the last error message.
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.
|
Get the last error message (VB Version).
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.
errormsg | string buffer to return the last error message (will return an empty string if there is no posted error message). |
l | the maximum length of the errormessage string including terminating null. |
|
Fetch the last error number.
This is the error number, not the error class.
|
Return a false if te ring is the first of a polygon.
feature | the mitab_feature object. |
requestedringindex |
the requested ring index
|
|
Iterator to get the next valid feature id when reading a dataset opened with mitab_c_open().
handle | the mitab_handle of the file opened for read access. |
last_feature_id | the id of the last feature that was read. Use -1 to get first feature id in the dataset. |
|
Open an existing .TAB or .MIF dataset for read access.
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.
pszFilename | the complete filename (including extension .TAB or .MIF) of the file to open. |
|
Read a mitab_feature object from the file.
Works only with datasets opened with mitab_c_open().
handle | the mitab_handle of the file opened for read access. |
feature_id | the id of the feature to read, obtained by calling mitab_c_next_feature_id(). |
|
Set an arc or ellipse feature parameters.
feature | the mitab_feature object. |
center_x | the arc/ellipse center X coordinate. |
center_y | the arc/ellipse center Y coordinate. |
x_radius | the arc/ellipse X radius. |
y_radius | the arc/ellipse Y radius. |
start_angle | for an arc: the start angle in degrees, counterclockwise. for an ellipse, this parameter is ignored. |
end_angle | for an arc: the end angle in degrees, counterclockwise. for an ellipse, this parameter is ignored. |
|
Set an object's brush properties.
Applies to region, ellipse and rectangle objects.
See the MIF specs for more details on the meaning and valid values of each parameter.
feature | the mitab_feature object. |
fg_color | the foreground color (24 bits RGB value). |
bg_color | the background color. |
pattern | the brush number (1 is none, 2 is solid fill, etc.). |
transparent | either 0 for an opaque brush (using bg color) or 1 for transparent (ignore bg color). |
|
Set the value of specified field in a feature object.
feature | the mitab_feature object. |
field_index | the 0-based index of the field to set. |
field_value | a string containing the value to set the field to. For any field type, the value should always be passed using its character string representation. |
|
Set the font name in a a TABFC_Text or TABFC_FontPoint object, or set the symbol name in a TABFC_CustomPoint.
feature | the mitab_feature object. |
fontname | the new font name. |
|
Set an object's pen properties.
Applies only to polyline, region, rectangle, arc and ellipse objects.
See the MIF specs for more details on the meaning and valid values of each parameter.
feature | the mitab_feature object. |
width | the pen width as defined in the MIF specs: 1-7 for pixel width, or 11-2047 for width in points (10 + (point_width*10)) |
pattern | the pen number (2 is default solid pen). |
color | the pen color (24 bits RGB value). |
|
Set the feature's coordinates.
feature | the mitab_feature object. |
part | the part number. Applies only to a region or a polyline, it is ignored for other object types. For regions and polyline, with multiple parts, call mitab_c_set_points() once for each part of the object (ring or polyline segment), starting with 0 for the first part. Note that it is only possible to add parts in a sequential order, and it is not possible to overwrite or modify existing parts using this function. For regions with multiple islands and holes, passing a negative part number will result in adding a new island (i.e. polygon). By default, parts > 1 are treated as holes in the last island (polygon) that was created. |
vertex_count | the number of points (pairs of x,y values). |
x | the array of 'vertex_count' X values. Note: for rectangle objects, the MBR of the array of points defines rectangle corners. |
y | the array of 'vertex_count' Y values. |
|
Set the projinfo on a newly created dataset.
Should be called immediately after creating the dataset and before adding features to it.
dataset | the mitab_handle of the target dataset. |
projinfo | the mitab_projinfo to set on the target dataset, obtained from mitab_c_get_projinfo(). |
|
Set an object's symbol properties.
Applies only to point objects and multipoint.
See the MIF specs for more details on the meaning and valid values of each parameter.
feature | the mitab_feature object. |
symbol_no | the symbol number (valid range: 32 to 67) |
symbol_size | the symbol size in pixels (valid range 1 to 48) |
symbol_color | the symbol color (24 bits RGB value) |
|
Set the text string on a TABFC_Text object.
feature | the mitab_feature object. |
text | the text string to set in the object. |
|
Set a TABFC_Text object's display properties.
See the MIF specs for more details on the meaning and valid values of each parameter.
feature | the mitab_feature object. |
angle | the text angle in degrees. |
height | the height of the text's MBR in ground units. |
width | the width of the text's MBR in ground units. |
fg_color | foreground color (24 bits RGB value). |
bg_color | background color. |
justification | one of TABTJ_Left (0), TABTJ_Center (1), or TABTJ_Right (2). |
spacing | one of TABTS_1 (0), TABTS_1_5 (1), or TABTS_2 (2) |
linetype | one of TABTL_NoLine (0), TABTL_Simple (1), or TABTL_Arrow (2). |
|
Write a new feature to a dataset.
Works only with datasets created using mitab_c_create().
The feature to write should have been created using mitab_c_create_feature() and its attributes and coordinate information set prior to calling this function.
Also note that the mitab_feature object will NOT be owned by the dataset after this call and it is still the responsibility of the caller to destroy it.
handle | the mitab_handle of the dataset opened for write access. |
feature | the mitab_feature to write to the dataset. |