Documentation | Other Specifications | AsText syntax
Styling parameters have a number of AsText
properties like TGIS_ParamsLine.WidthAsText
or TGIS_ParamsLine.ColorAsText
, which are designed to easily define a parameter using common names, measurement units (like point, pixels, inches, etc.), and field values.
As the name suggests, the parameter value specification is in a textual form.
All parameter names 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 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:
Supported non-scalable units are:
hair
px
dip
twips
pt
Supported scalable units are:
in
ft
yd
mi
mm
cm
m
km
nm
mu
To specify values directly:
"SIZE:value"
Where:
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 look 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"
To specify that a feature should use the size from an attribute field:
"FIELD:field_name:base_value"
Where:
For example:
// read value from 'myfield' and multiply it by 0.6 pixels Layer.Params.Line.WidthAsText = "FIELD:myfield:0.6 px"
To specify that a feature should use size attached by the renderer, simply:
Layer.Params.Line.WidthAsText = "RENDERER"
Measurement is quite similar to Size, but is designed for parameters like TGIS_ParamsSection.FalseZ property and TGIS_ParamsSectionVector.FalseM property.
Supported units are :
in
ft
yd
mi
mm
cm
m
km
\ kilometer, nm
All units are not scalable.
To specify values directly:
"SIZE:value"
Where:
For example:
// make a FalseZ a 4.2 km Layer.Params.FalseZAsText = "SIZE:4.2 km" // spaces and text case are not significant Layer.Params.FalseZAsText = "SIZE:4.2KM"
To specify that a feature should use size from an attribute field:
"FIELD:field_name:base_value"
Where:
For example:
// read value from 'myfield' and multiply it by 15 feet Layer.Params.FalseZAsText = "FIELD:15 ft"
Not supported.
Rotation parameters are parameters like TGIS_ParamsMarker.SymbolRotateAsText property or TGIS_ParamsLabel.RotateAsText property.
Supported units are:
deg
rad
To specify values directly:
"ANGLE:value"
Where:
For example:
// make symbol rotated by 45 degrees Layer.Params.Marker.SymbolRotateAsText = "ANGLE:45 deg" // spaces and text case are not significant Layer.Params.Marker.SymbolRotateAsText = "ANGLE:45DEG"
To specify that a feature should use rotation from an attribute field:
"FIELD:field_name:base_value"
Where:
For example:
// read value from 'myfield' and multiply it by 0.1 radians Layer.Params.Marker.SymbolRotateAsText = "FIELD:myfield:0.1 rad"
To specify that a feature should use rotation attached by the renderer, simply:
Layer.Params.Marker.SymbolRotateAsText = "RENDERER"
Color parameters are parameters like TGIS_ParamsFeature.ColorAsText property or TGIS_ParamsLabel.FontColorAsText property.
To specify values directly:
"ARGB:value"
Where:
For example:
// make color yellow Layer.Params.Area.ColorAsText = "ARGB:FFFFFF00"
To specify that a feature should use color from an attribute field:
"FIELD:field_name[:subtype]"
Where:
For example:
// read BGR value from 'myfield' Layer.Params.Area.ColorAsText = "FIELD:myfield"
// read ARGB value from 'myfield' Layer.Params.Area.ColorAsText = "FIELD:myfield:ARGB"
To specify that a feature should use a color attached by the renderer, simply:
Layer.Params.Area.ColorAsText = "RENDERER"
Lines parameters are parameters like TGIS_ParamsLine.StyleAsText property.
To specify values directly:
"SYMBOL:symbol_definition" "CODE:&line_symbology" "STOCK:build_in_values"
Where:
SOLID
, DASH
, DOT
, DASHDOT
, DASHDOTDOT
, and CLEAR
.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"
To specify that a feature should use a line style from an attribute field:
"FIELD:field_name"
Where:
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
.
Not supported.
Fill parameters are parameters like TGIS_ParamsFeature.PatternAsText property or TGIS_ParamsFeature.PatternAsText property .
"SYMBOL:symbol_definition" "STOCK:build_in_values" "TEXTURE:texture_file_name"
Where:
SOLID
, BDIAGONAL
, FDIAGONAL
, CROSS
, DIAGCROSS
, HORIZONTAL
, VERTICAL
and TRANSPARENT
,For example:
// make an area to be filled with a SVG symbol Layer.Area.PatternAsText = "SYMBOL:mysymbol.svg" // make an area to be filled with a cross pattern Layer.Area.PatternAsText = "STOCK:CROSS" // make an area to be filled with a bitmap Layer.Area.PatternAsText = "TEXTURE:mybitmap.bmp"
Not supported.
Not supported.
Marker style parameters are specific only to TGIS_ParamsMarker.StyleAsText property.
Where:
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" // make a marker to be rendered from ther LIBSVG library Layer.Marker.StyleAsText = "SYMBOL:LIBSVG:std:Apartment01"
Not supported.
Not supported.
Label position are specific only to |.
"STOCK:built_in_values"
Where:
UPLEFT
, UPCENTER
, UPRIGHT
, MIDDLELEFT
, MIDDLECENTER
, MIDDLERIGHT
, DOWNLEFT
, DOWNCENTER
, DOWNRIGHT
, FLOW
, and ANY
; UPLEFT:UPCENTER:UPRIGHT
.For example:
// make a label on the left or on the right Layer.Labels.PositionAsText = "STOCK:UPLEFT:UPRIGHT"
To specify that a feature should use label position setup from an attribute field:
"FIELD:field_name"
Where:
For example:
// read 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
.
Not supported.