User Tools

Site Tools


doc:paramastext

Param AsText syntax

Documentation | Other Specifications | AsText syntax

Styling parameters have a number of AtText properties like TGIS_ParamsLine.WidthAsText or TGIS_ParamsLine.ColorAsText, which is designed to easily define a parameter using common names, measurement units (like point, pixels, inches, etc), and field values.

As a name suggest parameter, the value specification is in a textual form.

All parameters name are case-insensitive (except file names, which on a non-Windows machine can be case sensitive). So the following code has the same meaning:

Layer.Labels.PositionAsText = "STOCK:upleft:upright"
Layer.Labels.PositionAsText = "stock:upleft:upright"
Layer.Labels.PositionAsText = "STOCK:UPLEFT:UPRIGHT"

Size

Size parameters are parameters like TGIS_ParamsLine.WidthAsText property, TGIS_ParamsLabel.FontSizeAsText property, TGIS_ParamsMarker.SizeAsText property, etc.

There are two basic types of units: scalable and non-scalable:

  • Non-scalable units are designated to specify feature to be an exact size.
  • Scalable parameters will scale upon map zooming. If map scale = 1 and a feature was defined as a 1cm then future on a screen will be rendered as a 1cm.

Supported non-scalable units are :

  • hair
    thinnest possible feature (hairline) to be used on a current device; should be used standalone (w/o any numeric value); this is device dependent unit,
  • px
    number of pixels; this is device dependent unit,
  • dip
    number of device independent pixel; 1 dip = 1 px on 96 DPI screen,
  • twips
    number of twips; 1 twip = 1/1400 of an inch; this is device independent unit,
  • pt
    typographical point; 1 point = 1/72 of an inch; this is device independent unit.

Supported scalable units are:

  • in
    inch,
  • ft
    U.S. survey foot,
  • yd
    US survey yard,
  • mi
    U.S. survey mile,
  • mm
    millimeter,
  • cm
    centimeter,
  • m
    meter,
  • km
    kilometer,
  • nm
    nautical mile,
  • mu
    map units; a special case - feature is not dependent on map scale but on map unit; used mostly for CAD file rendering.

Direct values

To specify values directly:

"SIZE:value"

Where:

  • value
    is a definition of a feature size.

For example:

// make a line 7.5 typographical point wide
Layer.Params.Line.WidthAsText = "SIZE:7.5 pt"
 
// make a line hairline width
Layer.Params.Line.WidthAsText = "SIZE:HAIRLINE"
 
// make a line on all devices to looks like 4 pixels wide
Layer.Params.Line.WidthAsText = "SIZE:4 dip"
 
// make a line 3.3 inches wide and scalable
Layer.Params.Line.WidthAsText = "SIZE:3.3 in"
 
// spaces and text case is not significant
Layer.Params.Line.WidthAsText = "SIZE:3.3IN"

Field values

To specify, that feature should use size from the attribute field:

"FIELD:field_name:base_value"

Where:

  • field_name
    is a name of an attribute field,
  • base_value
    is a definition how a 1 unit from attribute field should be represented.

For example:

// read value from 'myfield' and multiply it by 0.6 pixels
Layer.Params.Line.WidthAsText = "FIELD:myfield:0.6 px"

Renderer values

To specify, that feature should use size attached by renderer simply:

Layer.Params.Line.WidthAsText = "RENDERER"

Measurement

Measurement is quite similar to Size, but are designed for parameters like TGIS_ParamsSection.FalseZ property, and gisparams.tgis_paramssection.falsem.

Supported units are :

  • in
    inch,
  • ft
    U.S. survey foot,
  • yd
    US survey yard,
  • mi
    U.S. survey mile,
  • mm
    millimeter,
  • cm
    centimeter,
  • m
    meter,
  • km \ kilometer,
  • nm
    nautical mile.

All units are not scalable.

Direct values

To specify values directly:

"SIZE:value"

Where:

  • value
    is a definition of a feature size.

For example:

// make a FalseZ a 4.2 km 
Layer.Params.FalseZAsText = "SIZE:4.2 km"
 
// spaces and text case is not significant
Layer.Params.FalseZAsText = "SIZE:4.2KM"

Field values

To specify, that feature should use size from the attribute field:

"FIELD:field_name:base_value"

Where:

  • field_name
    is a name of an attribute field,
  • base_value
    is a definition how a 1 unit from attribute field should be represented.

For example:

// read value from 'myfield' and multiply it by 15 feet
Layer.Params.FalseZAsText = "FIELD:15 ft"

Renderer values

Not supported.

Rotation

Rotation parameters are parameters like TGIS_ParamsMarker.SymbolRotateAsText property or TGIS_ParamsLabel.RotateAsText property.

Supported units are :

  • deg
    degrees,
  • rad
    radians.

Direct values

To specify values directly:

"ANGLE:value"

Where:

  • value
    is a definition of a feature rotation.

For example:

// make symbol rotated by 45 degrees
Layer.Params.Marker.SymbolRotateAsText = "ANGLE:45 deg"
 
// spaces and text case is not significant
Layer.Params.Marker.SymbolRotateAsText = "ANGLE:45DEG"

Field values

To specify, that feature should use rotation from the attribute field:

"FIELD:field_name:base_value"

Where:

  • field_name
    is a name of an attribute field,
  • base_value
    is a definition how a 1 unit from the attribute field should be represented.

For example:

// read value from 'myfield' and multiply it by 0.1 radians
Layer.Params.Marker.SymbolRotateAsText = "FIELD:myfield:0.1 rad"

Renderer values

To specify, that feature should use rotation attached by renderer simply:

Layer.Params.Marker.SymbolRotateAsText = "RENDERER"

Color

Direct values

To specify values directly:

"ARGB:value"

Where:

  • value
    is a definition of a color represented as hexadecimal AARRGGGBB (alpha-red-green-blue)

For example:

// make color yellow
Layer.Params.Area.ColorAsText = "ARGB:FFFFFF00"

Field values

To specify, that feature should use color from the attribute field:

"FIELD:field_name"

Where:

  • field_name
    is a name of an attribute field,

For example:

// read ARGB value from 'myfield'
Layer.Params.Area.ColorAsText = "FIELD:myfield"

Renderer values

To specify, that feature should use color attached by renderer simply:

Layer.Params.Area.ColorAsText = "RENDERER"

Line style

Lines parameters are parameters like TGIS_ParamsLine.StyleAsText property.

Direct values

To specify values directly:

"SYMBOL:symbol_definition"
"CODE:&line_symbology"
"STOCK:build_in_values"

Where:

For example:

// make a line from a font symbol (character code 65)
Layer.Params.Line.StyleAsText = "SYMBOL:Arial:65:BOLD:ITALIC:UNDERLINE"
 
// make a line advanced styled
Layer.Params.Line.StyleAsText = "CODE:&LINE(100%)GOTO(0%)MOVE(80S 0)FOR(100%)FILL(0 0 -80S -40S 0 80S 80S -40S)MOVE(240S 0)END()"
 
// make a line dotted
Layer.Params.Line.StyleAsText = "STOCK:DOT"

Field values

To specify, that feature should use line style from the attribute field:

"FIELD:field_name"

Where:

  • field_name
    is a name of an attribute field,

For example:

// read value value from 'myfield'
Layer.Params.Line.StyleAsText = "FIELD:myfield"

Supported values are limited to stock values: SOLID, DASH, DOT, DASHDOT, DASHDOTDOT, and CLEAR.

Renderer values

Not supported.

Fill style

Direct values

"SYMBOL:symbol_definition"
"STOCK:build_in_values"
"TEXTURE:texture_file_name"

Where:

  • symbol_definition
    name of symbols same as in TGIS_SymbolList.Prepare(String) method,
  • build_in_values
    predefined styles: SOLID, BDIAGONAL, FDIAGONAL, CROSS, DIAGCROSS, HORIZONTAL, VERTICAL and TRANSPARENT,
  • texture_file_name
    texture file name.

For example:

// make an area to be filled with SVG symbol
Layer.Area.PatternAsText = "SYMBOL:mysymbol.svg"
 
// make an area to be filled with cross pattern
Layer.Area.PatternAsText = "STOCK:CROSS"
 
// make an area to be filled with bitmap
Layer.Area.PatternAsText = "TEXTURE:mybitmap.bmp"

Field values

Not supported.

Renderer values

Not supported.

Marker style

Marker style parameters are specific only to TGIS_ParamsMarker.StyleAsText property.

Direct values

Where:

  • symbol_definition
    name of symbols same as in TGIS_SymbolList.Prepare(String) method,
  • build_in_values
    predefined styles: BOX, CIRCLE, CROSS, DIAGCROSS, TRIANGLEUP, TRIANGLEDOWN, TRIANGLELEFT, and TRIANGLERIGHT.

For example:

// make a marker to be rendered as a SVG symbol
Layer.Marker.StyleAsText = "SYMBOL:mysymbol.svg"
 
// make a marker to be rendered as a circle
Layer.Marker.StyleAsText = "STOCK:CIRCLE"

Field values

Not supported.

Renderer values

Not supported.

Label position

Label position are specific only to |.

Direct values

"STOCK:build_in_values"

Where:

  • build_in_values
    predefined values: UPLEFT, UPCENTER, UPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, DOWNLEFT, DOWNCENTER, DOWNRIGHT, FLOW, and ANY;
    any combination of predefined values cane used, like UPLEFT:UPCENTER:UPRIGHT.

For example:

// make a label on a left or on a right
Layer.Labels.PositionAsText = "STOCK:UPLEFT:UPRIGHT"

Field values

To specify, that feature should use label position setup from the attribute field:

"FIELD:field_name"

Where:

  • field_name
    is a name of an attribute field,

For example:

// read value value from 'myfield'
Layer.Labels.PositionAsText = "FIELD:myfield"

Supported values are limited to stock values: UPLEFT, UPCENTER, UPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, DOWNLEFT, DOWNCENTER, DOWNRIGHT, FLOW, and ANY.

Renderer values

Not supported.

2018/03/29 10:33