The CreateView function method creates and returns an object reference to a new ENVIView. Use this function method to add views one at a time.

An alternative is to use the LAYOUT property to the ENVI function to specify default view layouts such as 2x2, 4x4, etc.

Example


Copy and paste the following code into the IDL command line:

; Start the application
e = ENVI()
 
; Open a raster file
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Create a view and add the raster layer to it
view1 = e.GetView()
layer1 = view1.CreateLayer(raster)

Now create a second view, and add a color-infrared version of the raster to the view:

view2 = e.CreateView()
layer2 = view2.CreateLayer(raster, /CIR)

Syntax


Result = ENVI.CreateView([, ERROR=variable])

Return Value


This method returns a reference to an ENVIView.

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.

Version History


ENVI 5

Introduced

API Version


4.2

See Also


ENVI function, ENVIView, ENVI::GetView