Professional Documents
Culture Documents
TGML Format Specification 1.0 B1
TGML Format Specification 1.0 B1
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 1 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Format Specification
TGML 1.0
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 2 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Abstract
This specification defines the features and syntax for TAC Graphics Markup
Language (TGML), which is a XML-based language for describing TAC dynamic
vector graphics.
The versions A1-A7 have been used during the development of the TGML
Graphics and this version (B1) has been reviewed as version A7 by the TGML
Development Team. The detailed history of the A1-A7 versions has been removed
in this version and replaced with a brief description (see Appendix D).
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 3 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Table of content
1 Overview ............................................................................................................... 5
1.1 TGML version ................................................................................................ 5
1.2 Namespaces .................................................................................................... 5
1.3 Properties and attributes ................................................................................. 6
1.3.1 Default values.......................................................................................... 6
1.3.2 Attribute inheritance................................................................................ 6
1.3.3 Custom attributes..................................................................................... 6
1.4 Error notifications........................................................................................... 7
1.5 Implicit syntax................................................................................................ 7
2 Coordinate system ................................................................................................. 8
2.1 Coordinates..................................................................................................... 8
2.2 Initial scale ..................................................................................................... 8
3 Rendering model ................................................................................................... 9
4 TGML types and enumerations ........................................................................... 10
4.1 Arrays ........................................................................................................... 12
5 Common attributes .............................................................................................. 13
6 Document structure ............................................................................................. 14
7 Document type element and Metadata ................................................................ 15
7.1 Document type element: <TGML> .............................................................. 15
7.2 Metadata: <Metadata>.................................................................................. 16
8 Grouping elements .............................................................................................. 17
8.1 Grouping: <Group>...................................................................................... 17
8.2 Components: <Component>......................................................................... 18
9 Basic shapes ........................................................................................................ 21
9.1 Shape attributes ............................................................................................ 21
9.2 Line: <Line>................................................................................................. 23
9.3 Polyline: <Polyline>..................................................................................... 25
9.4 Polygon: <Polygon>..................................................................................... 26
9.5 Rectangle: <Rectangle> ............................................................................... 27
9.6 Ellipse: <Ellipse> ......................................................................................... 29
10 Segment shapes ................................................................................................. 31
10.1 Elliptical arc: <Arc>................................................................................... 31
10.2 Elliptical pie: <Pie>.................................................................................... 32
10.3 Elliptical chord: <Chord>........................................................................... 33
11 Curves and paths ............................................................................................... 34
11.1 Cubic Bezier curve: <Curve>..................................................................... 34
11.2 Path element: <Path>.................................................................................. 35
12 Raster images .................................................................................................... 36
12.1 Image element: <Image>............................................................................ 36
13 Text.................................................................................................................... 37
13.1 Text line: <Text>........................................................................................ 39
13.2 Text flow: <TextBox>................................................................................ 39
14 Linking .............................................................................................................. 40
14.1 Link element: <Link>................................................................................. 40
15 Transformations................................................................................................. 41
15.1 Rotation: <Rotate> ..................................................................................... 42
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 4 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
1 Overview
TAC Graphics Markup Language (TGML) is a declarative XML based language
for dynamic 2D graphics.
TGML is inspired by the XML based Scalable Vector Graphics (SVG) which is an
open standard for 2D graphics.
TGML specifies a hierarchy of runtime objects with a set of properties and logic.
Each markup element (XML element) represents a TGML object which can be
edited, or configured, in the Graphics Editor. However, not all of the objects are
graphical (visible). Several objects are used to add a specific behavior to a
graphical object, such as enabling dynamic update of attributes, transformations
and gradients.
The TGML object model is based on the W3C Document Object Model (DOM).
The TGML graphics elements are accessible for applications through the exposed
TGML DOM interfaces.
<?xml version="1.0"?>
<?TGML Version="1.0"?>
1.2 Namespaces
The TGML graphics elements specified in this specification belong to the default
XML namespace, TGML.
TGML allows inclusion of elements from foreign namespaces anywhere with the
TGML content. In general, the TGML loader will include the unknown (foreign)
elements in the DOM, but will otherwise ignore the unknown elements.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 6 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
The attribute inheritance means that a child element inherits (gets) the attribute
value from an ancestor element if the attribute value is undefined (omitted) and if
the attribute has been specified for an ancestor (any of the parents).
In the example below, Line will inherit the Stroke value from the Group.
StrokeWidth is not defined either, but since it is not specified at the parent level,
StrokeWidth will be assigned the default StrokeWidth value.
<Group Stroke="#FF0000">
<Line X1="10.00" Y1="10.00" X2="100.00" Y2="100.00"/>
</Group>
Custom attributes can for example be used to create "local" variables. The custom
attribute can be bound to a signal, or animated, as any other attribute of an element
and it can be accessed from scripts in the graphics.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 7 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
The following example defines a group containing a line. The TGML code does
not reveal how the containment is implemented in Group. The Group
implementation includes for example a child list that is the actual container, but
such information is not serialized.
<Group>
<Line X1="50.00" Y1="100.00" X2="150.00" Y2="200.00
Fill="#FF0000" Stroke="#000000"/>
</Group>
Undefined (non-specified) attributes values are not serialized, to avoid breaking the
attribute inheritance.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 8 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
2 Coordinate system
The origin of the TGML default coordinate system is in the upper-left corner.
Values of x increase as you move right, and values of y increase as you move
down.
TGML +
0,0
Component +
0,0
2.1 Coordinates
The unit of measurement for coordinates is the device independent pixel, which is
1/96 of an inch (96dpi). The data type for coordinates and lengths (e.g. Width and
Height) is Double.
3 Rendering model
The following description is a summary of the TGML rendering model, which is
very similar to the SVG rendering model.
Elements in a TGML document have an implicit drawing order, with the first
elements in the TGML document getting "painted" first. Subsequent elements are
painted on top of previously painted elements.
Grouping elements have the effect of producing a temporary separate canvas onto
which child elements are painted. Upon the completion of the group, any filter
effects specified for the group are applied to create a modified temporary canvas.
The modified temporary canvas is composited into the background, taking into
account any group-level settings, such as opacity, on the group.
"Start"
"Stop"
Bool A boolean value:
"True"
"False"
Brush Describes how an area (Fill) or a stroke (Stroke) is
painted. Accepted values (WP1):
"None"
"‹Color›"
"Discrete"
"Linear"
Example:
"50.25"
FontStyle Describes the style of the font:
"Normal"
"Italic"
FontWeight Describes the weight of the font:
"Normal"
"Bold"
Format This enumeration describes the formatting of the
subscribed data.
"Center"
"Left"
"Right"
Point Represents a XY coordinate.
Syntax:
"‹Double› , ‹Double›"
Example:
"25.00 , 50.00"
Repeat Describes the way the animation will be repeated:
"‹Iterations›"
"Forever"
"None"
"Underline"
"Strikethrough"
Visibility An enumeration that specifies the visibility of an
element:
"Visible"
"Hidden"
4.1 Arrays
Some attributes accepts arrays of values, such as arrays of Double and Point.
Arrays are written as a sequence of values, delimited by space.
Examples
StrokeDashArray="5.0 3.0 2.0 3.0"
Points="50.0,150.0 100.0,50.0 150.0,150.0"
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 13 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
5 Common attributes
The following attributes are applicable to all TGML elements.
Inheritable: No
Animatable: No
Name String The name of the element. The primary use is to identify
exposed elements such as Bind.
Inheritable: No
Animatable: No
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 14 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
6 Document structure
The following example describes a static TGML document with a group containing
a line, a polyline and a polygon:
A TGML Graphics document always consists of at least one element, the root
("outermost") TGML element. This TGML element is the ancestor of all other
elements in the document.
A Metadata element carries information about its parent element. In the example
above, the metadata information applies to the outermost TGML element, which
means that this is the metadata information for the TGML Graphics document.
A TGML element and grouping elements, such as Group, can contain any number
of graphics elements, including other grouping elements.
Elements that describe shapes and other graphical (visible) objects can also have
children, but these children are not visible objects, but elements that add a specific
behavior, such as gradients, animations and dynamic bindings.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 15 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
Background Brush The background color of the document canvas (the
viewing area).
Default: "#FFFFFF"
Inheritable: No
Animatable: Yes
Height Double The height of the document. See Remarks.
Default: "600"
Inheritable: No
Animatable: No
Stretch Stretch Specifies how the document shall be stretched initially
within a viewer. See Remarks.
Default: "None"
Inheritable: No
Animatable: No
Width Double The width of the document. See Remarks.
Default: "800"
Inheritable: No
Animatable: No
Remarks
The viewer uses the width, height and stretch information to determine how the
document initially shall be stretched (transformed).
The viewer shall be able to display a document that misses information about the
width and height. Viewing such a document means that no stretching is applied and
any scroll bars are disabled.
Stretch="None": Preserve the original size. This usually means that scroll bars are
enabled so the user can scroll to the right and the bottom of the document.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 16 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Stretch="Uniform": Resize the content, preserving the native aspect ratio. Scroll
bars are initially disabled.
Stretch="Fill": The content is resized but aspect ratio is not preserved. Scroll bars
are initially disabled.
Applying metadata to the outermost TGML element is the same as applying the
information to the TGML document.
Attributes
Attribute Type Description
Name String A name that identifies the information.
Inheritable: No
Animatable: No
Value String The information.
Inheritable: No
Animatable: No
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 17 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
8 Grouping elements
Attributes
Attribute Type Description
Opacity Double A value between 0.0 (transparent) and 1.0 (opaque).
Default: "1.0"
Inheritable: No
Animatable: Yes
Visibility Visibility Specifies if the element shall be visible or not.
Default: "Visible"
Inheritable: No
Animatable: Yes
Example
<TGML>
<Group Opacity="0.5">
<Line X1="50.0" Y1="50.0" X2="150.0" Y2="150.0" />
<Line X1="50.0" Y1="100.0" X2="150.0" Y2="200.0" />
</Group>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 18 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Top and Left of Component specifies the position of the component in the parent
coordinate system. Component itself establishes a new coordinate system for the
contained elements, which means that the upper left corner of Component is the
origin (0,0) for the contained elements
Width and Height specifies the "viewport" (size on screen) of the component.
ContentWidth and ContentHeight specify the "viewbox", which is the boundary of
the contained elements. If the viewport is different from the viewbox, a scale
transformation is applied by the TGML implementation (similar to Stretch="Fill",
see 7.1 Document type element). In other words, resizing a Component has the
effect of scaling the content of the Component.
The Clip attribute specifies if the renderer shall clip elements that exceed (are
drawn outside) the specified viewbox or not.
When a Component includes Bind or Link elements, the Name of Component will
prefix the exposed bind names ("MyComponent.MyBind").
Attributes
Attribute Type Description
Clip Bool Specifies if the content shall be clipped or not.
Default: "True"
Inheritable: No
Animatable: No
ContentHeight Double Specifies the viewbox height (height of the content).
Inheritable: No
Animatable: No
ContentWidth Double Specifies the viewbox width (width of the content).
Inheritable: No
Animatable: No
Height Double The viewport height of the component (height on
screen).
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 19 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Default: "0"
Inheritable: No
Animatable: Yes
Opacity Double A value between 0.0 (transparent) and 1.0 (opaque).
Default: "1.0"
Inheritable: No
Animatable: Yes
Top Double The y-coordinate of the component's upper left
corner.
Default: "0"
Inheritable: No
Animatable: Yes
Visibility Visibility Specifies if the element shall be visible or not.
Default: "Visible"
Inheritable: No
Animatable: Yes
Width Double The viewport width of the component (width on
screen).
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 20 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Example
<TGML>
<Rectangle Left="0.0" Top="55" Width="30" Height="30"
Fill="#FF0000" Stroke="#FF0000" />
<Polyline Points="30.0,65.0 60.0,5.0 90.0,35.0"
Stroke="#FF0000" StrokeWidth="2.0"/>
9 Basic shapes
Attributes
Attribute Type Description
Fill Brush Specifies how the shape's interior is painted.
Default: "None"
Inheritable: Yes
Animatable: Yes
Opacity Double A value between 0.0 (transparent) and 1.0
(opaque).
Default: "1.0"
Inheritable: No
Animatable: Yes
Stroke Brush Describes how the line is painted.
Default: "#000000"
Inheritable: Yes
Animatable: Yes
StrokeDashArray Array of The pattern of dashes and gaps used to outline
Double shapes:
Default: "0"
Inheritable: Yes
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 22 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Default: "1"
Inheritable: Yes
Animatable: Yes
Visibility Visibility Specifies if the element shall be visible or not.
Default: "Visible"
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 23 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
Opacity Double See 9.1 Shape attributes.
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Visibility Visibility See 9.1 Shape attributes.
X1 Double The x-coordinate of the line's start point.
Default: "0"
Inheritable: No
Animatable: Yes
X2 Double The x-coordinate of the line's end point.
Default: "0"
Inheritable: No
Animatable: Yes
Y1 Double The y-coordinate of the line's start point.
Default: "0"
Inheritable: No
Animatable: Yes
Y2 Double The y-coordinate of the line's end point.
Default: "0"
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 24 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Example
<TGML>
<Line X2="100.0" Y2="50.0"/>
Attributes
Attribute Type Description
Fill Brush See 9.1 Shape attributes.
Opacity Double See 9.1 Shape attributes.
Points Array of The vertex points of the polyline:
Point
"‹x1›,‹y1› ‹x2›,‹y2› ..."
Inheritable: No
Animatable: No
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Visibility Visibility See 9.1 Shape attributes.
Example
<TGML>
<Polyline Points="50.0,150.0 100.0,50.0 150.0,150.0"
Stroke="#0000FF"/>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 26 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
Fill Brush See 9.1 Shape attributes.
Opacity Double See 9.1 Shape attributes.
Points Array of The vertex points of the polygon:
Point
"‹x1›,‹y1› ‹x2›,‹y2› ..."
Inheritable: No
Animatable: No
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Visibility Visibility See 9.1 Shape attributes.
Example
<TGML>
<Polygon Points="50.0,150.0 100.0,50.0 150.0,150.0"
Stroke="#0000FF" Fill="#FFFF00"/>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 27 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
Fill Brush See 9.1 Shape attributes.
Height Double The height of the rectangle.
Inheritable: No
Animatable: Yes
Left Double The x-coordinate of the rectangle's upper left
corner.
Default: "0"
Inheritable: No
Animatable: Yes
Opacity Double See 9.1 Shape attributes.
RadiusX Double For rounded rectangles. The x-axis radius of the
ellipse used to round off the corners of the
rectangle.
Default: "0"
Inheritable: No
Animatable: Yes
RadiusY Double For rounded rectangles. The y-axis radius of the
ellipse used to round off the corners of the
rectangle.
Default: "0"
Inheritable: No
Animatable: Yes
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 28 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Default: "0"
Inheritable: No
Animatable: Yes
Visibility Visibility See 9.1 Shape attributes.
Width Double The width of the rectangle.
Inheritable: No
Animatable: Yes
Example
<TGML>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 29 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
Fill Brush See 9.1 Shape attributes.
Height Double The height of the ellipse.
Inheritable: No
Animatable: Yes
Left Double The x-coordinate of the ellipse's upper left
corner.
Default: "0"
Inheritable: No
Animatable: Yes
Opacity Double See 9.1 Shape attributes.
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Top Double The y-coordinate of the ellipse's upper left
corner.
Default: "0"
Inheritable: No
Animatable: Yes
Visibility Visibility See 9.1 Shape attributes.
Width Double The width of the ellipse.
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 30 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Example
<TGML>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 31 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
10 Segment shapes
RadiusY
RadiusX
Center
StartAngle
SweepAngle
Attributes
Attribute Type Description
Center Point The center point of the ellipse.
Inheritable: No
Animatable: Yes
RadiusY Double The vertical radius of the ellipse.
Inheritable: No
Animatable: Yes
StartAngle Double Specifies the angle between the x-axis and the
starting point of the arc.
Default: "0.0"
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 32 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Default: "0.0"
Inheritable: No
Animatable: Yes
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Visibility Visibility See 9.1 Shape attributes.
RadiusY
RadiusX
Center
StartAngle
SweepAngle
Attributes
See 10 Elliptical arc.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 33 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
RadiusY
RadiusX
Center
StartAngle
SweepAngle
Attributes
See 10 Elliptical arc.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 34 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Curve supports "polybezier", which is a consecutive set of Bezier points. The end
point of the preceding Bezier becomes the start point of the following Bezier.
Attributes
Attribute Type Description
Closed Bool Describes if the curve is closed or not (If Points
data ends with "z" or not).
Default: "False"
Inheritable: No
Animatable: No
Fill Brush See 9.1 Shape attributes.
Opacity Double See 9.1 Shape attributes.
Points Array of The points (start point, control points and end
Point point) of the Bezier. Polybezier is supported.
Inheritable: No
Animatable: No
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 35 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
The path is described by the attribute PathData, which can contain moveto, line,
curve (both cubic and quadratic Beziers), arc and closepath instructions.
The Path element is an implementation of the SVG path data specification. For
more information of the path data syntax, see the "Scalable Vector Graphics (SVG)
1.1 Specification".
Attributes
Attribute Type Description
Fill Brush See 9.1 Shape attributes.
Opacity Double See 9.1 Shape attributes.
PathData String SVG path data.
Inheritable: No
Animatable: No
Stroke Brush See 9.1 Shape attributes.
StrokeDashArray Array of See 9.1 Shape attributes.
Double
StrokeWidth Double See 9.1 Shape attributes.
Visibility Visibility See 9.1 Shape attributes.
Remarks
Some of the path commands may be converted, or replaced, when importing SVG
paths. For example, h, H (horizontal lineto) and v, V (vertical lineto) may be
replaced with l and L (lineto).
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 36 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
12 Raster images
The image data is stored as a Base64 encoded string in the CDATA section of the
Image element.
Attributes
Attribute Type Description
Content String The image data.
Inheritable: No
Animatable: Yes
Height Double The height of the image.
Inheritable: No
Animatable: Yes
Left Double The x-coordinate of the image's upper left corner.
Default: "0"
Inheritable: No
Animatable: Yes
Opacity Double See 9.1 Shape attributes.
Top Double The y-coordinate of the image's upper left corner.
Default: "0"
Inheritable: No
Animatable: Yes
Visibility Visibility See 9.1 Shape attributes.
Width Double The width of the image.
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 37 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
13 Text
TGML supports two types of text elements: Text and TextBox. Text causes a single
line of text to be rendered, whereas TextBox wraps the text within the specified
box.
The character data (the text) is stored within the Text element (as XML Element
Content):
The character data is accessible through the attribute Content which means that it is
possible to create dynamic texts by animating, or binding, the Content attribute.
Inheritable: No
Animatable: Yes
FontFamily String The name of the font (or font family).
Inheritable: Yes
Animatable: Yes
FontSize Double The size of the font, in device independent
pixels (see 2.1 Coordinates).
Inheritable: Yes
Animatable: Yes
FontStyle FontStyle The style of the font (i.e. Normal or Italic).
Default: "Normal"
Inheritable: Yes
Animatable: Yes
FontWeight FontWeight The weight of the font (i.e. Normal or Bold).
Default: "Normal"
Inheritable: Yes
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 38 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Default: "Left"
Inheritable: Yes
Animatable: Yes
Left Double The x-coordinate of the text area's upper left
corner.
Default: "0"
Inheritable: No
Animatable: Yes
Opacity Double A value between 0.0 (transparent) and 1.0
(opaque).
Default: "1.0"
Inheritable: No
Animatable: Yes
Stroke Brush Specifies how the text is painted.
Default: "#000000"
Inheritable: Yes
Animatable: Yes
TextDecoration TextDecoration Specifies decorations that are added to the
text.
Default: "None"
Inheritable: Yes
Animatable: Yes
Top Double The y-coordinate of the text area's upper left
corner.
Default: "0"
Inheritable: No
Animatable: Yes
Visibility Visibility Specifies if the text shall be visible or not.
Default: "Visible"
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 39 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
See Common text attributes above.
Attributes
Attribute Type Description
Height Double The height of the text area.
Inheritable: No
Animatable: Yes
Width Double The width of the text area.
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 40 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
14 Linking
Link indicates that the immediate parent shape or container element shall be a
"hyperlink object" which the user can click on to navigate to another presentation.
A Link is bound to a presentation object in the server with the same technique as
used for Dynamics. The Name attribute of the Link element is exposed as a
connection point to which the presentation object is connected in the bind tool. See
17 Dynamics for more information about bindings.
Link makes the parent element an "interactive" element, and a TGML viewer is
supposed to open the linked presentation object when the user clicks on the
element.
Example
The following example shows how to make a text a link object:
<TGML>
<Text...>
Open Overview
<Link Name="Overview"/>
</Text>
</TGML>
Remarks
Only painted regions are "clickable". Clicking on an "hollow" shape (Fill="None")
will have no effect.
TAC Vista Workstation graphics has support for attached, or linked, Notes files. A
Link element that belongs to (is a child of) the TGML element shall be handled by
the TGML Viewer as a "Notes attachment" if the bound object is of the type Notes.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 41 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
15 Transformations
The transformation elements control the size, position, rotation and skew of
graphic objects. The transformation establishes a transformed coordinate system
for the immediate parent element.
Transformations are applied in the same order as they are specified in the TGML
file.
Attributes
Attribute Type Description
Angle Double The angle of the rotation, measured in degrees.
Default: "0.0"
Inheritable: No
Animatable: Yes
Center Point Describes the position of the center point ("X,Y") of the
rotation.
Remarks
The picture below illustrates different Center values:
Example
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000" Fill="None"/>
SkewX specifies a skew transformation along the x-axis. The skew angle is
measured in degrees from the y-axis.
SkewY specifies a skew transformation along the y-axis. The skew angle is
measured in degrees from the x-axis.
SkewX SkewY
Y Angle
X
Angle
Attributes
Attribute Type Description
Angle Double The skew angle, measured in degrees.
Default: "0.0"
Inheritable: No
Animatable: Yes
Center Point Describes the position of the center point of the skew.
Example
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000" Fill="None"/>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#0000FF" Fill="#FFFF00" Opacity="0.75">
<Skew Angle="45" Center="0.5,0.5"/>
</Polygon>
Attributes
Attribute Type Description
Center Point Describes the position of the center point (origin) of the
scale.
Default: "0.0"
Inheritable: No
Animatable: Yes
ScaleY Double The vertical scale factor.
Default: "0.0"
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 47 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
X Double Specifies the x-direction.
Default: "0.0"
Inheritable: No
Animatable: Yes
Y Double Specifies the y-direction.
Default: "0.0"
Inheritable: No
Animatable: Yes
Example
<TGML>
<Rectangle Left="0" Top="0" Width="50" Height="50"
Fill="#FF0000"/>
16 Animations
An animation is a time-based modification of an element attribute. The animation
defines a mapping of time to values for the target attribute.
Attributes
Attribute Type Description
Animation Animation Starts and stops the animation in Dynamic
mode.
Default: "Start"
Inheritable: No
Animatable: Yes
Attribute String The animated attribute of the parent
element.
Inheritable: No
Animatable: No
AutoReverse Bool Indicates whether the timeline plays in
reverse after it completes a forward
iteration.
Default: "False"
Inheritable: No
Animatable: Yes
CalcMode CalcMode Specifies how values shall be interpolated.
See Remarks.
Default: "Discrete"
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 49 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Inheritable: Yes
Animatable: Yes
Freeze Bool Specifies if the animated attribute value
shall be kept or not when the animation
ends (end of "active duration" or stopped
by setting Animation to Stop).
Default: "False"
Inheritable: No
Animatable: Yes
From String (untyped) The starting value of an animation. The
type is determined by the referenced
Attribute.
Inheritable: Yes
Animatable: Yes
Repeat Repeat Describes the way the animation will be
repeated.
Default: "Forever"
Inheritable: No
Animatable: Yes
To String (untyped) The ending value of the animation. The
type is determined by the referenced
Attribute.
Inheritable: Yes
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 50 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Remarks
CalcMode=Discrete CalcMode=Linear
Value Value
To=10 • To=10
•
0 1 2 0 1 2
Duration=2 Duration=2
Example
The following example shows a blink animation.
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000" Fill="#FF0000">
<Animate Attribute="Visibility" From="Visible" To="Hidden"
Duration="1.0" AutoReverse="True" />
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 51 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Sequence belongs to the immediate parent container element and controls the
visibility of the container's graphical elements.
Default: "Start"
Inheritable: No
Animatable: Yes
Interval Double Specifies for how long time each of the
container's shapes shall be visible.
Inheritable: Yes
Animatable: Yes
Example
The following example plays a sequence of three rectangles. The "frame rate"
(Interval) is set to one second. The Visibility attributes of the second and third
rectangle are set to "Hidden" to hide them in Edit mode.
<Tgml>
<Group>
<Sequence Interval="1"/>
<Rectangle Top="50.0" Left="50.0" Width="100" Height="100"
Fill="#00FF00" Stroke="#000000" Visibility="Visible"/>
<Rectangle Top="50.0" Left="50.0" Width="100" Height="100"
Fill="#FFFF00" Stroke="#000000" Visibility="Hidden"/>
<Rectangle Top="50.0" Left="50.0" Width="100" Height="100"
Fill="#FF0000" Stroke="#000000" Visibility="Hidden"/>
</Group>
</Tgml>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 52 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
17 Dynamics
A dynamic graphic object is an object (TGML element) whose properties (TGML
attributes) are bound to, and controlled by, server variables (signals).
The TGML implementation (Graphics Services) only runs the dynamics engine in
Dynamic mode, i.e. bound properties are not dynamically updated in Static (edit)
mode.
Server variables are connected to element attributes via Bind elements with
associated rule elements. A Bind element belongs to the immediate parent element
and specifies which attribute of the parent element that will be dynamically
updated (similar to animations). The rule elements belong to the immediate parent
Bind element and they specify how a signal value will be converted to a TGML
attribute value.
The rules are evaluated in sequence, in the same order as they are specified. A rule
is executed (and the specified attribute is set) only if the specified conditions are
fulfilled. If no matching rules are found, the bound attribute is left unaffected.
The Name attribute of the Bind element identifies the binding and is exposed to
bind tools as a binding point to which the server variable is connected.
Rectangle
Binding point
Temperature
Server
Bind Attribute="Fill" Name="Temperature"
variable
(signal)
T1
Attribute value = Red
Signal value = 0
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 53 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Subscriptions are set up using the names of the Bind elements. When the value of a
bound signal is updated, it will be experienced as if the binding point was updated
(the signal identity is "hidden" behind the binding point). It is up to the server, or
the communication proxy depending on the binding implementation, to resolve the
name.
A TGML document may contain multiple Bind elements with the same Name.
However, the TGML implementation will only expose the Name once to the bind
tool (unique binding point). This makes it possible to have multiple presentations
of a signal, using a single binding point.
Dynamic rotation
Bind Name="Fan"
On Dynamic text
Bind Name="Fan"
Dynamic color
Bind Name="Fan"
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 54 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Bind makes the parent element an "interactive" element. The TGML viewer is
supposed to respond (e.g. show a "change value" dialog) when the user clicks on
the element.
Attributes
Attribute Type Description
Attribute String The bound attribute of the parent element.
Inheritable: No
Animatable: No
Format Format Specifies the formatting of the subscribed data. See
Remarks.
Default: "None"
Inheritable: No
Animatable: No
Remarks
Format is an instruction to the server how the subscribed value shall be formatted.
"None" means "deliver the data as is". The data type is preserved (integer, float,
boolean, string etc). You typically use conversion elements to convert the server
variable value to a TGML element attribute value.
Example
The following example shows how you can create a dynamic text without any
conversion elements using the presentation format:
<TGML>
<Text ...>
<Bind Name="Status" Attribute="TextContent"
Format="Presentation" />
This string is displayed as default.
</Text>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 55 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
A ConvertValue rule is only executed when each of the specified conditions are
fulfilled. The following example means: "Set the attribute to #00FF00 (green)
when the signal value is more than 18 and less than or equal to 22".
The following example shows a rule that never can be fulfilled (and thus never
executed) since the signal value never can be both equal to 0 and more than 10:
Attributes
Attribute Type Description
AttributeValue String The attribute value that is to be set (resulting
(untyped) value). The type is determined by the bound
Attribute (referenced by the Bind element).
Inheritable: No
Animatable: No
SignalEqualTo String Corresponds to "=".
(untyped)
Inheritable: No
Animatable: No
SignalMoreThan String Corresponds to ">".
(untyped)
Inheritable: No
Animatable: No
SignalMoreOrEqualTo String Corresponds to ">=".
(untyped)
Inheritable: No
Animatable: No
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 56 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Examples
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000" Fill="#000000">
<Bind Name="State" Attribute="Fill">
<ConvertValue AttributeValue="#00FF00" SignalEqualTo="1"/>
<ConvertValue AttributeValue="#FF0000" SignalEqualTo="0"/>
</Bind>
</Polygon>
</TGML>
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000" Fill="#000000">
<Bind Name="Temperature" Attribute="Fill">
< ConvertValue AttributeValue="#0000FF"
SignalLessThan="18.0"/>
< ConvertValue AttributeValue="#00FF00"
SignalMoreOrEqualTo="18.0" SignalLessOrEqualTo="22.0"/>
< ConvertValue AttributeValue="#FF0000"
SignalMoreThan="22.0"/>
</Bind>
</Polygon>
</TGML>
Attributes
Attribute Type Description
AttributeValue String The attribute value that is to be set (resulting
(untyped) value). The type is determined by the bound
Attribute (referenced by the Bind element).
Inheritable: No
Animatable: No
SignalEqualTo String Corresponds to "=".
Inheritable: No
Animatable: No
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 59 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
A ConvertRange rule is executed when the signal value is within the specified
range. The Example below shows how the attribute value is calculated.
Attributes
Attribute Type Description
AttributeMaxValue String The upper bound of the attribute value. The
(untyped) referenced attribute (referenced by the Bind
element) will be set to this value when the
signal value is more than or equal to
SignalMaxValue.
Inheritable: No
Animatable: No
AttributeMinValue String The lower bound of the attribute value. The
(untyped) referenced attribute (referenced by the Bind
element) will be set to this value when the
signal value is less than or equal to
SignalMinValue.
Inheritable: No
Animatable: No
SignalMaxValue String The upper bound of the signal value.
(untyped)
Inheritable: No
Animatable: No
SignalMinValue String The lower bound of the signal value.
(untyped)
Inheritable: No
Animatable: No
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 60 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Example
<TGML>
<Polygon Points="150.0,50.0 160.0,150.0 140.0,150.0"
. Fill="#FF0000" Stroke="#000000" StrokeWidth="1.0">
<Rotate Angle="0.0" Center="0.5,1.1">
<Bind Name="Flow" Attribute="Angle">
<ConvertRange
AttributeMinValue="-90.0" SignalMinValue="0.0"
AttributeMaxValue="90.0" SignalMaxValue="60.0" />
</Bind>
</Rotate>
</Polygon>
</TGML>
function convert(value)
{
// TODO: add conversion code here
return value;
}
The function takes one parameter which is the signal value and it is supposed to
return a converted value.
The user can insert any valid JavaScript code in the function body to accomplish a
value conversion. By default the function just returns the signal value as is.
Example
<TGML>
return value;
}
]]></Script>
</ConvertCustom>
</Bind>
</Rectangle>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 62 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
18 Scripting
TGML supports the script language JavaScript 1.5, which you can use to access the
elements and their attributes in View mode. The script engine is not running in Edit
mode.
The DOM (the elements and their attributes) is accessed using DOM methods such
as getCurrentTarget, getAttribute and setAttribute.
Apart from accessing the DOM, it is also possible to interact with the TGML
Viewer (and thus the underlying system) using TAC specific JavaScript functions
such as setValue and execute.
The execution of the scripts is event driven. Event attributes are used to specify the
event and a function name. The function will be executed in View mode when the
specified event is raised.
See Appendix C: TGML scripting for more information about DOM methods, event
object methods and JavaScript functions.
Each Script element (script block) creates a JavaScript context. Function calls
between script blocks (contexts) are not supported, i.e. no support for global script
functions.
The script functions are stored in the CDATA section of the Script element. The
CDATA section is accessible through the Content attribute.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 63 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Element attributes
Attribute Type Description
Content String The script.
Inheritable: No
Animatable: No
Cancelable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 64 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Example
<Tgml>
<Rectangle Name="MyRect" Left="50" Top="50" Width="100"
Height="100" Fill="#FFFFFF" Stroke="#000000" >
<Script OnMouseClick="click"><![CDATA[
function click(evt)
{
element = evt.getTarget();
name = element.getAttribute("Name");
mouseX = evt.getClientX();
mouseY = evt.getClientY();
alert(message);
}
]]></Script>
</Rectangle>
</Tgml>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 65 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
You do not have to use TargetArea to be able to handle mouse events. All of the
graphical (painted) elements can be targets of mouse events. Use TargetArea when
you need an invisible but clickable area.
Attributes
Attribute Type Description
Height Double The height of the area.
Inheritable: No
Animatable: Yes
Left Double The x-coordinate of the area's upper left corner.
Default: "0"
Inheritable: No
Animatable: Yes
Top Double The y-coordinate of the area's upper left corner.
Default: "0"
Inheritable: No
Animatable: Yes
Width Double The width of the area.
Inheritable: No
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 66 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Example
In the following example the TargetArea is used to create a "mouse sensitive" area
that covers the whole Component.
Without the TargetArea, the MouseOver and MouseOut events will be sent every
time the cursor passes the contained elements since the Script is defined at the
Component level in this example. The TargetArea has the effect of "hiding" the
contained shapes and you will only get one MouseOver and one MouseOut when
the cursor passes the Component.
<Tgml>
<Component Left="50.0" Top="50.0" Width="102" Height="102"
ContentHeight="102" ContentWidth="102"
>
<Script OnMouseOut="out" OnMouseOver="over" ><![CDATA[
function over(evt)
{
// Show blue edge
component = evt.getCurrentTarget();
rectangle = component.getChildByName("Hovering");
rectangle.setAttribute("Visibility", "Visible");
}
function out(evt)
{
// Hide blue edge
component = evt.getCurrentTarget();
rectangle = component.getChildByName("Hovering");
rectangle.setAttribute("Visibility", "Hidden");
}
]]></Script>
<Shapes .../>
The following TGML fragment is an example of an invisible "link area" which can
be placed above other shapes:
19 Gradients
Gradients consist of continuously smooth color transitions along a vector from one
color to another. TGML provides for two types of gradients, linear gradients and
radial gradients.
LinearGradient works in conjunction with gradient stops (see 19.3 Gradient stop),
which describe the location and color of transition points in gradients.
Attributes
Attribute Type Description
Attribute String The brush attribute of the parent ("Fill" or
"Stroke").
Inheritable: No
Animatable: No
EndPoint Point The ending coordinates of the linear gradient,
see Remarks
Default: "Pad"
Inheritable: Yes
Animatable: Yes
StartPoint Point The starting coordinates of the linear gradient,
see Remarks.
Remarks
StartPoint and EndPoint specifies the starting and ending coordinates of the linear
gradient. "0.0 , 0.0" represents the upper-left corner of the element and "1.0 , 1.0"
represents the lower-right corner. In the following picture, the StartPoint and
EndPoint are set to "0.0,0.0" and "1.0,1.0", respectively.
Example
See 19.3 Gradient stop.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 69 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
RadialGradient works in conjunction with gradient stops (see 19.3 Gradient stop),
which describe the location and color of transition points in gradients.
Attributes
Attribute Type Description
Attribute String The brush attribute of the parent ("Fill" or
"Stroke").
Inheritable: No
Animatable: No
Center Point The center of the circle of the radial gradient,
see Remarks.
Default:"0.5 , 0.5"
Inheritable: Yes
Animatable: Yes
Focus Point The location of the focal point that defines the
beginning of the gradient, see Remarks.
Default:"0.5 , 0.5"
Inheritable: Yes
Animatable: Yes
RadiusX Double The horizontal radius of the circle of the radial
gradient, see Remarks.
Default:"0.5"
Inheritable: Yes
Animatable: Yes
RadiusY Double The vertical radius of the circle of a radial
gradient, see Remarks.
Default:"0.5"
Inheritable: Yes
Animatable: Yes
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 70 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Default: "Pad"
Inheritable: Yes
Animatable: Yes
Remarks
The RadialGradient is similar in programming model to the LinearGradient.
However RadialGradient does not have start and end points, but a circle, along
with a focal point, to define the gradient behavior. The focal point defines the
beginning of the gradient, and the circle defines the end point of the gradient.
Note that RadialGradient only supports the spread method Pad in TGML version
1.0.
Focus (0.3)
RadiusX (0.5)
RadiusY (0.5)
Example
See 19.3 Gradient stop.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 71 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Attributes
Attribute Type Description
Color Color The color of the gradient stop.
Inheritable: Yes
Animatable: Yes
Offset Double The location of the gradient stop within the gradient.
Inheritable: Yes
Animatable: Yes
Remarks
The following picture illustrates the relations between the StartPoint/EndPoint of
the LinearGradient and the Color/Offset of the GradientStop elements.
StartPoint of EndPoint of
LinearGradient LinearGradient
GradientStop, GradientStop,
Color=#FFFFFF, Color=#0000FF,
Offset=0.0 Offset=1.0
GradientStop, GradientStop,
Color=#FFFFFF, Color=#0000FF,
Offset=0.25 Offset=0.75
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 72 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Examples
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000">
<LinearGradient Attribute="Fill">
<GradientStop Color="#FFFFFF" Offset="0.0"/>
<GradientStop Color="#0000FF" Offset="1.0"/>
</LinearGradient>
</Polygon>
</TGML>
<TGML>
<Polygon Points="50.0,50.0 150.0,50.0 150.0,150.0 50.0,150.0"
Stroke="#000000">
<RadialGradient Attribute="Fill" Center="0.5,0.5"
Focus="0.35,0.35" RadiusX="0.5" RadiusY="0.5" >
<GradientStop Color="#FFFFFF" Offset="0.0"/>
<GradientStop Color="#0000FF" Offset="1.0"/>
</RadialGradient>
</Polygon>
</TGML>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 73 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
20 Attribute exposure
In TGML, it is possible to indicate that an attribute shall be exposed by the TGML
editor in such a way that it is easy to find and set the attribute value.
An Expose element is used to expose an attribute. The Name of the Expose element
is presented to the user instead of the original attribute name.
The attribute exposure is only handled by the TGML editor. TGML viewers shall
ignore the exposure.
Attributes
Attribute Type Description
ExposedAttribute String The exposed attribute of the parent element.
Inheritable: No
Animatable: No
Example
<Component...>
<Rectangle...>
<Expose ExposedAttribute=“Fill” Name=“Background”/>
</Rectangle>
<Ellipse...>
<Bind ...>
<ConvertRange...>
<Expose ExposedAttribute=“SignalMinValue” Name=“Min”/>
<Expose ExposedAttribute=“SignalMaxValue” Name=“Max”/>
</ConvertRange>
</Bind>
</Ellipse>
</Component>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 74 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
A snippet file contains only one TGML snippet. The root (outermost) element
includes at least two Metadata elements describing the snippet: one for Name and
one for Description. It is recommended that the file name matches the "Name"
metadata.
Appendix B: Components
Component library
Components are stored the same way as TGML code snippets. Component is the
root element and the associated Metadata elements describe the component.
Width and Height is replaced with (copied to) ContentWidth and ContentHeight of
the Component element when the component is stored.
Initial viewport
The Width and Height of the stored Component is the initial viewport (the initial
size of the component) when it is pasted into a TGML document.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 76 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Global variables
Variables declared outside the Java script functions are global within the script
block. The global variables exist while the TGML document is displayed
(executed) in Dynamic mode.
The global variables can only be accessed by the functions that are defined in the
same script block.
<Tgml>
<Rectangle Step="1" Fill="#FFFFFF" Height="50.0" Left="50.0"
Stroke="#000000" Top="50.0" Width="50.0">
<Bind Name="Value"/>
function signal(evt)
{
value = new Number(evt.getValue());
// Note: getValue may return a string.
}
function click(evt)
{
// If value is a numeric value (not a NaN).
if(!isNaN(value))
{
target = evt.getTarget();
else
{
alert("Not a numeric value.")
}
]]></Script>
</Rectangle>
</Tgml>
Remarks
When an element contains Bind or Link, the viewer are supposed to respond (e.g.
show a "change value" dialog or open the linked presentation object) when the user
clicks on the element. This is the "default action" for the viewer which is cancelled
by the preventDefault function.
Example
<Tgml>
<Component Left="99.5" Top="99.5" Width="101.0" Height="101.0"
ContentHeight="101.0" ContentWidth="101.0">
<Script OnMouseDown="down"><![CDATA[
function down(evt)
{
// The Rectangle will be the target since the Component
// has no painted (clickable) surface.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 78 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
rectangle = evt.getTarget();
</Component>
</Tgml>
0 = Left button.
1 = Middle button.
2 = Right button.
getClientX() Returns the X coordinate of the cursor, relative the
origin of the target coordinate system.
Example
<Tgml>
<Component Name="MyComponent" Left="99.5" Top="99.5"
Width="101.0" Height="101.0" ContentHeight="101.0"
ContentWidth="101.0">
<Script OnMouseClick="click"><![CDATA[
function click(evt)
{
component = evt.getCurrentTarget();
bind = component.getChildByName("Value");
fullName = bind.getFullBindName(); // "MyCmponent.Value"
....
}
]]></Script>
</Component>
</Tgml>
Example
<Tgml>
<Rectangle Left="50" Top="50" Width="100" Height="100"
Fill="#C0C0C0" Stroke="#000000" >
<Script OnMouseOver="over" OnMouseOut="out"><![CDATA[
function over(evt)
{
// Change fill color while hovering.
rectangle = evt.getTarget();
function out(evt)
{
// Restore the fill color
rectangle = evt.getTarget();
color = rectangle.getAttribute("originalColor");
rectangle.setAttribute("Fill", color);
}
]]></Script>
</Rectangle>
</Tgml>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 82 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Examples
<Tgml>
<Component Name="Switch" Left="50" Top="50" Width="102"
Height="102" ContentHeight="102" ContentWidth="102">
<Script OnMouseClick="click"
OnSignalChange="signal"><![CDATA[
currentValue = NaN;
function click(evt)
{
rect = evt.getTarget();
if(toggle == true)
setValue(fullName, newVal);
}
function signal(evt)
{
currentValue = evt.getValue();
}
]]></Script>
</Rectangle>
</Component>
</Tgml>
The example below assumes that the Link named "Report" is bound to a TACOS
report object. The function invoke will result in a "print report" operation in Vista
Workstation.
<Tgml>
<Text Left="100" Top="100">
Print TACOS report
<Script OnMouseClick="click"><![CDATA[
function click(evt)
{
rect = evt.getTarget();
link = rect.getChildByName("Report");
fullName = link.getFullBindName();
<Link Name="Report"/>
</Text>
</Tgml>
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 85 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
JavaScript 1.5
For more information about JavaScript 1.5, see ECMAScript Language
Specification, Rev 3.
Format Specification
TGML 1.0
Company Date Version Page
TAC AB 2006-10-12 B1 86 (86)
Author Document ID
Lars-Eric Assarsson TGML_Format_Specification
Version A1-A7
The A1-A7 versions were used by the TGML development team during the
development of the TGML Graphics. The full history of the revisions is
documented in the TGML Format Specification, version A7.
Version B1
This is the first official version of the TGML 1.0 Format Specification. This
version has been reviewed as version A7. The content in this version is the same as
in version A7.