Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  IDL Reference  >  Object Graphics - Destination  >  IDLgrClipboard

IDLgrClipboard

IDLgrClipboard

Superclasses | Creation | Properties | Methods | Examples | Version History

An IDLgrClipboard object sends Object Graphics output to the operating system native clipboard or to a file in bitmap or vector format. The FILENAME, VECTOR, and POSTSCRIPT keyword values in the IDLgrClipboard::Draw method, and the platform on which the call is issued determine the file type and destination. See IDLgrClipboard::Draw for details.

Note: Objects or subclasses of this type can not be saved or restored.

Superclasses


IDLitComponent

Creation


See IDLgrClipboard::Init.

Properties


Objects of this class have the following properties. See IDLgrClipboard Properties for details on individual properties.

In addition, objects of this class inherit the properties of all superclasses of this class.

Methods


This class has the following methods:

In addition, this class inherits the methods of its superclasses (if any).

Examples


This example demonstrates the process of copying the contents of an IDL graphics display object (a buffer or a window) to the system clipboard, where it becomes available for pasting into another application. The example also uses the IDLgrClipboard::Draw method to create a platform-dependent file type in the current directory.

PRO SendingPlotToClipboard
 
; Determine the path to the "damp_sn2.dat" file.
signalFile = FILEPATH('damp_sn2.dat', $
   SUBDIRECTORY = ['examples', 'data'])
 
; Initialize the parameters of the data within the file.
signalSize = 512
signal = BYTARR(signalSize, /NOZERO)
 
; Open the file, read in data, and then close the file.
OPENR, unit, signalFile, /GET_LUN
READU, unit, signal
FREE_LUN, unit
 
; Determine viewplane size and margins.
offsetScale = 150.
viewOffset = offsetScale*[-1., -1., 1., 1.]
signalRange = MAX(signal) - MIN(signal)
 
; Initialize the display objects.
windowSize = [512, 384]
oWindow = OBJ_NEW('IDLgrWindow', RETAIN = 2, $
   DIMENSIONS = windowSize, $
   TITLE = 'Damped Sine Wave with Noise')
 
; Use an IDLgrViewgroup as the picture rather than 
; an IDLgrView. This is used  as a container for the
; "loose" objects, such as the IDLgrText objects that 
; are the axis titles.
oViewgroup = OBJ_NEW('IDLgrViewgroup')
oWindow->SetProperty, GRAPHICS_TREE = oViewgroup
 
; Add an IDL container to the viewgroup to hold text objects.
oContainer = OBJ_NEW('IDL_CONTAINER')
oViewgroup->Add, oContainer
 
oView = OBJ_NEW('IDLgrView', $
   VIEWPLANE_RECT = [0., 0., signalSize, signalRange] + $
   viewOffset)
oViewgroup->Add, oView
oModel = OBJ_NEW('IDLgrModel')
oView->Add, oModel
 
; Initialize the plot object.
oPlot = OBJ_NEW('IDLgrPlot', signal, COLOR = [0, 0, 255])
oModel->Add, oPlot
 
; Obtain plot ranges.
oPlot->GetProperty, XRANGE = xPlotRange, $
   YRANGE = yPlotRange
 
; Initialize axes objects, which are based on the plot
; ranges.
oXTitle = OBJ_NEW('IDLgrText', 'Time (seconds)')
oContainer->Add, oXTitle
oXAxis = OBJ_NEW('IDLgrAxis', 0, RANGE = xPlotRange, $
   LOCATION = [xPlotRange[0], yPlotRange[0]], /EXACT, $
   TITLE = oXTitle, TICKDIR = 0, $
   TICKLEN = (0.02*(yPlotRange[1] - yPlotRange[0])))
oModel->Add, oXAxis
oYTitle = OBJ_NEW('IDLgrText', 'Amplitude (centimeters)')
oContainer->Add, oYTitle
oYAxis = OBJ_NEW('IDLgrAxis', 1, RANGE = yPlotRange, $
   LOCATION = [xPlotRange[0], yPlotRange[0]], /EXACT, $
   TITLE = oYTitle, TICKDIR = 0, $
   TICKLEN = (0.02*(xPlotRange[1] - xPlotRange[0])))
oModel->Add, oYAxis
oModel->Translate, -50., -50., 0.
oWindow->Draw
 
; Determine the centimeter to pixel resolution of the
; plot on the screen.
oWindow->GetProperty, RESOLUTION = screenResolution
 
; Initialize clipboard destination object.
oClipboard = OBJ_NEW('IDLgrClipboard', QUALITY = 2, $
   DIMENSIONS = windowSize, $
   RESOLUTION = screenResolution, $
   GRAPHICS_TREE = oViewgroup)
 
; Determine the type of export file, which depends on
; the screen device.
screenDevice = !D.NAME
CASE screenDevice OF
   'X': fileExtension = '.ps'
   'WIN': fileExtension = '.emf'
   ELSE: BEGIN
      OBJ_DESTROY, [oWindow, oClipboard]
      RETURN
      END
ENDCASE
clipboardFile = 'damp_sn2' + fileExtension
 
; Display the view within the clipboard destination,
; which exports to a PS or EMF.
oClipboard->Draw, FILENAME = clipboardFile, $
   /VECTOR
oClipboard->Draw, FILENAME = 'damp_sn2.eps', $
   /POSTSCRIPT, /VECTOR
 
; Place the image on the system clipboard, so that
; it can be pasted into another application.
oClipboard->Draw, /VECTOR
 
; Cleanup object references. Before destroying the 
; IDLgrClipboard object, reset its GRAPHICS_TREE 
; to NULL so the IDLgrViewgroup can remain associated 
; with the IDLgrWindow. Interactive destruction
; of the IDLgrWindow will free the other graphics objects
; implicitly. 
oClipboard->SetProperty, GRAPHICS_TREE = OBJ_NEW()
OBJ_DESTROY, oClipboard
 
END

Version History


5.1

Introduced

6.2

Added QueryRequiredTiles method

8.2 Added LINE_QUALITY property



© 2018 Harris Geospatial Solutions, Inc. |  Privacy Policy
My Account    |    Store    |    Contact Us