The table object is used to store information from the dbf file associated with a shapefile. More...
Public Member Functions | |
| bool | Calculate (string Expression, int RowIndex, out object Result, out string ErrorString) |
| Calculates the the expression taking the values from the specified row of the atrribute table. | |
| bool | Close () |
| Closes the attribute table. | |
| bool | CreateNew (string dbfFilename) |
| Creates a new attribute table. | |
| int | EditAddField (string Name, FieldType Type, int Precision, int Width) |
| Adds a field to the table. The table must be in editing mode. | |
| bool | EditCellValue (int FieldIndex, int RowIndex, object newVal) |
| Sets the value of the cell. | |
| bool | EditClear () |
| Deletes all rows and fields from the table. Note: The table must be set to allow editing before the rows and fields can be deleted from the table. | |
| bool | EditDeleteField (int FieldIndex, ICallback cBack) |
| Deletes a field from the table. | |
| bool | EditDeleteRow (int RowIndex) |
| Deletes a row from the table. | |
| bool | EditInsertField (Field Field, ref int FieldIndex, ICallback cBack) |
| Inserts a new field into the table. | |
| bool | EditInsertRow (ref int RowIndex) |
| Inserts a new row into the table. | |
| bool | EditReplaceField (int FieldIndex, Field NewField, ICallback cBack) |
| Replaces the specified field in the table with the new field. | |
| object | get_CellValue (int FieldIndex, int RowIndex) |
| Gets the value of the specified cell in the table. | |
| string | get_ErrorMsg (int ErrorCode) |
| Retrieves the error message associated with the specified error code. | |
| Field | get_Field (int FieldIndex) |
| Gets the field object at the specified field index in the table. | |
| int | get_FieldIndexByName (string Fieldname) |
| Seeks field with specified name. Comparison is case insensitive. | |
| object | get_MaxValue (int FieldIndex) |
| Returns the maximum value for the specified field of the table. | |
| double | get_MeanValue (int FieldIndex) |
| Calculates the mean value for the specified field of the table. | |
| object | get_MinValue (int FieldIndex) |
| Returns the minimum value for the specified field. | |
| double | get_StandardDeviation (int FieldIndex) |
| Calculates the standard deviation for the set of values in specified field. | |
| bool | Open (string dbfFilename, ICallback cBack) |
| Opens a .dbf table from file. | |
| bool | ParseExpression (string Expression, ref string ErrorString) |
| Checks if the expression is a valid one. | |
| bool | Query (string Expression, ref object Result, ref string ErrorString) |
| Selects the rows in the table which agree with the specified expression. | |
| bool | Save (ICallback cBack) |
| Saves in-memory version of the table to the source file. | |
| bool | SaveAs (string dbfFilename, ICallback cBack) |
| Saves the table using the specified filename. | |
| bool | StartEditingTable (ICallback cBack) |
| Sets the table to allow table editing. | |
| bool | StopEditingTable (bool ApplyChanges, ICallback cBack) |
| Sets the table to prevent editing. | |
| bool | TestExpression (string Expression, tkValueType ReturnType, ref string ErrorString) |
| Tests the validity of expression and determines its return type. | |
Properties | |
| string | CdlgFilter [get] |
| Returns the common dialog filter containing all supported file extensions in string format. | |
| bool | EditingTable [get] |
| Gets whether or not the table is in editing mode. | |
| ICallback | GlobalCallback [get, set] |
| The global callback is the interface used by MapWinGIS to pass progress and error events to interested applications. | |
| string | Key [get, set] |
| The key may be used by the programmer to store any string data associated with the object. | |
| int | LastErrorCode [get] |
| Retrieves the last error generated in the object. | |
| int | NumFields [get] |
| Gets the number of fields in the table. | |
| int | NumRows [get] |
| Gets the number of rows in the table. | |
The table object is used to store information from the dbf file associated with a shapefile.
Graph description
The following code will add the field in the table:
Shapefile sf = some_shapefile; if (sf.EditingTable) { // string field Field fld = new Field(); fld.Name = "New field"; fld.Type = FieldType.STRING_FIELD; fld.Width = 15; // 15 characters // let's insert it int fieldIndex = sf.NumFields; // it will be inserted as the last one sf.EditInsertField(fld, ref fieldIndex, null); }
To find the index of field with the given name in the table:
Shapefile sf = some_shapefile; // fast call int fieldIndex = sf.Table.get_FieldIndexByName("New field"); // to do the same "manually" fieldIndex = -1; for (int i = 0; i < sf.NumFields; i++) { if (sf.get_Field(i).Name == "New field") { fieldIndex = i; break; } } Debug.Print("Field index: " + fieldIndex.ToString());
| bool Table.Calculate | ( | string | Expression, |
| int | RowIndex, | ||
| out object | Result, | ||
| out string | ErrorString | ||
| ) |
Calculates the the expression taking the values from the specified row of the atrribute table.
| Expression | The expression to analyze. |
| RowIndex | The index of the row. |
| Result | The result of calculation as variant data type, either boolean, double or string. |
| ErrorString | An output string with the description of error in case method failed. |
| bool Table.Close | ( | ) |
Closes the attribute table.
| bool Table.CreateNew | ( | string | dbfFilename | ) |
Creates a new attribute table.
A new table is automatically in editing mode after it is created.
| dbfFilename | The filename for the new table. |
| int Table.EditAddField | ( | string | Name, |
| FieldType | Type, | ||
| int | Precision, | ||
| int | Width | ||
| ) |
Adds a field to the table. The table must be in editing mode.
| Name | The name of field. |
| Type | The type of field. |
| Precision | The precision of field. |
| Width | The width of field. |
| bool Table.EditCellValue | ( | int | FieldIndex, |
| int | RowIndex, | ||
| object | newVal | ||
| ) |
Sets the value of the cell.
The table must be set to allow editing before a cell's value may be edited.
| FieldIndex | The field index of the cell to be edited. |
| RowIndex | The row index of the cell to be edited. |
| newVal | The new value to be used to set the specified cell's value. |
| bool Table.EditClear | ( | ) |
Deletes all rows and fields from the table. Note: The table must be set to allow editing before the rows and fields can be deleted from the table.
| bool Table.EditDeleteField | ( | int | FieldIndex, |
| ICallback | cBack | ||
| ) |
Deletes a field from the table.
The table must be set to allow editing before a field can be deleted from the table.
| FieldIndex | The index of the field to be deleted from the table. |
| cBack | The ICallback object which will receive progress and error messages while the field is being deleted from the table. |
| bool Table.EditDeleteRow | ( | int | RowIndex | ) |
Deletes a row from the table.
The table must be set to allow editing before a row can be deleted from the table.
| RowIndex | The index of the row to be deleted from the table. |
| bool Table.EditInsertField | ( | Field | Field, |
| ref int | FieldIndex, | ||
| ICallback | cBack | ||
| ) |
Inserts a new field into the table.
The table must be set to allow editing before a field can be inserted into the table.
| Field | The new field to be inserted into the table. |
| FieldIndex | The desired index to be used for the new field being inserted into the table. If the desired index is invalid or unavailable, the actual index used for the new field will be returned. |
| cBack | The ICallback object which will receive progress and error messages while the new field is being inserted into the table. |
| bool Table.EditInsertRow | ( | ref int | RowIndex | ) |
Inserts a new row into the table.
The table must be set to allow editing before a row can be inserted into the table.
| RowIndex | The desired index to use when inserting the new row into the table. If the desired index is invalid or unavailable, the actual index used to insert the new row will be returned. |
| bool Table.EditReplaceField | ( | int | FieldIndex, |
| Field | NewField, | ||
| ICallback | cBack | ||
| ) |
Replaces the specified field in the table with the new field.
The table must be set to allow editing before a field can be replaced in the table.
| FieldIndex | The index of the field to be replaced. |
| NewField | The field to be used to replace the specified field in the table. |
| cBack | The ICallback object which will receive progress and error messages while the specified field is being replced by the new field. |
| object Table.get_CellValue | ( | int | FieldIndex, |
| int | RowIndex | ||
| ) |
Gets the value of the specified cell in the table.
| FieldIndex | The field index of the cell for which the value is required. |
| RowIndex | The row index of the cell for which the value is required. |
| string Table.get_ErrorMsg | ( | int | ErrorCode | ) |
Retrieves the error message associated with the specified error code.
| ErrorCode | The error code for which the error message is required. |
| Field Table.get_Field | ( | int | FieldIndex | ) |
Gets the field object at the specified field index in the table.
| FieldIndex | The index of the field in the table to be returned. |
| int Table.get_FieldIndexByName | ( | string | Fieldname | ) |
Seeks field with specified name. Comparison is case insensitive.
| Fieldname | The name of field to search. |
| object Table.get_MaxValue | ( | int | FieldIndex | ) |
Returns the maximum value for the specified field of the table.
NULL will be returned in case of invalid index.
| FieldIndex | The index of the field. |
| double Table.get_MeanValue | ( | int | FieldIndex | ) |
Calculates the mean value for the specified field of the table.
NULL will be returned in case of invalid index.
| FieldIndex | The index of the field. |
| object Table.get_MinValue | ( | int | FieldIndex | ) |
Returns the minimum value for the specified field.
NULL will be returned in case of invalid index.
| FieldIndex | The index of the field. |
| double Table.get_StandardDeviation | ( | int | FieldIndex | ) |
Calculates the standard deviation for the set of values in specified field.
NULL will be returned in case of invalid index.
| FieldIndex | The index of the field. |
| bool Table.Open | ( | string | dbfFilename, |
| ICallback | cBack | ||
| ) |
Opens a .dbf table from file.
| dbfFilename | The filename of the table to be opened. |
| cBack | The ICallback object which will receive progress and error messages while the table is being opened. |
| bool Table.ParseExpression | ( | string | Expression, |
| ref string | ErrorString | ||
| ) |
Checks if the expression is a valid one.
| Expression | The expression to analyze. |
| ErrorString | An output string with the description of error in case expression is not valid. |
| bool Table.Query | ( | string | Expression, |
| ref object | Result, | ||
| ref string | ErrorString | ||
| ) |
Selects the rows in the table which agree with the specified expression.
| Expression | The query expression. |
| Result | An array of integer type with the indices of rows which were selected. |
| ErrorString | An output string with the description of error on failure. |
| bool Table.Save | ( | ICallback | cBack | ) |
Saves in-memory version of the table to the source file.
This method should be called while the table is in editing mode. The editing mode will not be closed.
| cBack | A callback object to report information about progress and errors. |
| bool Table.SaveAs | ( | string | dbfFilename, |
| ICallback | cBack | ||
| ) |
Saves the table using the specified filename.
| dbfFilename | The filename to be used to save the table. |
| cBack | The ICallback object which will receive progress and error messages while the table is being saved. |
| bool Table.StartEditingTable | ( | ICallback | cBack | ) |
Sets the table to allow table editing.
| cBack | Optional. The ICallback object which will receive progress and error events while the table is being set to allow editing. |
| bool Table.StopEditingTable | ( | bool | ApplyChanges, |
| ICallback | cBack | ||
| ) |
Sets the table to prevent editing.
| ApplyChanges | Optional. A boolean value representing whether or not to save changes to the table. The default is True, to save the changes. |
| cBack | Optional. The ICallback object which will receive progress and error messages while the table is being set to prevent editing. |
| bool Table.TestExpression | ( | string | Expression, |
| tkValueType | ReturnType, | ||
| ref string | ErrorString | ||
| ) |
Tests the validity of expression and determines its return type.
| Expression | The expression to test. |
| ReturnType | An output value with the return type, either double, string or boolean. |
| ErrorString | An output string with the description of error. |
string Table.CdlgFilter [get] |
Returns the common dialog filter containing all supported file extensions in string format.
bool Table.EditingTable [get] |
Gets whether or not the table is in editing mode.
ICallback Table.GlobalCallback [get, set] |
The global callback is the interface used by MapWinGIS to pass progress and error events to interested applications.
string Table.Key [get, set] |
The key may be used by the programmer to store any string data associated with the object.
int Table.LastErrorCode [get] |
Retrieves the last error generated in the object.
int Table.NumFields [get] |
Gets the number of fields in the table.
int Table.NumRows [get] |
Gets the number of rows in the table.
1.7.6.1