GLG Toolkit, JavaScript Library  Version 4.6
1. Standard API Methods

Detailed Description

This group lists GLG Standard API methods of the GlgObject class.

These methods are used to:

Specialized Chart methods, as well as a variety of utility methods, are also provided.

Functions

GlgObject AddAnnotation (String resource_name, GlgObject annotation, double position_x, double position_y, boolean add_box)
 Adds an annotation to the chart object. More...
 
static void AddGlobalListener (GlgCallbackType type, Function callback)
 ADVANCED: Adds a global listener for the TemplateLoad events. More...
 
void AddListener (GlgCallbackType type, Function callback)
 Adds a GLG event listener to the viewport. More...
 
GlgObject AddPlot (String resource_name, GlgObject plot)
 Adds a plot line to the chart object. More...
 
GlgObject AddTimeLine (String resource_name, GlgObject time_line, double time_stamp)
 Adds a vertical time line to the chart object. More...
 
static void Bell ()
 Emits an audio beep. More...
 
static void BellExt (double volume, double frequency, double duration)
 Emits a beeping sound with the specified parameters. More...
 
void ChangeObject (String resource_path)
 Sends a change message the object without actually changing the object's properties. More...
 
boolean ClearDataBuffer (String resource_name)
 Clears accumulated data samples of a real-time chart or one of its plots. More...
 
static String ConcatResNames (String resource_name1, String resource_name2)
 Creates a composite resource path from two components. More...
 
boolean ConfigureWindow (int x, int y, int width, int height, GlgConfigureMask mask, GlgObject parent)
 Sets the size and/or position of a viewport's window. More...
 
GlgObject CreateAlarmList ()
 Creates and returns a list of alarms defined in the object. More...
 
static String CreateIndexedName (String template_name, int resource_index)
 Creates a string with a name of an enumerated resource. More...
 
static GlgObject CreateSelectionMessage (GlgObject top_vp, GlgCube rectangle, GlgObject selected_vp, GlgSelectionEventType selection_type, int button)
 Searches for an Action object that would be activated by the user interaction event. More...
 
static GlgObject CreateSelectionNames (GlgObject top_vp, GlgCube rectangle, GlgObject selected_vp)
 Returns a list of names of objects intersecting a given rectangle. More...
 
static GlgObject CreateSelectionNamesFromEvent (int x, int y, int delta, GlgObject top_vp, GlgObject selected_vp)
 Returns a list of names of objects located under the mouse. More...
 
GlgObject CreateTagList (boolean unique_tag_sources)
 Creates and returns a list of data tags defined in the object. More...
 
boolean DeleteAnnotation (String resource_name, GlgObject annotation, double position_x, double position_y)
 Deletes an annotation from the chart. More...
 
boolean DeletePlot (String resource_name, GlgObject plot)
 Deletes a plot line from the chart. More...
 
boolean DeleteTimeLine (String resource_name, GlgObject time_line, double time_stamp)
 Deletes a time line from the chart. More...
 
static void EnableMultiTouchDefaultAction (bool state)
 Enables or disables default browser actions on double touch when touch events are enabled. More...
 
static boolean EnableTimerXforms (boolean state)
 ADVANCED: Enables or disables all timer transformations defined inside GLG drawings. More...
 
boolean Equals (GlgObject object)
 Performs equality comparison between the object passed as the method parameter and the object the method is invoked on. More...
 
static void Error (GlgErrorType error_type, String message, Object exception)
 Display an error message using the GLG error handler. More...
 
Object ExportStrings (String separator1, String separator2)
 Writes all text strings defined in the viewport's drawing into an object representing an image of a string translation file. More...
 
Object ExportTags (String separator1, String separator2)
 Writes tag names and tag sources of all data tags defined in the viewport's drawing to a tag remapping file. More...
 
GlgMinMax GetChartDataExtent (String resource_name, boolean x_extent, boolean visible_only)
 Queries the minimum and maximum extent of the data accumulated in the chart or in one of its plots in the specified X or Y direction. More...
 
GlgDataType GetDataType ()
 Returns The data object's data type. More...
 
double GetDResource (String resource_name)
 Returns the current value of the object's D (double) resource. More...
 
double GetDTag (String tag_source)
 Returns the current value of the object's D (double) tag. More...
 
GlgPoint GetGResource (String resource_name)
 Returns the current value of the object's G (geometrical or color) resource. More...
 
GlgPoint GetGTag (String tag_source)
 Returns the current value of the object's G (geometrical or color) tag. More...
 
static String GetLibraryVersion ()
 Returns GLG API library version as a string. More...
 
static boolean GetModifierState (GlgModifierType modifier)
 Returns the current state of a modifier. More...
 
GlgObject GetNamedPlot (String resource_name, String plot_name)
 Given a name of the chart's plot, returns the plot's object ID. More...
 
Object GetNativeComponent (String resource_name, GlgComponentQueryType type)
 ADVANCED: Returns a native component used to render the viewport. More...
 
String GetObjectName ()
 Returns the object's name. More...
 
GlgObjectType GetObjectType ()
 Returns the object's type. More...
 
static int GetPendingInstances ()
 Returns a number of subdrawing and subwindow objects that are waiting for their templates being loaded. More...
 
static int GetPendingTemplates ()
 Returns a number of subdrawing and subwindow templates that are in the process of being loaded. More...
 
static GlgObject GetReference (GlgObject object)
 Creates a reference to a GlgObject that may be used outside of a callback function. More...
 
String GetSResource (String resource_name)
 Returns the current value of the object's S (string) resource. More...
 
static String GetStackTraceAsString ()
 Returns current stack trace as a string. More...
 
String GetSTag (String tag_source)
 Returns the current value of the object's S (string) tag. More...
 
static boolean GetTouchMode ()
 Queries the state of the GLG touch mode. More...
 
boolean GISConvert (String resource_name, GlgCoordType coord_type, boolean coord_to_lat_lon, GlgPoint in_point, GlgPoint out_point)
 Performs coordinate conversion from the GIS coordinates of the GIS Object to the GLG coordinates of the drawing and visa versa. More...
 
boolean GISCreateSelection (String resource_name, String layers, double x, double y, GlmLabelSelectionMode select_labels, Function callback)
 Queries information about GIS features located at the specified map position. More...
 
boolean GISGetElevation (String resource_name, String layer_name, double lon, double lat, Function callback)
 
Queries map server elevation data. More...
 
static void GlmConvert (GlgProjectionType projection, boolean stretch, GlgCoordType coord_type, boolean coord_to_lat_lon, GlgPoint center, GlgPoint extent, double angle, double min_x, double max_x, double min_y, double max_y, GlgPoint in_point, GlgPoint out_point)
 A low level method that performs coordinate conversion from the GIS coordinates of a map to the GLG coordinates of the drawing and visa versa without the help of a GLG GIS Object. More...
 
boolean HasResourceObject (String resource_name)
 Checks if the object's named resource exists. More...
 
boolean HasTagName (String tag_name)
 Checks if the object's data tag with a specified tag name exists. More...
 
boolean HasTagSource (String tag_source)
 Checks if the object's data tag with a specified tag source exists. More...
 
int ImportStrings (String data, boolean verbose)
 Replaces text strings in the viewport's drawing with the strings loaded from a string translation file. More...
 
int ImportTags (String data, boolean verbose)
 Replaces the TagName and TagSource attributes of data tags in the viewport's drawing with information loaded from a tag remapping file. More...
 
void InitialDraw ()
 Draws a GLG viewport object for the first time after it has been created or loaded. More...
 
static boolean IsDemo ()
 Queries the type of the GLG library. More...
 
static void LoadAsset (String url, GlgHTTPRequestResponseType request_type, Function callback, Object user_data, String user, String password)
 Loads an asset from a URL. More...
 
static GlgObject LoadObject (Object data, String encoding, String base_path, GlgObject rebind_ref)
 Loads a GLG object from raw data using the specified encoding. More...
 
static void LoadObjectFromURL (String url, String encoding, Function callback, Object user_data, function abort_func, GlgObject rebind_ref)
 Loads a GLG object from a URL using the specified encoding, with an ability to abort or rebind. More...
 
static GlgObject LoadWidget (Object data, String encoding, String base_path)
 Loads a viewport named $Widget from raw data using the specified encoding. More...
 
static GlgObject LoadWidgetFromObject (GlgObject glg_object)
 Finds a viewport named $Widget inside an object and returns it. More...
 
static void LoadWidgetFromURL (String url, String encoding, Function callback, Object user_data, function abort_func)
 Loads a viewport named $Widget from a URL using the specified encoding. More...
 
static boolean ObjectsEqual (GlgObject object1, GlgObject object2)
 Performs equality comparison between two GLG objects. More...
 
static String PrintfD (String format, double value)
 C-style printf method for formatting double values. More...
 
static String PrintfI (String format, int value)
 C-style printf method for formatting integer values. More...
 
static String PrintfS (String format, String value)
 C-style printf method for formatting strings. More...
 
static double Rand (double low, double high)
 Returns a random number in the specified range. More...
 
static ReleaseToCache (Object object)
 ADVANCED: Releases an object to a cache for reuse, minimizing garbage collection. More...
 
boolean Reset ()
 Reinitializes the viewport's drawing by resetting its drawing hierarchy, then setting it up again and rendering the drawing. More...
 
void ResetHierarchy ()
 Resets the object hierarchy of the object. More...
 
Object SendMessageToObject (String resource_name, String message, Object param1, Object param2, Object param3, Object param4)
 Sends a message to the object to request some action to be performed. More...
 
static GlgAlarmHandler SetAlarmHandler (GlgAlarmHandler alarm_handler)
 Installs a global alarm handler that will be invoked to process alarms. More...
 
static void SetCanvasScale (double scale, double text_scale, double native_text_scale, double pixel_offset_scale, double screen_coord_scale)
 Specifies parameters of the coordinate scaling used to render GLG drawings in HTML canvas on mobile devices. More...
 
boolean SetCursorType (String resource_name, GlgCursorType cursor_type)
 Sets cursor for the viewport's drawing or one of its child viewports. More...
 
static void SetCustomLoadFunc (Function custom_load_func)
 ADVANCED: Sets a custom load function callback. More...
 
static void SetCustomURLFormatter (Function formatter_func)
 ADVANCED: Sets a custom URL formatter. More...
 
boolean SetDResource (String resource_name, double value)
 Sets a new value of the object's D (double) resource. More...
 
boolean SetDResourceIf (String resource_name, double value, boolean if_changed)
 Sets a new value of the object's D (double) resource. More...
 
boolean SetDTag (String tag_source, double value, boolean if_changed)
 Sets a new value of the object's D (double) tag. More...
 
static boolean SetEditMode (GlgObject viewport, String resource_name, boolean edit_mode)
 Sets the viewport's edit mode to disable input objects in the viewport while the drawing is being edited. More...
 
static GlgErrorHandler SetErrorHandler (GlgErrorHandler new_handler)
 Replaces the GLG Toolkit error handler and returns the previous error handler. More...
 
void SetFocus (String resource_name)
 Sets the keyboard focus to the object's viewport. More...
 
boolean SetGResource (String resource_name, double x_value, double y_value, double z_value)
 Sets new values of the object's G (geometrical or color) resource. More...
 
boolean SetGResourceFromPoint (String resource_name, GlgPoint g_value)
 Sets new values of the object's G (geometrical or color) resource. More...
 
boolean SetGResourceFromPointIf (String resource_name, GlgPoint g_value, boolean if_changed)
 Sets new values of the object's G (geometrical or color) resource. More...
 
boolean SetGResourceIf (String resource_name, double x_value, double y_value, double z_value, boolean if_changed)
 Sets new values of the object's G (geometrical or color) resource. More...
 
boolean SetGTag (String tag_source, double x_value, double y_value, double z_value, boolean if_changed)
 Sets new values of the object's G (geometrical or color) tag. More...
 
boolean SetGTagObj (String tag_source, GlgPoint value, boolean if_changed)
 Sets new values of the object's G (geometrical or color) tag. More...
 
boolean SetLabelFormatter (String resource_name, function formatter)
 Attaches a custom label formatter to the chart axis or the stand-alone axis object. More...
 
boolean SetLinkedAxis (String resource_name, GlgObject axis_object, String axis_resource_name)
 Associates the chart's plot, level line or annotation object with an Y axis for automatic rescaling. More...
 
static void SetLocale (String locale)
 Sets locale used to display dates and numbers. More...
 
void SetParentElement (String element_id)
 Specifies a parent DIV element to use for the viewport's drawing. More...
 
boolean SetResourceFromObject (String resource_name, GlgObject value)
 Sets a new value of the object's resource to the value of contained in the provided data object of the same data type. More...
 
boolean SetResourceFromObjectIf (String resource_name, GlgObject value, boolean if_changed)
 Sets the value of the object's data object to the value of another data object of the same data type. More...
 
boolean SetSResource (String resource_name, String value)
 Replaces the string of the object's S (string) resource. More...
 
boolean SetSResourceFromD (String resource_name, String format, double value)
 Sets the value of the object's S (string) resource from a double value, converting the value into a string using a C-style printf format string. More...
 
boolean SetSResourceFromDIf (String resource_name, String format, double value, boolean if_changed)
 Sets the value of the object's S (string) resource from a double value, converting the value into a string using a C-style printf format string. More...
 
boolean SetSResourceIf (String resource_name, String value, boolean if_changed)
 Replaces the string of the object's S (string) resource. More...
 
boolean SetSTag (String tag_source, String value, boolean if_changed)
 Replaces the string of the object's S (string) tag. More...
 
boolean SetSTagFromD (String tag_source, String format, double value, boolean if_changed)
 Sets the value of the object's S (string) tag from a double value, converting the value into a string using a C-style printf format string. More...
 
static GlgTooltipFormatter SetTooltipFormatter (GlgTooltipFormatter formatter)
 Supplies a custom tooltip formatter. More...
 
static void SetTouchMode ()
 Enables handling of touch events. More...
 
void SetupHierarchy ()
 Provides an explicit request to set up the object hierarchy of the object without rendering it. More...
 
boolean SetZoom (String resource_name, char type, double value)
 Provides a programmatic interface to integrated zooming and panning. More...
 
boolean SetZoomMode (String resource_name, GlgObject zoom_object, String zoom_object_resource_name, GlgZoomMode zoom_mode)
 Sets or resets the viewport's zoom mode by supplying a GIS or Chart object to be zoomed. More...
 
static void ThrowExceptionOnError (boolean user_error, boolean internal_error, boolean detect_null_strings)
 Controls throwing an exception on an error to assist debugging. More...
 
boolean Update ()
 Updates the drawing of a viewport or a light viewport with the latest resource values. More...
 
boolean UpdateChartState (String resource_name, int state)
 Triggers updating the chart's state after prefilling it with data using the quick mode of AddPlotDataSample. More...
 
boolean UpdateChartTimeAxis (String resource_name, double time_stamp, boolean initialize)
 Scrolls the chart forward to show all data samples up to the provided time stamp or index. More...
 
void UpdateSize ()
 Updates the size of the top viewport. More...
 

Function Documentation

◆ AddAnnotation()

GlgObject AddAnnotation ( String  resource_name,
GlgObject  annotation,
double  position_x,
double  position_y,
boolean  add_box 
)

Adds an annotation to the chart object.

Parameters
resource_nameA resource path of a child chart, or null to add to the chart the method is invoked on. The resource path is relative to the invoking object.
annotationA Text object that will be used as an annotation. null may be used to create a new annotation.
position_xAn annotation's position relative to the X axis.
position_yAn annotation's position relative to the Y axis.
add_boxIf true, a text box will be added to the annotation's text object.
Returns
The added annotation on success, or null on failure.

The chart's NumAnnotations attribute should be set to -1 in order to use this method.

◆ AddGlobalListener()

static void AddGlobalListener ( GlgCallbackType  type,
Function  callback 
)
static

ADVANCED: Adds a global listener for the TemplateLoad events.

The listener is used to perform any subdrawing initialization that needs to be done after their object hierarchy has been set up. See TemplateLoadCallback for more information, including alternative ways to handle TemplateLoad events.

For the GLG event listeners, see AddListener.

Parameters
typeCallback type: TEMPLATE_LOAD_CB.
callbackA callback function with the type signature matching the type signature of the TemplateLoadCallback entry point of GlgTemplateLoadListener. This function will be invoked to handle TemplateLoad events generated by subdrawings and subwindows when their templates are loaded.

◆ AddListener()

void AddListener ( GlgCallbackType  type,
Function  callback 
)

Adds a GLG event listener to the viewport.

An Input listener can also be added to the light viewport.

Parameters
typeSpecifies the type of a listener to be added:
callbackSpecifies a callback function to be invoked to process GLG events. The function's type signature must match the type signature of the listener's single entry point (InputCallback for the GlgInputListener, TraceCallback for the GlgTraceListener, etc.).

This method adds the specified callback to the viewport. A callback is a user-supplied function that is called by the GLG Toolkit upon some action:

  • Input callback is invoked when an input widget, such as a slider or a toggle, receives some user input. It is also invoked when an object in the viewport is selected.
  • Select callback is invoked when a user selects an object in the widget's drawing area.
  • Trace callback is invoked for every native windowing system event received by the viewport or its child viewports and may be used to handle these events.
  • Hierarchy callback may be used to initialize loaded subdrawings.

See GlgInputListener, GlgSelectListener, GlgTraceListener and GlgHierarchyListener for the description of the available listener types.

Only one callback of each callback type may be added to an individual viewport. Any subsequent invocations of AddListener with the same callback type will overwrite the previous value of the viewport's callback. To remove a callback, call AddListener with null as a value of the callback parameter.

Note: Callbacks must be added before the drawing's hierarchy is set up.

Several callbacks of the same type may be added to different viewports on different levels of the drawing hierarchy. However, only the first encountered callback on the lowest level of the hierarchy will be called. For example, if an input callback is attached to a viewport and its child viewport, only the child viewport's callback will be invoked when input event occurs in the child viewport.

If an event occurs in a child viewport that doesn't have a callback attached, the callback of the first encountered parent viewport that has the callback attached will be invoked.

The viewport's ProcessMouse attribute controls processing of the mouse selection events and tooltips inside the viewport and its child viewports.

See the Callback Events section of the Handling User Input and Other Events chapter of the GLG Programming Reference Manual for more information.

◆ AddPlot()

GlgObject AddPlot ( String  resource_name,
GlgObject  plot 
)

Adds a plot line to the chart object.

Parameters
resource_nameA resource path of a child chart, or null to add to the chart the method is invoked on. The resource path is relative to the invoking object.
plotA plot object. null may be used to create a new plot.
Returns
The added plot on success, or null on failure.

◆ AddTimeLine()

GlgObject AddTimeLine ( String  resource_name,
GlgObject  time_line,
double  time_stamp 
)

Adds a vertical time line to the chart object.

Parameters
resource_nameA resource path of a child chart, or null to add to the chart the method is invoked on. The resource path is relative to the invoking object.
time_lineA Level Line object to be used as a time line. null may be used to create a new time line.
time_stampThe timestamp to position the time line at. This value will be assigned to the time line's Level attribute.
Returns
The added time line on success, or null on failure.

The chart's NumTimeLines attribute should be set to -1 in order to use this method.

◆ Bell()

static void Bell ( )
static

Emits an audio beep.

See BellExt for more control over the audio beep parameters.

◆ BellExt()

static void BellExt ( double  volume,
double  frequency,
double  duration 
)
static

Emits a beeping sound with the specified parameters.

The Bell method uses this method with the following parameters:

BellExt( 0.03, 520, 0.1 );
static void BellExt(double volume, double frequency, double duration)
Emits a beeping sound with the specified parameters.
Definition: GlgObject.cs:13699
Parameters
volumeThe sound volume.
frequencyThe sound frequency.
durationThe sound duration in seconds.

◆ ChangeObject()

void ChangeObject ( String  resource_path)

Sends a change message the object without actually changing the object's properties.

Parameters
resource_pathIf null, the message is sent to the object the method is invoked on. Otherwise, the message is sent to the object's child specified by the resource path. The resource path is relative to the invoking object.

This method may be used to send a change message to an object's attribute. Sending the message to an object attribute is equivalent to setting the attribute to the same value as its current value using one of the SetDResource, SetSResource or SetDResource methods.

For example, sending the message to the Factor attribute of a volatile series object forces the series to recreate its instances without actually changing the value of the Factor. If the change message is sent to the ImageFile attribute of an image object, the image will reload the image file (the image's EnableCache attribute should be set to NO to disable cache for images that need to be reloaded).

Sending a change message to a drawable object forces the object to redraw itself. If the message is sent to an object like a polygon or a text object, the area of the object's bounding box gets invalidated and redrawn. If an object is a viewport, it redraws its content.

◆ ClearDataBuffer()

boolean ClearDataBuffer ( String  resource_name)

Clears accumulated data samples of a real-time chart or one of its plots.

Parameters
resource_nameA resource path of a child chart or a child plot, or null to clear the chart or the plot the method is invoked on. The resource path is relative to the invoking object.
Returns
  • true if any data samples were cleared
  • false on error or if no samples were cleared.

For a Chart object, ClearDataBuffer discards data samples in all plots of the chart. For a Plot object, it discards only the data samples of that plot.

◆ ConcatResNames()

static String ConcatResNames ( String  resource_name1,
String  resource_name2 
)
static

Creates a composite resource path from two components.

This method is provided to mimic C/C++ API in cases when the C/C++ GLG code is converted to JavaScript.

Parameters
resource_name1Specifies the first resource path component.
resource_name2Specifies the second resource path component.
Returns
Created resource path.

This method creates and returns a resource path formed by concatenating the two components with the / character between them. The method checks if a trailing / separator is already present in the first string, and adds it only if the separator is not present.

Either argument may be null, in which case the returned string will precisely equal the input value of the other argument.

Examples

The following code:

let resource_path = GLG.ConcatResNames( "DataGroup", "DataSample2" );
console.log( "resource_path: " + resource_path );

produces the following output:

resource_path = DataGroup/DataSample2

Multiple calls to ConcatResNames may be used to create composite paths from more than two components:

let temp_name = GLG.ConcatResNames( "DataGroup", "DataSample2" );
let resource_path = GLG.ConcatResNames( temp_name, "Value" );
console.log( "resource_path: " + resource_path );

producing the following output:

resource_path: DataGroup/DataSample2/Value

◆ ConfigureWindow()

boolean ConfigureWindow ( int  x,
int  y,
int  width,
int  height,
GlgConfigureMask  mask,
GlgObject  parent 
)

Sets the size and/or position of a viewport's window.

The method is new in the GLG release 4.5. The method should be invoked only for the viewport objects, not the light viewports.

Parameters
xSpecifies X coordinate of the window origin in device pixels.
ySpecifies Y coordinate of the window origin in device pixels.
widthSpecifies window width in device pixels.
heightSpecifies window height in device pixels.
mask

Specifies flags that can be combined with bitwise OR to control the action to perform, set size, set position or both:

  • POSITION_MASK requests to set window position using x and y parameters and ignore the position defined by the viewport's control points. For top-level viewports, the x and y parameters specify position in screen coordinates relative to the origin of the screen. For child viewports and embedded dialog viewports, position parameters specify position relative to the origin of their parent viewport's window.
  • SIZE_MASK requests to set window size using width and height parameters and ignore the width and height defined by the viewport's control points.
  • POSITION_AND_SIZE_MASK requests to set both the size and position, is equivalent to:
  • RESET_POSITION_MASK resets the position request to restore the position defined by the viewport's control points.
  • RESET_SIZE_MASK resets the size request to restore the width and height defined by the viewport's control points.

The set and reset flags are exclusive and can't be used together for the same size or position attribute.

parentReserved, must be null.
Returns
Success or failure status.

Once the viewport's size or position is set using ConfigureWindow, the viewport's control points are no longer used for controlling the viewport's size and/or position. If only the viewport's position is set and not its size, the size will be still controlled by the viewport's control points, and vice versa if only the size is set and not the position. The mask parameter of the method contains options to restore the use of the control points for determining the viewport's size or position after it was set with ConfigureWindow.

Note: The method's x, y, width and height parameters must be integer values. Any non-integer parameter value should be truncated using the Math.trunc function to avoid exceptions when a debugging library with strict type checking is used.

◆ CreateAlarmList()

GlgObject CreateAlarmList ( )

Creates and returns a list of alarms defined in the object.

Returns
A group containing all alarm objects, or null if no alarm objects were found.

Each element of the returned group is a data object that has an alarm attached. The GetElement and GetSize methods of the Intermediate API may be used within the Standard API to handle the returned group object.

If the object is not a viewport, the returned alarm list will include only alarms contained inside the object. For a viewport, the alarm list will contain all alarms defined in the viewport's drawing.

Example

The following code prints information about all alarms defined in the drawing:

let alarm_list = viewport.CreateAlarmList();
if( alarm_list != null )
{
let size = alarm_list.GetSize();
for( let i=0; i<size; ++i )
{
// The data object the alarm is attached to.
let data_object = alarm_list.GetElement( i );
// AlarmLabel may be unnamed, extract it as the XformAttr1 resource of the alarm object.
let alarm_label = data_object.GetSResource( "Alarm/XformAttr1" );
console.log( "AlarmLabel: " + alarm_label );
}
}

◆ CreateIndexedName()

static String CreateIndexedName ( String  template_name,
int  resource_index 
)
static

Creates a string with a name of an enumerated resource.

This method is provided to mimic C/C++ API in cases when the C/C++ GLG code is converted to JavaScript.

Parameters
template_nameA character string containing the template name to be expanded. This name uses the % character to define the expansion position.
resource_indexSpecifies the number to use for expanding the % character in the template name.
Returns
Created resource name.

This method creates and returns a resource name by replacing the first (leftmost) occurrence of the % expansion character within the template name with the number corresponding to the resource_index parameter. If the template name does not contain the expansion character, the number is added to the end of the name.

Examples

The following code:

for( let i=0; i<3; ++i )
{
let name = GLG.CreateIndexedName( "XLabelGroup/XLabel%/String", i );
console.log( "Name: " + name );
}

produces the following output:

Name: XLabelGroup/XLabel0/String
Name: XLabelGroup/XLabel1/String
Name: XLabelGroup/XLabel2/String

CreateIndexedName may be used repeatedly if a template name has more than one expansion character. For example, the following code:

let name1 = GLG.CreateIndexedName( "Chart%/Plots/Plot#%/Value", 4 );
let name2 = GLG.CreateIndexedName( name1, 3 );
console.log( "Name:" + name2 );

produces the following output:

Name: Chart4/Plots/Plot#3/Value

◆ CreateSelectionMessage()

static GlgObject CreateSelectionMessage ( GlgObject  top_vp,
GlgCube  rectangle,
GlgObject  selected_vp,
GlgSelectionEventType  selection_type,
int  button 
)
static

Searches for an Action object that would be activated by the user interaction event.

This method provides a low-level API for searching all objects inside the given rectangle for an action with the specified selection trigger type attached to an object and returning a selection message for the first found action attached to the object.

The method may be used inside the GlgTraceListener's TraceCallback method to determine whether a mouse event was meant to trigger an action attached to a graphical object in a drawing.

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 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.
selection_typeSpecifies the selection type:
buttonThe mouse button (1, 2 or 3) for the CLICK_SELECTION selection type.
Returns
A message equivalent to the message received in the input callback when the event specified by the selection_type occurs in the specified rectangular area, or null if no matching actions were found.

◆ CreateSelectionNames()

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

Returns a list of names of 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 GlgTraceListener's TraceCallback method to implement custom handling of mouse events.

See also CreateSelectionNamesFromEvent that creates selection names from an event.

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

A more powerful CreateSelection method of the Intermediate API returns object IDs of the selected objects and may be used to handle unnamed objects.

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 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 of strings containing selected object names, or null if no named objects were selected.

The method returns an array of strings containing names of all objects that overlap with the given rectangle completely or partially. Both the selected objects at the bottom of the hierarchy and all their named parents will be included.

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.

Each returned name string is a complete resource path name (relative to top_vp) which can be used get the object ID of the object:

let selected_object = top_vp.GetResourceObject( path_name );

◆ CreateSelectionNamesFromEvent()

static GlgObject CreateSelectionNamesFromEvent ( int  x,
int  y,
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 GlgTraceListener's TraceCallback method to implement custom handling of mouse events.

See also CreateSelectionNames that creates selection names for the specified area.

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

A more powerful CreateSelectionFromEvent method of the Intermediate API returns object IDs of the selected objects and may be used to handle unnamed objects.

Parameters
xX coordinate of the event (relative to the selected_vp).
yY coordinate of the event (relative to the selected_vp).
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. 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.
Returns
An array of strings containing selected object names, or null if no named objects were selected.

Follow this link for information on using the returned array.

◆ CreateTagList()

GlgObject CreateTagList ( boolean  unique_tag_sources)

Creates and returns a list of data tags defined in the object.

Parameters
unique_tag_sources
  • If true, only the first encountered tag of the highest priority will be added to the list for tags with the same tag source. Input tags are prioritized over output tags, and enabled tags over disabled tags.
  • If false, all instances with the same tag source will be included.
Returns
A group containing all data tag objects, or null if no tags were found.

Each element of the returned group is an attribute object that has a data tag attached. The GetElement and GetSize methods of the Intermediate API may be used within the Standard API to handle the returned group object.

If the object is not a viewport, the returned tag list will include only the tags contained inside the object. For a viewport, the tag list will contain all tags defined in the viewport's drawing.

Example

The following code prints information about all tags defined in the drawing:

// Query list of tags defined in the drawing.
let tag_list = viewport.CreateTagList( false );
if( tag_list != null )
{
let size = tag_list.GetSize();
for( let i=0; i<size; ++i )
{
// Query TagName and TagSource of each tag.
let tag_object = GlgGetElement( tag_list, i );
let tag_name = tag_object.GetSResource( "TagName" );
let tag_source = tag_object.GetSResource( "TagSource" );
console.log( "TagName: " + tag_name + " TagSource: " + tag_source );
}
}

Tag Access Performance Optimization

Since tags returned by CreateTagList are actually data objects the tags are attached to, their object IDs may be stored and then used repeatedly to optimized tag access performance when tags are used to supply data for a drawing with large number of tags.

Instead of setting new tag values with SetDTag:

viewport.SetDTag( tag_source, new_value, true );

the stored object IDs may be used with the the SetDResource method using null as the resource_name parameter to set a new value of each data object directly without an overhead of searching the drawing for each tag by its TagSource:

tag_object.SetDResourceIf( null, new_value, true );

NOTE: If multiple tags in a drawing share the same tag source, setting a tag value using the object ID will only update a single, specific tag.

The AddPlotDataSample method of the Intermediate API can also be used instead of setting values of chart entry points to prefill a chart with a large number of data samples.

The GetTagObject and QueryTags methods of the Intermediate API provide extended functionality for querying both data and export tags.

◆ DeleteAnnotation()

boolean DeleteAnnotation ( String  resource_name,
GlgObject  annotation,
double  position_x,
double  position_y 
)

Deletes an annotation from the chart.

Parameters
resource_nameA resource path of a child chart, or null to delete from the chart the method is invoked on. The resource path is relative to the invoking object.
annotationThe annotation object to delete. If null, the annotation with the timestamp specified by the position_x and position_y parameters will be deleted.
position_xThe X position of the annotation to be deleted when the annotation parameter is null. The parameter is ignored if annotation is not null.
position_yThe Y position of the annotation to be deleted when the annotation parameter is null. The parameter is ignored if annotation is not null.
Returns
true if the annotation was successfully deleted.

The chart's NumAnnotations attribute should be set to -1 in order to use this method.

◆ DeletePlot()

boolean DeletePlot ( String  resource_name,
GlgObject  plot 
)

Deletes a plot line from the chart.

Parameters
resource_nameA resource path of a child chart, or null to delete from the chart the method is invoked on. The resource path is relative to the invoking object.
plotThe plot object to delete.
Returns
true if the plot was successfully deleted.

◆ DeleteTimeLine()

boolean DeleteTimeLine ( String  resource_name,
GlgObject  time_line,
double  time_stamp 
)

Deletes a time line from the chart.

Parameters
resource_nameA resource path of a child chart, or null to delete from the chart the method is invoked on. The resource path is relative to the invoking object.
time_lineThe time line object to delete. If null, the time line with the timestamp specified by time_stamp will be deleted.
time_stampThe timestamp of the time line to be deleted when the time_line parameter is null. The parameter is ignored if time_line is not null.
Returns
true if the plot was successfully deleted.

The chart's NumTimeLines attribute should be set to -1 in order to use this method.

◆ EnableMultiTouchDefaultAction()

static void EnableMultiTouchDefaultAction ( bool  state)
static

Enables or disables default browser actions on double touch when touch events are enabled.

If default browser actions on double touch are enabled (default), an application can use single touch for application activities, such as scrolling a real-time chart by touching and dragging, while letting the browser scroll or zoom the page when two fingers are used inside the GLG component. The double-touch events will be handled by the browser and will not be sent to the application's Trace callback.

Default browser actions on double touch can be disabled for applications that either provide custom handling of double touch events or want to disable the default scrolling and zooming actions in response to the touch events inside the GLG component. Default browser actions on double touch are disabled by passing false as the method's parameter, in which case all touch events will be passed to the application's Trace callback regardless of the number of simultaneous touches.

Parameters
statetrue to enable default browser actions on double touch or false to disable them.

◆ EnableTimerXforms()

static boolean EnableTimerXforms ( boolean  state)
static

ADVANCED: Enables or disables all timer transformations defined inside GLG drawings.

This method may be used to temporarily disable time transformation in some advanced usage scenarios.

Parameters
stateThe new enabled state.
Returns
Previous value of the enabled state.

◆ Equals()

boolean Equals ( GlgObject  object)

Performs equality comparison between the object passed as the method parameter and the object the method is invoked on.

Parameters
objectThe GlgObject to compare with.
Returns
true if the passed object represents the same internal GLG object as the object the method is invoked on.

◆ Error()

static void Error ( GlgErrorType  error_type,
String  message,
Object  exception 
)
static

Display an error message using the GLG error handler.

Invokes a currently installed error handler to generate an error message. See GlgErrorType for details on how different message types are handled by the default error handler.

Parameters
error_type

Specifies an error type, may be one of the following:

messageThe message to be displayed.
exceptionAn optional exception that caused the error. If it is not null, it is used to print additional information by converting it to string.

◆ ExportStrings()

Object ExportStrings ( String  separator1,
String  separator2 
)

Writes all text strings defined in the viewport's drawing into an object representing an image of a string translation file.

If the method is invoked on an arbitrary non-viewport object, it writes all text strings defined in the object.

Parameters
separator1A character value that specifies the first separator character to be used in the generated output (for example, '#').
separator2A character value that specifies the second separator character to be used in the generated output (for example, '#').
Returns
A JavaScript object containing a count and data properties on success, or null on error. An integer count property contains the number of exported strings, and a string data property contains an image of the string translation file with a list of exported strings.
The number of exported strings or -1 in case of an error.

This method exports all strings defined in the drawing to an ASCII string translation file that can be edited using a text editor.

The method exports strings of the S (string) resource objects, such as the String attribute of a text object. It does not export strings that are not values of S resource objects, such as object names, tag names and tag sources, which ensures that the program logic is not affected when the translated file is used by ImportStrings to modify text strings in the drawing.

The string translation file contains a line for each exported string. Each string entry contains the name of a string resource which helps identify how the string is used, and two copies of the string: the current value and the new value. Each item in the string entry is separated by two separator characters. The name of the string resource and the first copy of the string are used to identify the string and should not be changed.

When the file is translated, the second copy of the string (the new value) may be replaced with a new string representing the text in the local language and local character set. Multiple copies of the file can be created, one for each supported language.

The ImportStrings method can be used at run time to display a localized drawing. An application can load different versions of the translated file to display localized drawings for different language environments.

This method provides a programming interface for exporting strings from a drawing. The File, Export Strings option of the GLG editors can be used to export strings from the loaded drawing, in which case two double quotation characters are used as the default separators. This can be changed by defining the GLG_STRING_SEPARATOR environment variable to supply a two character string to be used as a separator.

Refer to the Localization Support section of the GLG User's Guide and Builder Reference Manual for more information about the string translation file format.

◆ ExportTags()

Object ExportTags ( String  separator1,
String  separator2 
)

Writes tag names and tag sources of all data tags defined in the viewport's drawing to a tag remapping file.

If the method is invoked on an arbitrary non-viewport object, it writes all data tags defined in the object.

Parameters
separator1A character value that specifies the first separator character to be used in the generated output (for example, '#').
separator2A character value that specifies the second separator character to be used in the generated output (for example, '#').
Returns
A JavaScript object containing a count and data properties on success, or null on error. An integer count property contains the number of exported tags, and a string data property contains an image of the tag remapping file with a list of exported tags.
The number of exported tags or -1 in case of an error.

This method exports all data tags defined in the drawing to an ASCII tag file that can be edited using a text editor.

Each tag entry contains two copies of the tag's TagName and TagSource attributes separated by two separator characters. The first copy of the TagName and TagSource attributes contains the current values. It is used to identify the tag and should not be changed.

The second copy of the attributes contains new values that may be changed to modify the tag. The new value of the TagSource attribute supplies the data source variable associated with the tag. Tag names can also be localized by translating new values of the TagName attributes to different languages.

The file can be edited to modify new values, and then imported into the drawing using ImportTags.

This makes it possible to use the drawing as a template, and modify it on the fly to use a different set of tags. This technique may be used to create a single drawing, and then use it at run time to display different sections of a plant or different rooms of a data center. Alternatively, tag remapping may also be done programmatically as shown in the GLG demos.

This method provides a programming interface for exporting tag from a drawing. The File, Export Tags option of the GLG editors can be used to export tags from the loaded drawing, in which case two double quotation characters are used as the default separators. This can be changed by defining the GLG_STRING_SEPARATOR environment variable to supply a two character string to be used as a separator.

Refer to the Tag Export and Import Features for Run-Time Tag Mapping section of the GLG User's Guide and Builder Reference Manual for more information about the tag file format.

◆ GetChartDataExtent()

GlgMinMax GetChartDataExtent ( String  resource_name,
boolean  x_extent,
boolean  visible_only 
)

Queries the minimum and maximum extent of the data accumulated in the chart or in one of its plots in the specified X or Y direction.

Parameters
resource_nameA resource path to access the child chart or the child plot. Use null to use the chart or the plot the method is invoked on. The resource path is relative to the invoking object.
x_extentIf true, the method returns the X extent, otherwise it returns the Y extent.
visible_onlyIf true, the method considers only visible data samples when calculating data extent, otherwise all samples are considered.
Returns
The returned data extent or null on error.

For a chart object, the method returns the data extent of all plots in the chart is returned. For a plot, the data extent of that plot is returned.

The object hierarchy must be set up for this method to succeed.

For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's ReleaseToCache method.

◆ GetDataType()

GlgDataType GetDataType ( )

Returns The data object's data type.

Returns
The object's data type.

◆ GetDResource()

double GetDResource ( String  resource_name)

Returns the current value of the object's D (double) resource.

Parameters
resource_nameSpecifies the resource path of the object's scalar resource to query.
Returns
Resource value or null if the resource was not found.

If a scalar resource with the given resource path exists, this method returns its value, otherwise it generates an error message and returns null.

◆ GetDTag()

double GetDTag ( String  tag_source)

Returns the current value of the object's D (double) tag.

Parameters
tag_sourceSpecifies the TagSource of the scalar tag to query.
Returns
Tag value or null if the tag was not found.

If a scalar tag with the given TagSource exists, this method returns its value, otherwise it generates an error message and returns null.

◆ GetGResource()

GlgPoint GetGResource ( String  resource_name)

Returns the current value of the object's G (geometrical or color) resource.

Parameters
resource_nameSpecifies the resource path of the G resource to query.
Returns
A GlgPoint containing XYZ or RGB resource values.

If a G resource with the given resource path exists, this method returns its values in a GlgPoint object, otherwise it generates an error message and returns null.

For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's ReleaseToCache method.

◆ GetGTag()

GlgPoint GetGTag ( String  tag_source)

Returns the current value of the object's G (geometrical or color) tag.

Parameters
tag_sourceSpecifies the TagSource of the G tag to query. All object's tags with the specified TagSource will be set to the supplied values.
Returns
A GlgPoint containing XYZ or RGB resource values.

If a G tag with the given TagSource exists, this method returns its values in a GlgPoint object, otherwise it generates an error message and returns null.

For efficiency, if the returned object is not null, it can be returned to the internal cache via the object's ReleaseToCache method.

◆ GetLibraryVersion()

static String GetLibraryVersion ( )
static

Returns GLG API library version as a string.

The string uses the "N1.N2" format, where N1 is replaced with MAJOR_VERSION and N2 is replaced with MINOR_VERSION, for example, "4.5".

Returns
The string that represents the major and minor version of the GLG JavaScript library.

◆ GetModifierState()

static boolean GetModifierState ( GlgModifierType  modifier)
static

Returns the current state of a modifier.

Parameters
modifierSpecifies the modifier to query, may be one of the following constants:
Returns
The current modifier state.

◆ GetNamedPlot()

GlgObject GetNamedPlot ( String  resource_name,
String  plot_name 
)

Given a name of the chart's plot, returns the plot's object ID.

Parameters
resource_nameA resource path of a child chart to query, or null to query the chart the method is invoked on. The resource path is relative to the invoking object.
plot_nameThe plot name.
Returns
The found plot, or null if a plot with the specified name was not found.

◆ GetNativeComponent()

Object GetNativeComponent ( String  resource_name,
GlgComponentQueryType  type 
)

ADVANCED: Returns a native component used to render the viewport.

The method provides an access to native components used to render the viewport, making it possible to set their native properties.

Parameters
resource_nameA resource path of a child viewport, or null to query the viewport the method is invoked on. The resource path is relative to the invoking object.
typeThe type of a component to retrieve:
  • WIDGET_QUERY returns the native component used to render the viewport.

  • SHELL_QUERY returns the top-level DIV element used to host the GLG drawing.

  • CHILD_WIDGET_QUERY returns native subcomponents of the native toggle button (check box) and list viewports. For these viewport types WIDGET_QUERY returns the DIV container that holds elements used to render these native widgets, while CHILD_WIDGET_QUERY returns the check box's Label element or the DIV element used to scroll the list.

  • CHILD_WIDGET2_QUERY returns native subcomponents of the native toggle button (check box) and list viewports. For these viewport types WIDGET_QUERY returns the DIV container that holds elements used to render these native widgets, while CHILD_WIDGET2_QUERY returns the check box (Input Checkbox) or the list (Select) element.

  • SHELL_TITLE_QUERY returns the DIV element used to render the title of viewports with the DIALOG_SHELL and APPLICATION_SHELL settings of the ShellType attributes.

  • SHELL_CLOSE_BUTTON_QUERY returns the Button element representing the Close (X) button inside the title of the DIALOG_SHELL and APPLICATION_SHELL viewports.
Returns
The retrieved native component.

◆ GetObjectName()

String GetObjectName ( )

Returns the object's name.

Returns
The object's name or null if the object is unnamed.

◆ GetObjectType()

GlgObjectType GetObjectType ( )

Returns the object's type.

Returns
The object's type.

◆ GetPendingInstances()

static int GetPendingInstances ( )
static

Returns a number of subdrawing and subwindow objects that are waiting for their templates being loaded.

Returns
The number of pending subdrawing and subwindow instances.

◆ GetPendingTemplates()

static int GetPendingTemplates ( )
static

Returns a number of subdrawing and subwindow templates that are in the process of being loaded.

Returns
The number of pending subdrawing and subwindow templates.

◆ GetReference()

static GlgObject GetReference ( GlgObject  object)
static

Creates a reference to a GlgObject that may be used outside of a callback function.

Parameters
objectGlgObject to reference.
Returns
GlgObject that equals to the object parameter and may be used outside of a callback function.

Any object obtained inside a callback without a call to a GLG method that returns an object is not valid outside of a callback. GetReference method should be used to assign such an object to a variable used outside the callback, as shown in the below example:

let StoredGlgObject = null;
function TraceCallback( viewport, trace_info )
{
// Incorrect: can't assign an object received in a callback to a variable outside the callback.
StoredGlgObject = viewport;
StoredGlgObject = trace_info.viewport;
// Correct: using GetReference to assign an object received in a callback to a variable outside the callback.
StoredGlgObject = GLG.GetReference( trace_viewport );
StoredGlgObject = GLG.GetReference( trace_info.viewport );
// Correct: storing a GLG object received from a call to a GLG API method.
StoredGlgObject = trace_info.viewport.GetResourceObject( "FillColor" );
}

Note: The only exception from the above rule is a load callback: the loaded object is owned by the application code and can be stored in a variable that is used outside the callback.

◆ GetSResource()

String GetSResource ( String  resource_name)

Returns the current value of the object's S (string) resource.

Parameters
resource_nameSpecifies the resource path of the string resource to query.
Returns
Resource value or null if the resource was not found.

If a string resource with the given resource path exists, this method returns its value, otherwise it generates an error message and returns null.

◆ GetStackTraceAsString()

static String GetStackTraceAsString ( )
static

Returns current stack trace as a string.

Returns
Stack trace string.

◆ GetSTag()

String GetSTag ( String  tag_source)

Returns the current value of the object's S (string) tag.

Parameters
tag_sourceSpecifies the TagSource of the string tag to query.
Returns
Resource value or null if the resource was not found.

If a string tag with the given TagSource exists, this method returns its value, otherwise it generates an error message and returns null.

◆ GetTouchMode()

static boolean GetTouchMode ( )
static

Queries the state of the GLG touch mode.

Returns
true if the touch mode is currently enabled by SetTouchMode.

◆ GISConvert()

boolean GISConvert ( String  resource_name,
GlgCoordType  coord_type,
boolean  coord_to_lat_lon,
GlgPoint  in_point,
GlgPoint  out_point 
)

Performs coordinate conversion from the GIS coordinates of the GIS Object to the GLG coordinates of the drawing and visa versa.

Parameters
resource_nameThe resource path of a child GIS object whose coordinate system to use for conversion, or null to use the GIS object the method is invoked on. The resource path is relative to the invoking object.
coord_typeThe type of the GLG coordinate system to convert to or from:
coord_to_lat_lon
  • true to convert from GLG coordinates to GIS longitude and latitude
  • false to convert the GIS longitude and latitude to GLG coordinates.
in_pointGlgPoint containing input values (x/y in the selected coordinate system or lon/lat).
out_pointGlgPoint that will receive converted output values (x/y in the selected coordinate system or lon/lat).
Returns
Success or failure status.

When converting from X/Y to lat/lon coordinates in the ORTHOGRAPHIC projection, the Z coordinate is set to a negative value for points on the invisible part of the globe or outside the globe area, and to zero for points on the edge of the globe. Coordinates of the returned point may be outside of the visible portion of the map for all projections.

This method performs coordinate conversion using the current settings of the GIS object, which must be set up and rendered.

The GlmConvert method may be used to perform coordinate conversion between GIS and GLG coordinates without the use of the GIS object, which could be done before the drawing is rendered, without a drawing at all, or without a GIS object being present.

◆ GISCreateSelection()

boolean GISCreateSelection ( String  resource_name,
String  layers,
double  x,
double  y,
GlmLabelSelectionMode  select_labels,
Function  callback 
)

Queries information about GIS features located at the specified map position.

This method provides a high-level interface to the map server's GlmGetSelection function and may be used to query GIS selection at the point selected by the mouse click.

Parameters
resource_nameThe resource path of a child GIS object to query or null to query the GIS object the method is invoked on.
layersA list of layers to query.
x,yCoordinates of a point in the screen coordinates of a viewport that contains the GIS object.
select_labelsSpecifies the label selection mode, can have the following values:
  • GIS_LBL_SEL_NONE - GIS features' labels are not considered for the GIS selection.
  • GIS_LBL_SEL_IN_TILE_PRECISION - enables labels to be considered for the GIS selection. For a faster selection, this option does not check labels that belong to GIS features in a different tile but extend to the current tile.
  • GIS_LBL_SEL_MAX_PRECISION - enables labels to be considered for the GIS selection and performs selection with the maximum label precision.

    The layer's settings have precedence over the select_labels parameter. The labels will be considered for selection only for the layers that do not override it by setting their LABEL SELECTION MODE=NONE in the layer's LIF file. If LABEL SELECTION MODE=INTILE, the labels will always be considered using the IN_TILE precision.
callback

A function to be invoked with the received selection data, with the following type signature:

void callback( GlgObject gis_object, double selection_message );

where:

  • gis_object is the GIS object being queried
  • selection_message is a message object containing returned selection data. It could be null if there was no selection detected at the requested coordinates.

Refer to the GlmGetSelection section of the GLG Map Server Reference Manual for information on the structure of the returned message object.

Returns
true if selection request was successfully posted (in which case the callback function will be invoked when the data are received), or false otherwise.

◆ GISGetElevation()

boolean GISGetElevation ( String  resource_name,
String  layer_name,
double  lon,
double  lat,
Function  callback 
)


Queries map server elevation data.

This method may be used to query elevation at the point selected by the mouse click.

The returned value is in the units (such as meters or feet) defined by the elevation data file.

Parameters
resource_nameThe resource path of a child GIS object to query or null to query the GIS object the method is invoked on.
layer_nameThe name of the layer with elevation data to query.
lon,latThe lon/lat coordinates of a point on the map.
callback

A function to be invoked with the received elevation data, with the following type signature:

void callback( GlgObject gis_object, double elevation );

where:

  • gis_object is the GIS object being queried
  • elevation is the returned elevation value, which could be null if the point is outside of the map in the ORTHOGRAPHIC projection, or if there is no elevation data for the specified location.
Returns
true if elevation request was successfully posted (in which case the callback function will be invoked when the data are received), or false otherwise.

◆ GlmConvert()

static void GlmConvert ( GlgProjectionType  projection,
boolean  stretch,
GlgCoordType  coord_type,
boolean  coord_to_lat_lon,
GlgPoint  center,
GlgPoint  extent,
double  angle,
double  min_x,
double  max_x,
double  min_y,
double  max_y,
GlgPoint  in_point,
GlgPoint  out_point 
)
static

A low level method that performs coordinate conversion from the GIS coordinates of a map to the GLG coordinates of the drawing and visa versa without the help of a GLG GIS Object.

Since the method does not rely on a GIS Object being displayed and set up, it may be used before the drawing is rendered, without a drawing at all, or without a GIS object being present.

When converting from X/Y to lat/lon coordinates in the ORTHOGRAPHIC projection, the Z coordinate is set to a negative value for points on the invisible part of the globe or outside the globe area, and to zero for points on the edge of the globe. Coordinates of the returned point may be outside of the visible portion of the map for all projections.

Parameters
projectionA GIS map projection: RECTANGULAR_PROJECTION or ORTHOGRAPHIC_PROJECTION.
stretchSpecifies if the map preserves the X/Y ratio (false) or not (true).
coord_typeThe type of the GLG coordinate system to convert to or from:
coord_to_lat_lon
  • true to convert from GLG coordinates to GIS longitude and latitude
  • false to convert from GIS longitude and latitude to GLG coordinates.
centerGlgPoint containing lat/lon coordinates of the map center. The Z coordinate must be set to 0.
extentGlgPoint containing X and Y extent of the map in the selected projection: in degrees for the RECTANGULAR projection or in meters for ORTHOGRAPHIC. The Z extent must be set to 0. Refer to the GIS Object section on of the GLG User's Guide and Builder Reference Manual for more details.
angleA map rotation angle in degrees.
min_x,max_x,min_y,max_yA map extent in the selected coordinate system. To get X/Y coordinates relative to the map image origin, use min_x=0, min_y=0, max_x=image_width, max_y=image_height.
in_pointGlgPoint containing coordinate values to be converted (x/y in the selected coordinate system or lon/lat).
out_pointGlgPoint that will receive converted coordinate values (x/y in the selected coordinate system or lon/lat).

◆ HasResourceObject()

boolean HasResourceObject ( String  resource_name)

Checks if the object's named resource exists.

Parameters
resource_nameThe resource path of the resource object to query.
Returns
true if a resource object with the given resource path exists, otherwise returns false without generating an error message.

◆ HasTagName()

boolean HasTagName ( String  tag_name)

Checks if the object's data tag with a specified tag name exists.

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

◆ HasTagSource()

boolean HasTagSource ( String  tag_source)

Checks if the object's data tag with a specified tag source exists.

Parameters
tag_sourceSpecifies the tag source to query.
Returns
true if a tag with the given tag source exists, otherwise returns false without generating an error message.

◆ ImportStrings()

int ImportStrings ( String  data,
boolean  verbose 
)

Replaces text strings in the viewport's drawing with the strings loaded from a string translation file.

If the method is invoked on an arbitrary non-viewport object, it replaces text strings defined in the object.

Parameters
dataA string containing an image of the loaded string translation file with a list of strings to be converted.
verboseIf true, generates an error for each string that was not changed to a new value because it was missing a matching entry in the string translation file.
Returns
The number of imported strings or -1 in case of an error.

This method can be used at run time to display a localized drawing. An application can load different versions of the translated file to display localized drawings for different language environments. See ExportStrings for more information.

This method provides a run time interface for importing translated strings into a drawing to display it in a different language environment. The File, Import Strings option of the GLG editors can be used to import strings into the currently loaded drawing for testing.

◆ ImportTags()

int ImportTags ( String  data,
boolean  verbose 
)

Replaces the TagName and TagSource attributes of data tags in the viewport's drawing with information loaded from a tag remapping file.

If the method is invoked on an arbitrary non-viewport object, it processes the data tags defined in the object.

Parameters
dataA string containing an image of the loaded tag remapping file with a list of tags to be converted.
verboseIf true, generates an error for each tag that was not modified because it was missing a matching entry in the tag remapping file.
Returns
The number of imported tags or -1 in case of an error.

This method can be used at run time to modify the data tags used by the drawing. It load the specified tag remapping file and uses it to modify the drawing's data tags. See ExportStrings for more information.

This method provides a run time interface for importing modified tags into a drawing. The File, Import Tags option of the GLG editors can be used to import tags into the currently loaded drawing for testing.

◆ InitialDraw()

void InitialDraw ( )

Draws a GLG viewport object for the first time after it has been created or loaded.

The method displays a viewport's drawing and is part of the GLG Generic API.

The method creates a top level window and renders the viewport's drawing in it.

InitialDraw is equivalent to the following sequence:

viewport.SetupHierarchy();
viewport.Update();

Follow this link for additional information on setting up subdrawings and subwindows.

◆ IsDemo()

static boolean IsDemo ( )
static

Queries the type of the GLG library.

Returns
true if the Community Edition version of the library is used.

◆ LoadAsset()

static void LoadAsset ( String  url,
GlgHTTPRequestResponseType  request_type,
Function  callback,
Object  user_data,
String  user,
String  password 
)
static

Loads an asset from a URL.

The asset data are loaded asynchronously and a callback is invoked when the data are ready.

Parameters
urlAsset URL.
request_typeA type of the asset to load: one of the values of the GlgHTTPRequestResponseType enum, such as GLG_DRAWING, TEXT, BLOB, UINT8_ARRAY, etc.
callback

A callback function to be invoked when the asset data has been loaded, with the following type signature:

void callback( Object loaded_data, Object user_data, String load_path );

where:

  • loaded_data is the loaded asset data in the requested format
  • user_data is the user_data parameter passed to LoadAsset
  • load_path is the full URL path used to load the asset.
user_dataAn object that will be passed to the callback.
userAn optional username for HTTP Basic Authentication, enabling credential-based access to protected resources.
passwordAn optional password for HTTP Basic Authentication.

NOTE: Do not hardcode usernames or passwords as literal strings. For enhanced security, users should enter these credentials via a dialog box over an HTTPS connection.

The GLG HTML5 demos and examples in the GLG installation directory provide examples of using LoadAsset in various application scenarios.

◆ LoadObject()

static GlgObject LoadObject ( Object  data,
String  encoding,
String  base_path,
GlgObject  rebind_ref 
)
static

Loads a GLG object from raw data using the specified encoding.

The raw data may be obtained using the LoadAsset method with the GLG_DRAWING request type.

Parameters
dataThe raw data to load the object from (Uint8Array).
encodingDefines encoding to be used for string decoding, "ascii", "latin1" or "utf8". Pass null to use the default Latin1 encoding. The encoding is used to decode all input strings that do not have the UTF8 flag set. The S (string) data objects with the UTF8 flag are always decoded using UTF8.
base_pathAn optional load path of the drawing object represented by the data parameter, or null. If any image, subdrawing or subwindow objects are present in the drawing, the images' ImagePath and the subdrawings' SourcePath attributes will be interpreted relative to the base_path.
rebind_refThe reference object to use for rebinding if the loaded object will be used as a template via SetTemplate, or null otherwise.
Returns
The loaded object or null if loading fails.

◆ LoadObjectFromURL()

static void LoadObjectFromURL ( String  url,
String  encoding,
Function  callback,
Object  user_data,
function  abort_func,
GlgObject  rebind_ref 
)
static

Loads a GLG object from a URL using the specified encoding, with an ability to abort or rebind.

This method is similar to LoadAsset, but provides additional parameters to abort the loading process as soon as possible, as well as to perform data rebinding when the method is used to load a subdrawing or subwindow template.

Parameters
urlDefines a URL of the drawing.
encodingDefines encoding to be used for string decoding, "ascii", "latin1" or "utf8". Pass null to use the default Latin1 encoding. The encoding is used to decode all input strings that do not have the UTF8 flag set. The S "S" (string) data objects with the UTF8 flag are always decoded using UTF8.
callback

A callback to be invoked when the GLG object has been loaded, with the following type signature:

void callback( GlgObject loaded_object, Object user_data, String load_path );

where:

  • loaded_object is the loaded GLG object
  • user_data is the user_data parameter passed to LoadObjectFromURL
  • load_path is the full URL path used to load the object.
user_dataUser data to be passed to the callback.
abort_func

An optional function used to check if the load request was canceled while it was being processed, with the following type signature:

void abort_callback( Object user_data );

where:

The function will be invoked when the browser finishes loading the object's raw data, but before deserializing it into a GLG object. If the function returns true, the load process will be aborted. If it returns false, the loading process will proceed to create GLG objects from the loaded raw data. Pass null to disable the abort callback.

rebind_refThe reference object to use for rebinding if the loaded object will be used as a template, or null otherwise. This parameter is used when a subdrawing template object is explicitly loaded by an application code before being passed to SetTemplate.

◆ LoadWidget()

static GlgObject LoadWidget ( Object  data,
String  encoding,
String  base_path 
)
static

Loads a viewport named $Widget from raw data using the specified encoding.

The raw data may be obtained using the LoadAsset method with the GLG_DRAWING request type.

Parameters
dataThe raw data to load the widget from (Uint8Array).
encodingDefines encoding to be used for string decoding, "ascii", "latin1" or "utf8". Pass null to use the default Latin1 encoding. The encoding is used to decode all input strings that do not have the UTF8 flag set. The S (string) data objects with the UTF8 flag are always decoded using UTF8.
base_pathAn optional load path of the object represented by the data parameter, or null. If any image, subdrawing or subwindow objects are present in the drawing, the images' ImagePath and the subdrawings' SourcePath attributes will be interpreted relative to the base_path.
Returns
Loaded viewport or null if loading fails.

This method loads an object from raw data and searches it for a viewport object named $Widget. If the viewport is found, it references and returns it, otherwise it produces an error message and returns null.

◆ LoadWidgetFromObject()

static GlgObject LoadWidgetFromObject ( GlgObject  glg_object)
static

Finds a viewport named $Widget inside an object and returns it.

Parameters
glg_objectAn object containing the $Widget viewport.
Returns
The found $Widget viewport or null if the search fails.

◆ LoadWidgetFromURL()

static void LoadWidgetFromURL ( String  url,
String  encoding,
Function  callback,
Object  user_data,
function  abort_func 
)
static

Loads a viewport named $Widget from a URL using the specified encoding.

Parameters
urlDefines a URL of the drawing.
encodingDefines encoding to be used for string decoding, "ascii", "latin1" or "utf8". Pass null to use the default Latin1 encoding. The encoding is used to decode all input strings that do not have the UTF8 flag set. The S (string) data objects with the UTF8 flag are always decoded using UTF8.
callback

A callback to be invoked when the widget has been loaded, with the following type signature:

void callback( GlgObject viewport, Object user_data, String load_path );

where:

  • viewport is the loaded widget viewport
  • user_data is the user_data parameter passed to LoadWidgetFromURL
  • load_path is the full URL path used to load the widget.
user_dataUser data to be passed to the callback.
abort_func

An optional function used to check if the load request was canceled while it was being processed, with the following type signature:

boolean abort_callback( Object user_data );

where:

The function will be invoked when the browser finishes loading the widget's raw data. If the function returns true, the load process will be aborted. If it returns false, loading process will proceed to create GLG objects from the loaded raw data. Pass null to disable the abort callback.

This method loads a drawing from a URL and searches the drawing for a viewport object named $Widget. If the viewport is found, it references and returns it, otherwise it produces an error message and returns null.

◆ ObjectsEqual()

static boolean ObjectsEqual ( GlgObject  object1,
GlgObject  object2 
)
static

Performs equality comparison between two GLG objects.

Parameters
object1The first object to check, may be null.
object2The second object to check, may be null.
Returns
true if both objects represents the same internal GLG object or are both null.

◆ PrintfD()

static String PrintfD ( String  format,
double  value 
)
static

C-style printf method for formatting double values.

Parameters
formatC-style format string.
valueDouble value to be formatted.
Returns
Formatted string.

◆ PrintfI()

static String PrintfI ( String  format,
int  value 
)
static

C-style printf method for formatting integer values.

Parameters
formatC-style format string.
valueInteger value to be formatted.
Returns
Formatted string.

◆ PrintfS()

static String PrintfS ( String  format,
String  value 
)
static

C-style printf method for formatting strings.

Parameters
formatC-style format string.
valueString value to be formatted.
Returns
Formatted string.

◆ Rand()

static double Rand ( double  low,
double  high 
)
static

Returns a random number in the specified range.

Parameters
lowThe low limit.
highThe high limit.
Returns
Generated random number.

◆ ReleaseToCache()

static ReleaseToCache ( Object  object)
static

ADVANCED: Releases an object to a cache for reuse, minimizing garbage collection.

Parameters
objectAn object to be released to the cache, must be an instance of GlgObject, GlgPoint, GlgCube, GlgInteger, GlgMatrixData, or GlgMinMax objects.

The method can be used with any GlgObject, GlgPoint, GlgCube, GlgInteger, GlgMatrixData, or GlgMinMax objects that were obtained by a call to a GLG API method. It cannot be used with objects obtained inside callbacks and stored using an assignment operator without a call to a GLG method.

The method can yield performance improvements for applications with loops that invoke a large number of GLG methods returning GLG objects.

Since all GLG objects are wrappers around the internal representation of the GLG objects, releasing an instance of a wrapper to a cache does not affect the internal GLG object the wrapper represents.

Note: releasing a GlgCube releases its GlgPoint objects.

The following examples demonstrate correct uses of the method:

// Traverse all objects in a viewport.
let size = viewport.GetSize();
for( let i=0; i<size; ++i )
{
let object = viewport.GetElement( i ); // GLG Object
// Apply some action to the object.
...
GLG.ReleaseToCache( object );
}
// Traverse all points of a polygon.
let size = polygon.GetSize();
for( let i=0; i<size; ++i )
{
// Get polygon point values as GlgPoint.
let point = polygon.GetElement( i ).GetGResource( null );
// Examine point's x, y and z values as needed.
...
GLG.ReleaseToCache( point );
}

The example below shows both valid and invalid uses of the method:

function TraceCallback( viewport, trace_info )
{
// Incorrect: can't release an object received in a callback.
let trace_viewport = trace_info.viewport;
GLG.ReleaseToCache( trace_viewport );
// Correct: releasing an object obtained by calling a GLG method.
let fill_color = trace_info.viewport.GetResourceObject( "FillColor" );
GLG.ReleaseToCache( fill_color );
// Incorrect: the object is used after being released.
var line_width = trace_info.viewport.GetResourceObject( "LineWidth" );
GLG.ReleaseToCache( line_width );
line_width.SetDResource( null, 3 );
}

◆ Reset()

boolean Reset ( )

Reinitializes the viewport's drawing by resetting its drawing hierarchy, then setting it up again and rendering the drawing.

Calling Reset restores all volatile resource changes to the values the resources had when the widget was first drawn. It also discards currently displayed chart data, unless the chart Persistent attribute is set to true.

The method should be invoked only for the top-level viewports, not the child viewports or the light viewports.

Returns
true if the drawing has been successfully reinitialized, otherwise false.

◆ ResetHierarchy()

void ResetHierarchy ( )

Resets the object hierarchy of the object.

Resets the object hierarchy of a top-level viewport. If a viewport containing a drawing was displayed using the InitialDraw, this method erases the drawing.

Warning: Do not confuse this method with the Reset method, which is used to redraw a displayed drawing and to regenerate the object hierarchy.

◆ SendMessageToObject()

Object SendMessageToObject ( String  resource_name,
String  message,
Object  param1,
Object  param2,
Object  param3,
Object  param4 
)

Sends a message to the object to request some action to be performed.

In most cases, the object it is a viewport with a GLG input handler attached, such as a button or a slider.

Parameters
resource_name

Specifies the resource path of a child object to send the message to, or null to send the message to the object the method is invoked on. The resource path is relative to the invoking object.

For example, to send the message to a viewport's handler, use the viewport as the object parameter and "Handler" as the resource_name parameter.

messageA string that defines the message type.
param1Message type dependent.
param2Message type dependent.
param3Message type dependent.
param4Message type dependent.
Returns
The query result of messages that execute some query, is ignored otherwise.

This method is used to send a message to an input object with a request to execute some action. For example, a program can send an "Activate" message to a push button widget to simulate a user click, which will activate any click processing Action objects attached to the button. "Set" and "Reset" messages may be sent to a toggle button widget to change its value, which will also process any Action objects attached to the toggle.

The method also serves as an escape mechanism for actions that can not be easily accomplished by setting or querying a single resource, such us adding items to a list widget or querying a state of a multiple-selection list.

Refer to the Input Objects chapter of the of the GLG User's Guide and Builder Reference Manual for the description of the method's parameters and returned value for each of the GLG input handlers.

Integer parameters should be passed as GlgInteger objects created with CreateGlgInteger.

Integer return values are also returned as GlgInteger objects.

◆ SetAlarmHandler()

static GlgAlarmHandler SetAlarmHandler ( GlgAlarmHandler  alarm_handler)
static

Installs a global alarm handler that will be invoked to process alarms.

Alarms are generated by the Alarm objects attached to objects in the drawing and activated when the controlled values go outside the ranges specified in the Alarm objects.

Parameters
alarm_handlerAn alarm handler that will be invoked to process alarm messages generated by the application's drawings. Use CreateGlgAlarmHandler to create an alarm handler.
Returns
The previously installed alarm handler, or null.

See GlgAlarmHandler for more information.

◆ SetCanvasScale()

static void SetCanvasScale ( double  scale,
double  text_scale,
double  native_text_scale,
double  pixel_offset_scale,
double  screen_coord_scale 
)
static

Specifies parameters of the coordinate scaling used to render GLG drawings in HTML canvas on mobile devices.

Parameters
scale

Specifies canvas coordinate scale. The screen coordinates used to draw graphics in the canvas will be bigger than the Cascading Style Sheet (CSS) pixel coordinates by the scale value. This is used for HTML pages with responsive design rendered on mobile devices with devicePixelRatio different from 1, or when browser zoom is in effect in a desktop browser, which changes devicePixelRatio as well.

If the scale is set to 1 (default) when devicePixelRatio > 1, each GLG screen coordinate will correspond to several physical pixels. As a result, thin lines with LineWidth=1 will be rendered several physical pixels thick. The drawing will also be rendered in a small size (in the GLG screen coordinates) equal to the size of the GLG area in CSS pixels, which will not look good.

Setting the scale to a value bigger than 1 increases canvas resolution by the specified scale. For example, specifying scale equal to devicePixelRatio on mobile devices causes each GLG screen coordinate to correspond to one physical pixel, resulting in very crisp rendering of thin lines. The drawing will also be rendered in a size in the GLG screen coordinates which is bigger (by the specified scale) than the size of the GLG area in CSS pixels.

For example, if the width of the GLG area in CSS pixels is 300 and the value of devicePixelRatio=3 is passed as the scale parameter, the drawing will be rendered with width=900 in the GLG screen coordinates. The scale lower than devicePixelRatio can also be used to control the crispness of the rendering. For example, scale=2 can be used even if devicePixelRatio=3 to make lines a bit thicker for better visibility.

If scale is set to a value different from 1, all values in the CSS pixel coordinates must be converted to the GLG screen coordinates by multiplying them by the scale before passing them to any GLG methods as GLG screen coordinates. For example, mouse_x and mouse_y cursor coordinates received by the Trace callback are in CSS pixels, and must be multiplied by the scale before using them as GLG screen coordinates. The x, y, width and height parameters of the ConfigureWindow method should also be in the GLG screen coordinates.

text_scale

Specifies a text scaling factor (default 1). When canvas resolution is increased by setting scale > 1, all fixed size text objects appear scaled down by the same scale because canvas text is rendered in screen coordinates, making text too small to be readable.

The only exception is the resizable text objects with a TextScaling attribute that scales them on resize, since they are automatically scaled up when the drawing size in GLG screen coordinates is increased due to scale > 1.

The text_scale parameter may be used to increase text size of non-scalable text to make it more readable. On mobile devices, text_scale may be set to a value which is less than the canvas' scale to avoid the text being too big.

native_text_scale

Specifies a scaling factor (default 1) for native text, such as text inside the buttons, checkboxes and other native HTML objects. The text in native HTML objects used in the drawing is scaled by the browser using CSS pixels and is not scaled down when canvas' scale > 1. As a result, the text may appear unproportional to the size of the text objects drawn in a GLG drawing canvas when canvas' scale > 1.

The parameter may be set to a value < 1 to adjust text size of native objects to match the size of the text objects in the GLG drawing.

pixel_offset_scale

Specifies a scaling factor (default 1) for values in the GLG drawing that use pixel coordinates, such as pixel offsets of the GLG pixel offset transformations, MarkerSize, as well as the AchorOffset of text objects.

Pixel offsets are used to control layout of GLG real-time charts. When fixed size text used by the chart axes increases due to the canvas' text_scale setting, the pixel offsets must be increased as well to allow more space for rendering chart axes labels. Setting pixel_offset_scale to the same value as text_scale adjusts the actual value of pixel offsets proportionally to the text scaling.

screen_coord_scale

Specifies a scaling factor (default 1) for fixed scale viewports that use screen coordinates. This parameter may be set to a value different from 1 to scale objects inside fixed scale viewports.

When fixed scale viewports' sizes are controlled by the pixel offset transformations, screen_coord_scale may be set to the same value as pixel_offset_scale to scale content of these viewports proportionally to their sizes.

This method should be invoked at the beginning of the program code before the first GLG drawing has been set up or drawn. If the method is invoked just once, the canvases used to render GLG drawings will be scaled as an image when the browser zoom is used in desktop browsers, resulting in a pixelized image.

To avoid pixelization when browser content is zoomed, the method should be invoked on window resize events, as shown in the GLG demos and examples. On mobile devices, the resize even is not generated and canvases are always scaled as images.

Refer to the code of the GLG JavaScript Demos for examples of the method's usage.

◆ SetCursorType()

boolean SetCursorType ( String  resource_name,
GlgCursorType  cursor_type 
)

Sets cursor for the viewport's drawing or one of its child viewports.

Parameters
resource_nameA resource path of a child viewport, or null to set cursor for the viewport the method is invoked on. The resource path is relative to the invoking object.
cursor_typeOne of the system cursor types to be used:
Returns
Success or failure status.

The specified cursor will be used when the mouse moves inside the viewport the cursor is assigned to. The drawing's hierarchy must be set up in order to set cursor type.

◆ SetCustomLoadFunc()

static void SetCustomLoadFunc ( Function  custom_load_func)
static

ADVANCED: Sets a custom load function callback.

The custom load function will be invoked to load data using a custom loading method instead of default loading from a URL. For example, an application may use axios.get as an alternative load method.

Parameters
custom_load_funcA custom loading function.

The custom load function will be invoked every time GLG needs to load data, such as drawings, subdrawings or assets. When the data has been loaded, the function must call the provided done_callback callback with the request status and request data parameters.

The custom load function is not invoked for images. The SetCustomURLFormatter method may be used instead of SetCustomLoadFunc for customized loading of both drawings and images.

The custom load function is invoked to perform the actual data loading, with the following type signature:

boolean custom_load_func( String url, String http_response_type, GlgHTTPRequestResponseType glg_request_type, Function done_callback );
GlgHTTPRequestResponseType
GLG responce type constants.
Definition: GlgObject.cs:24244

where:

  • url - the URL be loaded.
  • http_response_type - the XMLHttpRequest response type to be used for loading data.
  • glg_request_type - the GLG request type (one of the GlgHTTPRequestResponseType enum constants).
  • done_callback - the callback function to be invoked when the data has been loaded (see below).

The load function may return false to let GLG load the data, or return true to indicate that the function will load the data and will invoke done_callback when the data is ready.

When the data are ready, the load function must invoke the done function (the function it receives as the done_callback parameter). The done function has following type signature:

void done_func( int status, Object data );

and has to be invoked with the following parameters:

  • status - the returned status of XMLHttpRequest: 200 on success or a different value to indicate an error.
  • data Loaded data, or null in case of a load error.

◆ SetCustomURLFormatter()

static void SetCustomURLFormatter ( Function  formatter_func)
static

ADVANCED: Sets a custom URL formatter.

The custom URL formatter may be used to load drawings, assets and images stored in a database instead of a web server's file system. The formatter is invoked for any URLs before the URL is used for loading, with the URL string passed as a parameter. The formatter can convert the URL string to map it to a different URL, for example, redirecting it to a database. The formatter returns the converted URL string that will be used for loading.

Parameters
formatter_funcA custom URL formatter function.

The formatter is invoked to remap URL strings, with the following type signature:

String formatter_func( String url, boolean is_image );

where:

  • url the URL to be loaded.
  • is_image - true if the URL string is used to load an image, false otherwise.

The formatter may return null to use the original URL string as is, or return a modified URL string that points to a new location.

If both the custom URL formatter and the custom load function are supplied, the modified URL will be passed to the custom load function to be loaded.

◆ SetDResource()

boolean SetDResource ( String  resource_name,
double  value 
)

Sets a new value of the object's D (double) resource.

Parameters
resource_nameSpecifies the resource path of the scalar resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
valueSpecifies a new value.
Returns
Success or failure status.

If a scalar resource with the given resource path exists, this method sets it to a new value and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetDResourceIf()

boolean SetDResourceIf ( String  resource_name,
double  value,
boolean  if_changed 
)

Sets a new value of the object's D (double) resource.

Parameters
resource_nameSpecifies the resource path of the scalar resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
valueSpecifies a new value.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one (equivalent to SetDResource). Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed. The parameter is ignored when updating chart entry points to allow plotting straight lines when the plotted value does not change over time.
Returns
Success or failure status.

If a scalar resource with the given resource path exists, this method sets it to a new value and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetDTag()

boolean SetDTag ( String  tag_source,
double  value,
boolean  if_changed 
)

Sets a new value of the object's D (double) tag.

Parameters
tag_sourceSpecifies TagSource of the scalar tag to be set. All object's tags with the specified TagSource will be set to the supplied value. May use wildcards, see Using Resource and Tag Wildcards .
valueSpecifies a new value.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one. Setting if_changed=true optimizes performance of applications that set tag values regardless whether the values have changed. The parameter is ignored when updating chart entry points to allow plotting straight lines when the plotted value does not change over time.
Returns
Success or failure status.

If scalar tags with the given TagSource exist, this method sets their new values and returns true, otherwise it generates an error message and returns false.

See Tag Access Performance Optimization for more.

◆ SetEditMode()

static boolean SetEditMode ( GlgObject  viewport,
String  resource_name,
boolean  edit_mode 
)
static

Sets the viewport's edit mode to disable input objects in the viewport while the drawing is being edited.

Parameters
viewportA viewport object (either a Viewport or a Light Viewport) to set the editing mode of, or its parent.
resource_nameA resource path to access the viewport from the parent supplied by the viewport parameter, or null to set the editing mode of the viewport specified by the viewport parameter.
edit_mode
  • true to set the editing mode
  • false to cancel the editing mode.
Returns
Success or failure status.

If the viewport's edit mode is turned on, input objects in the viewport will not react to the mouse and keyboard events. The rest of the input objects outside of the viewport will still be active. The edit mode is inherited by all child viewports.

The edit mode is usually set for viewports that serve as a drawing area; the edit mode ensures that the input objects do not react to mouse clicks when they are dragged with the mouse to a new position. This is similar to the behavior of the Graphics Builder's Drawing Area.

The edit mode is global and may be set only for one viewport used as a drawing area. Setting the edit mode of a new viewport resets the edit mode of the previous viewport. A viewport's edit mode is inherited by all its child viewports.

◆ SetErrorHandler()

static GlgErrorHandler SetErrorHandler ( GlgErrorHandler  new_handler)
static

Replaces the GLG Toolkit error handler and returns the previous error handler.

Parameters
new_handlerSpecifies a new error handler, supplied by the user, to be called on an error condition. This does not include internal errors of the GLG Toolkit, if any are detected: they are still reported using the default handler. Use CreateGlgErrorHandler to create a custom error handler.
Returns
The previous error handler.

The GLG default error handler logs the error in the browser console. See ThrowExceptionOnError for additional debugging information.

See GlgErrorType for details on how different message types are handled by the default error handler.

◆ SetFocus()

void SetFocus ( String  resource_name)

Sets the keyboard focus to the object's viewport.

If the target object is a viewport, the focus is set to this viewport, otherwise the focus is set to the target object's parent viewport.

Parameters
resource_nameA resource path of a target child object, or null to use the object the method is invoked on. The resource path is relative to the invoking object.

◆ SetGResource()

boolean SetGResource ( String  resource_name,
double  x_value,
double  y_value,
double  z_value 
)

Sets new values of the object's G (geometrical or color) resource.

Parameters
resource_nameSpecifies the resource path of the geometrical or color resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
x_valueSpecifies the new X value.
y_valueSpecifies the new Y value.
z_valueSpecifies the new Z value.
Returns
Success or failure status.

If a G resource with the given resource path exists, this method sets its new values and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetGResourceFromPoint()

boolean SetGResourceFromPoint ( String  resource_name,
GlgPoint  g_value 
)

Sets new values of the object's G (geometrical or color) resource.

Parameters
resource_nameSpecifies the resource path of the geometrical or color resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
g_valueA GlgPoint containing XYZ or RGB resource values.
Returns
Success or failure status.

If a G resource with the given resource path exists, this method sets its new values and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetGResourceFromPointIf()

boolean SetGResourceFromPointIf ( String  resource_name,
GlgPoint  g_value,
boolean  if_changed 
)

Sets new values of the object's G (geometrical or color) resource.

Parameters
resource_nameSpecifies the resource path of the geometrical or color resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
g_valueA GlgPoint containing XYZ or RGB resource values.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one (equivalent to SetGResourceFromPoint). Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed.
Returns
Success or failure status.

If a G resource with the given resource path exists, this method sets its new values and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetGResourceIf()

boolean SetGResourceIf ( String  resource_name,
double  x_value,
double  y_value,
double  z_value,
boolean  if_changed 
)

Sets new values of the object's G (geometrical or color) resource.

Parameters
resource_nameSpecifies the resource path of the geometrical or color resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
x_valueSpecifies the new X value.
y_valueSpecifies the new Y value.
z_valueSpecifies the new Z value.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one (equivalent to SetGResource). Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed.
Returns
Success or failure status.

If a G resource with the given resource path exists, this method sets its new values and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetGTag()

boolean SetGTag ( String  tag_source,
double  x_value,
double  y_value,
double  z_value,
boolean  if_changed 
)

Sets new values of the object's G (geometrical or color) tag.

Parameters
tag_sourceSpecifies the TagSource of the geometrical or color tag to be set. All object's tags with the specified TagSource will be set to the supplied values. May use wildcards, see Using Resource and Tag Wildcards .
x_valueSpecifies the new X value.
y_valueSpecifies the new Y value.
z_valueSpecifies the new Z value.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one. Setting if_changed=true optimizes performance of applications that set tag values regardless whether the values have changed.
Returns
Success or failure status.

If G tags with the given TagSource exist, this method sets their new value and returns true, otherwise it generates an error message and returns false.

See Tag Access Performance Optimization for more.

◆ SetGTagObj()

boolean SetGTagObj ( String  tag_source,
GlgPoint  value,
boolean  if_changed 
)

Sets new values of the object's G (geometrical or color) tag.

Parameters
tag_sourceSpecifies the TagSource of the geometrical or color tag to be set. All object's tags with the specified TagSource will be set to the supplied values. May use wildcards, see Using Resource and Tag Wildcards .
valueA GlgPoint containing XYZ or RGB resource values.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one. Setting if_changed=true optimizes performance of applications that set tag values regardless whether the values have changed.
Returns
Success or failure status.

If G tags with the given TagSource exist, this method sets their new value and returns true, otherwise it generates an error message and returns false.

See Tag Access Performance Optimization for more.

◆ SetLabelFormatter()

boolean SetLabelFormatter ( String  resource_name,
function  formatter 
)

Attaches a custom label formatter to the chart axis or the stand-alone axis object.

See GlgLabelFormatter for more information.

Parameters
resource_nameA resource path of a child axis, or null to attach the formatter to the axis the method is invoked on. The resource path is relative to the invoking object.
formatterA custom label formatter function with the type signature matching the type signature of the GetString entry point of GlgLabelFormatter.
Returns
true if the formatter was successfully attached.

◆ SetLinkedAxis()

boolean SetLinkedAxis ( String  resource_name,
GlgObject  axis_object,
String  axis_resource_name 
)

Associates the chart's plot, level line or annotation object with an Y axis for automatic rescaling.

Parameters
resource_nameA resource path for accessing the child plot, the level line or the annotation inside the object the method is invoked on. The resource path is relative to the invoking object. Use null to use the plot, level line or annotation object the method is invoked on.
axis_objectThe axis to link with, or the axis' parent.
axis_resource_nameA resource path for accessing the axis inside axis_object, or inside the object the method is invoked on if axis_object is null. Use null when the axis_object parameter specifies an axis.
Returns
Success or failure status.

◆ SetLocale()

static void SetLocale ( String  locale)
static

Sets locale used to display dates and numbers.

Parameters
localeLocale name.

◆ SetParentElement()

void SetParentElement ( String  element_id)

Specifies a parent DIV element to use for the viewport's drawing.

Parameters
element_idThe element ID for the getElementById method, for example "glg_area".

◆ SetResourceFromObject()

boolean SetResourceFromObject ( String  resource_name,
GlgObject  value 
)

Sets a new value of the object's resource to the value of contained in the provided data object of the same data type.

Parameters
resource_nameSpecifies the name of the D, S or G resource to be set.
valueAn object of the matching data type containing the new value.
Returns
Success or failure status.

If a resource of a matching type at the given resource path exists, the method sets the value of the resource to a value defined by the value object and returns true, otherwise it generates an error message and returns false.

The object type and data type of the resource specified by the resource path should match the corresponding types of the value object.

See Resource Access Optimization for more.

◆ SetResourceFromObjectIf()

boolean SetResourceFromObjectIf ( String  resource_name,
GlgObject  value,
boolean  if_changed 
)

Sets the value of the object's data object to the value of another data object of the same data type.

Parameters
resource_nameSpecifies the name of the resource to be set.
valueSpecifies the object containing the new value.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one (equivalent to SetResourceFromObject). Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed.
Returns
Success or failure status.

If a resource of a matching type at the given resource path exists, the method sets the value of the resource to a value defined by the value object and returns true, otherwise it generates an error message and returns false.

The object type and data type of the resource specified by the resource path should match the corresponding types of the value object.

The object type (and data type for the data object) of the resource specified by the resource path should match the type of the value object.

See Resource Access Optimization for more.

◆ SetSResource()

boolean SetSResource ( String  resource_name,
String  value 
)

Replaces the string of the object's S (string) resource.

Parameters
resource_nameSpecifies the resource path of the string resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
valueSpecifies a new string.
Returns
Success or failure status.

If a string resource with the given resource path exists, this method sets its the new value and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetSResourceFromD()

boolean SetSResourceFromD ( String  resource_name,
String  format,
double  value 
)

Sets the value of the object's S (string) resource from a double value, converting the value into a string using a C-style printf format string.

Parameters
resource_nameSpecifies the resource path of the string resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
formatSpecifies the C-style printf format to use (for example, "%.2f").
valueSpecifies the numerical value to be converted to a string according to the specified format.
Returns
Success or failure status.

If a string resource with the given resource path exists, this method sets it to a new string containing the value parameter formatter using the format argument and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetSResourceFromDIf()

boolean SetSResourceFromDIf ( String  resource_name,
String  format,
double  value,
boolean  if_changed 
)

Sets the value of the object's S (string) resource from a double value, converting the value into a string using a C-style printf format string.

Parameters
resource_nameSpecifies the resource path of the string resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
formatSpecifies the C-style printf format to use (for example, "%.2f").
valueSpecifies the numerical value to be converted to a string according to the specified format.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one (equivalent to SetSResourceFromD). Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed.
Returns
Success or failure status.

If a string resource with the given resource path exists, this method sets it to a new string containing the value parameter formatter using the format argument and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetSResourceIf()

boolean SetSResourceIf ( String  resource_name,
String  value,
boolean  if_changed 
)

Replaces the string of the object's S (string) resource.

Parameters
resource_nameSpecifies the resource path of the string resource to be set. May use wildcards, see Using Resource and Tag Wildcards .
valueSpecifies a new string.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one (equivalent to SetSResource). Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed.
Returns
Success or failure status.

If a string resource with the given resource path exists, this method sets its the new value and returns true, otherwise it generates an error message and returns false.

See Resource Access Optimization for more.

◆ SetSTag()

boolean SetSTag ( String  tag_source,
String  value,
boolean  if_changed 
)

Replaces the string of the object's S (string) tag.

Parameters
tag_sourceSpecifies TagSource of the string tag to be set. All object's tags with the specified TagSource will be set to the supplied value. May use wildcards, see Using Resource and Tag Wildcards .
valueSpecifies a new string.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one. Setting if_changed=true optimizes performance of applications that set tag values regardless whether the values have changed.
Returns
Tag value or null if the tag was not found.

If string tags with the given TagSource exist, this method sets their new values and returns true, otherwise it generates an error message and returns false.

See Tag Access Performance Optimization for more.

◆ SetSTagFromD()

boolean SetSTagFromD ( String  tag_source,
String  format,
double  value,
boolean  if_changed 
)

Sets the value of the object's S (string) tag from a double value, converting the value into a string using a C-style printf format string.

Parameters
tag_sourceSpecifies TagSource of the string tag to be set. All object's tags with the specified TagSource will be set to the supplied value. May use wildcards, see Using Resource and Tag Wildcards .
formatSpecifies the C-style printf format to use (for example, "%.2f").
valueSpecifies the numerical value to be converted to a string according to the specified format.
if_changedIf set to false, the graphical updates will be performed even if the new value is the same as the old one. Setting if_changed=true optimizes performance of applications that set resource values regardless whether the values have changed.
Returns
Success or failure status.

If a tag resource with the given resource path exists, this method sets it to a new string containing the value parameter formatter using the format argument and returns true, otherwise it generates an error message and returns false.

See Tag Access Performance Optimization for more.

◆ SetTooltipFormatter()

static GlgTooltipFormatter SetTooltipFormatter ( GlgTooltipFormatter  formatter)
static

Supplies a custom tooltip formatter.

A custom tooltip formatter may be used to supply custom context-sensitive tooltip strings by querying an object's properties and displaying them in the tooltip.

See GlgTooltipFormatter for more.

Parameters
formatterSpecifies a custom tooltip formatter. Use CreateGlgTooltipFormatter to create a custom tooltip formatter.
Returns
The previously set formatter, if any, or null otherwise.

◆ SetTouchMode()

static void SetTouchMode ( )
static

Enables handling of touch events.

The method may be invoked on the TOUCH_START event inside the Trace callback to enable handing of the consequent TOUCH_MOVED, TOUCH_END and TOUCH_CANCEL events.

If the touch mode is enabled, the default browser handling of touch events will be disabled, and the application will receive these events in the Trace callback to implement application-defined touch actions. For example, an application could use touch move events to drag objects or scroll the chart.

If the touch mode is not enabled, the browser will use touch events for scrolling or zooming the web page, and the application will not receive any touch events after the initial TOUCH_START event. The MOUSE_MOVED, MOUSE_PRESSED and MOUSE_RELEASED events will be received after the browser finished handling touch events.

The enabled state of touch mode is active only for the duration of one touch event sequence, and is reset when the touch ends or is canceled.

The examples_html5/realtime_chart/GlgRealTimeChart.js file in GLG installation directory provides an example handling touch events to scroll a chart by touching and dragging it.

GLG sliders and knob interaction handlers automatically activate the touch mode to handle dragging via the touch move events. The GlgSliderTouchDrag global configuration resource may be used to disable this feature if it interferes with the browser use of the touch events for scrolling and zooming the web page.

◆ SetupHierarchy()

void SetupHierarchy ( )

Provides an explicit request to set up the object hierarchy of the object without rendering it.

When invoked on a drawing which has been loaded but not yet displayed, the method sets up the drawing's object hierarchy to prepare the drawing for rendering. The drawing should contain either a top-level viewport object, or a group containing several top-level viewports.

After the initial draw (when the object hierarchy has already been set up), the method can be used to set up any type of object after its resources were changed. Unlike fref Update, SetupHierarchy sets up the object without repainting it.

Note: For drawings containing reference objects (subdrawings and subwindows), SetupHierarchy initiates the process of loading their templates, but does not wait for the load process to finish. The browser loads the templates asynchronously, and the Hierarchy listener is invoked for each subdrawing object when its template loaded. The Template Load listener is also invoked after each template has been loaded.

The Input listener also receives a message with Format="TemplateLoad" after each template has been loaded. The GetPendingTemplates and GetPendingInstances methods may be used to find if all subdrawings have finished loading their templates, in which case the methods return 0.

The SCADAViewer/HTML5/SCADAViewer/GlgViewer.js file in the GLG installation directory provides an example of using both the Hierarchy and Input listeners to handle subdrawings and subwindows.

◆ SetZoom()

boolean SetZoom ( String  resource_name,
char  type,
double  value 
)

Provides a programmatic interface to integrated zooming and panning.

This method is invoked on a viewport or a light viewport to perform a zooming or panning operation.

Parameters
resource_nameA resource path of a child viewport to zoom or pan, or null to zoom or pan the viewport the method is invoked on. The resource path is relative to the invoking object.
typeA character value that specifies the type of the zoom or pan operation to perform. For example, 'i' may be used to zoom in.

The value of this parameter matches the corresponding zooming and panning accelerators:
  • i - zooms in relatively to the center of the drawing by the factor specified by the value parameter (the value of 2 is used as a default if value=0). In the Chart Zoom Mode, it zooms in only in the X/Time direction.

  • I - same as 'i' but zooms in relatively to the current mouse position.> In the Chart Zoom Mode, it zooms out only in the Y direction.

  • o - zooms out relatively to the center of the drawing by the factor specified by the value parameter (the value of 2 is used as a default if value=0). In the Chart Zoom Mode, it zooms out only in the X/Time direction.

  • O - same as o but zooms out relatively to the current mouse position. In the Chart Zoom Mode, it zooms out only in the Y direction.

  • t - starts generic ZoomTo mode (left-click and drag the mouse to finish, value is ignored). In the Chart Zoom Mode, if the first point of the ZoomTo box is located within the X or Y axis area, zooming will be performed only in the direction of the selected axis. For example, if the user defines the ZoomTo box in the X axis area, the chart will be zoomed only in the X direction.

  • _ - starts ZoomToX mode, which zooms only in the X direction and preserves the Y scale (left-click and drag the mouse to finish, value is ignored). It is especially useful in the Chart Zoom Mode to zoom the chart along the time axis.

  • | - starts ZoomToY mode, which zooms only in the Y direction preserves the X scale (left-click and drag the mouse to finish, value is ignored). It is especially useful in the Chart Zoom Mode to zoom the chart along the value axis.

  • @ - starts ZoomToXY mode (left-click and drag the mouse to finish, value is ignored).

  • T - starts custom ZoomTo mode (left-click and drag the mouse to ZoomTo, value is ignored). A custom zoom mode lets the user define the ZoomTo area without performing the zoom operation. An application can use the selected ZoomTo rectangle as the input to implement custom zooming or object selection logic. An application can handle Zoom events in input callback to perform a custom zoom operation. Refer to the Appendix B: Message Object Resources section of the GLG Programming Reference Manual for details of the Zoom event.

  • e - aborts ZoomTo mode, value is ignored.

  • s - starts generic dragging mode (left-click and drag the drawing with the mouse to pan or scroll). In the Chart Zoom Mode, if the user clicks and drags the mouse within the X or Y axis area, scrolling will be performed in the direction matching the direction of the selected axis.

  • ^ - starts vertical dragging mode (left-click and drag the drawing with the mouse to pan or scroll in the vertical direction). It is especially useful in the Chart Zoom Mode.

  • > - starts horizontal dragging mode (left-click and drag the drawing with the mouse to pan or scroll in the horizontal direction). It is especially useful in the Chart Zoom Mode.

  • & - starts XY dragging mode (left-click and drag the drawing with the mouse to pan or scroll).

  • f - fits the drawing to the visible area of the viewport, value is ignored (Drawing Zoom Mode only). The X/Y ratio is maintained depending on the setting of the viewport's Stretch attribute.

  • F - fits the area of the drawing defined by an object named GlgFitArea to the visible area of the viewport, value is ignored (Drawing Zoom Mode only). The X/Y ratio is maintained depending on the setting of the viewport's Stretch attribute.

  • n - resets zoom, value is ignored.
    In the GIS zoom mode with map in the ORTHOGRAPHIC projection, resets zooming but keeps the GIS center unchanged. In the RECTANGULAR projection, resets zooming and panning but keeps the rotation angle unchanged. In the Chart Zoom Mode, resets the Y range to fit all chart plots in the visible area of the chart in Y direction.

  • N - resets zoom, value is ignored.
    In the Chart Zoom Mode, resets the Y range and changes the chart's X span to show all accumulated data samples in the visible area of the chart.

  • u - pans up by the fraction of the widow height specified by the value parameter (the value of 0.5 is used as a default if value=0). In the Chart Zoom Mode, scroll the chart up by a fraction of the chart's data area height.

  • d - pans down by the fraction of the widow height specified by the value parameter (the value of 0.5 is used as a default if value=0). In the Chart Zoom Mode, scroll the chart down by a fraction of the chart's data area height.

  • l - pans left by the fraction of the widow width specified by the value parameter (the value of 0.5 is used as a default if value=0). In the Chart Zoom Mode, scroll the chart left by a fraction of the chart's data area width.

  • r - pans right by the fraction of the widow width specified by the value parameter (the value of 0.5 is used as a default if value=0). In the Chart Zoom Mode, scroll the chart right by a fraction of the chart's data area width.

  • x - pans horizontally by the distance in screen coordinates specified by the value parameter, the sign of the value defines the pan direction.

  • y - pans vertically by the distance in screen coordinates specified by the value parameter, the sign of the value defines the pan direction.

  • X - pans horizontally by the distance in world coordinates specified by the value parameter, the sign of the value defines the pan direction. In the GIS Zoom Mode, pans by the latitude degrees. In the Chart Zoom Mode, scrolls by the units of the X axis.

  • Y - pans vertically by the distance in world coordinates specified by the value parameter, the sign of the value defines the pan direction. In the GIS Zoom Mode, pans by the longitude degrees. In the Chart Zoom Mode, scrolls by the units of the first Y axis.

  • U - anchors on the upper edge, value is ignored (Drawing Zoom Mode only).

  • D - anchors on the lower edge, value is ignored (Drawing Zoom Mode only).

  • R - anchors on the right edge, value is ignored (Drawing Zoom Mode only).

  • L - anchors on the lower edge, value is ignored (Drawing Zoom Mode only).

  • A - rotates the drawing clockwise around X axis by the angle specified by the value parameter (Drawing Zoom Mode only).

  • a - rotates the drawing counterclockwise around X axis by the angle specified by the value parameter (Drawing Zoom Mode only).

  • B - rotates the drawing clockwise around Y axis by the angle specified by the value parameter (Drawing Zoom Mode only).

  • b - rotates the drawing counterclockwise around Y axis by the angle specified by the value parameter (Drawing Zoom Mode only).

  • C - rotates the drawing clockwise around Z axis by the angle specified by the value parameter (Drawing Zoom Mode or GIS Zoom Mode with the RECTANGULAR projection only).

  • c - rotates the drawing counterclockwise around Z axis by the angle specified by the value parameter (Drawing Zoom Mode or GIS Zoom Mode with the RECTANGULAR projection only).

valueSpecifies a value for zoom and pan operations as described above.
Returns
true if zoom operation succeeded, otherwise false.

This method performs a specified zoom or pan operation regardless of the setting of the viewport's Pan and ZoomEnabled attributes.

Zooming and panning keyboard accelerators may also be used by settings a viewport's ZoomEnabled attribute to true (the user may have to click on the viewport first to set the keyboard focus). This is especially useful for interactive testing of integrated zooming and panning in the GLG Graphics Builder.

The viewport's Pan attribute can be used to activate integrated scrollbars for scrolling the drawing, as well as scrolling charts and GIS maps.

In the Drawing Zoom Mode, if the method attempts to set a very large zoom factor which would result in the overflow of the integer coordinate values used by the native windowing system, the zoom operation is not performed and the method returns false.

The left mouse button is the default button for performing the ZoomTo operation, as well as for panning and scrolling the drawing by dragging it with the mouse. These defaults can be changed by setting the GlgZoomToButton and GlgPanDragButton global configuration resources. If the default is changed, the left-click used in the description of the affected operations changes to the click with the mouse button assigned to the respective ZoomTo or Pan operation.

◆ SetZoomMode()

boolean SetZoomMode ( String  resource_name,
GlgObject  zoom_object,
String  zoom_object_resource_name,
GlgZoomMode  zoom_mode 
)

Sets or resets the viewport's zoom mode by supplying a GIS or Chart object to be zoomed.

In the Drawing Zoom Mode (default), the drawing displayed in the viewport is zoomed and panned. If the GIS Zoom Mode is set, any zooming and panning operation performed by SetZoom will zoom and pan the map displayed in the viewport's GIS Object, instead of being applied to the viewport's drawing. In the Chart Zoom Mode, the content of the chart is zoomed and panned.

Parameters
resource_nameA resource path of a child viewport whose zoom mode to set, or null to set the Zoom Mode of the viewport the method is invoked on. The resource path is relative to the invoking object.
zoom_objectGIS or Chart object to be zoomed in the GIS and Chart zooming modes (or null for the Drawing zoom mode):
  • If not null, specifies the GIS or Chart object (or its parent if zoom_object_resource_name is not null).
  • If null, zoom_object_resource_name is used to to specify the GIS or Chart object in the GIS and Chart zooming modes as describe below.
zoom_object_resource_nameResource name of the GIS or Chart object.
  • If null, the GIS or Chart object supplied by the zoom_object parameter is selected as the GIS or Chart object to be zoomed.
  • If not null, specifies the resource path of the GIS or Chart object to be zoomed. The resource path is relative to the zoom_object parameter, or to the object the method is invoked on and the resource_name parameter if the zoom_object parameter is null.
zoom_modeThe zoom mode to set:
Returns
Success or failure status.

◆ ThrowExceptionOnError()

static void ThrowExceptionOnError ( boolean  user_error,
boolean  internal_error,
boolean  detect_null_strings 
)
static

Controls throwing an exception on an error to assist debugging.

Parameters
user_errorSet to true to throw exceptions on application errors, such as "Can't find resource".
internal_errorSet to true to throw exceptions on internal GLG errors.
detect_null_stringsSet to true to detect null strings being used as values of resources that are GLG data objects of S (String) type. Setting values of these attributes to null strings causes exceptions much later, when the objects are drawn. Setting this parameter to true makes it possible to detect such errors right at the line of code where the resource value is set.

◆ Update()

boolean Update ( )

Updates the drawing of a viewport or a light viewport with the latest resource values.

Returns
true if the drawing has been successfully updated, otherwise false.

If the object is a light viewport, an update of its parent viewport will be performed. All resource changes are held until the Update method is called.

Follow this link for additional information on setting up subdrawings and subwindows.

Note: Some drawing resources affect the object hierarchy of the drawing. For example, the Factor attribute of a series object controls the number of template instances that will be created by the series. If a number of instances is increased by setting the series' Factor, the new instances will be created and their resources can be accessed only after the Update or SetupHierarchy method is invoked. If the series object is not persistent, any change (either increase or decrease) of its Factor attribute recreates its instances, and either the Update or SetupHierarchy method should be called before accessing resources of the series' instances.

◆ UpdateChartState()

boolean UpdateChartState ( String  resource_name,
int  state 
)

Triggers updating the chart's state after prefilling it with data using the quick mode of AddPlotDataSample.

Parameters
resource_nameA resource path of a child chart, or null to update the chart the method is invoked on. The resource path is relative to the invoking object.
state

Contains binary flags that specify the state to be updated:

Multiple flags can be combined with bitwise OR operator.

Returns
Success or failure status.

This method marks the selected chart states for updating. The actual update happens on the next invocation of the Update or SetupHierarchy methods.

◆ UpdateChartTimeAxis()

boolean UpdateChartTimeAxis ( String  resource_name,
double  time_stamp,
boolean  initialize 
)

Scrolls the chart forward to show all data samples up to the provided time stamp or index.

Parameters
resource_nameA resource path of a child chart, or null to scroll the chart the method is invoked on. The resource path is relative to the invoking object.
time_stampA timestamp (or an index for a chart with an index X axis).
initializeMay be set to true for initializing an empty sweep chart, positioning the sweep bar at the start of the plot instead of the plot end.
Returns
Success or failure status.

While a strip chart's X axis can be updated by simply setting its EndValue resource to the timestamp, a sweep chart needs to update the sweep bar and update the X axis only if needed.

UpdateChartTimeAxis should be used to properly update sweep charts after using the quick mode of the AddPlotDataSample method to supply a large number of data samples. The method handles both strip and sweep charts.

◆ UpdateSize()

void UpdateSize ( )

Updates the size of the top viewport.

This method is invoked on top viewports embedded in HTML to force an immediate size update to fit the parent DIV element after the DIV size change.