Functions | |
void | Show_Selection_Element (HC_KEY *key, int *offset1, int *offset2, int *offset3) |
void Show_Selection_Element | ( | HC_KEY * | key, |
int * | offset1, | ||
int * | offset2, | ||
int * | offset3 | ||
) |
Returns the key of the database element that was selected by the user, plus an offset within that element.
key | - The key of the "best match" element of your scene. Passed by reference always. Returned to user. |
offset1 | - A rough indication of what came closest within the element pointed to by key. See below for details. Passed by reference always. Returned to user. |
offset2 | - As above. |
offset3 | - As above. |
Once a "selection" event has reached the front of the event queue and become the current event---either by enabling selection events and calling Await_Event() , or by calling Get_Selection() to do all the work---your program can ask for details about it. Show_Selection() and Get_Selection() return the name of the segment that was selected; Show_Selection_Element() can be used to identify the exact element in either case. The information is returned as a key and three offsets. The key is that of the item of geometry if geometry was selected, or of the segment itself if a window was selected. The key might be compared against a list of "interesting" keys saved from the original calls to Insert_Polygon() , Insert_Polyline() , etc., or it can be used in calls to the geometry "Show" routines ( Show_Key_Type() , Show_Polygon() , etc.)
The offsets have the following meanings when the key value is:
Negative offsets will only be returned if a window is the selected element. This is a quick way to differentiate between window selections and geometry selections.
If a variety of types of keys are selectable, Show_Key_Type() might be helpful in determining the meaning of key.
If the selecting situation is totally ambiguous---a polyline was defined with coincident vertices, for example, or two polygons occupy the same position on the screen (and hidden surfaces are not enabled)---the system will have made an arbitrary choice. See Find_Related_Selection() .
If the heuristic "internal selection element = -1" is set, then the subgeometry elements defined in offset1, offset2 and offset3 are not guaranteed to be the best elements for that specific piece of geometry. For example, if a shell that represented a sphere was selected, then a back face may be passed back rather than the face on the front of the sphere.