Generic Logic, Inc.

GLG 4.0 Release: New Features and Enhancements

Overview
HTML5 and JavaScript Web Deployment Option
Tag and Constraints Tracing Option
New Real-Time Chart Features
     Custom Chart Annotations
     Prefilling Historical Charts with Data
New Widgets
Transparent Dials and Gauges Option
Asynchronous Image Loading for Java, C# and JavaScript APIs
Asynchronous GIS Map Loading for Java, C# and JavaScript APIs
Asynchronous GIS Map Loading Request
New Min/Max transformation
New WriteStringFromWidget Command Action
Initial Selected Index for List Controls
New UTF8 Conversion Options of the Graphics Builder and the HMI Configurator
Miscellaneous GLG Editor Changes
New API methods
     Method to Change Number of Elements in a Container
     New Installable Interface Handler Methods
New Embedded Platforms (Jetson Nano, ARMv8 AArch64)
Miscellaneous API and Run-Time Engine Changes
     Java Anti-Aliasing on Per-Object Basis
     Image Load Timeout
     Intelligent Handling of the if_changed Parameter
     SetResourceObject Use with the Standard API
     Configuration Resources for Touch Screen Devices
     OpenGL Driver Improvements
     Font File Parsing Enhancements
     Application Security Enhancements
Bug Fixes
Web SCADA Demo
  HTML5 & JavaScript version
of the GLG SCADA DEMO
running in a Web Browser

Overview 

The 4.0 release introduces a new HTML5 and JavaScript Web deployment option that makes it possible to develop and deploy a GLG application in a Web browser using a client-side JavaScript. All existing GLG drawings can be used in a Web environment using the provided GLG JavaScript library, and programming logic already developed for the desktop applications can be easily reused in the Web version of the application using the GLG JavaScript API.

Other new features include:

HTML5 and JavaScript Web Deployment Option

A new GLG JavaScript library may be used to deploy GLG applications on a web page in a browser on any desktop or mobile device. The JavaScript library uses pure HTML5 and JavaScript and provides the same full GLG API that was previously available only to desktop applications written in C/C++, Java or C#. Any existing GLG drawing can be deployed on a web page by using the client-side JavaScript library that renders the drawing in an HTML canvas, updates the drawing with real-time data and handles user interaction.

Except for the changes to comply with the JavaScript syntax, the GLG JavaScript API is identical to the corresponding C/C++, Java and C# GLG APIs, which makes it possible to reuse not only the drawings, but also the programming logic which has already been developed for the desktop version of an application. A new Web application can also be developed from scratch by creating a drawing using the GLG Graphics Builder, and deploying it on a web page using HTML5 and the GLG JavaScript library.

The JavaScript library supports all major browsers, such as Chrome, Safari, Firefox and Microsoft Edge. It also provides support for mobile and touch screen devices, so that the same application can be deployed on either a desktop or mobile device. The scalable nature of GLG drawings makes it easier to deploy them on devices with different screen sizes, as well as on web pages that utilize Responsive Web Design. The API's SetCanvasScale method provides capabilities for adjusting the drawing to screens with different pixel ratios, which ensures crisp graphics rendering and automatically increases the size of text objects in the GLG drawings when displaying them on mobile devices with small screens. The library provides support for both the mouse and touch events.

The documentation for the GLG JavaScript is available at the following link:

    https://www.genlogic.com/doc_html/javascript_doc/index.html

Tag and Constraints Tracing Option

This introspection feature provides a visual feedback when browsing tags, resources or object attributes. When this feature is activated using the Options, Trace/Highlight, Trace Tags, Resources and Constraints menu option, it highlights all objects in the drawing that depend on a tag selected in a tag browser, a resource selected in a resource browser or an attribute displayed in the Attribute dialog.

This feature can be used in conjunction with the Trace Attribute Constraints for Mark0 option of the same menu that highlights attributes in the property dialogs that depend on the attribute marked as Mark0.

The Options, Trace/Highlight menu has two options that control highlighting:

If neither option is checked, the closest drawable parent of the traced object will be highlighted.

The feature is available in both the Graphics Builder and the HMI Configurator, as well as at the application run-time. The TraceObject API method may be used by an application to highlight all objects in the drawing that depend on a tag or a resource.

Internally, highlighting is handled via a new HighlightFlag attribute of drawable objects, which may be also set in a program to highlight or unhighlight an object.

New Real-Time Chart Features

Custom Chart Annotations

A new real-time chart feature allows adding custom annotations to a chart.  An annotation can contain a text label, a marker, or both, and can be positioned in a chart at a specified time and value. The chart automatically maintains the annotation's position when the chart is scrolled or zoomed.

Static annotations may be used to add labels to the level lines and saved with the drawing. An annotation position in both X and Y direction may be defined as either a value in the range of a corresponding axis, or as an absolute position within the chart. Annotations defined by an absolute position do not scroll with the chart. The number of static annotations is controlled by the chart's NumAnnotations attribute.

Dynamic annotations can be added to the chart at run time to annotate data samples of interest using the AddAnnotation API method, in which case the NumAnnotations attribute should be set to -1 at run time. The chart manages dynamic annotations, deleting them when the corresponding datasample drops out of the chart buffer as the chart scrolls to display new data.

Color, text string and other attributes of each annotation can be modified and (for static annotations) saved with the drawing. Any annotation attribute can be dynamically changed based on application data or user interaction. These changes can be done at any time, even after the annotation has been added to a chart. For example, an annotation's color can be changed when the user selects it with the mouse.

Prefilling Historical Charts with Data

A new AddDataSample method of the GLG Intermediate API may be used to prefill a historical chart with a large number of data samples. The method does not use resources and pushes data samples directly into a chart's data history buffer, which provides a noticeable performance increase when filling a chart with hundreds of thousands of data samples in Java, C# or JavaScript environment.

Linear GaugeNew Widgets

New widgets include automotive speedometer and tachometer gauges, new radial and linear gauges, as well as several setpoint gauges with an additional setpoint needle or other setpoint indicators. Linear gauges include a color bar gauge that uses different colors to annotate parts of the bar that exceeds specified thresholds.

Transparent Dials and Gauges Option

A new Make Widget Viewports Transparent option of the Palettes menu may be used to add dials and gauges with transparent background. If it is checked, adding a viewport-based widget from the palette converts it to use a light viewport with a transparent background. If the option is not checked, a viewport object with non-transparent background is used. Previously, to make a widget transparent, the widget had to be converted to a light viewport with a transparent background manually, which was less convenient. The option is available in both the Graphics Builder and the HMI Configurator.

With this new option, the windowless dial widgets available in the previous releases are no longer needed. They were deprecated in the new release and were removed from the editor palettes. If they are still needed for backward compatibility, they may be enabled by uncommenting the controls/windowless_dials.pal line in the <glg>/widgets/palettes.pls file.

The Manual Widget Positioning option has also been moved from the Options to the Palettes menu.

Speedometer
                        Widget

Tachometer
                        Widget

Asynchronous Image Loading for Java, C# and JavaScript APIs

In the new release, the Java, C# and JavaScript APIs support asynchronous image loading. Previously, when the drawing containing images was initially displayed, it was waiting for all images to finish loading before rendering the drawing (synchronous loading). It could cause delays when images were loaded from remote URLs.

In the new release, an application can control if images are loaded synchronously or asynchronously. It is controlled globally by the GlgAsyncImageLoading global configuration resource and may be overridden by the AsyncMode property of an individual image object.

If an image is using an asynchronous mode and the image data are not ready at the time the drawing is displayed, the drawing will be displayed without the image, and the image will appear when its data become available. When an image with the asynchronous mode finishes loading its data, it sends an ImageLoad message to the Input callback to nofify an application that the drawing may need to be updated. The ImageLoaded property of an image object can be queried to determine if the image is ready to be rendered.

By default, Java and C# versions of the GLG library use the synchronous image loading mode. The JavaScript version of the library uses the asynchronous loading mode, which is the only mode supported by the JavaScript.

Asynchronous GIS Map Loading for Java, C# and JavaScript APIs

The asynchronous image loading mode can also be used for the GIS object used to display a map inside a GLG drawing. When the map is loaded asynchronously, the drawing appears without a map on initial appearance or when the map is zoomed or panned, with the map appearing when the map image becomes ready.

The GlgAsyncImageLoading global configuration resource controls loading mode for both images and maps, and may be overridden by the AsyncMode property of a GIS object. The GIS object with asynchronous map loading also sends an ImageLoad message to notify an application when a new map is ready, and the ImageLoaded property of the GIS object may be used to query the status of the new map.

The Asynchronous GIS Map Loading Request described below may be used to avoid displaying a drawing without a map while the zoom or pan request is being processed.

Asynchronous GIS Map Loading Request

A new asynchronous GIS map loading request feature enables GIS applications to better handle map zooming and panning in Java, C# and JavaScript environment.

This feature solves a problem of handling map zoom or pan operation which requires a new map image to be fetched from the server. With a synchronous map loading mode, an application will freeze until the new map is ready. With an asynchronous map loading mode, the dynamic symbols on the map would be displayed in the new map zoom state right away, but without the map in the background, with the new map appearing when it is received from the server. Both of these modes are undesirable, and the Asynchronous GIS Request feature offers a solution described below.

The asynchronous GIS map request makes it possible for an application to issue a zoom or pan map request to the server, while continuing to operate in the old map state until the new map is ready. When the new map becomes ready, the display will switch to the new map zoom or pan state instantaneously.

With this feature, the application will never be frozen waiting for a new map or displayed without a map in the background. This is especially important for Java, C# and JavaScript applications, since they use a web-based GLG Map Server that introduces web-related delays compared to the embedded GLG Map Server used by the C/C++ applications.

An application has a complete control over the map loading request. The application is notified when the new map is ready, at which time it can decide to either install the new map, or discard it if it was superseded by another map request with a higher priority. The following Intermediate API methods were added to request and process a map loading request:

New Min/Max transformation

New Min and Max transformation options were added to the Compare transformation to return the smallest or the largest value from the two arguments. The rest of the options of the Compare transformation compare values of its two arguments and return a boolean value (0 or 1) based on the selected comparison criterion.

New WriteStringFromWidget Command Action

The new WriteStringFromWidget command was added to a list of command actions.  It may be used to write a string (S) tag based on the user input, and is similar to the existing WriteValueFromWidget command that writes a double (D) tag.

Initial Selected Index for List Controls

The GlgNList handler now supports an optional InitSelectedIndex resource that is saved in the drawing and specifies a 0-based index of the item that should be selected on initial appearance. If the resource is not specified or is set to -1, no items will be selected when the list is initially drawn.

New UTF8 Conversion Options of the Graphics Builder and the HMI Configurator

A new Convert Strings to UTF8 on Save option in the Options menu may be used to convert all string attributes (such as TextString of a text object) from the current locale to UTF8 when the drawing is saved. This is especially convenient when using localized strings on Windows in a drawing that will be used on the web with the JavaScript. JavaScript supports a limited number of character sets, using UTF8 as a default character set, while the UTF8 system locale is not supported on Windows. The Convert Strings to UTF8 on Save option provides a convenient way to save the drawing in the UTF8 locale without a need to use external converters.

In addition, the Arrange, UTF8 Conversions menu provides options for converting all strings in the drawing from the current locale to UTF8 and from UTF8 to the current locale. These options may be used to verify the converted drawing before saving it.

The conversion options convert strings of attributes that are data objects of S (string) type and do not convert string attributes that are not GLG objects, such as object and tag names.

Miscellaneous GLG Editor Changes

New UnitsSeparator and SuffixSeparator parameters were added to the Value Display and Text Display predefined transformations. The new parameters are used to supply a space or other separator between the value and the trailing string, without a need to embed the separator in the trailing string.

Ctrl-Shift-click may now be used to perform the Set Focus action by clicked on a viewport or light viewport in the HMI Configurator. Previously, this action was enabled only in the Graphics Builder.

The layout policy of the Transformation Properties dialog was changed to display more properties when the user resizes the dialog to increase its height.

New API methods

Method to Change Number of Elements in a Container

A new Flush method was added to the Extended API for all supported deployment options. The method sets the size of a container object to the requested size. If the new size is less than the container size, extra elements are removed. If the new size is larger, it adds elements by making a copy of the last element.

The container may be a group, a viewport, a polygon (as a container of points), a spline or a connector. The method can only be invoked if the container is not set up. If the container is set up (drawn), the method must be surrounded by the SuspendObject and ReleaseObject calls.

New Installable Interface Handler Methods

The GlgIHGetCurrIH method may be used to obtain an ID of the currently active interface handler. The GlgIHGetPrevIH method returns the ID of the parent handler of the currently active interface handler. The parent handler is the handler preceding the current handler on the stack of the installed handlers.

New Embedded Platforms (Jetson Nano, ARMv8 AArch64)

The Linux version of the Toolkit has been ported to the embedded boards with the ARM8 64-bit architecture, such as Jetson Nano. Both the GLG Editors and the GLG C/C++ applications can now be run natively on the ARMv8 AArch64 embedded boards.

In the previous releases, only 32-bit ARM6 and ARM7 embedded boards were supported, such as Raspberry Pi and BeagleBone.

Miscellaneous API and Run-Time Engine Changes

Java Anti-Aliasing on Per-Object Basis

The Java version of the GLG run-time engine was changed to handle anti-aliasing on per-object basis, as controlled by an object's AntiAliasing attribute. This makes it compatible with the rest of the GLG run-time engines for other programming environments (C/C++, C# and JavaScript). Previously, the AntiAliasing was ignored in Java, and anti-aliasing was controlled globally by the GlgAntiAliasing global configuration resource. In the new version, GlgAntiAliasing is set to -1 by default to let the object's AntiAliasing attribute control anti-aliased rendering. If GlgAntiAliasing is set to 0, the anti-aliasing will be disabled.

Image Load Timeout

A new GlgURLTimeout global configuration resource was added to the Java and C# versions of the GLG library. The new resource specifies the timeout (in seconds) for loading images and GIS maps in the synchronous loading mode, when the application waits for the image or map to finish loading before proceeding to render the drawing. If the image or map is not loaded within the specified timeout, the image or map loading will be aborted and the application will continue after generating an error message. The ImageLoaded attribute of the image or GIS object may be used to query their loading status.

Intelligent Handling of the if_changed Parameter

The if_changed parameter of the SetTag and SetResourceIf methods is used to optimize update performance. If it is set to True, the drawing will be updated only if the resource or tag value has changed. It is common to use if_changed=True when supplying data using tags.

Some resources, such as a chart entry point used to push data into the chart, need to be updated even if the data value did not change, since the chart has to scroll even when the plotted value doesn't change over time. If a tag is used to push data into a chart's entry point, the if_changed parameter should be set to False.

In previous releases, application developers had to write code to set the if_changed flag conditionally depending on whether the value is pushed into a chart or another object. In the new release, it is handled automatically, ignoring the if_changed parameter for chart entry points.

A new AlwaysChanged attribute of data objects is used internally to handle chart entry points. When the drawing is set up, the attribute is set to True for data objects that are used as chart entry points. When data are pushed into the tag that corresponds to the chart entry point, the drawing is updated regardless of the setting of the if_changed parameter of the SetTag method.

The attribute may be queried via the GLG API to find out if a resource or a tag is a chart entry point.

SetResourceObject Use with the Standard API

The SetResourceObject method is now available in the Java, C# and JavaScript Standard API for setting global configuration resources that are objects, such as a default font table object or default scrollbars.

The Extended API is required to use this methods for resources other than global configuration resources.

Configuration Resources for Touch Screen Devices

Two new global configuration resources have been added to assist deployment on touch screen devices without a mouse: GlgDisableMouseButtonCheck and GlgDisableControlKeyCheck. Both resources disable action conditions that are not available on touch screen devices without a mouse.

The GlgDisableMouseButtonCheck resource may be set to true to disable a mouse button check, so that all actions that are configured to be executed on the right mouse click may be changed to be executed on a touch action, which is handled as the left mouse button click.

The GlgDisableControlKeyCheck resource may be set to true to disable the Control key modifier check for actions that are configured to be activated on the Ctrl-click on devices with a keyboard. When this resource is set to true on touch screen devices that do not have an external keyboard, these actions will be activated on a touch without a Control key check.

OpenGL Driver Improvements

In the previous GLG releases, the C/C++ GLG OpenGL driver on Linux was configured to automatically switch to software OpenGL when the hardware OpenGL driver was not properly configured. In the newer Linux releases, the changes to the OpenGL library caused this condition to be triggered erroneously, causing the switch to the software OpenGL to happen even when the graphics card was properly set up on some systems.

In the new release, the automatic switch to the software OpenGL in the GLG OpenGL driver was disabled in order to properly use the hardware-accelerated OpenGL when it is available. If the hardware OpenGL is not available, the driver will still switch to the software OpenGL. If the hardware OpenGL is available, but the system OpenGL has problems, the use of the software OpenGL may be forced by disabling the hardware OpenGL using the -glg-disable-hardware-opengl command-line option or by setting the GLG_DISABLE_HARDWARE_OPENGL environment variable to True.

Font File Parsing Enhancements

The font file parser was changed to skip empty lines that contain only spaces, in addition to the comment lines starting with the # sign. This avoids hard to debug errors when an empty line is used in the file to separate font families.

Application Security Enhancements

The code of the GLG C/C++ library was refactored to eliminate the use of "%n" in writable strings to allow using the library in environments with fortified glibc, such as the Jetson Nano embedded board.

Bug Fixes

The following bugs were fixed in the new release: