VTK
dox/IO/vtkNetCDFPOPReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkNetCDFPOPReader.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00025 #ifndef __vtkNetCDFPOPReader_h
00026 #define __vtkNetCDFPOPReader_h
00027 
00028 #include "vtkRectilinearGridAlgorithm.h"
00029 #include "vtkSmartPointer.h" // For SmartPointer
00030 
00031 class vtkDataArraySelection;
00032 class vtkCallbackCommand;
00033 
00034 //TODO: get rid of these completely arbitrary limits
00035 //or at least protect against overflow
00036 #define NCDFPOP_MAX_ARRAYS 100
00037 #define NCDFPOP_MAX_NAMELEN 100
00038 
00039 class VTK_IO_EXPORT vtkNetCDFPOPReader : public vtkRectilinearGridAlgorithm
00040 {
00041 public:
00042   vtkTypeMacro(vtkNetCDFPOPReader,vtkRectilinearGridAlgorithm);
00043   static vtkNetCDFPOPReader *New();
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045 
00047 
00048   vtkSetStringMacro(FileName);
00049   vtkGetStringMacro(FileName);
00051 
00053 
00054   vtkSetVector3Macro(Stride, int);
00055   vtkGetVector3Macro(Stride, int);
00057 
00059 
00060   virtual int GetNumberOfVariableArrays();
00061   virtual const char *GetVariableArrayName(int idx);
00062   virtual int GetVariableArrayStatus(const char *name);
00063   virtual void SetVariableArrayStatus(const char *name, int status);
00065 
00066 protected:
00067   vtkNetCDFPOPReader();
00068   ~vtkNetCDFPOPReader();
00069 //BTX
00070   vtkSmartPointer<vtkDataArraySelection> VariableArraySelection;
00071 
00072 //ETX
00073   int RequestData(vtkInformation*,vtkInformationVector**,
00074                   vtkInformationVector*);
00075   virtual int RequestInformation(vtkInformation* request,
00076                                  vtkInformationVector** inputVector,
00077                                  vtkInformationVector* outputVector);
00078 
00079   static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid,
00080                                         void *clientdata, void *calldata);
00081 
00082   static void EventCallback(vtkObject* caller, unsigned long eid,
00083                                 void* clientdata, void* calldata);
00084 
00085   //TODO: these hardcoded limits must be removed
00086   char VariableArrayInfo[NCDFPOP_MAX_ARRAYS][NCDFPOP_MAX_NAMELEN];
00087   // name of variables that user wants
00088   char VariableName[NCDFPOP_MAX_ARRAYS][NCDFPOP_MAX_NAMELEN];
00089   //name of all variables
00090   int Draw[NCDFPOP_MAX_ARRAYS];
00091   //if 0, don't draw, if set to 1, draw out the rectilinear grid
00092   vtkCallbackCommand* SelectionObserver;
00093 
00094   char *FileName;
00095 
00096   int NCDFFD; //netcdf file descriptor
00097   int NVarsp; //number of variables
00098   int NVarspw; //number of variables we list
00099 
00100   int Stride[3];
00101 
00102 private:
00103   vtkNetCDFPOPReader(const vtkNetCDFPOPReader&);  // Not implemented.
00104   void operator=(const vtkNetCDFPOPReader&);  // Not implemented.
00105 };
00106 #endif