DK for Java | tatukgis.jdk.TGIS_FieldInfo | Classes | Constructors | Methods | Properties
Describes field schema information and field behavior flags.
// Java public class TGIS_FieldInfo extends TGIS_Object { };
// Oxygene type TGIS_FieldInfo = public class( TGIS_Object ) end;
→ TGIS_Object
| Name | Visibility | Description | |
|---|---|---|---|
| TGIS_FieldInfo() | public | Create an instance. | |
| Name | Visibility | Description | |
|---|---|---|---|
| checkFlags | protected | Validates field settings and updates cumulative flags. | |
| Clone | public | Creates a copy of this field information object. | |
| Name | Visibility | Description | |
|---|---|---|---|
| Binary | public | Binary width for TAB/DAT files. | |
| Decimal | public | Decimal as represented in saved version. | |
| Deleted | public | Indicates whether the field should be deleted on save. | |
| ExportName | public | Name of the field to use during export. | |
| FieldType | public | Type of field. | |
| FileFormat | public | Indicates whether the field is specific to a file format and should not be visible. | |
| Flags | public | Set of cumulative field flags. | |
| Formula | public | Formula to calculate a value. | |
| Hidden | public | Indicates whether the field is hidden in controls. | |
| IsUID | public | Indicates whether the field is used as GIS_UID and will be exported. | |
| Name | public | Name as represented in saved version. | |
| NewDecimal | public | New decimal size of field. | |
| NewName | public | New name of field. | |
| NewWidth | public | New width of field. | |
| ReadOnly | public | Indicates whether the field value cannot be modified. | |
| Rules | public | Field rules. | |
| Saved | public | Indicates whether the field exists in the saved disk-based layer. | |
| Temporary | public | Indicates whether the field is temporary and not stored in a file. | |
| Width | public | Width as represented in saved version. | |
To set a calculated field, you must assign the Formula property a formula in the SQL query format (compabible with TGIS_SqlQuery) that calculates the value for that field, e.g.
fld.Formula = "num*10"
After saving a layer, the formula definition will be saved to the .fld file. Example file definition :
[TatukGIS Field Formulas] CALC=num*float/10 [TatukGIS Fields]
procedure CreateFieldFormula ; var shp : TGIS_Shape ; lv : TGIS_LayerVector ; fld : TGIS_FieldInfo ; val : Double ; begin // create a layer and fields definition lv := TGIS_LayerVector.Create ; try lv.Open ; lv.AddField( 'name', TGIS_FieldType.String, 1, 0 ) ; lv.AddField( 'num', TGIS_FieldType.Number, 5, 0 ) ; lv.AddField( 'float', TGIS_FieldType.Float, 10, 5 ) ; lv.AddField( 'calc', TGIS_FieldType.Float, 10, 5 ) ; // create a formula for a calculated field fld := lv.FieldInfo( lv.Fields.Count-1 ) ; fld.Formula := TGIS_FieldFormula.Create( 'num*float/10' ) ; // create a shape to store field values shp := lv.CreateShape( TGIS_ShapeType.Point ) ; shp.AddPart ; shp.AddPoint( GisPoint(1,1) ) ; shp.SetField( 'num', 5 ) ; shp.SetField( 'float', 1.1 ) ; // get a calculated value val := VarToDouble( shp.GetField( 'calc' ) ) ; Assert.AreEqual( 0.55, val ) ; // Save and reopen .fld file to restore the formula lv.Path := OUTPUT_TEST_PATH + 'test.shp'; lv.PrepareExportFieldNames( 32 ) ; lv.ExportStructureToFLD ; lv.ReadFieldDefinition ; val := VarToDouble( shp.GetField( 'calc' ) ) ; Assert.AreEqual( 0.55, val ) ; finally FreeObject( lv ) ; end; end ;