user manual

396 Appendix A: Controlling iTools from the IDL Command Line
Replacing Data in an iTool iTool Developer’s Guide
class to insert new data into the parameter. The following example changes the data
associated with the “Y” parameter of the plot visualization created in the previous
section:
oDataY = oPlot->GetParameter('Y')
success = oDataY->SetData(FINDGEN(50))
Using the FindIdentifiers Method
It is also possible to use the FindIdentifiers method to retrieve the full identifier of a
data object stored in the Data Manager, and use that identifier to retrieve the
IDLitData object using the GetByIdentifier method of the IDLitContainer class.
While this approach might seem simpler than retrieving the parameter names from
the visualization and using the GetParameter method, it has the drawback that
identifiers for objects in the Data Manager do not necessarily correspond to a single
visualization. As a result, it can be difficult to determine which data item is which,
based solely on inspection of the identifier.
Under some circumstances this may not be a problem. For example, if your code
creates a new visualization based on data supplied at the command line, you will
know that the data object or objects created in the Data Manager will be the last items
in the Data Manager container object. The following code creates a new surface
visualization using the ISURFACE command, and then immediately retrieves the
data identifier of the last data item inserted into the Data Manager:
ISURFACE, DIST(40)
idTool = ITGETCURRENT(TOOL=oTool)
allData = oTool->FindIdentifiers(/DATA_MANAGER, COUNT=c)
idDataSurface = allData[c-1]
PRINT, idDataSurface
IDL prints:
/DATA MANAGER/SURFACE PARAMETERS/Z
You then could the use the data identifier to retrieve a reference to the data object and
change the data value using the SetData method:
oSurfaceData = oTool->GetByIdentifier(idDataSurface)
success = oSurfaceData->SetData(1/(DIST(40)+1))