Tuesday, July 25, 2006

Session Graphics 101

Session Graphics in the GTViewer Family of products are Redlines. They are called Session Graphics because the redlines are stored in a user’s Session. Redlines are non-destructive graphics drawn on top of the GIS data. They can be used for many things including making notes, capturing data, correcting data, clarifying data, etc. Session Graphics can also be shared with other uses, taken back to the GIS, or simply disposed of.

When a GTViewer dataset is created, a Session Category is generally defined in the data (in the .GTM file). A session category is similar to any of the other Categories in the GTViewer data, except that it does not have a predefined graphics file (.gtg) or a predefined spatial index (.gtn). Instead, the Session Category points to the user’s session which can be a GTViewer Session File (.GTS) file or the embedded session in an extract file (.GTX). Session Graphics can also be exported as a GTViewer graphics file (.GTG), Shapefiles, .DGN files, or XML.

While Session Graphics may appear somewhat straightforward, there are many features they provide that might not be readily apparent. A session graphics element supports both Keys (linkages) and embedded data (for more information on the differences between keys and embedded data, see Linkages and Embedded Data).


Current State Properties

The basics for Session Graphics are the same in all of the GTViewer Family of products: GTViewer, GTVx, Pocket GTViewer, GTWeb, and the Pocket GTViewer Control. There exists a set of properties that define many of the characteristics of session graphic elements. This set of properties consists of FilterId, ColorId, StyleId, Weight, and ExtendedStyle; and these properties use a current state concept. When one of these properties is set to a value, all session graphics elements created subsequently will use this property’s value; until it is changed to another value. So if you set the current ColorId to 3, then add a line, a circle, and a text element; all of these elements will use color id 3.

Filter Id and Session Graphics

Filter Id is an important property that is sometimes not fully understood. Filter ids are used for several different things, and this is probably why they are sometimes confusing. Filter Ids are a way to group common elements; they can be thought of as layers or levels and each GTViewer category can (currently) have 500 unique filter ids. The Filter Definition files (.flt files defined in the category sections of the .GTM file) specify a name and several properties for each Filter Id (such as min and max display thresholds and selectability).

Filter Ids are used by several important mechanisms in GTViewer, such as Display Control and Style Rules. Display Control (or the Display Filter, which is the origin of the term filter id) determines which elements are displayed either by turning an entire category on or off, or by turning individual filter ids within a category on or off. The grouping of common features provided by the filter ids provides a logical and effective method for controlling the display.

Style Rules are another feature that uses Filter Ids. Style Rules map a style definition to a particular filter id in a particular category. Once mapped, all elements in the category with the filter id have the mapped style definition applied to them before rendering. Some data uses style rules for all symbology, some data uses instance-based symbology with no style rules, and some data uses a mixture of style rules and instance-based symbology. For more information on Style Rules, see The Dynamic Display.

Adding Embedded Data to Session Graphics Elements

Unlike the element characteristics specified with the current state properties like FilterId, color id, style id, and weight; Embedded Data and Keys, use an only-for-the-next-element concept. So if you set Embedded Data to a value, the data will be embedded on the next session graphics element added, but then will be reset. So, if you set the Embedded Data to a value, place a line, and then place a circle; only the line will have embedded data.

Embedded Data can be any text string you want to store on the element; however, if you use the t-a-v format, the embedded data will automatically be processed like a database record. The t-a-v format is very simple:



You specify a one or more records by starting with \t followed by the table name. Then for each attribute/value pair, add \a followed by the attribute name, and \v following by the attribute value. You can repeat the \a\v pairs for as many attributes as you need. If you need to represent more than one record, simply add another \t entry followed by a set of \a\v pairs. For example:

\tPole\aPole_Number\v1234\aHeight\v45\aClass\v1

Would represent:

Table: Pole

Attr 1: Pole_Number=1234

Attr 2: Height=45

Attr 3: Class=1

Embedded Data is a very power tool for collecting attribute data along with graphics and can be processed in many ways. GTRead can read this information, and so can the automation layer in GTViewer and GTVx. GTViewer can export just embedded data (by table) as wells as export XML containing the both geometry and tabular information (including the embedded data). There is also a GTData tool called GTFormatInfo that can read a .GTG or .GTX file and export the embedded data in a user-specified format (like SQL Updates, CSV files, etc.).

Adding Keys to Session Graphics Elements

Keys are simply one or two 32 bit integer values embedded into the Session Graphics element. When an element is reviewed (with Attribute Info or through programmatic means), the keys on the element are retrieved and then the database associated with the element’s category is queried to find any tabular information with the same keys. This process can return one or more records from one or more different tables. For example, a Pole might have a Pole Table, a Work Order Table, and a Common Table; and the Work Order Table may have multiple records for the same pole.

Setting Keys works the same way as Embedded Data; setting the keys to a value only applies to the next element added.

A Session Category can use any of the existing database information associated with the GIS data; however, there turns out to be a more important use for keys in the Session Category. Keys are an easy way to manage the elements in the Session Category. If you assign a Session Category element a unique key, then you can manage that element with that key. It can be deleted, edited, or reviewed using this key (none of which may require the GIS database as keys normally do).

Group Elements

Group Elements are special elements that contain more than one element (sub-elements), but are treated as a single element. The group concept is generally simple, but it can seem complicated when Embedded Data and Keys are thrown in to the mix. A Group element contains one or more sub-elements; each sub element can have it own color id , weight, style id, and extended style; but filter id, embedded data, and keys are only allowed on the Group element itself. Nested Groups are not allowed (meaning you can add a group element as a sub-element in another group element).

No comments: