|
GLG Toolkit, C / C++ API Library
Version 4.6
|
This group contains methods for querying objects, their properties and relations to other objects. More...
This group contains methods for querying objects, their properties and relations to other objects.
Functions | |
| GlgObjectC (GlgObjectC &parent, char *resource_name) | |
| Constructor, Intermediate API: associates this object with a named resource object inside another object. More... | |
| GlgObject | CreatePointArray (GlgControlPointType type) |
| ADVANCED: Creates and returns an array containing all control points of an object. More... | |
| GlgObject | CreateResourceList (GlgBoolean list_named_res, GlgBoolean list_def_attr, GlgBoolean list_aliases) |
| Returns a list of an object's resources. More... | |
| GlgCube * | GetBoxPtr (void) |
| Returns an object's bounding box extent in screen coordinates. More... | |
| GlgObject | GetParent (GlgLong *num_parents) |
| Returns an object's parent object, if one exists. More... | |
| GlgObject | GetResourceObject (char *resource_name) |
| Find a resource object. More... | |
| GlgObject | GetTagObject (char *search_string, GlgBoolean by_name, GlgBoolean unique_tags, GlgBoolean single_tag, GlgTagType tag_type_mask) |
| Retrieves a tag object with a specified tag name, data tag source, or export tag category, or retrieves a list of tags matching the specified tag name, tag source or category pattern. More... | |
| GlgBoolean | HasTag (char *tag_name, GlgTagType tag_type_mask) |
| Checks if a data or export tag with a specified tag name exists. More... | |
| GlgBoolean | Load (GlgObjectC &parent, char *resource_name=NULL) |
| Finds a resource. More... | |
| GlgObject | QueryTags (GlgTagType tag_type_mask) |
| Returns a group of all tags of the requested tag type defined in the object. More... | |
| GlgObjectC | ( | GlgObjectC & | parent, |
| char * | resource_name | ||
| ) |
Constructor, Intermediate API: associates this object with a named resource object inside another object.
| parent | The parent object whose resources are queried. |
| resource_name | A string that specifies a resource path to access the resource object inside the parent. If NULL, the parent object itself is used. |
This is a wrapper for GlgGetResourceObject, see GlgGetResourceObject for more information.
| GlgObject CreatePointArray | ( | GlgControlPointType | type | ) |
ADVANCED: Creates and returns an array containing all control points of an object.
This is a wrapper for GlgCreatePointArray.
| type | The type of points to be returned:
|
| GlgObject CreateResourceList | ( | GlgBoolean | list_named_res, |
| GlgBoolean | list_def_attr, | ||
| GlgBoolean | list_aliases | ||
| ) |
Returns a list of an object's resources.
This is a wrapper for GlgCreateResourceList.
| list_named_res | Include named resources if True. |
| list_def_attr | Include default attributes if True. The resource objects referred to by the default resource names are not actually included in the list. Instead a dummy scalar data object (type D) is included whose name is the same as the default attribute. |
| list_aliases | Include aliases if True. The resource objects referred to by the aliases are not included in the list. Instead a dummy scalar data object (type D) is included whose name is the same as the alias. |
The list_named_res, list_def_attr and list_aliases parameters let you choose whether the returned array should include named resources, default attributes, aliases or any combination of the above.
The returned array has one entry for each resource. The entries are not sorted and are listed in the order of the occurrence inside their category. The named resources (if any) are listed first, then default resources and finally the aliases.
For named resources, the entries are the object IDs of the resource objects themselves. For default resources and aliases, the entries are dummy scalar data objects named after the default attributes or aliases. For both types of entries, the name of the entry object is the name of the resource listed.
The following code fragment shows how to print the list of an object's resources:
The method returns the resource list on only one level of the resource hierarchy. To see the resource lists of the returned resources, invoke CreateResourceList recursively using one of the following techniques:
| GlgCube* GetBoxPtr | ( | void | ) |
Returns an object's bounding box extent in screen coordinates.
This is a wrapper for GlgGetBoxPtr.
The returned pointer points to internal structures which are valid only while the object exists and should not be modified. The object box may be converted to world coordinates by using the GetDrawingMatrix, InverseMatrix and TransformPoint methods.
Returns an object's parent object, if one exists.
or an array of all parents for constrained data objects. This is a wrapper for GlgGetParent.
| num_parents | A pointer used to return the number of parents attached to the object. If it is NULL, an error message will be generated if the object has more than one parent. |
For constrained data objects, there may be more than one parent object. In this case, the method returns an array of parent object IDs and sets num_parents, which may be used to check whether a data object is constrained.
The returned object ID is a pointer to an internal data structure and it should not be dereferenced. To keep it from being destroyed when the parent object is destroyed, you can reference it with Reference (and dereference later). If the return value is an array of parents and you want to keep it around, the safer method to keep it is to create a copy using GLG_SHALLOW_CLONE. This prevents the array's elements from being modified by the GLG internals.
This method must be called after the hierarchy is created.
| GlgObject GetResourceObject | ( | char * | resource_name | ) |
Find a resource object.
Retrieves an object ID of a resource object inside this object. This is a wrapper for GlgGetResourceObject.
| resource_name | A string that specifies a resource path to access the resource object inside this. |
This method finds and returns a named resource of the this object or an object ID its attribute. It cannot be used to access attributes that are not objects, such as an object's Name.
If the resource is not found, the method returns NULL. No error message is generated in this case, so this method can be used to query an object's existence.
The returned object ID can be assigned to a GlgObjectC instance that will store and reference it.
| GlgObject GetTagObject | ( | char * | search_string, |
| GlgBoolean | by_name, | ||
| GlgBoolean | unique_tags, | ||
| GlgBoolean | single_tag, | ||
| GlgTagType | tag_type_mask | ||
| ) |
Retrieves a tag object with a specified tag name, data tag source, or export tag category, or retrieves a list of tags matching the specified tag name, tag source or category pattern.
This is a wrapper for GlgGetTagObject.
| search_string | A string or a pattern for the search, supporting wildcards: ? (matches any single character) and * (matches any sequence of characters). |
| by_name | If True, the search is performed by matching the tag names, otherwise the search is done by matching the tag sources for data tags or matching the tag categories for export tags. |
| unique_tags | Controls if only one tag is included in case there are multiple data tags with the same TagName or TagSource (is ignored in the single tag mode and when searching for export tags):
|
| single_tag | Defines the single tag (True) or multiple tag (False) mode. In the single tag mode, the first found tag object of the highest priority matching the search criteria will be returned. Input tags are prioritized over output tags, and enabled tags over disabled tags. |
| tag_type_mask | Defines the type of tags to query: data tags or export tags. For export tags, tag type constants may be combined with bitwise OR to query multiple subtypes of export tags. |
The GetElement and GetSize methods may be used to handle the returned group object in the multiple tag mode.
| GlgBoolean HasTag | ( | char * | tag_name, |
| GlgTagType | tag_type_mask | ||
| ) |
Checks if a data or export tag with a specified tag name exists.
This is a wrapper for GlgHasTag.
| tag_name | Specifies the TagName to query, supporting wildcards: ? (matches any single character) and * (matches any sequence of characters). |
| tag_type_mask | Defines the type of tags to query: data tags or export tags. For export tags, tag type constants may be combined with bitwise OR to query multiple subtypes of export tags. |
| GlgBoolean Load | ( | GlgObjectC & | parent, |
| char * | resource_name = NULL |
||
| ) |
Finds a resource.
Replaces the stored object with a resource object of the parent object.
| parent | The parent object whose resources are queried. |
| resource_name | A string that specifies a resource path to access the resource object inside the parent. If NULL, the parent object itself is used. |
This is a wrapper for GlgGetResourceObject, see GlgGetResourceObject for more information. The C++ version automatically references the stored resource object.
| GlgObject QueryTags | ( | GlgTagType | tag_type_mask | ) |
Returns a group of all tags of the requested tag type defined in the object.
This is a wrapper for GlgQueryTags.
| tag_type_mask | Defines the type of tags to query: data tags or export tags. For export tags, tag type constants may be combined with bitwise OR to query multiple subtypes of export tags. |
Each element of the returned group is an attribute object that has a tag attached. The GetElement and GetSize methods may be used to handle the returned group object.