Doing fancy stuff with the graphics control file for WikiRoads

Some of the things you see in the output of getplan output are not hardwired into the program but controlled by an attribute file called graphics.attr.

Some example graphics.attr entries look like these:

kind="stream"
colour="river-water"

type="pub"
graphic="pub"

Features controlled by graphics.attr

Features of getplan output currently controlled by getplan.attr include colours and graphics. When getplan supports VRML, the default VRML descriptions for kinds of entries will also come from this file.

Graphics

Note that the matching for this is over-ridden by the graphic field, if given, of the data file entry.

The name given in the graphic field of a graphics.attr entry is used to find a GIF in the directory graphics. The string .gif is appended to it to make the filename in that directory.

Colour

Note that the matching for this is over-ridden by the colour field, if given, of the data file entry.

The name given in the graphic field of a graphics.attr entry is used to find an entry in the colours.attr file, and the value of field whose field-name is the desired colourspace, from that entry, is used for the output. Currently the colourspaces

rgbhex
this is the format used by NetScape etc
vrml-colour
A VRML material colour (including the type of surface)

An example colours.attr entry looks like this:

name="grass-green"
rgbhex="008000"
vrml-colour="diffuseColor 0 .5 0"

Size

If the attribute pixacross is provided, it is used as the size in pixels for the cell, as used by Mozilla-style browsers. (They may make it larger than this, but shouldn't make it smaller.) It is used as the width in pixels if the entry takes more than one grid row vertically (for example, for the road down the middle of each page), and as the height otherwise. This may be used in conjunction with setting the background picture of the cell to get special effects using tiled pictures.

Background

The attributes tallbgpic and widebgpic are used to specify a background picture for the cell; the picture is found as for graphics within the cell. Used together with setting the size of a cell, this may be used to make a tiled background; for example, a road with white and yellow lines along it as appropriate.

Shape

The value of the vrml-shape field of a graphics.attr entry is a piece of VRML for drawing that sort of object.

Fields requested by the editor

Kinds

The attribute kinds specifies the possible kinds of features of this type. The standard edit-form writing code will output a set of radio buttons for these kinds. The format is a series of lines, each of which has the kind name (in lower case, with no spaces) which is returned by selecting that option, then a space, then the text to output labelling that radio button.

Fields

The list of attribute names specifically requested by the edit form for a particular type is given by the fields attribute, which should be a series of names separated by commas. Whitespace is ignored (since you can't have it in field names, anyway). Do not include kind among these fields; the edit field for kinds

Types

The types which the edit form will make available for setting the type of a dummy entry are listed in the types attribute of a special graphics.attr entry matched by type=typelist. (There are no real entries in the system with this type!)

Maintenance details

A special entry matched by type=merge contains details of the most recent merge of unvetted edits by the streetmaster. It contains at least an attribute date, which is in a human-readable format (not further specified, and not particularly intended for machine parsing).

Matching entries in graphics.attr

To find the graphics.attr entry to use for a data file entry, the code first searches for an entry in graphics.attr with the same variety field as the entry from the data file; if there aren't any of those, it then tries matching on kind, and if none match on that, on type.


For more information, see the index to the technical documentation.


Last modified: Fri Jan 24 16:47:28 1997 SourceForge.net Logo