Re: Opening a .isv file [message #50674 is a reply to message #50673] |
Fri, 13 October 2006 11:22   |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <1160754314.429990.182420@h48g2000cwc.googlegroups.com>,
codepod@gmail.com wrote:
> Actually, an ISV file is just a save file that contains a portion of
> the iTools data/vis hierarchy. So you can just use restore.
>
> CP
I tried that, and RESTORE restores some data, but it does not open an
iTool window and display the visualization.
After a little thought I realized that one it is possible to control the iTool
interface programmatically to execute the Open operation, so here is a simple
program to do that.
To use,
IDL> isv_open_kpb, isvfile
where isvfile is the name of the .isv file.
I make no guarantees, as my object-oriented programming is severely limited,
but this seems to work.
Plus, it *has* to be good luck to offer this up on Friday the 13th.
Cheers, Ken Bowman
PRO ISV_OPEN_KPB, isvfile, $
ITOOL_ID = itool_id, $
VERBOSE = verbose
;+
;NAME:
; ISV_OPEN_KPB
;PURPOSE:
; Open an iTool visualization saved as an ISV file.
;CATEGORY:
; Graphics and display.
;CALLING SEQUENCE:
; ISV_OPEN_KPB, isvfile
;INPUT:
; isvfile : String containing name of ISV file to open.
;KEYWORDS:
; ITOOL_ID : On return this keyword contains the iTool ID of the newly created iTool.
; VERBOSE : If set, print verbose informational messages.
;OUTPUT:
; Opens iTool window and displays the saved visualization.
;MODIFICATION HISTORY:
; Kenneth P. Bowman, 2006-10-13.
;-
COMPILE_OPT IDL2 ;Set compiler options
IF (N_PARAMS() EQ 0) THEN begin
MESSAGE, 'You must provide the name of an ISV file.', /CONTINUE ;Error - no filename provided
RETURN
ENDIF
file = FILE_SEARCH(isvfile, COUNT = nfiles) ;Check that file exists
IF (nfiles EQ 0) THEN BEGIN
MESSAGE, 'File "' + isvfile + '" not found.', /CONTINUE ;Error - file does not exist
RETURN
ENDIF
iPlot, IDENTIFIER = itool_id, /DISABLE_SPLASH_SCREEN ;Create new iTool
temp = itGetCurrent(TOOL = itool_obj) ;Get iTool object reference
open_op_id = itool_obj -> FindIdentifiers('*OPEN*', /OPERATIONS) ;Get Open operator identifier
open_op_obj = itool_obj -> GetByIdentifier(open_op_id) ;Get Open operator object reference
open_op_obj -> SetProperty, SHOW_EXECUTION_UI = 0, $ ;Turn off Open operator user interface
FILENAME = isvfile ;Set ISV input file name
rc = itool_obj -> DoAction(open_op_id) ;Open ISV file
IF KEYWORD_SET(verbose) THEN PRINT, 'ISV file read from ', isvfile ;Completion message
END
|
|
|