vtkMRMLXYPlotManagerNode.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2009 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $RCSfile: vtkMRMLCurveAnalysisNode.h,v $
00010   Date:      $Date: 2006/03/19 17:12:29 $
00011   Version:   $Revision: 1.3 $
00012 
00013 =========================================================================auto=*/
00014 #ifndef __vtkMRMLXYPlotManagerNode_h
00015 #define __vtkMRMLXYPlotManagerNode_h
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 #include "vtkObject.h"
00021 #include "vtkCollection.h"
00022 
00023 #include "vtkMRML.h"
00024 #include "vtkMRMLNode.h"
00025 #include "vtkMRMLStorageNode.h"
00026 #include "vtkMRMLDoubleArrayNode.h"
00027 #include "vtkMRMLPlotNode.h"
00028 
00029 
00030 class vtkIntArray;
00031 
00032 class VTK_MRML_EXPORT vtkMRMLXYPlotManagerNode : public vtkMRMLNode
00033 {
00034 
00035  public:
00036 
00037   //----------------------------------------------------------------
00039   //----------------------------------------------------------------
00040 
00042   //BTX
00043   enum {
00044     UpdateGraphEvent = 11900
00045   };
00046   //ETX
00047 
00049   //BTX
00050   enum {
00051     INTERP_LINEAR = 0
00052   };
00053   enum {
00054     TYPE_CURVE = 0,
00055     TYPE_VERTICAL_LINE,
00056     TYPE_HORIZONTAL_LINE
00057   };
00058   //ETX
00059 
00060   //----------------------------------------------------------------
00062   //----------------------------------------------------------------
00063 
00064   static vtkMRMLXYPlotManagerNode *New();
00065   vtkTypeMacro(vtkMRMLXYPlotManagerNode,vtkMRMLNode);
00066   
00067   void PrintSelf(ostream& os, vtkIndent indent);
00068 
00069   virtual vtkMRMLNode* CreateNodeInstance();
00070 
00073   virtual void ReadXMLAttributes( const char** atts);
00074 
00077   virtual void WriteXML(ostream& of, int indent);
00078 
00081   virtual void Copy(vtkMRMLNode *node);
00082 
00085   virtual const char* GetNodeTagName() { return "XYPlot"; };
00086 
00089   virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData );
00090 
00091   //----------------------------------------------------------------
00093   //----------------------------------------------------------------
00094   
00097   int AddPlotNode(vtkMRMLPlotNode* node);
00098 
00101   void RemovePlotNode(int id);
00102 
00105   void RemovePlotNodeByNodeID(const char* nodeID);
00106 
00109   void ClearPlotNodes();
00110 
00113   unsigned int GetNumberOfPlotNodes();
00114 
00117   vtkIntArray* GetPlotNodeIDList();
00118 
00121   vtkMRMLPlotNode* GetPlotNode(int id);
00122 
00126   vtkCollection* GetPlotNodes(const char* tag=NULL);
00127 
00128 
00129   //----------------------------------------------------------------
00131   //----------------------------------------------------------------
00132 
00135   void SetVisibilityAll(int i);
00136 
00139   void SetErrorBarAll(int i);
00140 
00141 
00142   //----------------------------------------------------------------
00144   //----------------------------------------------------------------
00145 
00148   void Refresh();
00149 
00150   //----------------------------------------------------------------
00152   //----------------------------------------------------------------
00153 
00156   void SetTitle(const char* str)
00157   {
00158     this->Title = str;
00159     this->Modified();
00160   };
00161 
00164   const char* GetTitle()
00165   {
00166     return this->Title.c_str();
00167   };
00168 
00171   void SetXLabel(const char* str)
00172   {
00173     this->XLabel = str;
00174     this->Modified();
00175   };
00176 
00179   const char* GetXLabel()
00180   {
00181     return this->XLabel.c_str();
00182   };
00183 
00186   void SetYLabel(const char* str)
00187   {
00188     this->YLabel = str;
00189     this->Modified();
00190   };
00191   
00194   const char* GetYLabel()
00195   {
00196     return this->YLabel.c_str();
00197   };
00198 
00201   vtkSetMacro ( AutoXRange, int );
00202   vtkGetMacro ( AutoXRange, int );
00203   vtkSetMacro ( AutoYRange, int );
00204   vtkGetMacro ( AutoYRange, int );
00205 
00208   void SetXRange(double* range)
00209   {
00210     if (range[0] <= range[1])
00211       {
00212         this->XRange[0] = range[0];
00213         this->XRange[1] = range[1];
00214         this->Modified();
00215       }
00216   };
00217 
00220   void SetYRange(double* range)
00221   {
00222     if (range[0] <= range[1])
00223       {
00224         this->YRange[0] = range[0];
00225         this->YRange[1] = range[1];
00226         this->Modified();
00227       }
00228   };
00229 
00232   void GetXRange(double* range)
00233   {
00234     range[0] = this->YRange[0];
00235     range[1] = this->YRange[1];
00236   };
00237  
00240   void GetYRange(double* range)
00241   {
00242     range[0] = this->YRange[0];
00243     range[1] = this->YRange[1];
00244   };
00245 
00248   vtkSetVector3Macro( AxesColor, double );
00249   vtkGetVector3Macro( AxesColor, double );
00250 
00253   void SetBackgroundColor(double r, double g, double b)
00254   {
00255     this->BackgroundColor[0] = r;
00256     this->BackgroundColor[1] = g;
00257     this->BackgroundColor[2] = b;
00258     this->Modified();
00259   };
00260 
00263   void GetBackgroundColor(double* r, double* g, double* b)
00264   {
00265     *r = this->BackgroundColor[0];
00266     *g = this->BackgroundColor[1];
00267     *b = this->BackgroundColor[2];
00268   };
00269 
00270   
00271  protected:
00272   //----------------------------------------------------------------
00274   //----------------------------------------------------------------
00275   
00276   vtkMRMLXYPlotManagerNode();
00277   ~vtkMRMLXYPlotManagerNode();
00278   vtkMRMLXYPlotManagerNode(const vtkMRMLXYPlotManagerNode&);
00279   void operator=(const vtkMRMLXYPlotManagerNode&);
00280 
00281 
00282  protected:
00283   //----------------------------------------------------------------
00285   //----------------------------------------------------------------
00286 
00287   //BTX
00288   std::string Title;             
00289   std::string XLabel;            
00290   std::string YLabel;            
00291   std::map< int, vtkMRMLPlotNode* > Data;  
00292   //ETX
00293 
00294   int LastArrayID;
00295 
00296   int    AutoXRange;  
00297   int    AutoYRange;  
00298   double XRange[2];
00299   double YRange[2];
00300 
00301   double AxesColor[3];
00302   double BackgroundColor[3];
00303   
00304 };
00305 
00306 #endif
00307 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1