Tagging Primitives within a Segment

GpiSetTag inserts a long integer value, called a tag, at the current element pointer position. The tag becomes a segment element, which serves as an identifier for the primitives that follow until the next tag is issued. Tags also are called pick tags or pick identifiers. Typically, applications assign tags only to elements that correspond to primitives. You can determine the value of the last tag assigned to an element using GpiQueryTag.

Note: Tags are used only in correlation. They are not used in the chaining or calling of segments, nor do they cause or modify output.

The long integer value of the tag is 0 by default. However, a 0 value makes the subsequent primitives undetectable. An application can use this effect to make some parts of a segment detectable and other parts of it non-detectable. If you know that this capability is unnecessary, you can change the default tag value using GpiSetDefTag.

The tag you specify becomes the current tag, and it applies to all subsequent primitives until you next call GpiSetTag. The tag can be considered one of the attributes of the primitive and therefore affected by the current attribute mode. In AM_PRESERVE mode, it is stored on the LIFO stack and can be recalled with GpiPop. Tags cannot be inserted between a GpiBeginArea and GpiEndArea area bracket. All primitives within an area have the same tag.

A tag value greater than 0 enables correlation on the subsequent primitives, but only if the segment ID is greater than 0 as well. The data returned from each correlation consists of a set of segment-tag pairs. The reason for this pairing is that a single segment can draw objects in several locations. By adding identifiers within the segment, an application has a more exact description of what has intersected the pick aperture.

For simple chained segments, each unique segment-tag pair within the pick aperture is known as a hit. If two or more primitives in the pick aperture have the same tag, they are considered a single hit. Hits for called segments differ slightly and are described in The lMaxDepth Input Parameter.


[Back: Correlating Retained Graphics]
[Next: Correlation Functions for Retained Graphics]