|
GLG Toolkit, JavaScript Library
Version 4.6
|
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... | |
| static void | AddHandler (String handler_name, GlgHandler handler) |
| Registers a custom interaction handler. More... | |
| boolean | AddPlotDataSample (double value, double time_stamp, boolean valid, float marker_visibility, boolean quick_mode) |
| Adds a new data sample with the supplied values directly to the plot's data buffer. 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... | |
| 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 String | CreateResourcePath (GlgObject object, GlgObject parent) |
| Returns a relative resource path that can be used to access the object as a resource of the parent object. 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 | CreateSelectionFromEvent (int x, int y, 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... | |
| Object | FindObjects (GlgObjectMatchType match_type, boolean find_parents, boolean include_top_object, boolean find_first_match, boolean search_inside, boolean search_drawable_only, GlgObjectType object_type, String object_name, String resource_name, GlgObject object_id, Function custom_match, boolean search_templates, boolean dont_add_matches) |
| 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... | |
| 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 int | GetNativeEventKey (GlgCallEvent call_event) |
| Retrieves the key of the native keypress event. More... | |
| static GlgEventType | GetNativeEventType (GlgCallEvent call_event) |
| Retrieves the type of the native event that triggered the call event being sent to the custom interaction handler. More... | |
| static double | GetNativeEventXY (GlgCallEvent call_event, boolean y_coord) |
| Retrieves the X and Y coordinates of the native event. 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 | MoveObjectByPoint (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 | PositionObjectByPoint (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... | |
| 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 page 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... | |
| Uint8List | SaveObject (String encoding) |
| Serializes the object into a byte array using the specified encoding. 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... | |
| void | SetTemplate (GlgObject template) |
| ADVANCED: Sets a template of a subdrawing or subwindow object. 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, Function 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 (Function enter_func, Function exit_func) |
| Traverses the object hierarchy of the object and invokes the supplied functions 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... | |
| void AbortGISRequest | ( | String | resource_name | ) |
Aborts a GIS object's asynchronous map loading request in progress, if any.
| resource_name | A 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. |
|
static |
Registers a custom interaction handler.
| handler_name | The 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. |
| handler | The handler's interface that implements the handler's functionality. Use CreateGlgHandler to create a handler's interface. |
See GlgHandler for more information.
| boolean AddPlotDataSample | ( | double | value, |
| double | time_stamp, | ||
| boolean | valid, | ||
| float | marker_visibility, | ||
| boolean | quick_mode | ||
| ) |
Adds a new data sample with the supplied values directly to the plot's data buffer.
This method is used to enhance performance when 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.
If the plot uses a cache, and the cache is not empty, the new data sample will be taken from the plot's cache.
NOTE: The method adds a basic data sample, not an extended data sample.
| value | The datasample value. |
| time_stamp | The timestamp. |
| valid | The valid flag. |
| marker_visibility | The marker visibility in the range [0;1]. |
| quick_mode | Enables a quick mode that bypasses chart autoscroll and autoscale logic for faster chart prefilling. It also disables all validity checks for increased performance of charts with large number of data samples. 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. |
Note: It is recommended that the initial development is done with quick_mode=false, switching to quick_mode=true when all potential errors have been dealt with.
The examples_html5/realtime_chart/GlgRealTimeChart.js file in the GLG installation directory provides a coding example of prefilling a chart with data.
| 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.
| to_attribute | The attribute or the point to constrain to. This object may be queried by using either the default or a user-defined resource name. |
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.
| boolean ContainsObject | ( | Object | object | ) |
Checks if object belongs to the container.
| object | The object to search for. |
| 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.
| plot | An optional plot object:
|
| x,y | Specify the position inside the chart:
|
| dx,dy | Specify 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_coord | Controls the way the x and y parameters are interpreted:
|
| include_invalid |
|
| x_priority |
|
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.
| GlgObject CreateInversedMatrix | ( | ) |
ADVANCED: Inverts the matrix object.
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.
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.
| viewport | The handler's viewport. |
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.
| GlgObject CreatePointArray | ( | GlgControlPointType | type | ) |
ADVANCED: Creates and returns an array containing all control points of the object.
| type | The type of points to be returned:
|
| GlgObject CreateResourceList | ( | boolean | list_named_res, |
| boolean | list_def_attr, | ||
| boolean | list_aliases | ||
| ) |
Returns a list of the object's resources.
| list_named_res | Include named resources if true. |
| list_def_attr | Include default attributes if true. The resource objects referred to by the default resource names are not actually included in the list. Instead a dummy scalar data object (type D) is included whose name is the same as the default attribute. |
| list_aliases | Include aliases if true. The resource objects referred to by the aliases are not included in the list. Instead a dummy scalar data object (type D) is included whose name is the same as the alias. |
The list_named_res, list_def_attr and list_aliases parameters let you choose whether the returned array should include named resources, default attributes, aliases or any combination of the above.
The returned array has one entry for each resource. The entries are not sorted and are listed in the order of the occurrence inside their category. The named resources (if any) are listed first, then default resources and finally the aliases.
For named resources, the entries are the resource objects themselves. For default resources and aliases, the entries are dummy scalar data objects named after the default attributes or aliases. For both types of entries, the name of the entry object is the name of the resource listed.
The following code fragment shows how to print the list of an object's resources:
The method returns 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:
Returns a relative resource path that can be used to access the object as a resource of the parent object.
| object | The object whose resource path is being queried. The object must be named. |
| parent | The parent object relative to which the resource path is evaluated. It must have its HasResources flag set. |
|
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 CreateSelectionFromEvent that creates selection from an event.
Action objects attached to objects in the drawing provide a higher level interface for custom object selection processing.
| top_vp | The 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. |
| rectangle | The 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_vp | The 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. |
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.
|
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.
| x | X coordinate of the event (relative to the selected_vp). |
| y | Y coordinate of the event (relative to the selected_vp). |
| delta | Specifies 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_vp | The 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_vp | The viewport in which the mouse event occurred. The X and Y coordinates are defined relatively to this viewport's area. If a light viewport is supplied, its parent viewport will be used. |
| 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.
| x,y | Specify 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,dy | Specify 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. |
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_HTML5/misc_demos/GlgRTChart.js 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.
| boolean DeleteTags | ( | GlgTagType | tag_type_mask | ) |
Deletes all data tags or all public properties inside the object the method is invoked on.
| tag_type_mask | Defines the type of tags to delete: |
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.
|
static |
Controls the use of attachment points to determine object extents when the objects are aligned.
| state | Specifies if attachment points should be used in addition to the control points to determine object extents when the objects are aligned using control points. |
| Object FindObjects | ( | GlgObjectMatchType | match_type, |
| boolean | find_parents, | ||
| boolean | include_top_object, | ||
| boolean | find_first_match, | ||
| boolean | search_inside, | ||
| boolean | search_drawable_only, | ||
| GlgObjectType | object_type, | ||
| String | object_name, | ||
| String | resource_name, | ||
| GlgObject | object_id, | ||
| Function | custom_match, | ||
| boolean | search_templates, | ||
| boolean | dont_add_matches | ||
| ) |
Finds either one or all parents or children of the object that match the supplied search criteria.
| match_type | Specifies a bitwise mask of the object matching criteria. The following criteria are supported:
All of the criteria in the mask must be true in order for an object to match. |
| find_parents | Controls search direction:
|
| include_top_object |
|
| find_first_match |
|
| search_inside |
|
| search_drawable_only |
|
| object_type | Object type for the object type search. Only objects of this type will be matched. |
| object_name | Object name for the object name search. Only objects with this name will be matched. |
| resource_name | Resource name for the RESOURCE_MATCH. "resource search". Only objects that have a resource at the resource path specified by resource_name will be matched. The resource pointed to by the resource path must be an object. |
| object_id | An object to be matched for the OBJECT_ID_MATCH "object ID match". Only the specified object will be matched. This type of search can be used to find out if the specified object is either a child or a parent of the object the method is invoked on. |
| custom_match | A function that will be invoked for each object to provide custom matching logic. The function must have the following type signature: boolean custom_match( GlgObject object );
where:
The function should return true if a match was detected, |
| search_templates |
This flag is ignored when the search is performed before hierarchy setup, when the instances have not yet been loaded, and only the templates are available. |
| dont_add_matches |
|
| boolean FitObject | ( | GlgCoordType | coord_type, |
| GlgCube | box, | ||
| boolean | keep_ratio | ||
| ) |
Fits the object to the specified rectangular area.
| coord_type | Specifies the coordinate system for interpreting coordinates of the area to fit to:
|
| box | The area to fit the object to.
|
| keep_ratio | Controls how the object's X/Y ratio is handled:
|
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.
| 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.
| action_type | An action type. If zero (0), actions of any type will be considered. |
| trigger_type | A trigger type. If zero (0), actions with any trigger type will be considered. |
| button | A mouse button. If zero (0), actions that are activated by any mouse button will be considered. |
| armed_state | The setting of the action's ProcessArmed attribute, see GlgArmedStateType. |
| double_click_state | The setting of an action's DoubleClick attribute, see GlgDoubleClickStateType. |
| action | The input action string for action objects with INPUT_TRIGGER trigger. If null, action objects with any input action string will be considered. |
| subaction | Specifies input subaction string for action objects with INPUT_TRIGGER trigger. If null, action objects with any input subaction string will be considered. |
| enabled_only | If true, only actions enabled by the settings of their Enabled attribute will be considered. |
| 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.
| alarm_label | A string or a pattern for the search (may include ? and wildcards). |
| single_alarm | Defines a single alarm (true) or multiple alarm (false) mode. |
The GetElement and GetSize methods may be used to handle the returned group object.
| GlgCube GetBox | ( | ) |
Returns the object's bounding box extent in screen coordinates.
For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's x ReleaseToCache method.
The object box may be converted to world coordinates by using the sequence of the GetDrawingMatrix, CreateInversedMatrix and TransformPoint methods.
| GlgObject GetDrawingMatrix | ( | ) |
ADVANCED: Returns transformation matrix 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.
| Object GetElement | ( | int | index | ) |
Returns element at the specified position in the container.
| index | The element's position inside the container. |
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.
| GlgGISRequestObserver GetGISRequestInfo | ( | String | resource_name | ) |
Obtains information about an asynchronous map loading request in progress for the GIS object the method is invoked on.
| resource_name | A 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. |
|
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.
| viewport | The viewport the handler is attached to. |
| int GetIndex | ( | Object | object | ) |
Returns index of the first occurrence of an object in the container.
| object | The object to search for. |
| 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.
| x,y | Specifies the position in screen coordinates of the viewport containing the legend. |
See also GetSelectedPlot.
| GlgMatrixData GetMatrixData | ( | GlgMatrixData | matrix_data | ) |
ADVANCED: Queries matrix coefficients of the matrix.
| matrix_data | The 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. |
For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's ReleaseToCache method.
| GlgObject GetNamedObject | ( | String | name | ) |
Finds an object with the specified name inside the container of GLG objects and returns it.
| name | The object's name. |
|
static |
Retrieves the key of the native keypress event.
| call_event | A call event of the NATIVE_EVENT type containing a native key event. |
|
static |
Retrieves the type of the native event that triggered the call event being sent to the custom interaction handler.
| call_event | A call event of the NATIVE_EVENT type. |
|
static |
Retrieves the X and Y coordinates of the native event.
| call_event | A call event of the NATIVE_EVENT type containing a native mouse event. |
| y_coord | If true, returns Y coordinate, otherwise returns X coordinate. |
| 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.
| Object GetObjectData | ( | ) |
Retrieves application data attached to the object via SetObjectData.
| GlgObject GetObjectViewport | ( | boolean | heavy_weight, |
| boolean | self | ||
| ) |
Returns parent viewport of the drawable object.
| heavy_weight | Controls the type of a parent viewport to be returned.
|
| self |
|
The object's hierarchy must be set up to use this method, otherwise an error message is generated and null is returned.
| GlgObject GetParent | ( | ) |
ADVANCED: Returns the object's parent object, if one exists, or an array of all parents for constrained data objects.
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.
| GlgObject GetParentViewport | ( | boolean | heavy_weight | ) |
Returns parent viewport of the drawable object.
| heavy_weight | Controls the type of a parent viewport to be returned.
|
The object's hierarchy must be set up to use this method, otherwise an error message is generated and null is returned.
| Object GetResource | ( | String | resource_name | ) |
Deprecated, use GetNativeComponent:
Returns an ID of a native resource.
| resource_name | Specifies the resource path of a native resource. |
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.
| GlgObject GetResourceObject | ( | String | resource_name | ) |
Finds and returns a named resource or an attribute of the object.
| resource_name | A resource path to access the resource object inside the object the method is invoked on. It may use object names or default attribute names. |
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.
|
static |
Returns the plot object corresponding to the last legend item selected with the mouse, if any.
The setting of the chart's viewport ProcessMouse attribute controls when legend selection happens:
This method can be used in conjunction with a mouse click Action attached to the Legend object. The DEMOS_HTML5/misc_demos/GlgRTChart.js 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.
| int GetSize | ( | ) |
Returns size of the container object.
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.
| int GetStringIndex | ( | String | search_string | ) |
| 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.
| search_string | A string or a pattern for the search (may include the ? and * wildcards). |
| by_name | If true, the search is performed by matching the tag names, otherwise the search is done by matching the tag sources for data tags or matching the tag categories for export tags. |
| unique_tags | Controls if only one tag is included in case there are multiple data tags with the same TagName or TagSource (is ignored in the single tag mode and when searching for export tags):
|
| single_tag | Defines the single tag (true) or multiple tag (false) mode. In the single tag mode, the first found tag object of the highest priority matching the search criteria will be returned. Input tags are prioritized over output tags, and enabled tags over disabled tags. |
| tag_type_mask | Defines the type of tags to query: data tags or export tags. For export tags, tag type constants may be combined with bitwise OR to query multiple subtypes of export tags. |
The GetElement and GetSize methods may be used to handle the returned group object in the multiple tag mode.
| 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.
| tag_name | Specifies 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. |
| 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.
| resource_name | A 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. |
The DEMOS_HTML5/misc_demos/GlgAirTraffic.js in the GLG installation directory proides an example of using the method to install the received map.
| void Inverse | ( | ) |
Inverses the order of elements inside the container object.
| boolean IsAt | ( | GlgPositionType | position | ) |
Checks the position of the iteration pointer (the current element of the container).
| position | The position that is being checked. |
true if the container's current position pointer matches the specified position:
| boolean IsDrawable | ( | ) |
Checks 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.
| Object Iterate | ( | ) |
Traverses the container object's elements in the forward direction.
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:
| Object IterateBack | ( | ) |
Traverses the container object's elements in the backward direction.
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:
| 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.
| anchor | The anchor object for alignment operations. If null, the first encountered object in the specified alignment direction is used. |
| type | The type of the layout action to perform:
|
| distance | The distance in screen coordinates for positioning objects, it is interpreted depending on the layout action. |
| use_box | Controls how the objects extent is determined:
|
| process_subobjects | Controls how to apply the layout action if the object is a group:
|
The object's hierarchy must be set up to use this method.
| boolean MoveObject | ( | GlgCoordType | coord_type, |
| GlgPoint | start_point, | ||
| GlgPoint | end_point | ||
| ) |
Moves an object by a move vector.
| coord_type | Specifies the coordinate system for interpreting the move vector:
|
| start_point | The start point of the move vector. If null, (0,0,0) is used as the start point. |
| end_point | The end point of the move vector. |
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.
| boolean MoveObjectBy | ( | GlgCoordType | coord_type, |
| double | x, | ||
| double | y, | ||
| double | z | ||
| ) |
Moves the object by the specified distances.
| coord_type | Specifies the coordinate system for interpreting move distances:
|
| x,y,z | The X, Y and Z move distances. |
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.
| boolean MoveObjectByPoint | ( | GlgCoordType | coord_type, |
| GlgPoint | point | ||
| ) |
Moves the object by distances specified by the GlgPoint object.
| coord_type | Specifies the coordinate system for interpreting move distances:
|
| point | GlgPoint containing X, Y and Z move distance values. |
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.
| boolean PositionObject | ( | GlgCoordType | coord_type, |
| GlgAnchoringType | anchoring, | ||
| double | x, | ||
| double | y, | ||
| double | z | ||
| ) |
Positions the object at the specified location.
| coord_type | Specifies the coordinate system for interpreting postion coordinates:
|
| 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,z | The X, Y and Z coordinates of the desired object position. |
This method positions the object, calculating new control point values. The object's hierarchy must be set up to use this method.
| boolean PositionObjectByPoint | ( | GlgCoordType | coord_type, |
| GlgAnchoringType | anchoring, | ||
| GlgPoint | position | ||
| ) |
Positions the object at the location specified by the GlgPoint object.
| coord_type | Specifies the coordinate system for interpreting postion coordinates:
|
| 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. |
| position | GlgPoint containing x, y and z coordinates of the desired object position. |
This method positions the object, calculating new control point values. The object's hierarchy must be set up to use this method.
| 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.
For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's ReleaseToCache method.
| resource_name | A 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,y | Specify 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_x | If true, false will be returned for points outside the X extent of the chart or axis object. |
| outside_y | If true, false will be returned for points outside the Y extent of the chart or axis object. |
| GlgObject QueryTags | ( | GlgTagType | tag_type_mask | ) |
Returns a group of all tags of the requested tag type defined in the object.
| 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. |
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.
| void ReleaseObject | ( | GlgObject | suspend_info | ) |
Releases the object that was suspended for editing.
| suspend_info | Suspension 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.
| boolean ReorderElement | ( | int | current_index, |
| int | new_index | ||
| ) |
Changes an element's position inside the container.
| current_index | The index of an element to be reordered. |
| new_index | A new element position. |
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.
| 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. When the map is requested, the browser loads GIS map asynchronously. 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. This is 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.
| resource_name | A 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_x | Specifies a new GIS x extent. |
| extent_y | Specifies a new GIS y extent. |
| center_x | Specifies a new GIS x center. |
| center_y | Specifies a new GIS y center. |
| angle | Specifies a new GIS angle. |
| projection | Specifies a new GIS projection. |
| layers | Specifies a new GIS layer string. |
| flags | Controls which GIS object's parameters will be updated and is formed as a bitwise OR the following flags: |
| request_observer | Specifies an observer whose RequestUpdate method will be invoked with status updates. Use CreateGlgGISRequestObserver to create a GIS request observer. See GlgGISRequestObserver for more information. |
The DEMOS_HTML5/misc_demos/GlgAirTraffic.js in the GLG installation directory proides an example of using the method to load a new map.
| 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. When the map is zoomed or scrolled, the browser loads GIS map asynchronously. 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. This is 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.
| resource_name | A 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. |
| type | A character 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. |
| value | Specifies the amount to zoom or pan by. See the value parameter of the SetZoom method for more information. |
| request_observer | Specifies an observer whose RequestUpdate method will be invoked with status updates. Use CreateGlgGISRequestObserver to create a GIS request observer. See GlgGISRequestObserver for more information. |
The DEMOS_HTML5/misc_demos/GlgAirTraffic.js in the GLG installation directory proides an example of using the method to zoom and pan the map.
Converts screen coordinates relative to the page to the screen coordinates in the specified viewport.
| viewport | The viewport whose screen coordinate system to convert to. |
| point | The point to be converted. The converted values are placed back into the point. |
The viewport's hierarchy must be set up to use this method.
| boolean RotateObject | ( | GlgCoordType | coord_type, |
| GlgPoint | center, | ||
| double | x_angle, | ||
| double | y_angle, | ||
| double | z_angle | ||
| ) |
Rotates the object.
| coord_type | Specifies the coordinate system for interpreting the rotation's center:
|
| center | The 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_angle | The 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). |
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.
| Uint8List SaveObject | ( | String | encoding | ) |
Serializes the object into a byte array using the specified encoding.
This method serializes the object and all its subsidiary objects into a byte array using the GLG ASCII save format that provides maximum portability between different deployment environments.
| encoding | Defines encoding to be used for string encoding, "ascii", "latin1" or "utf8". Pass null to use the default Latin1 encoding. |
| boolean ScaleObject | ( | GlgCoordType | coord_type, |
| GlgPoint | center, | ||
| double | x_scale, | ||
| double | y_scale, | ||
| double | z_scale | ||
| ) |
Scales the object.
| coord_type | Specifies the coordinate system for interpreting the scale center:
|
| center | The 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_scale | The X, Y and Z scaling factors. Use the same value for all three factors to scale the object uniformly in all dimensions. |
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.
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.
| inside_vp | If the object is a viewport or a light viewport, inside_vp specifies which world coordinate system to use:
The value of this parameter is ignored for objects other than a viewport or light viewport. |
| in_point | The point to be converted. |
| out_point | The point that will receive converted world coordinates. |
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.
|
static |
Sends a message to the Input callback.
This method is used by custom interaction handlers to invoke an application's Input callback.
| viewport | The handler's viewport. |
| message_obj | A GLG message object created via CreateMessage. |
| action | The 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. |
| subaction | The 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.
|
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.
| handler | The custom setup handler to be invoked. Use CreateCustomSetupHandler to create a custom setup handler. |
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_HTML5/SCADAViewer/GlgViewer.js file 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.
| 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.
|
static |
Stores data used by the custom handler instance.
This method is invoked on the viewport or light viewport the handler is attached to.
| viewport | The viewport the handler is attached to. |
| data | The 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.
| void SetMatrixData | ( | GlgMatrixData | matrix_data | ) |
ADVANCED: Sets matrix's coefficients to the supplied values.
| matrix_data | GlgMatrixData object containing new matrix values. |
| void SetObjectData | ( | Object | data | ) |
Attaches arbitrary application data to the graphical object the method is invoked on.
| data | The data that will be attached. |
| GlgGISRequestObserver SetScrollbarObserver | ( | String | resource_name, |
| GlgGISRequestObserver | request_observer | ||
| ) |
Controls the the way integrated scrollbars work for the GIS object.
| resource_name | A 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_observer | Specifies a request observer:
|
The DEMOS_HTML5/misc_demos/GlgAirTraffic.js 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.
| 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.
| void SetTemplate | ( | GlgObject | template | ) |
ADVANCED: Sets a template of a subdrawing or subwindow object.
| template | The object to set as a template of reference object the method is invoked on. If template is null, the drawing specified by the SourcePath attribute will be used. The SourcePath attribute must be set before setting a null template. |
The content displayed in a subdrawing or subwindow object can be changed by setting the object's SourcePath attribute. The browser loads new content asynchronously, and an empty space is displayed while the new content is loaded. The SetTemplate method an be used when an application wants to continue displaying the subdrawing's or subwindow's old content while the new content is being loaded. The SetTemplate method is then used to set the new content when it is becomes available.
The DEMOS_HTML5/SCADAViewer/GlgViewer.js file in the GLG installation directory demonstrates the use of the SetTemplate method to replace the subwindow content.
| GlgObject SuspendObject | ( | ) |
Suspends the object for editing after it has been drawn.
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.
|
static |
Highlights all objects in the drawing that depend on the tag or resource object that is being traced.
| object | The object to trace. The object must be set up in order to trace its dependencies. |
| state |
|
| is_widget |
|
| top_parent |
|
| action | An optional method that that provides a custom condition and will be invoked for every parent of the traced object with the following type signature: boolean custom_match( GlgObject object );
where:
If the method returns true, the parent will be highlighed or unhighlighted depending on the value of the state parameter. |
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 method) 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.
| 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.
| xform | The transformation (an XFORM object) to be applied to the object's points |
| coord_type | The coordinate system to interpret the transformation in:
|
| parent | The 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. |
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.
Transforms a single point using the matrix object the method is invoked on.
| in_point | The input point to be transformed. |
| out_point | The transformed point. |
This method applies the transformation matrix to the in_point parameter, and returns the result in out_point.
|
static |
Converts screen coordinates of a point in one viewport to the screen coordinates of another viewport.
| from_viewport | The viewport in which the point's screen coordinates are defined. |
| to_viewport | The viewport whose screen coordinate system to convert to. |
| point | The point to be converted. The converted values are placed back into the point. |
The objects's hierarchy must be set up to use this method.
| void TraverseObjects | ( | Function | enter_func, |
| Function | exit_func | ||
| ) |
Traverses the object hierarchy of the object and invokes the supplied functions on the object itself and all its subobjects, including object attributes.
One function is invoked when entering an object and another when exiting it.
| enter_func | A custom traversal function that will be invoked for each traversed object to perform a custom action before traversing its subobjects. The function must have the following type signature: boolean enter_action( GlgObject object );
where:
The function's return result is used to modify the traversal: if the function returns false for a subobject, traversal of objects inside the subobject will not be performed. |
| exit_func | An optional function that will be invoked for each traversed object to perform a custom action after traversing its subobjects. If null is supplied as the value of the exit_func parameter, the exit function will not be used. The function must have the same type signature as enter_action and must always return true. |
| boolean UnconstrainObject | ( | ) |
Unconstrains the object's attribute or the object's point.
| attribute | The attribute or point object to be unconstrained. |
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.
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.
| inside_vp | If the object is a viewport or a light viewport, inside_vp specifies which world coordinate system to use:
The value of this parameter is ignored for objects other than a viewport or light viewport. |
| in_point | The point to be converted. |
| out_point | The point that will receive converted screen coordinates. |
The object's hierarchy must be set up to use this method.