; $Id: davegr__get.pro,v 1.10 2006/04/27 17:18:42 azuah Exp $
;###############################################################################
;
; CLASS NAME:
;   DaveGr
;
; PURPOSE:
;   This DaveGr class defines an entity which consists of one or more
;   datasets and all the necessary properties or attributes to display
;   or plot the dataset(s). A dataset is contained in a DaveDat
;   object and can be manipulated using that class' methods.
;
; CATEGORY:
;   Data Browser
;
; SUPERCLASSES:
;   IDL_CONTAINER
;
; PUBLIC METHODS:
;   Add
;   Get
;   Remove
;   Set
;
; AUTHOR:
;   Richard Tumanjong Azuah
;   NIST Center for Neutron Research
;   100 Bureau Drive, Gaithersburg, MD 20899
;   United States
;   azuah@nist.gov; (301) 9755604
;   Nov, 2002
;
; LICENSE:
;  The software in this file is written by an employee of 
;  National Institute of Standards and Technology 
;  as part of the DAVE software project.
;
;  The DAVE software package is not subject to copyright protection
;  and is in the public domain. It should be considered as an
;  experimental neutron scattering data reduction, visualization, and
;  analysis system. As such, the authors assume no responsibility
;  whatsoever for its use, and make no guarantees, expressed or
;  implied, about its quality, reliability, or any other
;  characteristic. The use of certain trade names or commercial
;  products does not imply any endorsement of a particular product,
;  nor does it imply that the named product is necessarily the best
;  product for the stated purpose. We would appreciate acknowledgment
;  if the DAVE software is used or if the code in this file is
;  included in another product.
;
;###############################################################################



;===============================================================================
; DaveGr::Get
;
; PURPOSE:
;   Get method for class.
;
; PARAMETERS:
;
; KEYWORDS:
;   title [out] - text to be used for the main plot title
;
;   nameTag [out] - A string name tag used for identifying this
;                  object's icon in a widget application.
;
;   label [out] - A variable (an ANNOTATE structure) specifying a text
;                label to be associated with the DaveGr object
;                created.
;
;   nlabel [out] - Set the number of text labels
;
;   bgColor [out] - an [R,G,B] vector of byte values to be used as the
;                  background color when displaying this object.
;
;   xColor [out] - an [R,G,B] vector of byte values specifying the
;                 x-axis color.
;
;   xFont [out] - a string specifying a valid font family name for the
;                x-axis.
;
;   xFontSize [out] - an integer specifying a valid fontsize for the
;                    x-axis.
;
;   xLabel [out] - a string specifying the label for the x-axis.
;
;   xLineSize [out] - a float specifying a valid line thickness for
;                    drawing the x-axis.
;
;   xMiscAttribs [out] - a structure specifying various graphics
;                       attributes for the x-axis.
;
;   zColor [out] - dependent-axis equivalent of xColor
;
;   zFont [out] - dependent-axis equivalent of xFont
;
;   zFontSize [out] - dependent-axis equivalent of xFontSize
;
;   zLabel [out] - dependent-axis equivalent of xLabel
;
;   zLineSize [out] - dependent-axis equivalent of xLineSize
;
;   zMiscAttribs [out] - a structure specifying various graphics
;                       attributes for the z-axis.
;
;   guiAttribsPtr [out] - a placeholder for storing various
;                         user-specified graphics settings at run
;                         time.
;
;   dataRef [out] - return a reference to the conatined DaveDat
;                   objects.
;
;   position [out] - if set, the dataRef keyword would return the
;                    object reference at the index location specified
;                    by position.
;
;   all [out] - if set, the dataRef keyword will return all contained
;               DaveDat* objects.
;
;   count [out] - return the number of DaveDat* objects present.
;
; RETURN VALUE:
;   0 => failure
;   1 => success.
;
function DaveGr::get, label=label,nlabel=nlabel,position=pos,count=dataCount,dataRef=dataRef,nameTag=nameTag, $
  bgColor=bgColor,xColor=xColor,xFontVal=xFont,xFontSize=xFontSize,xLabel=xLabel,xLineSize=xLineSize, $
  zColor=zColor,zFontVal=zFont,zFontSize=zFontSize,zLabel=zLabel,zLineSize=zLineSize,title=title, $
  xMiscAttribs=xMiscAttribs,zMiscAttribs=zMiscAttribs,guiAttribsPtr=guiAttribsPtr, $
  all=all, visRef=visRef

retVal = 1

; return guiAttribsPtr
if (arg_present(guiAttribsPtr)) then begin
    guiAttribsPtr = self.guiAttribsPtr
endif

; Visualization object
if (arg_present(visRef)) then visRef = self.visRef

; Return title
if (arg_present(title)) then begin
    title = self.title
endif

; Return label
if (arg_present(label)) then begin
    if (self.nlabel gt 0) then $
      label = self.label[0:self.nlabel-1]
endif

; Return number labels present
if (arg_present(nlabel)) then begin
      nlabel = self.nlabel
endif

; Return name tag
if (arg_present(nameTag)) then begin
    nameTag = self.nameTag
endif

; Return miscellaneous graph attributes for x-axis
if (arg_present(xMiscAttribs)) then begin
    xMiscAttribs = self.xMiscAttribs
endif

; Return miscellaneous graph attributes for z-axis
if (arg_present(zMiscAttribs)) then begin
    zMiscAttribs = self.zMiscAttribs
endif

; bgColor
if (arg_present(bgColor)) then begin
    bgColor = self.bgColor
endif

; xColor
if (arg_present(xColor)) then begin
    xColor = self.xColor
endif

; xFont
if (arg_present(xFont)) then begin
    xFont = self.xFont
endif

; xFontSize
if (arg_present(xFontSize)) then begin
    xFontSize = self.xFontSize
endif

; xLineSize
if (arg_present(xLineSize)) then begin
    xLineSize = self.xLineSize
endif

; xLabel
if (arg_present(xLabel)) then begin
    xLabel = self.xLabel
endif

; zColor
if (arg_present(zColor)) then begin
    zColor = self.zColor
endif

; zFont
if (arg_present(zFont)) then begin
    zFont = self.zFont
endif

; zFontSize
if (arg_present(zFontSize)) then begin
    zFontSize = self.zFontSize
endif

; zLineSize
if (arg_present(zLineSize)) then begin
    zLineSize = self.zLineSize
endif

; zLabel
if (arg_present(zLabel)) then begin
    zLabel = self.zLabel
endif

; Return number of datasets
if (arg_present(nData)) then begin
    nData = self.nData
endif

; Return a reference to the DaveDat objects.
; ** Essentially a wrapper around IDL_CONTEINER::get!
if (n_elements(etc) eq 0) then etc = {dummy:0} ;  create a dummy keyword in etc struct if necessary

if (arg_present(dataRef)) then begin
    ;; If position keyword is set, pass it on
    if (n_elements(pos) gt 0) then begin 
        etc = create_struct(etc, 'position',pos)
    endif else  etc = create_struct(etc, 'all',1)

    dataRef = self->IDL_CONTAINER::get(count=dataCount,_EXTRA=etc)
endif else begin
    if (keyword_set(all)) then begin
        retVal = self->IDL_CONTAINER::get(count=dataCount,/all)
    endif
endelse

return, retVal
end
