GLG Toolkit, JavaScript Library  Version 4.6
Zooming and Scrolling

This group contains methods for zooming, panning and scrolling GLG drawings, charts and GIS map objects. More...

Detailed Description

This group contains methods for zooming, panning and scrolling GLG drawings, charts and GIS map objects.

Functions

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

Function Documentation

◆ 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.