By default, the Zoom method zooms in to the view using the fixed zoom factor specified in the Zoom Factor preference. You can also:

  • Specify a custom zoom factor with an argument
  • Zoom based on the pixel scale of a specific layer
  • Zoom based on the map scale of the view

Example


The following code zooms in and out of a raster layer.

; Launch the application
e = ENVI()
 
; Create an ENVIRaster and display it
file = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
 
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
 
; Zoom to 200% (2:1)
view.Zoom, 2.0
 
; Zoom IN/OUT to the fixed zoom factor specified
; in the Zoom Factor preference
view.Zoom
view.Zoom, /OUT

Syntax


ENVIView.Zoom, ZoomFactor [, Keywords=value]

Arguments


ZoomFactor

To zoom the image in or out, specify a floating-point zoom factor.

To zoom based on map scale, specify a string of the form '1:n', which defines the map ratio.

To zoom based on the pixel scale of a specific layer, specify a string of the form 'n%' (it must end with the % symbol). To do this, the LAYER keyword must be set to an ENVIRasterLayer.

If you do not specify this argument, the Zoom method uses the fixed zoom factor specified in the Zoom Factor preference.

Keywords


Keywords are applied only during the initial creation of the object.

ERROR

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

FULL_EXTENT

Set this keyword to zoom to the full extent of either a single layer or all layers in the view. If the LAYER keyword is set, the Zoom method zooms to the full extent of the layer specified. If the LAYER keyword is not set, the Zoom method zooms to the full extent of all layers.

If the FULL_EXTENT keyword is specified, ZoomFactor is ignored.

FULL_RESOLUTION

Set this keyword to zoom to the full resolution (1:1) of the specified layer's pixels. If this keyword is set, LAYER must be set to an ENVIRasterLayer. This process differs from setting ZoomFactor to '100%' in that if the zoom causes the layer to be completely outside of the view, it will pan the layer so that the top left corner of the layer matches up with the top left corner of the view.

If the FULL_RESOLUTION keyword is specified, ZoomFactor is ignored. FULL_EXTENT and FULL_RESOLUTION may not both be set at the same time.

LAYER

Set this keyword to an ENVIRasterLayer or ENVIVectorLayer to do layer-dependent zooming.

OUT

Set this keyword to zoom out instead of in. If the argument ZoomFactor is specified, the zoom factor uses this value. If the ZoomFactor argument is not specified, the zoom factor uses the fixed value specified in the Zoom Factor preference.

Version History


ENVI 5

Introduced

API Version


4.2

See Also


ENVIView