GLG Toolkit, Java Class Library  Version 4.5
2. Intermediate API Methods

Detailed Description

This group contains GLG Intermediate API methods of the GlgObject class.

These methods provide additional methods that can be used to traverse all objects defined in the drawing to discover the structure of the drawing, perform coordinate conversion or implement custom object manipulation, such as dragging objects with the mouse.

It also includes:

Functions

void AbortGISRequest (String resource_name)
 Aborts a GIS object's asynchronous map loading request in progress, if any. More...
 
boolean AddDataSampleNode (GlgDataSampleNode node, boolean quick_mode)
 Adds a data sample node directly to the plot's data buffer. More...
 
static void AddHandler (String handler_name, GlgHandler handler)
 Registers a custom interaction handler. More...
 
boolean ConstrainObject (GlgObject to_attribute)
 Constrains an attribute or a point of the object to an attribute or a point of another object. More...
 
boolean ContainsObject (Object object)
 Checks if object belongs to the container. More...
 
GlgObject CreateChartSelection (GlgObject plot, double x, double y, double dx, double dy, boolean screen_coord, boolean include_invalid, boolean x_priority)
 Selects the chart's data sample closest to the specified position. More...
 
static GlgDataSampleNode CreateDataSampleNode (GlgObject plot, boolean extended)
 Creates a data sample node to be used with the AddDataSampleNode method. More...
 
GlgObject CreateInversedMatrix ()
 ADVANCED: Inverts the matrix object. More...
 
static GlgObject CreateMessage (GlgObject viewport)
 Creates a GLG message object that may be sent by an interaction handler to a parent handler or a parent's Input callback via SendMessageToParent. More...
 
GlgObject CreatePointArray (GlgControlPointType type)
 ADVANCED: Creates and returns an array containing all control points of the object. More...
 
GlgObject CreateResourceList (boolean list_named_res, boolean list_def_attr, boolean list_aliases)
 Returns a list of the object's resources. More...
 
static GlgObject CreateSelection (GlgObject top_vp, GlgCube rectangle, GlgObject selected_vp)
 Returns a list of the objects intersecting a given rectangle. More...
 
static GlgObject CreateSelection (MouseEvent mouse_event, int delta, GlgObject top_vp, GlgObject selected_vp)
 Returns a list of names of objects located under the mouse. More...
 
String CreateTooltipString (double x, double y, double dx, double dy, String format)
 Creates and returns a chart or axis tooltip string corresponding to the specified position in screen coordinates. More...
 
boolean DeleteTags (GlgTagType tag_type_mask)
 Deletes all data tags or all public properties inside the object the method is invoked on. More...
 
static boolean EnableAttachmentPoints (boolean state)
 Controls the use of attachment points to determine object extents when the objects are aligned. More...
 
boolean FindObjects (GlgFindObjectsData data)
 Finds either one or all parents or children of the object that match the supplied search criteria. More...
 
boolean FitObject (GlgCoordType coord_type, GlgCube box, boolean keep_ratio)
 Fits the object to the specified rectangular area. More...
 
static void FreeDataSampleNode (GlgObject plot, GlgDataSampleNode node)
 Returns a data sample node to the plot cache for reuse, if possible. More...
 
GlgObject GetAction (GlgActionType action_type, GlgTriggerType trigger_type, int button, GlgArmedStateType armed_state, GlgDoubleClickStateType double_click_state, String action, String subaction, boolean enabled_only)
 Returns the first found action with the matching parameters attached to the object. More...
 
GlgObject GetAlarmObject (String alarm_label, boolean single_alarm)
 Retrieves an alarm object with a specified alarm label inside the object the method is invoked on. More...
 
GlgCube GetBox ()
 Returns the object's bounding box extent in screen coordinates. More...
 
GlgObject GetDrawingMatrix ()
 ADVANCED: Returns transformation matrix used to draw the object. More...
 
Object GetElement (int index)
 Returns element at the specified position in the container. More...
 
GlgGISRequestObserver GetGISRequestInfo (String resource_name)
 Obtains information about an asynchronous map loading request in progress for the GIS object the method is invoked on. More...
 
static Object GetHandlerData (GlgObject viewport)
 Retrieves stored data used by a custom handler instance. More...
 
int GetIndex (Object object)
 Returns index of the first occurrence of an object in the container. More...
 
GlgObject GetLegendSelection (double x, double y)
 Returns the plot object corresponding to the legend item at the specified position in the legend object the method is invoked on, if any. More...
 
GlgMatrixData GetMatrixData (GlgMatrixData matrix_data)
 ADVANCED: Queries matrix coefficients of the matrix. More...
 
GlgObject GetNamedObject (String name)
 Finds an object with the specified name inside the container of GLG objects and returns it. More...
 
static GlgDataSample GetNodeDataSample (GlgDataSampleNode node)
 Returns the datasample contained in the node. More...
 
int GetNumParents ()
 ADVANCED: Returns number of the object's parents. More...
 
Object GetObjectData ()
 Retrieves application data attached to the object via SetObjectData. More...
 
GlgObject GetObjectViewport (boolean heavy_weight, boolean self)
 Returns parent viewport of the drawable object. More...
 
GlgObject GetParent ()
 ADVANCED: Returns the object's parent object, if one exists, or an array of all parents for constrained data objects. More...
 
GlgObject GetParentViewport (boolean heavy_weight)
 Returns parent viewport of the drawable object. More...
 
Object GetResource (String resource_name)
 Deprecated, use GetNativeComponent:
Returns an ID of a native resource. More...
 
GlgObject GetResourceObject (String resource_name)
 Finds and returns a named resource or an attribute of the object. More...
 
static GlgObject GetSelectedPlot ()
 Returns the plot object corresponding to the last legend item selected with the mouse, if any. More...
 
int GetSize ()
 Returns size of the container object. More...
 
int GetStringIndex (String search_string)
 Returns index of the first occurrence of a string in the container of the STRING type. More...
 
GlgObject GetTagObject (String search_string, boolean by_name, boolean unique_tags, boolean single_tag, GlgTagType tag_type_mask)
 Retrieves a tag object with a specified tag name, data tag source, or export tag category inside the object the method is invoked on. More...
 
boolean HasTag (String tag_name, GlgTagType tag_type_mask)
 Checks if a data or export tag with a specified tag name exists inside the object the method is invoked on. More...
 
boolean InstallGISRequest (String resource_name)
 Installs a new map received by the GIS request in the GIS object. More...
 
void Inverse ()
 Inverses the order of elements inside the container object. More...
 
boolean IsAt (GlgPositionType position)
 Checks the position of the iteration pointer (the current element of the container). More...
 
boolean IsDrawable ()
 Checks if the object is drawable. More...
 
Object Iterate ()
 Traverses the container object's elements in the forward direction. More...
 
Object IterateBack ()
 Traverses the container object's elements in the backward direction. More...
 
boolean LayoutObjects (GlgObject anchor, GlgLayoutType type, double distance, boolean use_box, boolean process_subobjects)
 Performs operations ranging from setting an object's width and height to aligning and layout of groups of objects. More...
 
boolean MoveObject (GlgCoordType coord_type, GlgPoint start_point, GlgPoint end_point)
 Moves an object by a move vector. More...
 
boolean MoveObjectBy (GlgCoordType coord_type, double x, double y, double z)
 Moves the object by the specified distances. More...
 
boolean MoveObjectBy (GlgCoordType coord_type, GlgPoint point)
 Moves the object by distances specified by the GlgPoint object. More...
 
boolean PositionObject (GlgCoordType coord_type, GlgAnchoringType anchoring, double x, double y, double z)
 Positions the object at the specified location. More...
 
boolean PositionObject (GlgCoordType coord_type, GlgAnchoringType anchoring, GlgPoint position)
 Positions the object at the location specified by the GlgPoint object. More...
 
Double PositionToValue (String resource_name, double x, double y, boolean outside_x, boolean outside_y)
 Returns a value corresponding to the specified position on top of the Chart or an Axis object. More...
 
GlgDouble PositionToValueObj (String resource_name, double x, double y, boolean outside_x, boolean outside_y)
 Returns a value corresponding to the specified position on top of the Chart or an Axis object. More...
 
GlgObject QueryTags (GlgTagType tag_type_mask)
 Returns a group of all tags of the requested tag type defined in the object. More...
 
void ReleaseObject (GlgObject suspend_info)
 Releases the object that was suspended for editing. More...
 
boolean ReorderElement (int current_index, int new_index)
 Changes an element's position inside the container. More...
 
boolean RequestGISMap (String resource_name, double extent_x, double extent_y, double center_x, double center_y, double angle, GlgProjectionType projection, String layers, GlgGISRequestFlags flags, GlgGISRequestObserver request_observer)
 Initiates an asynchronous GIS map loading request. More...
 
boolean RequestGISZoom (String resource_name, char type, double value, GlgGISRequestObserver request_observer)
 Initiates an asynchronous GIS zooming or panning request compatible with the SetZoom method interface. More...
 
static boolean RootToScreenCoord (GlgObject viewport, GlgPoint point)
 Converts screen coordinates relative to the root window to the screen coordinates in the specified viewport. More...
 
boolean RotateObject (GlgCoordType coord_type, GlgPoint center, double x_angle, double y_angle, double z_angle)
 Rotates the object. More...
 
boolean SaveObject (Object medium, GlgMediumType medium_type)
 Saves the object into a stream using a default charset. More...
 
boolean SaveObject (Object medium, GlgMediumType medium_type, String charset_name)
 Saves the object into a stream using the specified charset. More...
 
boolean SaveObject (String filename)
 Saves the object to a file using a default charset. More...
 
boolean SaveObject (String filename, String charset_name)
 Saves the object to a file using the specified charset. More...
 
boolean ScaleObject (GlgCoordType coord_type, GlgPoint center, double x_scale, double y_scale, double z_scale)
 Scales the object. More...
 
boolean ScreenToWorld (boolean inside_vp, GlgPoint in_point, GlgPoint out_point)
 Converts a point's screen coordinates to the GLG world coordinate system. More...
 
static void SendMessageToParent (GlgObject viewport, GlgObject message_obj, String action, String subaction)
 Sends a message to the Input callback. More...
 
static void SetCustomSetupHandler (GlgCustomSetupHandler handler)
 Installs a custom setup handler that will be invoked to perform custom processing of objects tagged using the CustomSetup flag in the GLG drawing. More...
 
void SetEnd ()
 Initializes the container object for the backward traversing. More...
 
static void SetHandlerData (GlgObject viewport, Object data)
 Stores data used by the custom handler instance. More...
 
void SetMatrixData (GlgMatrixData matrix_data)
 ADVANCED: Sets matrix's coefficients to the supplied values. More...
 
void SetObjectData (Object data)
 Attaches arbitrary application data to the graphical object the method is invoked on. More...
 
GlgGISRequestObserver SetScrollbarObserver (String resource_name, GlgGISRequestObserver request_observer)
 Controls the the way integrated scrollbars work for the GIS object. More...
 
void SetStart ()
 Initializes the container object for the forward traversing. More...
 
GlgObject SuspendObject ()
 Suspends the object for editing after it has been drawn. More...
 
static boolean TraceObject (GlgObject object, boolean state, boolean is_widget, GlgObject top_parent, GlgObjectActionInterface action)
 Highlights all objects in the drawing that depend on the tag or resource object that is being traced. More...
 
boolean TransformObject (GlgObject xform, GlgCoordType coord_type, GlgObject parent)
 ADVANCED: Transforms all control points of the object with an arbitrary transformation. More...
 
void TransformPoint (GlgPoint in_point, GlgPoint out_point)
 Transforms a single point using the matrix object the method is invoked on. More...
 
static boolean TranslatePointOrigin (GlgObject from_viewport, GlgObject to_viewport, GlgPoint point)
 Converts screen coordinates of a point in one viewport to the screen coordinates of another viewport. More...
 
void TraverseObjects (GlgObjectActionInterface action)
 Traverses the object hierarchy of the object and and performs the specified actions on the object itself and all its subobjects, including object attributes. More...
 
boolean UnconstrainObject ()
 Unconstrains the object's attribute or the object's point. More...
 
boolean WorldToScreen (boolean inside_vp, GlgPoint in_point, GlgPoint out_point)
 Converts a point's coordinates from the GLG world coordinate system to the screen coordinate system. More...
 

Function Documentation

◆ AbortGISRequest()

void AbortGISRequest ( String  resource_name)

Aborts a GIS object's asynchronous map loading request in progress, if any.

Parameters
resource_nameA resource path of a child GIS object, or null to abort an asynchronous map loading request for the GIS object the method is invoked on. The resource path is relative to the invoking object.

◆ AddDataSampleNode()

boolean AddDataSampleNode ( GlgDataSampleNode  node,
boolean  quick_mode 
)

Adds a data sample node directly to the plot's data buffer.

This method is used to quickly prefill a chart with a large number of samples.

Parameters
nodeA data sample node containing the data sample to be added. CreateDataSampleNode may be used to create data sample nodes.
quick_mode

Enables a quick mode that bypasses chart autoscroll and autoscale logic for faster chart prefilling, and also disables all validity checks for increased performance.

When the last data sample is added, a chart with the SCROLL X axis can be scrolled to show the last added sample by setting EndValue of the chart's X axis to the timestamp of the last data sample.

For a chart with the SWEEP X axis, the UpdateChartTimeAxis method can be used to scroll the chart.

The UpdateChartState method may also be used to update the chart's autoscale and scrollbars when done.

Returns
Success or failure status.

This method is used to enhance performance of prefilling a chart with a large number of data samples. For periodic updates, new data may be pushed into the plot's entry points using SetDResource or SetDTag.

It is recommended that the initial development is done with the quick mode disabled, enabling it when all potential errors have been dealt with.

The examples_java/RealTimeChart/GlgChart.java file in the GLG installation directory provides a coding example of prefilling a chart with data using AddDataSampleNode.

◆ AddHandler()

static void AddHandler ( String  handler_name,
GlgHandler  handler 
)
static

Registers a custom interaction handler.

Parameters
handler_nameThe handler name. The name may be assigned to the Handler attribute of a viewport or a light viewport in the GLG drawing. The name should start with the $ character to avoid generating error messages in GLG editors if the handler assigned to the viewport is not activated in the editor via the GLG Editor Custom Option DLL described here.
handlerThe handler's interface that implements the handler's functionality.

See GlgHandler for more information.

◆ ConstrainObject()

boolean ConstrainObject ( GlgObject  to_attribute)

Constrains an attribute or a point of the object to an attribute or a point of another object.

This method constrains an attribute or a point object stored in the object the method is invoked on. To obtain the object ID of the attribute or point object to be constrained, the GetResourceObject method must be used with a default resource name rather than a user-defined resource name as the last part of resource path. For example, "object1/FillColor" must be used to get the object ID of the FillColor attribute of my_object, and not "my_object/my_color".

For objects that have a fixed number of control points (Arc, Text, etc.), use the default attribute name ("PointN") to access an object's Nth control point. For objects with a variable number of points (e.g. polygons), use the GetElement or Iterate method to get its points and use them as the from_attribute.

Parameters
to_attributeThe attribute or the point to constrain to. This object may be queried by using either the default or a user-defined resource name.
Returns
Success or failure status.

The method constrains the attribute or the point the method is invoked on to the attribute or the point specified by to_attribute. If two attributes are constrained, changing the value of either attribute changes the values of both. For more information about constraining, see the Constraints section in the Structure of a GLG Drawing chapter of the GLG User's Guide and Builder Reference Manual.

If the object whose attribute is being constrained has already been drawn, an error message will be generated. You should either constrain object attributes before drawing the object or use the SuspendObject and ReleaseObject methods to temporarily suspend a drawn object for editing.

You cannot constrain any objects beside attribute objects (a control point is an attribute object as well). The objects being constrained must be of the same data subtype. That is, you cannot constrain a color attribute object (eref GlgDataType.G "G" type) to the line width attribute object (D "D" type) because they have different data types.

If any of the conditions above are not satisfied, the method fails and returns false. If constraining is successful, the method returns true.

Note that constraining an attribute object causes all the attributes of the attribute object to be identical to the attributes of the object to which it is constrained, including its name, transformation and value. If a transformation is added to an attribute object, it is automatically added to all the attribute objects that are constrained to this attribute object in order to maintain the constraints.

Similarly, if the object name is changed, it is automatically changed for all the objects that are constrained to the object. These changes are permanent and remain in effect even after the constraints are removed.

◆ ContainsObject()

boolean ContainsObject ( Object  object)

Checks if object belongs to the container.

Parameters
objectThe object to search for.
Returns
true if the object is found in the container, false otherwise.

◆ CreateChartSelection()

GlgObject CreateChartSelection ( GlgObject  plot,
double  x,
double  y,
double  dx,
double  dy,
boolean  screen_coord,
boolean  include_invalid,
boolean  x_priority 
)

Selects the chart's data sample closest to the specified position.

The method selects the data sample closest to the specified position in the chart the method is invoked on and returns a message object containing the selected sample's information.

Parameters
plotAn optional plot object:
  • If it is not null, the method queries only the samples in that plot.
  • If it is null, the method queries data samples in all plots of the chart and selects the sample closest to the specified position.
x,ySpecify the position inside the chart:
  • If screen_coord=true, the position is defined in the screen coordinates of the chart's parent viewport. When the mouse position is used, add COORD_MAPPING_ADJ to the x and y screen coordinates of the mouse for precise mapping.
  • If screen_coord=false, the x position is defined as an X or time value, and the y position is defined in relative coordinates in the range [0; 1] to allow the chart to process selection for plots with different ranges (0 corresponds to the Low range of each plot, and 1 to the High range).
dx,dySpecify an extent around the point defined by the x and y parameters. The extent is defined in the same coordinates as x and y, depending on the value of the screen_coord parameter. Only the data samples located within the dx and dy distances of the specified position are considered for the selection.
screen_coordControls the way the x and y parameters are interpreted:
  • If true, the x and y parameters supply screen coordinates in the chart's parent viewport.
  • If false, x and y supply relative value, see description of the x and y parameters above.
include_invalid
  • If true, invalid data samples are considered for selection
  • If false, invalid samples are never selected.
x_priority
  • If true, the method selects the data sample closest to the specified position in the horizontal direction with no regards to its distance from the specified position in the vertical direction.
  • If false, a data sample with the closest distance from the specified position is selected.
Returns

The information about the selected data sample is returned in the form of a message object described in the Chart Selection Message Object section in the Appendix B of the GLG Programming Reference Manual.

The method returns null if no data sample matching the selection criteria was found.

◆ CreateDataSampleNode()

static GlgDataSampleNode CreateDataSampleNode ( GlgObject  plot,
boolean  extended 
)
static

Creates a data sample node to be used with the AddDataSampleNode method.

The method returns a cached data sample node if available, otherwise it creates a new one and returns it.

A data sample node contains a GlgDataSample object that may be retrieved from the node using GetNodeDataSample. Properties of the data sample must be filled before adding it to the plot using AddDataSampleNode.

Unused data sample nodes that were not added to a chart may be returned to a cache using FreeDataSampleNode.

Parameters
plotAn optional plot the data sample node will be added to. If plot is provided, a new data sample node will be taken from the plot's cache, if possible:
  • If the plot doesn't use a cache, this parameter may be set to null.
  • If the plot uses cache, the method returns a data sample node from the cache, if available:
    • If the plot cache is empty, or if the plot parameter is null, the datasample node will be taken from a global cache.
    • If the global cache is empty, a newly created datasample node will be returned.
extendedThe type of the data sample to be created inside the node:
Returns
A new node containing a data sample of the requested type.

◆ CreateInversedMatrix()

GlgObject CreateInversedMatrix ( )

ADVANCED: Inverts the matrix object.

Returns
The inverse of the matrix.

This method may be used to invert the drawing transformation obtained using GetDrawingMatrix. While the drawing transformation converts world to screen coordinates, the inverse of it may be used to convert the screen coordinates of objects and object bounding boxes back to world coordinates.

◆ CreateMessage()

static GlgObject CreateMessage ( GlgObject  viewport)
static

Creates a GLG message object that may be sent by an interaction handler to a parent handler or a parent's Input callback via SendMessageToParent.

Parameters
viewportThe handler's viewport.
Returns
New message object.

The message object's Origin resource will be set to the viewport's name, and the Object resource will be set to the viewport's object ID. The handler can add objects containing additional information to the message object.

The message object is usually stored to be reused for the duration of the handler lifetime, as shown in the Sample Implementation.

◆ CreatePointArray()

GlgObject CreatePointArray ( GlgControlPointType  type)

ADVANCED: Creates and returns an array containing all control points of the object.

Parameters
typeThe type of points to be returned:
Returns
An array of G "G" data objects used as control points.

◆ CreateResourceList()

GlgObject CreateResourceList ( boolean  list_named_res,
boolean  list_def_attr,
boolean  list_aliases 
)

Returns a list of the object's resources.

Parameters
list_named_resInclude named resources if true.
list_def_attrInclude 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_aliasesInclude 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.
Returns
An array of the object's resources.

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 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:

GlgObject list = object.CreateResourceList( true, true, false );
if( list != null )
{
int size = list.GetSize();
for( int i=0; i < size; ++i )
{
GlgObject list_element = list.GetElement( i);
System.out.println( "Resource Name: " + list_element.GetObjectName() );
}
}

The method returns 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:

  • Use CreateResourceList on the resources in the returned list. This will only work for the named resources since the default resources and aliases are represented by dummy objects.
  • Get the name of a resource in the returned resource list and use the GetResourceObject method to obtain its object ID, then call CreateResourceList with that object ID. This method is slower but will work for both named resources, default attributes and aliases.

◆ CreateSelection() [1/2]

static GlgObject CreateSelection ( GlgObject  top_vp,
GlgCube  rectangle,
GlgObject  selected_vp 
)
static

Returns a list of the objects intersecting a given rectangle.

This method provides a low-level API to determine whether a mouse event was meant to select graphical objects in a drawing, and may be used inside the Trace callback to implement custom handling of mouse events.

See also CreateSelection that creates selection from an event.

Action objects attached to objects in the drawing provide a higher level interface for custom object selection processing.

Parameters
top_vpThe top viewport or light viewport of the selection query (must be an ancestor of selected_vp or the same as selected_vp). It may be either a viewport or a light viewport.
rectangleThe GlgCube object representing the bounding rectangle in screen coordinates of the selected_vp viewport. All graphical shapes whose rendering intersects this rectangle, including shapes in the top_vp viewport, are included in the selection list.
selected_vpThe viewport relatively to which the bounding rectangle is defined. When used with the mouse events, this is the viewport in which the mouse event occurred. If a light viewport is supplied, its parent viewport will be used.
Returns
An array containing all selected objects, or null if no objects were selected.

This method is similar to CreateSelectionNames method, but it returns an array of objects instead of an array of object names. The objects in the array are listed in the reversed order compared to their drawing order, so that the objects that are at the bottom of the drawing list and are drawn on top of other objects will be listed first in the array.

While CreateSelectionNames reports both the selected objects on the bottom of the hierarchy and all their parents, this method reports only objects at the bottom and doesn't include their parents. For example, if a polygon in a group is selected, only the polygon is reported and not the group. To get information about the parents of selected objects, use the GetParent method.

◆ CreateSelection() [2/2]

static GlgObject CreateSelection ( MouseEvent  mouse_event,
int  delta,
GlgObject  top_vp,
GlgObject  selected_vp 
)
static

Returns a list of names of objects located under the mouse.

This method provides a low-level API to determine whether a mouse event was meant to select graphical objects in a drawing, and may be used inside the Trace callback to implement custom handling of mouse events.

See also CreateSelection that creates selection for the specified area.

Action objects attached to objects in the drawing provide a higher level interface for custom object selection processing.

Parameters
mouse_eventMouse event.
deltaSpecifies the radius of the area around the cursor position that will be used to select objects. All graphical shapes whose rendering intersects this area, including shapes in the top_vp viewport, are included in the selection list.
top_vpThe top viewport or light viewport of the selection query (must be an ancestor of selected_vp or the same as selected_vp). It may be either a viewport or a light viewport.
selected_vpThe viewport in which the mouse event occurred. If a light viewport is supplied, its parent viewport will be used.
Returns
An array containing all selected objects, or null if no objects were selected.

◆ CreateTooltipString()

String CreateTooltipString ( double  x,
double  y,
double  dx,
double  dy,
String  format 
)

Creates and returns a chart or axis tooltip string corresponding to the specified position in screen coordinates.

The method can be invoked on either a Chart or Axis object to create the tooltip for.

Parameters
x,ySpecify a position on top of a chart or an axis in screen coordinates. When using the cursor position, add COORD_MAPPING_ADJ to the cursor's X and Y screen coordinates for precise mapping.
dx,dySpecify the maximum extent in screen pixels around the specified position.
format

Provides a custom format for creating a tooltip string and uses the same syntax as the TooltipFormat attributes of the Chart and Axis objects. If it is set to null or an empty string, the format provided by the TooltipFormat attribute of the chart or the axis will be used.

A special "<single_line>" tag may be prepended to the format string to force the method to remove all line breaks from the returned tooltip string. A "<chart_only>" tag may also be prepended to search only for a chart tooltip and disable search for the axes' tooltips when the method is invoked for a Chart object.

Returns
A Chart or Axis tooltip string containing information about the chart data sample or an axis position at the specified coordinates, or null if no tooltip was created.

If the method is invoked on a Chart object, and the specified position is within the chart's data area, the method selects a data sample closest to the specified position and returns a tooltip string containing information about the sample. The dx and dy parameters define the maximum extent for selecting a data sample, and the TooltipMode attribute of the chart defines the data sample selection mode: X or XY. null is returned if no data samples were found within the dx and dy distances of the specified position.

If the object parameter specifies an Axis, or if the object is a Chart and the specified position is on top of one of the chart's axes, the returned tooltip string contain information about the axis value corresponding to the selected position.

While the Chart object proves an integrated tooltip functionality that automatically displays the tooltip without any application involvement when a mouse is hovering over the chart, CreateTooltipString can be used to generate a string containing information about the data sample under the current mouse position that is displayed as the mouse continuously moves over the chart.

The DEMOS_JAVA/GlgRealTimeChart.java file in the GLG installation directory demonstrates the use of the method to create a tooltip string that displays such cursor feedback information at the top of the chart.

◆ DeleteTags()

boolean DeleteTags ( GlgTagType  tag_type_mask)

Deletes all data tags or all public properties inside the object the method is invoked on.

Parameters
tag_type_maskDefines the type of tags to delete:
Returns
Success or failure status.

This method fails if the object has been set up and drawn. The SuspendObject and ReleaseObject methods may be used to temporarily suspend an object that has been drawn to perform any modifications that require a hierarchy reset.

◆ EnableAttachmentPoints()

static boolean EnableAttachmentPoints ( boolean  state)
static

Controls the use of attachment points to determine object extents when the objects are aligned.

Parameters
stateSpecifies if attachment points should be used in addition to the control points to determine object extents when the objects are aligned using control points.
Returns
The previous state of the setting.

◆ FindObjects()

boolean FindObjects ( GlgFindObjectsData  data)

Finds either one or all parents or children of the object that match the supplied search criteria.

Parameters
dataThe GlgFindObjectsData object that specifies search criteria and returns the search results.
Returns
true if at least one matching object was found, false otherwise.

If one or more matches were found, the the found_object property of GlgFindObjectsData will contain the search result:

  • If the result is a single object, found_multiple property will be set to false.
  • If the result is a group of several matching objects, the found_multiple property will be set to true.

The dont_add_matches property of GlgFindObjectsData may be set to true to prevent adding matching objects to the found_object property when the custom_match interface processes objects in-place, as shown in the DEMOS_JAVA/SCADAViewer/HMIPageC.java file in the GLG installation directory.

See GlgFindObjectsData for more information.

◆ FitObject()

boolean FitObject ( GlgCoordType  coord_type,
GlgCube  box,
boolean  keep_ratio 
)

Fits the object to the specified rectangular area.

Parameters
coord_typeSpecifies the coordinate system for interpreting coordinates of the area to fit to:
  • SCREEN_COORD - the coordinates are interpreted as screen pixels.
  • OBJECT_COORD - the coordinates are interpreted as the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the coordinates are interpreted as the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
boxThe area to fit the object to.
  • If the Z extent of the box is 0, 2D fitting is performed and the object is not scaled in the Z dimension.
  • If the Z extent is not 0, 3D fitting is performed.
keep_ratioControls how the object's X/Y ratio is handled:
  • true to preserve the object's X/Y ratio by using the smallest of the required X and Y scale factors for both directions.
  • false to use different scale factors for X and Y scaling to fit the object to the box more precisely.
Returns
Success or failure status.

This method transforms the object to fit it to the area defined by the box parameter, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ FreeDataSampleNode()

static void FreeDataSampleNode ( GlgObject  plot,
GlgDataSampleNode  node 
)
static

Returns a data sample node to the plot cache for reuse, if possible.

The node and its datasample should not be accessed by the program after the node has been released.

Parameters
plotAn optional plot the data sample node belongs to. If provided (not null), the data sample node will be returned to the plot's cache if it is enabled. Otherwise, the node will be released to the global cache.
nodeThe data sample node to be freed.

◆ GetAction()

GlgObject GetAction ( GlgActionType  action_type,
GlgTriggerType  trigger_type,
int  button,
GlgArmedStateType  armed_state,
GlgDoubleClickStateType  double_click_state,
String  action,
String  subaction,
boolean  enabled_only 
)

Returns the first found action with the matching parameters attached to the object.

Parameters
action_typeAn action type. If zero (0), actions of any type will be considered.
trigger_typeA trigger type. If zero (0), actions with any trigger type will be considered.
buttonA mouse button. If zero (0), actions that are activated by any mouse button will be considered.
armed_stateThe setting of the action's ProcessArmed attribute, see GlgArmedStateType.
double_click_stateThe setting of an action's DoubleClick attribute, see GlgDoubleClickStateType.
actionThe input action string for action objects with INPUT_TRIGGER trigger. If null, action objects with any input action string will be considered.
subactionSpecifies input subaction string for action objects with INPUT_TRIGGER trigger. If null, action objects with any input subaction string will be considered.
enabled_onlyIf true, only actions enabled by the settings of their Enabled attribute will be considered.
Returns
The first matching action object, or null if no matching actions were found.

◆ GetAlarmObject()

GlgObject GetAlarmObject ( String  alarm_label,
boolean  single_alarm 
)

Retrieves an alarm object with a specified alarm label inside the object the method is invoked on.

The search string can contain wildcards to retrieve a list of alarms matching the specified alarm label pattern.

Parameters
alarm_labelA string or a pattern for the search (may include ? and wildcards).
single_alarmDefines a single alarm (true) or multiple alarm (false) mode.
Returns
  • In the single alarm mode, returns an data object that has an attached alarm with the alarm label matching the search criterion.
  • In the multiple alarm mode, returns a group containing all data objects that have alarms with matching alarm labels attached to the objects.
  • null if no matching alarms were found.

The GetElement and GetSize methods may be used to handle the returned group object.

◆ GetBox()

GlgCube GetBox ( )

Returns the object's bounding box extent in screen coordinates.

Returns
The GlgCube object representing the object's bounding box. The box boundaries are in absolute screen coordinates (pixels) and are valid only after the object has been drawn. (That is, after the hierarchy has been set up.)

The method returns an internal object which is valid only immediately after the method call and should not be modified.

The object box may be converted to world coordinates by using the sequence of the GetDrawingMatrix, CreateInversedMatrix and TransformPoint methods.

◆ GetDrawingMatrix()

GlgObject GetDrawingMatrix ( )

ADVANCED: Returns transformation matrix used to draw the object.

Returns
A matrix object that combines matrices of all transformations used to draw the object.

Transformation matrices are only used for geometric transformations, so this method may be called only for graphical objects, like polygons, arcs and text objects. This method must be called after the object has been drawn. (That is, after its hierarchy has been set up.)

The method returns the internal matrix object which is valid only immediately after the method call and should not be modified. To store a matrix for future use, create a copy of it to prevent it from being modified.

Querying the drawing matrix of a viewport returns the drawing matrix used to position the viewport's control points, and not the matrix used to render the objects inside it. To get the drawing matrix the viewport uses to draw objects inside it, query the drawing list of the viewport (the Array resource of the viewport) and use it as a parameter of the GetDrawingMatrix method.

◆ GetElement()

Object GetElement ( int  index)

Returns element at the specified position in the container.

Parameters
indexThe element's position inside the container.
Returns
The element at the specified position.

If the specified index is invalid, an error message is generated and null is returned.

While the method provides the Intermediate API functionality, it is also available in the Standard API when used with a group object returned by CreateTagList.

◆ GetGISRequestInfo()

GlgGISRequestObserver GetGISRequestInfo ( String  resource_name)

Obtains information about an asynchronous map loading request in progress for the GIS object the method is invoked on.

Parameters
resource_nameA resource path of a child GIS object, or null to query the GIS object the method is invoked on. The resource path is relative to the invoking object.
Returns
The request observer of a map loading request in progress, or null if the GIS object has no pending GIS requests.

◆ GetHandlerData()

static Object GetHandlerData ( GlgObject  viewport)
static

Retrieves stored data used by a custom handler instance.

This method is invoked on the viewport or light viewport the handler is attached to.

Parameters
viewportThe viewport the handler is attached to.
Returns
The stored data.

◆ GetIndex()

int GetIndex ( Object  object)

Returns index of the first occurrence of an object in the container.

Parameters
objectThe object to search for.
Returns
Index of the object, or -1 if the object was not found in the container.

◆ GetLegendSelection()

GlgObject GetLegendSelection ( double  x,
double  y 
)

Returns the plot object corresponding to the legend item at the specified position in the legend object the method is invoked on, if any.

Parameters
x,ySpecifies the position in screen coordinates of the viewport containing the legend.
Returns
The plot corresponding to the item at the specified legend position, or null if no legend item was found.

See also GetSelectedPlot.

◆ GetMatrixData()

GlgMatrixData GetMatrixData ( GlgMatrixData  matrix_data)

ADVANCED: Queries matrix coefficients of the matrix.

Parameters
matrix_dataThe GlgMatrixData object that will be returned after being filled with matrix data. If null is passed, a new GlgMatrixData object containing matrix data will be returned.
Returns
GlgMatrixData object containing matrix data. See GlgMatrixData for details.

◆ GetNamedObject()

GlgObject GetNamedObject ( String  name)

Finds an object with the specified name inside the container of GLG objects and returns it.

Parameters
nameThe object's name.
Returns
The retrieved object, of null if the named object was not found.

◆ GetNodeDataSample()

static GlgDataSample GetNodeDataSample ( GlgDataSampleNode  node)
static

Returns the datasample contained in the node.

Parameters
nodeThe data sample node to query.
Returns
Depending on the type of the data sample contained in the node, returns either GlgDataSample or GlgDataSampleExt that can be added to a chart after filling up the data sample's fields.

◆ GetNumParents()

int GetNumParents ( )

ADVANCED: Returns number of the object's parents.

This method is used to determine the type of the return value of the GetParent method and must be called after the hierarchy is created.

For constrained objects, the method returns a number greater than 1.

Returns
The number of the object's parents.

◆ GetObjectData()

Object GetObjectData ( )

Retrieves application data attached to the object via SetObjectData.

Returns
The data attached to the object.

◆ GetObjectViewport()

GlgObject GetObjectViewport ( boolean  heavy_weight,
boolean  self 
)

Returns parent viewport of the drawable object.

Parameters
heavy_weightControls the type of a parent viewport to be returned.
  • false to return the closest parent viewport regardless of its type: either a heavyweight or light viewport.
  • true to return the closest heavyweight parent viewport. For example, if the object is inside a light viewport, it will return the heavyweight viewport which is a parent of the light viewport.
self
  • true to return the object itself if the object is a viewport or a light viewport and heavy_weight is false, or if the object is a viewport and heavy_weight is true.
Returns
A viewport of the requested type, or null if the object is a top level viewport that has no parent and self=false.

The object's hierarchy must be set up to use this method, otherwise an error message is generated and null is returned.

◆ GetParent()

GlgObject GetParent ( )

ADVANCED: Returns the object's parent object, if one exists, or an array of all parents for constrained data objects.

Returns
  • The parent object if the object has a single parent.
  • A group containing all object's parents if the object has multiple parents.
  • null if the object has no parents or in case of an error.

For constrained data objects, there may be more than one parent object. In this case, the method returns an array of parent objects. GetNumParents may be used to determine the type of the return value.

The returned array of parents is an internal object which should not be modified and is destroyed when the object's hierarchy is reset. To keep it around, create a copy using SHALLOW_CLONE, which prevents array's elements from being modified by the GLG internals.

This method must be called after the hierarchy is created.

◆ GetParentViewport()

GlgObject GetParentViewport ( boolean  heavy_weight)

Returns parent viewport of the drawable object.

Parameters
heavy_weightControls the type of a parent viewport to be returned.
  • false to return the closest parent viewport regardless of its type: either a heavyweight or light viewport.
  • true to return the closest heavyweight parent viewport. For example, if the object is inside a light viewport, it will return the heavyweight viewport which is a parent of the light viewport.
Returns
A parent viewport of the requested type, or null if the object is a top level viewport that has no parent.

The object's hierarchy must be set up to use this method, otherwise an error message is generated and null is returned.

◆ GetResource()

Object GetResource ( String  resource_name)

Deprecated, use GetNativeComponent:
Returns an ID of a native resource.

Parameters
resource_nameSpecifies the resource path of a native resource.
Returns
Native resource object.

This method was used in previous releases to get IDs of native objects used to render the viewport's drawing.

The method is deprecated, use GetNativeComponent.

◆ GetResourceObject()

GlgObject GetResourceObject ( String  resource_name)

Finds and returns a named resource or an attribute of the object.

Parameters
resource_nameA resource path to access the resource object inside the object the method is invoked on. It may use object names or default attribute names.
Returns
The retrieved object, or null if the resource was not found.

This method finds and returns a named resource or an attribute of the object. 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 if a resource exists.

◆ GetSelectedPlot()

static GlgObject GetSelectedPlot ( )
static

Returns the plot object corresponding to the last legend item selected with the mouse, if any.

Returns
Selected plot object or null if no plots were selected.

The setting of the chart's viewport ProcessMouse attribute controls when legend selection happens:

  • NO_MOUSE_EVENTS disables legend selection.
  • for MOUSE_CLICK, a plot is selected when a legend items is clicked on, and the selected plot is stored until it is replaced by a new selection.
  • for MOUSE_OVER_SELECTION, a plot is selected when a mouse moves over a legend item, and the selected plot is reset when the mouse moves away from the item.
  • for MOUSE_OVER_TOOLTIP, a plot is selected when a mouse is hovering over a legend item, and the selected plot is stored until it is replaced by a new selection.
  • for a combination of MOUSE_CLICK and MOUSE_OVER_SELECTION, the selection will happen on both mouse click and mouse over events, but the selected plot will be reset when the mouse moves away from the item.
  • for a combination of MOUSE_CLICK and MOUSE_OVER_TOOLTIP, the selection will happen on both the mouse click and mouse hover events, and the selected plot will be stored until it is replaced by a new selection.

This method can be used in conjunction with a mouse click Action attached to the Legend object. The DEMOS_Java/GlgRealTimeChart.java file in the GLG installation directory provides an example of using this technique to highlight a plot when its legend icon is clicked on.

See also GetLegendSelection.

◆ GetSize()

int GetSize ( )

Returns size of the container object.

Returns
The size of the container.

For a viewport or group object, the size is the number of objects in the viewport or group. For a polygon, the size is the number of vertices.

While the method provides the Intermediate API functionality, it is also available in the Standard API when used with a group object returned by CreateTagList.

◆ GetStringIndex()

int GetStringIndex ( String  search_string)

Returns index of the first occurrence of a string in the container of the STRING type.

Parameters
search_stringSpecifies the string content to search for using an exact match.
Returns
Index of the string, or -1 if the string was not found in the container.

◆ GetTagObject()

GlgObject GetTagObject ( String  search_string,
boolean  by_name,
boolean  unique_tags,
boolean  single_tag,
GlgTagType  tag_type_mask 
)

Retrieves a tag object with a specified tag name, data tag source, or export tag category inside the object the method is invoked on.

The search string can contain wildcards to retrieve a list of tags matching the specified tag name, tag source or category pattern.

Parameters
search_stringA string or a pattern for the search (may include the ? and * wildcards).
by_nameIf 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_tagsControls 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):
  • If true, only the first encountered tag of the highest priority will be listed when several data tags with the same tag name or tag source exist in the drawing. Input tags are prioritized over output tags, and enabled tags over disabled tags.
  • If false, all tags matching the search criteria will be included in the returned list.
single_tagDefines 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_maskDefines 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.
Returns
  • In the single tag mode, the method returns the first attribute object that has an attached tag that matches the search criteria.
  • In the multiple tag mode, the method returns a group containing all attribute objects that have matching tags attached.
  • null if no matching tags were found.

The GetElement and GetSize methods may be used to handle the returned group object in the multiple tag mode.

◆ HasTag()

boolean HasTag ( String  tag_name,
GlgTagType  tag_type_mask 
)

Checks if a data or export tag with a specified tag name exists inside the object the method is invoked on.

Parameters
tag_nameSpecifies the TagName to query.
tag_type_mask

Defines the type of tags to query:

For export tags, tag type constants may be combined with bitwise OR to query multiple subtypes of export tags.

Returns
true if a tag with the given TagName exists, otherwise returns false without generating an error message.

◆ InstallGISRequest()

boolean InstallGISRequest ( String  resource_name)

Installs a new map received by the GIS request in the GIS object.

This method may be invoked only from inside of a request observer's RequestUpdate method invoked with the GIS_REQUEST_READY status.

Parameters
resource_nameA resource path of a child GIS object, or null to use the GIS object the method is invoked on. The resource path is relative to the invoking object.
Returns
Success or failure status.

The DEMOS_JAVA/GlgAirTrafficDemoExt.java in the GLG installation directory proides an example of using the method to install the received map.

◆ Inverse()

void Inverse ( )

Inverses the order of elements inside the container object.

◆ IsAt()

boolean IsAt ( GlgPositionType  position)

Checks the position of the iteration pointer (the current element of the container).

Parameters
positionThe position that is being checked.
Returns

true if the container's current position pointer matches the specified position:

  • for START, true if the iteration pointer is positioned before the first element of the container, false otherwise
  • for END, true if the iteration pointer is positioned past the last element of the container, false otherwise
  • for FIRST, true if the iteration pointer is positioned at the first element of the container, false otherwise
  • for LAST, true if the iteration pointer is positioned at the last element of the container, false otherwise.

◆ IsDrawable()

boolean IsDrawable ( )

Checks if the object is drawable.

Returns
true if the object is drawable.

Drawable objects can be placed directly in a drawing area, have control points and a bounding box, have the Visibility attribute and can contain custom properties, actions and aliases.

For a Chart object, the Chart itself is drawable, but its Plot objects are not.

◆ Iterate()

Object Iterate ( )

Traverses the container object's elements in the forward direction.

Returns
The next element of the container.

Iterate advances the iteration pointer and returns the next element of the container.

SetStart must be used to initialize the container for iterating before Iterate is invoked the first time. The add, delete and search operations affect the iteration state and should not be performed on the container while it is being iterated.

To perform a safe iteration that is not affected by the add and delete operations, a copy of the container can be created using the CloneObject method with the SHALLOW_CLONE clone type. The shallow copy will return a new container with a list of objects that can be safely iterated while objects are added or deleted from the original container.

Alternatively, GetElement can be used to traverse elements of the container using an element index, which is not affected by the search operations on the container.

The following coding example shows how to iterate all objects in a container using Iterate:

int size = container.GetSize();
if( size != 0 )
{
container.SetStart(); // Initialize forward traversing.
for( int i=0; i<size; ++i )
{
GlgObject object = container.Iterate();
... // Code to process the object.
}
}

◆ IterateBack()

Object IterateBack ( )

Traverses the container object's elements in the backward direction.

Returns
The previous element of the container.

IterateBack decrements the iteration pointer and returns the previous element of the container.

SetEnd must be used to initialize the container for backward iteration before IterateBack is invoked the first time. The add, delete and search operations affect the iteration state and should not be performed on the container while it is being iterated.

To perform a safe iteration that is not affected by the add and delete operations, a copy of the container can be created using the CloneObject method with the SHALLOW_CLONE clone type. The shallow copy will return a new container with a list of objects that can be safely iterated while objects are added or deleted from the original container.

Alternatively, GetElement can be used to traverse elements of the container using an element index, which is not affected by the search operations on the container.

The following coding example shows how to iterate all objects in a container in the backward direction using IterateBack:

int size = container.GetSize();
if( size != 0 )
{
container.SetEnd(); // Initialize forward traversing.
for( int i=0; i<size; ++i )
{
GlgObject object = container.IterateBack();
... // Code to process the object.
}
}

◆ LayoutObjects()

boolean LayoutObjects ( GlgObject  anchor,
GlgLayoutType  type,
double  distance,
boolean  use_box,
boolean  process_subobjects 
)

Performs operations ranging from setting an object's width and height to aligning and layout of groups of objects.

This method can be invoked on an object or a group of objects to perform the requested operations upon them.

Parameters
anchorThe anchor object for alignment operations. If null, the first encountered object in the specified alignment direction is used.
typeThe type of the layout action to perform:
  • ALIGN_LEFT - aligns the left edge of elements within the group with the left edge of the anchor element.
  • ALIGN_RIGHT - aligns the right edge of elements within the group with the right edge of the anchor element.
  • ALIGN_HCENTER - aligns the center of elements within the group with the center of the anchor element horizontally.
  • ALIGN_TOP - aligns the top edge of elements within the group with the top edge of the anchor element.
  • ALIGN_BOTTOM - aligns the bottom edge of elements within the group with the bottom edge of the anchor element.
  • ALIGN_VCENTER - aligns the center of elements within the group with the center of the anchor element vertically.
  • SET_EQUAL_VSIZE - sets the height of elements within the group to the height of the anchor.
  • SET_EQUAL_HSIZE - sets the width of elements within the group to the width of the anchor.
  • SET_EQUAL_SIZE - sets the width and height of elements within the group to the width and height of the anchor.
  • SET_EQUAL_VDISTANCE - equally distributes the group's elements in vertical direction as measured by the distance between their centers.
  • SET_EQUAL_HDISTANCE - equally distributes the group's elements in horizontal direction as measured by the distance between their centers.
  • SET_EQUAL_VSPACE - equally distributes space gaps between group's elements in vertical direction.
  • SET_EQUAL_HSPACE - equally distributes space gaps between group's elements in horizontal direction.
  • SET_VSIZE - sets the height of the object or of all objects in the group to the value specified by the distance parameter:
    • if process_subobjects=false, sets the object's height
    • if process_subobjects=true, sets the height of all elements within the group.
  • SET_HSIZE - sets the width of the object or of all objects in the group to the value specified by the distance parameter:
    • if process_subobjects=false, sets the object's width
    • if process_subobjects=true, sets the width of all elements within the group.
  • SET_VDISTANCE - sets the vertical distance between centers of the group's elements to a value specified by the distance parameter.
  • SET_HDISTANCE - sets the horizontal distance between centers of the group's elements to a value specified by the distance parameter.
  • SET_VSPACE - sets the space gaps between group's elements in vertical direction to a value specified by the distance parameter.
  • SET_HSPACE - sets space gaps between group's elements in horizontal direction to a value specified by the distance parameter.
distanceThe distance in screen coordinates for positioning objects, it is interpreted depending on the layout action.
use_boxControls how the objects extent is determined:
  • true to use the object's real bounding box to align objects
  • false to use the object's control points to determine the object's extent, which could be different from the real bounding box for objects such as a Text object with a single conrol point.
process_subobjectsControls how to apply the layout action if the object is a group:
  • true to apply the action to all objects contained in the group
  • false the apply the action (such as SET_HSIZE) to the group itself.
Returns
  • false if errors were encountered during the requested layout action,
  • true if the requested action was successfully executed.

The object's hierarchy must be set up to use this method.

◆ MoveObject()

boolean MoveObject ( GlgCoordType  coord_type,
GlgPoint  start_point,
GlgPoint  end_point 
)

Moves an object by a move vector.

Parameters
coord_typeSpecifies the coordinate system for interpreting the move vector:
  • SCREEN_COORD - the move vector is considered to be defined using screen pixels.
  • OBJECT_COORD - the move vector coordinates are interpreted in the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the move vector coordinates are interpreted in the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
start_pointThe start point of the move vector. If null, (0,0,0) is used as the start point.
end_pointThe end point of the move vector.
Returns
Success or failure status.

This method moves an object's control points by the distance defined by the move vector, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ MoveObjectBy() [1/2]

boolean MoveObjectBy ( GlgCoordType  coord_type,
double  x,
double  y,
double  z 
)

Moves the object by the specified distances.

Parameters
coord_typeSpecifies the coordinate system for interpreting move distances:
  • SCREEN_COORD - move distances are considered to be in screen pixels.
  • OBJECT_COORD - move distances are considered to be in the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - move distances are considered to be in the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
x,y,zThe X, Y and Z move distances.
Returns
Success or failure status.

This method moves the object's control points by the specified X, Y and Z distances, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ MoveObjectBy() [2/2]

boolean MoveObjectBy ( GlgCoordType  coord_type,
GlgPoint  point 
)

Moves the object by distances specified by the GlgPoint object.

Parameters
coord_typeSpecifies the coordinate system for interpreting move distances:
  • SCREEN_COORD - the distances is considered to be defined using screen pixels.
  • OBJECT_COORD - the distances are interpreted in the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the coordinates are interpreted in the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
pointGlgPoint containing X, Y and Z move distance values.
Returns
Success or failure status.

This method moves an object's control points by the distances specified as the X, Y and Z parameters of the GlgPoint, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ PositionObject() [1/2]

boolean PositionObject ( GlgCoordType  coord_type,
GlgAnchoringType  anchoring,
double  x,
double  y,
double  z 
)

Positions the object at the specified location.

Parameters
coord_typeSpecifies the coordinate system for interpreting postion coordinates:
  • SCREEN_COORD - the coordinates are interpreted as screen pixels.
  • OBJECT_COORD - the coordinates are interpreted as the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the coordinates are interpreted as the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
anchoring

Specifies what part of the object's bounding box will be anchored at the specified position. It is formed as a bitwise OR of the horizontal anchoring constant (HLEFT, HCENTER or HRIGHT) with the vertical anchoring constants (VTOP, VCENTER or VBOTTOM).

For example, using ( VTOP | HLEFT ) causes the upper left corner of the object's bounding box to be positioned at the specified location.

x,y,zThe X, Y and Z coordinates of the desired object position.
Returns
Success or failure status.

This method positions the object, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ PositionObject() [2/2]

boolean PositionObject ( GlgCoordType  coord_type,
GlgAnchoringType  anchoring,
GlgPoint  position 
)

Positions the object at the location specified by the GlgPoint object.

Parameters
coord_typeSpecifies the coordinate system for interpreting postion coordinates:
  • SCREEN_COORD - the coordinates are interpreted as screen pixels.
  • OBJECT_COORD - the coordinates are interpreted as the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the coordinates are interpreted as the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
anchoring

Specifies what part of the object's bounding box will be anchored at the specified position. It is formed as a bitwise OR of the horizontal anchoring constant (HLEFT, HCENTER or HRIGHT) with the vertical anchoring constants (VTOP, VCENTER or VBOTTOM).

For example, using ( VTOP | HLEFT ) causes the upper left corner of the object's bounding box to be positioned at the specified location.

positionGlgPoint containing x, y and z coordinates of the desired object position.
Returns
Success or failure status.

This method positions the object, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ PositionToValue()

Double PositionToValue ( String  resource_name,
double  x,
double  y,
boolean  outside_x,
boolean  outside_y 
)

Returns a value corresponding to the specified position on top of the Chart or an Axis object.

Parameters
resource_nameA resource path of a child Chart, Plot or Axis object, or null to query the Chart, Plot or Axis object the method is invoked on. The resource path is relative to the invoking object.
x,ySpecify a position in the screen coordinates of the parent viewport. When using the cursor position, add COORD_MAPPING_ADJ to the cursor's X and Y coordinates for precise mapping.
outside_xIf true, false will be returned for points outside the X extent of the chart or axis object.
outside_yIf true, false will be returned for points outside the Y extent of the chart or axis object.
Returns
Double object containing the value corresponding to the specified position:
  • If object is a Plot, the method converts the specified position to a Y value in the Low/High range of the plot.
  • If object is an Axis, the method converts the specified position to the axis value.
  • If object is a Chart, the method converts the specified position to the X or time value of the chart's X axis.

◆ PositionToValueObj()

GlgDouble PositionToValueObj ( String  resource_name,
double  x,
double  y,
boolean  outside_x,
boolean  outside_y 
)

Returns a value corresponding to the specified position on top of the Chart or an Axis object.

This is more efficient version of the fref PositionToValue method that uses cached GlgDouble objects for return values. For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's ReleaseToCache method.

Parameters
resource_nameA resource path of a child Chart, Plot or Axis object, or null to query the Chart, Plot or Axis object the method is invoked on. The resource path is relative to the invoking object.
x,ySpecify a position in the screen coordinates of the parent viewport. When using the cursor position, add COORD_MAPPING_ADJ to the cursor's X and Y coordinates for precise mapping.
outside_xIf true, false will be returned for points outside the X extent of the chart or axis object.
outside_yIf true, false will be returned for points outside the Y extent of the chart or axis object.
Returns
GlgDouble object containing the value corresponding to the specified position:
  • If object is a Plot, the method converts the specified position to a Y value in the Low/High range of the plot.
  • If object is an Axis, the method converts the specified position to the axis value.
  • If object is a Chart, the method converts the specified position to the X or time value of the chart's X axis.

◆ QueryTags()

GlgObject QueryTags ( GlgTagType  tag_type_mask)

Returns a group of all tags of the requested tag type defined in the object.

Parameters
tag_type_mask

Defines the type of tags to query:

For export tags, tag type constants may be combined with bitwise OR to query multiple subtypes of export tags.

Returns
A list of all attribute objects that have tags of the specified type attached.

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.

◆ ReleaseObject()

void ReleaseObject ( GlgObject  suspend_info)

Releases the object that was suspended for editing.

Parameters
suspend_infoSuspension information returned by the previous call to SuspendObject.

This method releases previously suspended object and is intended to be used only in conjunction with the SuspendObject method.

◆ ReorderElement()

boolean ReorderElement ( int  current_index,
int  new_index 
)

Changes an element's position inside the container.

Parameters
current_indexThe index of an element to be reordered.
new_indexA new element position.
Returns
Success or failure status.

This method moves the element at the old_index to the new_index position inside the container. It generates an error message and returns false if indexes are out of range.

◆ RequestGISMap()

boolean RequestGISMap ( String  resource_name,
double  extent_x,
double  extent_y,
double  center_x,
double  center_y,
double  angle,
GlgProjectionType  projection,
String  layers,
GlgGISRequestFlags  flags,
GlgGISRequestObserver  request_observer 
)

Initiates an asynchronous GIS map loading request.

The easiest way to change a map displayed inside a GIS object is by changing the GIS object's parameters to specify a new map area, a new map projection or new map layers. If a synchronous map loading mode is used, the application will freeze while the new map is being loaded. If an asynchronous map loading mode is used, dynamic symbols on the map are displayed at the new map positions right away, but without the background map, with the new map appearing when it is received from the server. Both of these modes are undesirable, and an asynchronous GIS request offers a solution.

Instead of changing GIS parameters, an application can issue an asynchronous GIS map request that requests a new map from the map server. While the request is being loaded, the application continues to update dynamic icons on the map in its current state, and switches to the new map when the new map is received. This avoids displaying no map while the new map is being loaded.

The RequestGISMap method is used to issue an asynchronous GIS map request by specifying parameters of the new map. The method's request_observer parameter specifies a request observer that will be invoked when the map is ready. When the new map image is either ready or aborted, the request observer's RequestUpdate method will be invoked with the status information. The observer can install a successfully prepared request via the InstallGISRequest method, or do nothing to cancel the request. See GlgGISRequestObserver for more information.

The method aborts any asynchronous map loading request in progress for the GIS object the method is invoked on.

Parameters
resource_nameA resource path of a child viewport with the GIS zoom mode, or null to use the viewport the method is invoked on. The resource path is relative to the invoking object.
extent_xSpecifies a new GIS x extent.
extent_ySpecifies a new GIS y extent.
center_xSpecifies a new GIS x center.
center_ySpecifies a new GIS y center.
angleSpecifies a new GIS angle.
projectionSpecifies a new GIS projection.
layersSpecifies a new GIS layer string.
flagsControls which GIS object's parameters will be updated and is formed as a bitwise OR the following flags:
request_observerSpecifies an observer whose RequestUpdate method will be invoked with status updates. See GlgGISRequestObserver for more information.
Returns
Success or failure status.

The DEMOS_JAVA/GlgAirTrafficDemoExt.java in the GLG installation directory proides an example of using the method to load a new map.

◆ RequestGISZoom()

boolean RequestGISZoom ( String  resource_name,
char  type,
double  value,
GlgGISRequestObserver  request_observer 
)

Initiates an asynchronous GIS zooming or panning request compatible with the SetZoom method interface.

The easiest way to zoom or scroll a map displayed inside a GIS object is by using the SetZoom method, which changes the GIS object's parameters to perform the requested zoom or pan operation. If a synchronous map loading mode is used, the application will freeze while the new map is being loaded. If an asynchronous map loading mode is used, dynamic symbols on the map are displayed in the new map zoom state right away, but without the background map, with the new map appearing when it is received from the server. Both of these modes are undesirable, and an asynchronous GIS request offers a solution.

Instead of using SetZoom, an application can issue an asynchronous GIS map request that requests a new zoomed or scrolled map from the map server. While the request is being loaded, the application continues to update dynamic icons on the map in its current state, and switches to the new map when the new map is received. This avoids displaying no map while the new map is being loaded.

The RequestGISZoom method is used to issue an asynchronous GIS map request in a way compatible with the SetZoom method, which allows to use the same zoom or pan parameters to request asynchronous GIS zoom or pan request.

The method uses an addition request_observer parameter that specified a request observer that will be invoked when the map is ready. When the new map image is either ready or aborted, the request observer's RequestUpdate method will be invoked with the status information. The observer can install a successfully prepared request via the InstallGISRequest method, or do nothing to cancel the request. See GlgGISRequestObserver for more information.

The method aborts any asynchronous map loading request in progress for the GIS object the method is invoked on.

Parameters
resource_nameA resource path of a child viewport with the GIS zoom mode, or null to use the viewport the method is invoked on. The resource path is relative to the invoking object.
typeA char value that specifies the type of the zoom or pan operation to perform. For example, 'i' may be used to zoom in.
See the type parameter of the SetZoom method for a list of possible values.
valueSpecifies the amount to zoom or pan by. See the value parameter of the SetZoom method for more information.
request_observerSpecifies an observer whose RequestUpdate method will be invoked with status updates. See GlgGISRequestObserver for more information.
Returns
Success or failure status.

The DEMOS_JAVA/GlgAirTrafficDemoExt.java in the GLG installation directory proides an example of using the method to zoom and pan the map.

◆ RootToScreenCoord()

static boolean RootToScreenCoord ( GlgObject  viewport,
GlgPoint  point 
)
static

Converts screen coordinates relative to the root window to the screen coordinates in the specified viewport.

Parameters
viewportThe viewport whose screen coordinate system to convert to.
pointThe point to be converted. The converted values are placed back into the point.
Returns
Success or failure status.

The viewport's hierarchy must be set up to use this method.

◆ RotateObject()

boolean RotateObject ( GlgCoordType  coord_type,
GlgPoint  center,
double  x_angle,
double  y_angle,
double  z_angle 
)

Rotates the object.

Parameters
coord_typeSpecifies the coordinate system for interpreting the rotation's center:
  • SCREEN_COORD - the rotation's center coordinates are interpreted as screen pixels.
  • OBJECT_COORD - the rotation's center coordinates are interpreted as the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the rotation's center coordinates are interpreted as the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
centerThe center of rotation. If the parameter is null, the object is rotated relative to the center of its bounding box.
x_angle,y_angle,z_angleThe X, Y and Z rotation angles in degrees. Only one rotation at a time can be performed (only one angle can have non-zero value).
Returns
Success or failure status.

This method rotates the object's control points by the specified rotation angle and relative to the specified center, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ SaveObject() [1/4]

boolean SaveObject ( Object  medium,
GlgMediumType  medium_type 
)

Saves the object into a stream using a default charset.

This method serializes the object and all its subsidiary objects into a stream using the GLG ASCII save format that provides maximum portability between different deployment environments.

Parameters
mediumThe destination stream to save to.
medium_typeDestination type, must be STREAM.
Returns
Success or failure status.

◆ SaveObject() [2/4]

boolean SaveObject ( Object  medium,
GlgMediumType  medium_type,
String  charset_name 
)

Saves the object into a stream using the specified charset.

This method serializes the object and all its subsidiary objects into a stream using the GLG ASCII save format that provides maximum portability between different deployment environments.

Parameters
mediumThe destination stream to save to.
medium_typeDestination type, must be STREAM.
charset_nameName of a charset for string encoding.
Returns
Success or failure status.

◆ SaveObject() [3/4]

boolean SaveObject ( String  filename)

Saves the object to a file using a default charset.

This method can be used to save either a viewport, or any GlgObject object.

Parameters
filenameThe file to save the object to.
Returns
false if the file is not accessible for writing, true if the object was successfully saved.

This method saves the specified object and all its subsidiary objects to a file. A GLG object of any type may be saved in this fashion and later loaded using LoadObject. The method uses the GLG ASCII save format that provides maximum portability between different deployment environments.

For applications that load a drawing, modify it and save if back to a file, the drawing should be loaded using LoadObject instead of LoadWidget. LoadWidget extracts the $Widget viewport from the loaded drawing, discarding the rest of the drawing, while LoadObject returns an object that represents the whole drawing.

Using SaveObject to save a viewport loaded with LoadWidget will result in a loss of information contained in the discarded part of the drawing, such as the type of the coordinate system used to display the viewport, which will make it difficult to load and edit the drawing in the Graphics Builder. The following example demonstrates the proper technique:

GlgObject drawing = GlgObject.LoadObject( "drawing.g" );
GlgObject viewport = GlgObject.LoadWidgetFromObject( drawing ); // Extract $Widget viewport.
... // Code that modifies the drawing using the <i>viewport</i> object ID.
drawing.SaveObject( "new_drawing.g" );

◆ SaveObject() [4/4]

boolean SaveObject ( String  filename,
String  charset_name 
)

Saves the object to a file using the specified charset.

This method is similar to the SaveObject method described above, but allows to save using the specified charset.

Parameters
filenameThe file to save the object to.
charset_nameName of a charset for string encoding.
Returns
false if the file is not accessible for writing, true if the object was successfully saved.

◆ ScaleObject()

boolean ScaleObject ( GlgCoordType  coord_type,
GlgPoint  center,
double  x_scale,
double  y_scale,
double  z_scale 
)

Scales the object.

Parameters
coord_typeSpecifies the coordinate system for interpreting the scale center:
  • SCREEN_COORD - the scale center coordinates are interpreted as screen pixels.
  • OBJECT_COORD - the scale center coordinates are interpreted as the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - the scale center coordinates are interpreted as the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
centerThe center of scaling. If the parameter is null, the object is scaled relative to the center of its bounding box.
x_scale,y_scale,z_scaleThe X, Y and Z scaling factors. Use the same value for all three factors to scale the object uniformly in all dimensions.
Returns
Success or failure status.

This method scales the object's control points by the specified scale factors and relative to the specified center, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ ScreenToWorld()

boolean ScreenToWorld ( boolean  inside_vp,
GlgPoint  in_point,
GlgPoint  out_point 
)

Converts a point's screen coordinates to the GLG world coordinate system.

The method uses the world coordinate system of the object it is invoked on, which includes the effect of all drawing transformations attached to the object and all its parents.

Parameters
inside_vp

If the object is a viewport or a light viewport, inside_vp specifies which world coordinate system to use:

  • true to will use the world coordinate system used to draw objects inside this viewport object.
  • false, to use the world coordinate system used to draw this viewport object inside its parent viewport.

The value of this parameter is ignored for objects other than a viewport or light viewport.

in_pointThe point to be converted.
out_pointThe point that will receive converted world coordinates.
Returns
Success or failure status.

The object's hierarchy must be set up to use this method.

When converting the cursor position to world coordinates, add COORD_MAPPING_ADJ to the cursor's X and Y screen coordinates for precise mapping.

◆ SendMessageToParent()

static void SendMessageToParent ( GlgObject  viewport,
GlgObject  message_obj,
String  action,
String  subaction 
)
static

Sends a message to the Input callback.

This method is used by custom interaction handlers to invoke an application's Input callback.

Parameters
viewportThe handler's viewport.
message_objA GLG message object created via CreateMessage.
actionThe action to be set as the message's Action resource. If action=null, the message will be sent as is without setting its action and sub_action.
subactionThe subaction to be set as the message's SubAction resource.

The message is first sent to the handler of the viewport's parent (if any), which can either process and stop message propagation, or send the message to the Input callback. For example, when a spinner's Increase button is pressed, it sends a message to the spinner's handler, which increments the value and stops message propagation. If a stand-alone Increase button is pressed, the message is sent directly to the Input callback. This logic allows parent input handlers handle messages from their children's handlers.

◆ SetCustomSetupHandler()

static void SetCustomSetupHandler ( GlgCustomSetupHandler  handler)
static

Installs a custom setup handler that will be invoked to perform custom processing of objects tagged using the CustomSetup flag in the GLG drawing.

Parameters
handlerThe custom setup handler to be invoked.

A custom setup handler is invoked at different times during the lifetime of objects tagged using the CustomSetup flag. The handler's ProcessObject method is invoked for each tagged object with the object passed as a parameter. The handler can perform custom processing based on the information stored in the object.

Custom setup may be used to automate object data tags assignment on per-object basis or to attach Input and Trace callbacks to objects representing custom widgets that handle user interaction.

The DEMOS_JAVA/SCADAViewer/GlgViewer.java and DEMOS_JAVA/SCADAViewer/HMIPageC.java files in the GLG installation directory provide an elaborate example of an application framework that uses a custom setup handler to process special custom widgets.

See GlgCustomSetupHandler for more information.

◆ SetEnd()

void SetEnd ( )

Initializes the container object for the backward traversing.

The method sets the current position pointer past the last element of the container, preparing the container object for the backward traversing with IterateBack.

◆ SetHandlerData()

static void SetHandlerData ( GlgObject  viewport,
Object  data 
)
static

Stores data used by the custom handler instance.

This method is invoked on the viewport or light viewport the handler is attached to.

Parameters
viewportThe viewport the handler is attached to.
dataThe data to be stored.

A custom handler can store its data on set up using this method, and obtain the stored data using GetHandlerData when the handler is invoked to handle user interaction.

◆ SetMatrixData()

void SetMatrixData ( GlgMatrixData  matrix_data)

ADVANCED: Sets matrix's coefficients to the supplied values.

Parameters
matrix_dataGlgMatrixData object containing new matrix values.

◆ SetObjectData()

void SetObjectData ( Object  data)

Attaches arbitrary application data to the graphical object the method is invoked on.

Parameters
dataThe data that will be attached.

◆ SetScrollbarObserver()

GlgGISRequestObserver SetScrollbarObserver ( String  resource_name,
GlgGISRequestObserver  request_observer 
)

Controls the the way integrated scrollbars work for the GIS object.

Parameters
resource_nameA resource path of a child GIS object, or null to set scrollbar observer of the GIS object the method is invoked on. The resource path is relative to the invoking object.
request_observerSpecifies a request observer:
  • If a non-null observer is specified, integrated scrollbars will use an asynchronous request to scroll the map. The observer's RequestUpdate method will be invoked with status updates.
  • If null is specified, the new map will be loaded without the use of an asynchronous request.
Returns
The previous scrollbar request observer, or null if the GIS object didn't use scrollbar request observers.

The DEMOS_JAVA/GlgAirTrafficDemoExt.java in the GLG installation directory proides an example of using scrollbar observers to load a new map when the map is scrolled using the integrated scrollbars.

See GlgGISRequestObserver for more information.

◆ SetStart()

void SetStart ( )

Initializes the container object for the forward traversing.

The method sets the current position pointer before the first element of the container, preparing the container object for the forward traversing with Iterate.

◆ SuspendObject()

GlgObject SuspendObject ( )

Suspends the object for editing after it has been drawn.

Returns
An object which keeps suspension information. This information should be passed to the ReleaseObject method when the object is released.

Some operations, such as attaching a transformation to an object, constraining an object's attribute and some others, may be carried out only before the object has been drawn. If the object has been drawn and you still need to perform these operations, the SuspendObject method must be used to suspend the object for editing. If SuspendObject is not used, any attempt to perform these modifications will fail, producing an error message.

SuspendObject may be called only for the graphical objects, such as a viewport, group, polygon, text, etc.

The ReleaseObject method must be called after the editing operations have been completed. If an object is suspended, it is not allowed to call Update until the object has been released.

◆ TraceObject()

static boolean TraceObject ( GlgObject  object,
boolean  state,
boolean  is_widget,
GlgObject  top_parent,
GlgObjectActionInterface  action 
)
static

Highlights all objects in the drawing that depend on the tag or resource object that is being traced.

Parameters
objectThe object to trace. The object must be set up in order to trace its dependencies.
state
  • true to highlight the objects in the drawing that depend on the traced object
  • false to unhighlight them.
is_widget
  • true to highlight or unhighlight (depending on the state parameter) only the object's parent objects that have resource named IsWidget.
  • false to highlight or unhighlight all parent objects.
top_parent
  • Non-null to highlight or unhighlight only the parent objects that are direct children of top_parent.
  • null to highlight or unhighlight all parent objects.
actionAn optional interface that provides a custom condition. The Action method of the interface will be invoked for every parent of the traced object. If the method returns true, the parent will be highlighed or unhighlighted depending on the value of the state parameter.
Returns
true if any parents were highlighted or unhighlighted, false otherwise.

TraceObject searches all parents of the traced object and highlights or unhighlights them (as directed by the state parameter) based on the specified conditions. The parent search is performed until any of the specified conditions (is_widget, top_parent or a custom criteria evaluated by the supplied action interface ) are satisfied. If no conditions are specified, all immediate drawable parents of the traced object will be highlighted or unhighlighted.

The dependent parent objects are highlighted with an outline. The attributes of the outline are defined by the GlgHighlightPolygon global configuration resource.

Internally, object highlighting is done setting an object's HighlightFlag attribute to true. An application can also set and reset this attribute of drawable objects via the SetDResource method to highlight or unhighlight individual objects of interest.

◆ TransformObject()

boolean TransformObject ( GlgObject  xform,
GlgCoordType  coord_type,
GlgObject  parent 
)

ADVANCED: Transforms all control points of the object with an arbitrary transformation.

The method can be invoked on a drawable object or on a G data object representing a control point.

Parameters
xformThe transformation (an XFORM object) to be applied to the object's points
coord_typeThe coordinate system to interpret the transformation in:
  • SCREEN_COORD - parameters of the transformation are considered to be in screen pixels.
    For example, this may be used to move the object by the number of screen pixels as defined by the mouse move. The start and end coordinates of the mouse move can be supplied using the TRANSLATE_XF transformation as the xform parameter.
  • OBJECT_COORD - transformation parameters are interpreted in the GLG world coordinates of the object, which includes all transformations applied to the object.
  • PARENT_COORD - transformation parameters are interpreted in the GLG world coordinates of the parent object, which includes all transformations applied to the parent, but excludes transformations attached to the object.
parentThe object's parent. It is required if coord_type=PARENT_COORD, or if the object is a G data object representing a control point. null may be passed in all other cases.
Returns
Success or failure status.

This method applies the given transformation to an object's control points, calculating new control point values. The object's hierarchy must be set up to use this method.

◆ TransformPoint()

void TransformPoint ( GlgPoint  in_point,
GlgPoint  out_point 
)

Transforms a single point using the matrix object the method is invoked on.

Parameters
in_pointThe input point to be transformed.
out_pointThe transformed point.

This method applies the transformation matrix to the in_point parameter, and returns the result in out_point.

◆ TranslatePointOrigin()

static boolean TranslatePointOrigin ( GlgObject  from_viewport,
GlgObject  to_viewport,
GlgPoint  point 
)
static

Converts screen coordinates of a point in one viewport to the screen coordinates of another viewport.

Parameters
from_viewportThe viewport in which the point's screen coordinates are defined.
to_viewportThe viewport whose screen coordinate system to convert to.
pointThe point to be converted. The converted values are placed back into the point.
Returns
Success or failure status.

The objects's hierarchy must be set up to use this method.

◆ TraverseObjects()

void TraverseObjects ( GlgObjectActionInterface  action)

Traverses the object hierarchy of the object and and performs the specified actions on the object itself and all its subobjects, including object attributes.

Parameters
action

GlgObjectActionInterface or GlgObjectActionInterfaceExt interface that provides custom actions to be performed on each traversed object.

If action implements the GlgObjectActionInterfaceExt interface, the interface's methods will be invoked twice for each traversed object: the Action method will be invoked before traversing the object's subobjects, and ActionExt will be invoked after traversing the object's subobjects.

If action implements the GlgObjectActionInterface interface, the interface's Action method will be invoked just once before traversing each object's subobjects.

The return result of the Action interface method (invoked before traversing the object's subobjects) is used to modify the traversal: if the method returns false for a subobject, traversal of objects inside the subobject will not be performed.

◆ UnconstrainObject()

boolean UnconstrainObject ( )

Unconstrains the object's attribute or the object's point.

Parameters
attributeThe attribute or point object to be unconstrained.
Returns
Success or failure status.

This method removes any constraints applied to an attribute object. Any changes made to the object while it was constrained to another object are permanent and will be in effect even after the constraints are removed. The removal of the constraints only means that changes to this object are no longer copied to the other objects to which it was once constrained.

If any of the objects which are using this attribute object (or any objects with attributes constrained to it) have already been drawn, an error message will be generated. You should either unconstrain object attributes before drawing the object or use the SuspendObject and ReleaseObject methods to temporarily suspend a drawn object for editing.

◆ WorldToScreen()

boolean WorldToScreen ( boolean  inside_vp,
GlgPoint  in_point,
GlgPoint  out_point 
)

Converts a point's coordinates from the GLG world coordinate system to the screen coordinate system.

The method uses the world coordinate system of the object it is invoked on, which includes the effect of all drawing transformations attached to the object and all its parents.

Parameters
inside_vp

If the object is a viewport or a light viewport, inside_vp specifies which world coordinate system to use:

  • true to will use the world coordinate system used to draw objects inside this viewport object.
  • false, to use the world coordinate system used to draw this viewport object inside its parent viewport.

The value of this parameter is ignored for objects other than a viewport or light viewport.

in_pointThe point to be converted.
out_pointThe point that will receive converted screen coordinates.
Returns
Success or failure status.

The object's hierarchy must be set up to use this method.