Adding a plot to an itool Image [message #37956] |
Thu, 05 February 2004 13:22 |
mvukovic
Messages: 63 Registered: July 1998
|
Member |
|
|
A few days ago, I faced a problem of adding a plot to an itool Image.
Not having found anything on the group, after considerable probing, I
managed to do it. Here is the routine, hoping that someone may
improve upon it.
Cheers,
Mirko
PS. I'm getting to really like these iTools.
pro AddPlot2IImage, vX, vY
;; Add a plot to a currently active iTool image.
; This first part was gleaned from iPlot startup.
;; Pack data in IDLVector objects. Offset for pixel size (not sure
if it
;; works.
oDataX = obj_new('idlitDataIDLVector', vX+0.5, NAME = 'X')
oDataY = obj_new('idlitDataIDLVector', vY+0.5, NAME = 'Y')
;; This data is stored in a ParameterSet object
oParmSet = OBJ_NEW('IDLitParameterSet', $
NAME = 'Plot parameters', $
ICON = 'plot', $
DESCRIPTION = 'Plot parameters')
oParmSet -> add, oDataX, PARAMETER_NAME = 'X'
oParmSet -> add, oDataY, PARAMETER_NAME = 'Y'
; I got this from the iTool Developers Guide, p.99
;; The ParameterSet object is passed to the VisPlot.
oPlot = OBJ_NEW('IDLitVisPlot', /REGISTER_PROPERTIES)
oPlot -> OnDataChangeUpdate, oParmSet, '<Parameter Set>'
;; Finally, add the VisPlot to the iImage object. Also from
;; Developers Guide, p. 99
oSys = _IDLitSys_GetSystem()
oTool = oSys -> _GetCurrentTool()
oTool -> Add, oPlot, /AGGREGATE
return
end
|
|
|