Visual Thought User's Guide
[TOC] [Prev] [Next] [Index]

Appendix H

File Format

Introduction

Visual Thought's file format is a simple, LISP-like language that is easy to write and parse. This Appendix describing the file format is intended for users who want to read and/or write Visual Thought files to create interfaces with other tools.

If you read or parse the language, you can use Visual Thought as a graphical front-end. For example, you might use Visual Thought to draw objects and relationships, then read the resulting files to generate an object model for an object-oriented database.

If you write the language, you can use Visual Thought as a graphical back-end to display the results of computations. An example might be to use Visual Thought to display the results of reverse-engineering source code. Given a set of source code, you might programmatically analyze it for entities and their relationships, then write them out as Visual Thought files for display.

Overview of the Language

The Visual Thought file format is a text format language that is very much like LISP. It uses ; for comments and parentheses as delimiters. Although Visual Thought writes its files with indentation for readability, the file format is not line-based and extra spacing and line breaks may be eliminated if desired.

The language is composed of comments, literals, and expressions.

Grammar

The grammar of the Visual Thought file format is presented here. Each expression definition is of the form:

expression_name
expression_expansion

The name of each expression is to the left of the arrow; the expansion of that expression is to the right.

Expressions are set in a sans-serif font. Keywords are set in a typewriter font. Optional expressions are italicized, required expressions are not. + appended to an expression denotes one or more instances of that expression; * denotes zero or more; ? denotes zero or one.

document
header_section
document_section
view_section
shape_section
connection_section
group_section

header_section
(header
(program string)
(version string)
(buildDate string)
(
writeDate string)
(
documentPath string)
)

document_section
(document
(palette boolean)
layout_description
)

layout_description
(layout
(page string)
(
units string)
(
orientation string)
(
numberOfPages integer integer)
(
scale float)
(
margins float float float float)
page_description
)

page_description
(pageDescription
(orientation string)
(
size integer integer)
(
dscPageSize string)
(
paperTray string)
(
paperSize string)
)

view_section
(views
view_description+
)

view_description
(view
(location integer integer)
(
size integer integer)
(
zoom float)
(
documentLocation integer integer)
(
gridSnap boolean)
(gridVisibility boolean)
(gridSpacing integer)
(
pageBreaks boolean)
(
rulerVisibility boolean)
(
toolVisibility boolean)
)

shape_section
(shapes
shape_description*
)

shape_description
(shape
(id integer)
(layer integer)
(type string)
(location float float)
(size float float)
(
rotation float)
(
locked boolean)
(
flipHorizontal boolean)
(
flipVertical boolean)
(
showText boolean)
(
textVerticalAlignment string)
(
text string)
(
sound string)
(
image string)
style_description
attachment_description
)

style_description
(style
(filled boolean)
(
fillColor integer integer integer)
(
stroked boolean)
(
strokeColor integer integer integer)
(
lineWidth float)
(
shadowed boolean)
(
shadowColor integer integer integer)
dash_description
)

dash_description
(dash
(pattern float+)
(
offset float)
)

attachment_description
(attachment
(path string)
(inputArguments string)
)

connection_section
(connections
connection_description*
)

connection_description
(connection
(id integer)
(layer integer)
(rotation float)
(
locked boolean)
(
showText boolean)
(
start integer integer?)
(
end integer integer?)
(
curved boolean)
(
textDistancePercentage float)
(
textWidth float)
(
textOffset float)
(
textRotation float)
(
text string)
(
drawStartArrowhead boolean)
(
drawEndArrowhead boolean)
(
startArrowhead string)
(
endArrowhead string)
(
sound string)
style_description
attachment_description
points_description
)

points_description
(points
point_description+
)

point_description
(float float)

group_section
(groups
group_description*
)

group_description
(group
(id integer)
(layer integer)
(rotation float)
(
locked boolean)
contents_description
)

contents_description
(contents
integer integer+
)

Keyword Definitions

This section defines each keyword and its usage. Every keyword definition is laid out in the following format:

keyword optional
value: expression | literal
default: literal
used by: keyword*

Keyword commentary.

The keyword itself is set in a bolded, sans-serif font. If it is optional, the italicized word "optional" will appear at upper right. The value of a keyword may be a literal (a string, number, or boolean value), in which case the type of literal is listed, or zero or more expressions, in which case the expressions are listed if possible. If the value of a keyword is a literal, the default value, if any, will be listed. Any optional keyword with a default literal value will have the default value assumed if the keyword does not appear in a file. The "used by" field lists zero or more keywords of the expressions that can contain this keyword. Finally, the keyword is described in text below the "used by" field.

Entries in this section are listed in alphabetical order.

attachment optional
value: expression+
default:
used by: shape, connection

Introduces an attachment expression, which associates an arbitrary file with an object.

buildDate optional
value: string
default:
used by: header

The date on which the program that wrote the file was built.

connection optional
value: expression+
default:
used by: connections

Introduces the definition of one connection.

connections
value: expression*
default:
used by:

Introduces the connection section, which defines all connections in the document. The connection section may be empty.

contents
value: integer integer+
default:
used by: group

Lists the id's of objects contained by the group. Each group must contain at least two objects.

curved optional
value: boolean
default: F
used by: connection

Defines whether the connection is curved.

dash optional
value: expression*
default:
used by: style

Introduces a dash definition. If a dash is defined, it is used for stroking lines and outlines of the given object.

document
value: expression+
default:
used by:

Introduces the document section, which defines general properties of the document represented by the file, such as whether it is a Palette, or its page layout characteristics.

documentLocation optional
value: integer integer
default: 0 0
used by: view

The scroll location of the View in points, on the document. (0, 0) makes the lower left corner of the View coincide with the lower-left corner of the document.

documentPath optional
value: string
default:
used by: header

The file system path to the file. For example, "/home/users/william/test.vthought".

drawEndArrowhead optional
value: boolean
default: F
used by: connection

Defines whether to draw an arrowhead at the end of a connection.

drawStartArrowhead optional
value: boolean
default: F
used by: connection

Defines whether to draw an arrowhead at the start of a connection.

dscPageSize optional
value: string
default: "Letter"
used by: pageDescription

Defines the option keyword for the *PageSize feature in the PostScript DSC printer output for a custom page. The keyword appears as "<option>" in the DSC comment "%%BeginFeature: *PageSize <option>".

end optional
value: integer integer?
default:
used by: connection

The end value is one or two integers. The first integer is always the id of the object to which the end of the connection is connected. The second integer, if it exists, is the site number (starting from 0) of the object to which the end of the connection is connected. In general, shapes only have one connection site (numbered 0), and connections have as many connection sites as they have vertices.

endArrowhead optional
value: string
default: "StandardArrow"
used by: connection

Defines the type of arrowhead to be drawn at the end of a connection.

fillColor optional
value: integer integer integer
default: 65535 65535 65535
used by: style

Determines the fill color of an object. The three integers listed must range from 0 to 65535, and they denote the R, G, and B values of the color, respectively. The default value is white.

filled optional
value: boolean
default: T
used by: style

Defines whether the object is filled with a color or not.

flipHorizontal optional
value: boolean
default: F
used by: shape

Whether the shape is flipped horizontally.

flipVertical optional
value: boolean
default: F
used by: shape

Whether the shape is flipped vertically.

gridSnap optional
value: boolean
default: T
used by: view

Defines whether grid snap is on in the View.

gridSpacing optional
value: integer
default: 9
used by: view

The spacing, in points, used by the grid. By default, 9 points, which is 1/8".

gridVisibility optional
value: boolean
default: F
used by: view

Defines whether the grid is visible in the View.

group optional
value: expression+
default:
used by: groups

Introduces the definition of one group object.

groups
value: expression*
default:
used by:

Introduces the groups section, which defines all groups in the document. This section may be empty.

header
value: expression+
default:
used by:

Introduces expressions describing the document defined by the file.

id
value: integer
default:
used by: shape, connection, group

An integer identifier unique to each defined object. ID's must progress sequentially starting from 1.

image optional
value: string
default:
used by: shape

Defines the path to an image file to be displayed inside the shape.

inputArguments optional
value: string
default: ""
used by: attachment

Input arguments to the executable which runs the attached file. For example, suppose the file attached to an object is "/home/william/test.txt" and the input argument string is "-q". When the attachment is activated, suppose further that the file typing mechanism determines that the program "emacs" runs the attached file. Then the command that is run as a result of the activation will be of the form: "emacs -q /home/william/test.txt".

layer
value: integer
default:
used by: shape, connection, group

An integer, unique for each object, defining the layer to which each object belongs. Layer numbers of ungrouped objects must progress sequentially starting from 0. Layer numbers of objects inside a group must have layer number -1, as these objects take on the layer of their parent group. Objects with greater layer numbers are overlaid (when drawn) by objects with lesser layer numbers.

layout optional
value: expression+
default:
used by: document

Introduces the layout expression that defines the page layout characteristics of a document.

lineWidth optional
value: float
default: 1.0
used by: style

The width of an object's lines and outlines, in points. The minimum line width is 0 (the thinnest line that can be drawn).

location
value: float float
default:
used by: shape

The location of the lower-left corner (x coordinate, then y) of the shape in points (document coordinates). In general, only positive values are allowed.

location optional
value: integer integer
default:
used by: view

Defines the location of the lower-left corner of the View window, in pixels, from the lower-left corner of the root window. The horizontal coordinate is listed first. If the location expression is not supplied, the View is placed at a default location, against the bottom of the Main window and right edge of the Inspector.

locked optional
value: boolean
default: F
used by: shape, connection, group

Defines whether the object is locked or not. Locked objects do not interact with tools and surrounding objects, although they are drawn, and their attachments may be activated.

margins optional
value: float float float float
default: 18.0 18.0 18.0 18.0
used by: layout

Defines the top, bottom, left, and right margins of the page layout in points, in that order.

numberOfPages optional
value: integer integer
default: 1 1
used by: layout

Defines the number of pages in the page layout in the horizontal, then vertical directions.

offset optional
value: float
default: 0.0
used by: dash

The offset of a dash pattern, in points. The offset can be used to make the first segment of a pattern to appear to be an off-segment.

orientation optional
value: string
default: "portrait"
used by: layout, pageDescription

If used in a layout expression, defines the orientation of the page layout. If used in a pageDescription expression, defines the default orientation of a custom page. May only take the values "portrait" or "landscape".

page optional
value: string
default: "Letter"
used by: layout

Defines the page type used by the page layout. Currently known types are listed in the Paper Type popup menu of the Page Layout dialog.

pageBreaks optional
value: boolean
default: T
used by: view

Defines whether page breaks are visible in the View.

pageDescription optional
value: expression+
default:
used by: layout

Introduces the definition of a custom page description. If the pageDescription keyword is supplied, the page keyword should also be supplied with value "Custom".

palette optional
value: boolean
default: F
used by: document

Denotes whether the document is a Palette or a regular document. The difference between Palettes and regular documents is in how they are viewed. Any View of a Palette allows you to toggle the Palette between drag-and-drop and editing mode; any View of a regular document only allows editing mode. Otherwise, a Palette and a regular document behave the same.

paperSize optional
value: string
default: "letter"
used by: pageDescription

Defines the paper size operator in the PostScript Level 1 printer output for a custom page. This operator is executed to request a specific paper size. It is only executed if the operator defined by the paperTray keyword fails.

paperTray optional
value: string
default: "lettertray"
used by: pageDescription

Defines the paper tray operator in the PostScript Level 1 printer output for a custom page. This operator is executed to request a tray containing a specific paper size. If it fails, the operator defined by the paperSize keyword is executed.

path
value: string
default:
used by: attachment

The file system path to the file attached to an object.

pattern optional
value: float+
default: 0.0
used by: dash

Defines the dash pattern. The pattern value is a list of floats that define the alternating on-off segments. The first segment is assumed to be on, but may be offset. Segment lengths are in points. If the list length is even, successive numbers define the length of on-segment, then of an off-segment. If the list length is odd, the pattern is concatenated with itself to yield a list with an even number of elements, which is treated as above.

points optional
value: (float float)+
default:
used by: connection

Introduces the point list of a connection. If the points expression is written, it must list at least one point. Each point in the point list is defined by two floats, the x and y coordinates in points. Every connection must have at least two points. Points defined in the point list, however, do not include any ends that are connected to other objects. For example, if a connection with three points is connected at its start to a shape (the end of the connection being free), then the connection would write a start expression and a point list containing only two points.

program
value: string
default:
used by: header

The program for which the file was written. Currently, the value "vthought" is expected.

rotation optional
value: float
default: 0.0
used by: shape, connection, group

The rotation angle, in degrees, of the object. The angle increases counterclockwise from the x-axis, which extends horizontally from left-to-right. For shapes, connections, and groups, the rotation angle affects the entire object.

rulerVisibility optional
value: boolean
default: T
used by: view

Defines whether rulers are visible in the View.

scale optional
value: float
default: 100.0
used by: layout

Defines the scale of the page layout in percentage points. A value of 100 indicates no magnification or reduction. A value less than 100 indicates a reduction in the size of the drawing, so that the drawing takes less space on a printed page; a value greater than 100 indicates an enlargement.

shadowColor optional
value: integer integer integer
default: 39321 39321 39321
used by: style

Determines the shadow color of an object. The three integers listed must range from 0 to 65535, and they denote the R, G, and B values of the color, respectively. The default value is 60% gray.

shadowed optional
value: boolean
default: T
used by: style

Defines whether an object is shadowed.

shape optional
value: expression+
default:
used by: shapes

Introduces the definition of one shape.

shapes
value: expression*
default:
used by:

Introduces the shape section, which defines all shapes in the document. The shape section may be empty.

showText optional
value: boolean
default: F
used by: shape, connection

Defines whether the text of a shape or connection is shown.

size optional
value: float float
default: 612.0 792.0
used by: pageDescription

Defines the width and height, respectively, of a custom page in points.

size optional
value: float float
default: 72.0 72.0
used by: shape

The width and height, respectively, of the shape, in points.

size optional
value: integer integer
default: 632 723
used by: view

Defines the width and height, respectively, of the View, in screen pixels. If the size expression is not supplied, the View is given a default size (632 x 723) that approximately fits a portrait-oriented page.

sound optional
value: string
default:
used by: shape, connection

Defines the path to a sound file to be associated with the object.

start optional
value: integer integer?
default:
used by: connection

The start value is one or two integers. The first integer is always the id of the object to which the start of the connection is connected. The second integer, if it exists, is the site number (starting from 0) of the object to which the start of the connection is connected. In general, shapes only have one connection site (numbered 0), and connections have as many connection sites as they have vertices.

startArrowhead optional
value: string
default: "StandardArrow"
used by: connection

Defines the type of arrowhead to be drawn at the start of a connection.

strokeColor optional
value: integer integer integer
default: 0 0 0
used by: style

Determines the stroke color of an object. The three integers listed must range from 0 to 65535, and they denote the R, G, and B values of the color, respectively. The default value is black.

stroked optional
value: boolean
default: T
used by: style

Defines whether the object's lines and outlines are drawn ("stroked").

style optional
value: expression*
default:
used by: shape, connection

Introduces a style, which defines graphical attributes such as line, fill, and shadow attributes.

text optional
value: string
default:
used by: shape, connection

Defines the text in a shape or connection. The text is an RTF (Rich Text Format) or plain character string. If a plain character string, no font or style or other formatting information may be applied, but nonetheless, this format is accepted for convenience. This manual will not attempt to describe RTF, except to note that RTF accepted by Visual Thought generally conforms to conventions used by Microsoft Word 5.0.

textDistancePercentage optional
value: float
default: 0.5
used by: connection

Defines at what fraction of the total connection length should the text label appear. The default is 0.5, which is halfway along the connection. Valid values range from 0.0 to 1.0.

textOffset optional
value: float
default: 0.0
used by: connection

The perpendicular offset, in points, of the text label from the connection at the textDistancePercentage point. Valid values are negative, zero, or positive.

textRotation optional
value: float
default: 0.0
used by: connection

The rotation angle, in degrees, of the text label of a connection. The angle increases counterclockwise from the x-axis, which extends horizontally from left-to-right.

textVerticalAlignment optional
value: string
default: "center"
used by: shape

Defines whether a shape's text is aligned against the top or bottom of the shape, or centered. Valid string values are: top, bottom, center.

textWidth optional
value: float
default: 72.0
used by: connection

Defines the width of a connection's text label, in points. The minimum width is 10.0 points.

toolVisibility optional
value: boolean
default: T
used by: view

Defines whether the tool bar (containing the six drawing tools) are visible in the View.

type optional
value: string
default: "Rectangle"
used by: shape

The type of a shape. The type defines what gives a shape its "shape". Examples of type values are: Ellipse, Rectangle, Trapezoid. There are many others.

units optional
value: string
default: "Inches"
used by: layout

Defines the units used by the page layout. Currently known unit types are listed in the Units popup menu of the Page Layout dialog (current types are: Inches, Centimeters, Picas, Points).

version
value: string
default:
used by: header

The version number of the program for which the file was written. Currently, the value "1.0" is expected.

view
value: expression+
default:
used by: views

Introduces an expression describing one View.

views
value: expression+
default:
used by:

Introduces the views section, which contains descriptions of every View of the document. Each View represents a window on the screen. Views of the same document may have different sizes, positions, document zoom and scroll factors, grid snap, page break, ruler, and tool visibility values. At least one View must be defined.

writeDate optional
value: string
default:
used by: header

The date on which the file was written.

zoom optional
value: float
default: 1.0
used by: view

The zoom factor of the View. The default, 1.0, is normal size. This factor does not affect how the View's document is printed; rather it merely changes the on-screen magnification of the document.



Visual Thought User's Guide
[TOC] [Prev] [Next] [Index]

webmaster@confluent.com
¨ 1997 Confluent, Inc. All rights reserved.