PmiCanvas - Deatiled object description

See: Object PmiCanvas
The PmiCanvas graphic item permanently contains the drawing area (raster image in memory - bitmap) the size of the graphic item. The drawing area (represented by the CanvasCtx object) is available for onDraw drawing event (JavaScript) via the pEvent.GetCtx(state) method. When drawing the item physicaly into the PROMOTIC panel window the current remembered content of the drawing area is used, the onDraw event is not used for redrawing the area.
The concept of foreground/background:

If the animated 2D content is complex, large and some portion of it is changing rapidly, then the CPU load could be quite high. The possible solution of such situation is to divide the complex PmiCanvas item up into two overlaping PmiCanvas items. One portion being static complex background and the second part being dynamic simple foreground. The graphic item representing the dynamic foreground is embedded in the static background, constituting one compound graphic item. This is the standard solution used for creating most of the preconfigured PmiCanvas items.

The embedded item (foreground) can access Vars variables of the parent item (background). If the Vars variables of the parent item (background) are modified, the refresh of embedded item (background) is provided.

See the configurator "In onDraw the pEvent.GetParentVar() method will be used".

PmiCanvas graphic item allows automated calling of onDraw drawing event for redrawing the draw area CanvasCtx if needed:

1) If the drawing area is not initialised (empty) after opening the panel or after changing the dimensions of the PmiCanvas graphic item, or after calling the CtxReset method. In this case the drawing area is always empty (transparent).
2) If the input variables (Variables) of the PmiCanvas graphic item were changed. The drawing method may request an existing drawing area, see pEvent.GetCtx(1), or more commonly non-initialized (empty) drawing area, see pEvent.GetCtx(0).
3) If the variables (Variables) of the parent grafiphic item (background) PmiCanvas were changed (valid for embedded item - foreground).

The drawing area is redrawn by the onDraw event only if changed. If no change occurs, then it is not necessary to use the script for redrawing the area and the remembered appearance is used. The onDraw event can access only the values of local variables (Variables) of the PmiCanvas item, that are currently used as data interface of the drawing function. It can also use the Pm object and the drawing area object CanvasCtx. The scripting interface of the CanvasCtx object enables most of the methods and properties for 2D drawing used in HTML5 in the <canvas> tag.

- Drawing by script allows conditioned drawing, repeated drawing, recounting, obtaining and formatting values, (statements if...else, for, the Pm object, local variables Variables, etc.).
- It is functional also in Web panels, drawing directly in client PC browsers, most browsers are supported. The methods and properties for drawing are present in the CanvasCtx object. A standard HTML5 item canvas that is commonly supported; there are many exemples, editors and testers online.
- Faster than SVG in PmiRasterImage (localy and on the Web) and supports text displaying.
- when editing the PmiCanvas item including the onDraw drawing event the item is displayed immediatelly in the development environment (in panel editor).
- The designers can use and modify the preconfigured items based on PmiCanvas.
- On the Web, the graphics (drawing scripts) are integral part of the panel, there is no need to download any aditional graphic files.
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice