Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

GUI/Client/vtkPVSource.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    $RCSfile: vtkPVSource.h,v $
00005 
00006   Copyright (c) Kitware, Inc.
00007   All rights reserved.
00008   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
00023 #ifndef __vtkPVSource_h
00024 #define __vtkPVSource_h
00025 
00026 #include "vtkPVTracedWidget.h"
00027 #include "vtkClientServerStream.h"  // needed for vtkClientServerID
00028 
00029 class vtkCollection;
00030 class vtkKWFrame;
00031 class vtkKWFrameWithScrollbar;
00032 class vtkKWView;
00033 class vtkPVApplication;
00034 class vtkPVColorMap;
00035 class vtkPVDataInformation;
00036 class vtkPVDataSetAttributesInformation;
00037 class vtkPVDisplayGUI;
00038 class vtkPVInputProperty;
00039 class vtkPVLookmark;
00040 class vtkPVNumberOfOutputsInformation;
00041 class vtkPVRenderView;
00042 class vtkPVSourceNotebook;
00043 class vtkPVWidget;
00044 class vtkPVWidgetCollection;
00045 class vtkPVWindow;
00046 class vtkSMCubeAxesDisplayProxy;
00047 class vtkSMDataObjectDisplayProxy;
00048 class vtkSMDisplayProxy;
00049 class vtkSMPart;
00050 class vtkSMPointLabelDisplayProxy;
00051 class vtkSMSourceProxy;
00052 class vtkSource;
00053 class vtkStringList;
00054 
00055 
00056 class VTK_EXPORT vtkPVSource : public vtkPVTracedWidget
00057 {
00058 public:
00059   static vtkPVSource* New();
00060   vtkTypeRevisionMacro(vtkPVSource,vtkPVTracedWidget);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062   
00065   vtkPVWindow *GetPVWindow();
00066   
00068   virtual void CreateProperties();
00069 
00072   void Update();
00073 
00075 
00079   virtual void Select();
00080   virtual void Deselect(int doPackForget = 1);
00081   virtual void Pack();
00083 
00085 
00087   void SetVisibility(int v);
00088   int GetVisibility();
00089   virtual void SetVisibilityNoTrace(int v);
00091   
00094   void SetPVColorMap(vtkPVColorMap *colorMap);  
00095   
00102   void SetDefaultColorParameters();
00103   
00105 
00107   void SetCubeAxesVisibility(int val);
00108   void SetCubeAxesVisibilityNoTrace(int val);
00109   vtkGetMacro(CubeAxesVisibility, int);
00111 
00113 
00114   void SetPointLabelVisibility(int val);
00115   void SetPointLabelVisibilityNoTrace(int val);
00116   vtkGetMacro(PointLabelVisibility, int);
00118 
00119   void SetPointLabelFontSize(int val);
00120   void SetPointLabelFontSizeNoTrace(int val);
00121   vtkGetMacro(PointLabelFontSize, int);
00122 
00124 
00128   void AddPVInput(vtkPVSource *input);
00129   void SetPVInput(const char* name, int idx, vtkPVSource *input);
00131 
00133   vtkPVSource* GetPVInput(int idx) {return this->GetNthPVInput(idx);}
00134 
00136 
00137   vtkGetMacro(NumberOfPVInputs, int);
00139 
00142   void RemoveAllPVInputs();
00143 
00145 
00146   vtkGetMacro(NumberOfPVConsumers, int);
00148 
00150 
00151   void AddPVConsumer(vtkPVSource *c);
00152   void RemovePVConsumer(vtkPVSource *c);
00153   vtkPVSource *GetPVConsumer(int i);
00154   int IsPVConsumer(vtkPVSource *c);
00156 
00158   vtkPVDisplayGUI* GetPVOutput();
00159   
00161 
00162   vtkGetObjectMacro(PVColorMap, vtkPVColorMap);
00164    
00166 
00169   virtual void SetName(const char *name);
00170   char* GetName();
00172 
00174 
00176   vtkSetMacro(OverideAutoAccept,int);
00177   vtkGetMacro(OverideAutoAccept,int);
00179     
00181 
00185   virtual void SetLabelNoTrace(const char *label);
00186   virtual void SetLabel(const char *label);
00187   virtual char* GetLabel();
00188   virtual void SetLabelOnce(const char *label);
00190     
00192   vtkPVApplication* GetPVApplication();  
00193 
00195 
00196   void AcceptCallback();
00197   virtual void PreAcceptCallback();
00199 
00203   virtual int IsDeletable();
00204 
00206 
00208   virtual void Accept() { this->Accept(0); }
00209   virtual void Accept(int hideFlag) { this->Accept(hideFlag, 1); }
00210   virtual void Accept(int hideFlag, int hideSource);
00212   
00214   void ResetCallback();
00215 
00217   virtual void DeleteCallback();
00218 
00221   virtual void Reset();
00222   
00224   void UpdateProperties();  
00225 
00228   virtual void UpdateVTKSourceParameters();
00229 
00230   //BTX
00232 
00233   void AddVTKSource(vtkClientServerID);
00234   //ETX
00236 
00238   int GetNumberOfVTKSources();
00239 
00240   //BTX
00242 
00243   vtkClientServerID GetVTKSourceID(int idx);
00244   //ETX
00245   // Description:
00246   // Give an index, return the ID of a VTK source as unsigned int.
00247   unsigned int GetVTKSourceIDAsInt(int idx);
00249 
00250   //BTX
00251   vtkGetObjectMacro(Widgets, vtkPVWidgetCollection);
00252   //ETX
00253   
00256   virtual void SaveInBatchScript(ofstream *file);
00257 
00259 
00261   virtual void SaveState(ofstream *file);
00262   virtual void SaveStateVisibility(ofstream *file);
00263   virtual void SaveStateDisplay(ofstream *file);
00265   
00267 
00269   vtkSetMacro(ReplaceInput, int);
00270   vtkGetMacro(ReplaceInput, int);
00271   vtkBooleanMacro(ReplaceInput, int);
00273 
00275   vtkPVWidget *GetPVWidget(const char *name);
00276 
00278   vtkPVSource **GetPVInputs() { return this->PVInputs; };
00279 
00281 
00282   void SetNotebook(vtkPVSourceNotebook* notebook);
00283   vtkGetObjectMacro(Notebook, vtkPVSourceNotebook);
00285 
00287 
00290   vtkSetMacro(VisitedFlag,int);
00291   vtkGetMacro(VisitedFlag,int);
00293 
00296   void AddPVWidget(vtkPVWidget *pvw);
00297 
00299   int CloneAndInitialize(int makeCurrent, vtkPVSource*& clone);
00300 
00306   int ClonePrototype(vtkPVSource*& clone);
00307 
00314   virtual int InitializeClone(int makeCurrent);
00315 
00318   virtual int InitializeData();  
00319 
00323   virtual void InitializePrototype() {}
00324 
00326 
00327   vtkSetStringMacro(SourceClassName);
00328   vtkGetStringMacro(SourceClassName);
00330 
00332 
00333   vtkSMPart *GetPart() {return this->GetPart(0);} 
00334   vtkSMPart *GetPart(int idx); 
00335   int GetNumberOfParts();
00337 
00339 
00346   vtkIdType GetNumberOfInputProperties();
00347   vtkPVInputProperty* GetInputProperty(int idx);
00348   vtkPVInputProperty* GetInputProperty(const char* name);
00350 
00352 
00356   vtkSetMacro(VTKMultipleInputsFlag, int);
00357   vtkGetMacro(VTKMultipleInputsFlag, int);
00359   
00361 
00365   vtkSetMacro(VTKMultipleProcessFlag, int);
00366   vtkGetMacro(VTKMultipleProcessFlag, int);
00368   
00373   int GetNumberOfProcessorsValid();
00374   
00376 
00378   vtkSetMacro(IsPermanent, int);
00379   vtkGetMacro(IsPermanent, int);
00380   vtkBooleanMacro(IsPermanent, int);
00382 
00384 
00387   vtkSetStringMacro(ModuleName);
00388   vtkGetStringMacro(ModuleName);
00390 
00392 
00393   vtkSetStringMacro(MenuName);
00394   vtkGetStringMacro(MenuName);
00396 
00398 
00399   vtkSetStringMacro(ShortHelp);
00400   vtkGetStringMacro(ShortHelp);
00402 
00404 
00405   vtkSetStringMacro(LongHelp);
00406   vtkGetStringMacro(LongHelp);
00408 
00410 
00412   vtkGetMacro(Initialized, int);
00414 
00416 
00420   vtkSetMacro(ToolbarModule, int);
00421   vtkGetMacro(ToolbarModule, int);
00422   vtkBooleanMacro(ToolbarModule, int);
00424 
00426 
00430   void GrabFocus();
00431   void UnGrabFocus();
00433 
00435   vtkPVDataInformation* GetDataInformation();
00436   
00438   void InvalidateDataInformation();
00439 
00441   vtkPVRenderView *GetPVRenderView();
00442 
00444 
00445   vtkGetObjectMacro(NumberOfOutputsInformation,
00446                     vtkPVNumberOfOutputsInformation);
00448 
00455   virtual void UpdateEnableState();
00456 
00458 
00459   vtkGetMacro(SourceGrabbed, int);
00461  
00463 
00464   void SetProxy(vtkSMSourceProxy* proxy);
00465   vtkGetObjectMacro(Proxy, vtkSMSourceProxy);
00467 
00468   void RegisterProxy(const char* sourceList, vtkPVSource* clone);
00469 
00471   virtual void UpdateVTKObjects();
00472   
00474 
00475   void SetDisplayProxy(vtkSMDataObjectDisplayProxy* pdisp);
00476   vtkGetObjectMacro(DisplayProxy, vtkSMDataObjectDisplayProxy);
00478 
00480 
00481   vtkGetObjectMacro(PointLabelDisplayProxy, vtkSMPointLabelDisplayProxy);
00483 
00485   void VolumeRenderByArray(const char* arrayname, int field);
00486 
00490   void ColorByArray(const char* arrayname, int field);
00491 
00494   void SetAcceptButtonColorToModified();
00495 
00496   void MarkSourcesForUpdate();
00497 
00499 
00504   void SetLookmark(vtkPVLookmark *lookmark);
00505   vtkGetObjectMacro(Lookmark,vtkPVLookmark);
00507 
00508 protected:
00509   vtkPVSource();
00510   ~vtkPVSource();
00511 
00513 
00514   virtual void SetupDisplays();
00515   virtual void CleanupDisplays();
00517 
00519   void ColorByArray(vtkPVColorMap* colorMap, int field);
00520 
00521   void SetPVInputInternal(const char* name, 
00522                           int idx, 
00523                           vtkPVSource *input, 
00524                           int doInit);
00525 
00526   void SaveFilterInBatchScript(ofstream *file);
00527 
00528   virtual void InitializeWidgets();  
00529 
00530 
00531   vtkPVColorMap *PVColorMap;
00532   
00533   int DataInformationValid;
00534 
00535   vtkPVNumberOfOutputsInformation *NumberOfOutputsInformation;
00536   
00537   // This flag gets set after the user hits accept for the first time.
00538   int Initialized;
00539 
00540   // This is different than the CubeAxesDisplay visibility.
00541   // This is the state of the user selection. The CubeAxesDisplay
00542   // visibility is the value "visibility and CubeAxesVisibility".
00543   int CubeAxesVisibility;
00544 
00545   // This is different than the PointLabelDisplay visibility.
00546   // This is the state of the user selection. The PointLabelDisplay
00547   // visibility is the value "visibility and PointLabelVisibility".
00548   int PointLabelVisibility;
00549   int PointLabelFontSize;
00550 
00551   vtkKWFrameWithScrollbar *ParameterFrame;
00552   vtkSMDataObjectDisplayProxy* DisplayProxy;
00553 
00555 
00556   void AddDisplayToRenderModule(vtkSMDisplayProxy* pDisp);
00557   void RemoveDisplayFromRenderModule(vtkSMDisplayProxy* pDisp);
00559 
00560   // Called to allocate the input array.  Copies old inputs.
00561   void SetNumberOfPVInputs(int num);
00562   vtkPVSource **PVInputs;
00563   int NumberOfPVInputs; 
00564   vtkPVSource *GetNthPVInput(int idx);
00565   void SetNthPVInput(int idx, vtkPVSource *input);
00566 
00567   // Keep a list of sources that are using this data.
00568   vtkPVSource **PVConsumers;
00569   int NumberOfPVConsumers;
00570      
00571   // The real AcceptCallback method.
00572   virtual void AcceptCallbackInternal();
00573   
00574   vtkPVSourceNotebook *Notebook;
00575   // Since the notebook is share between all sources,
00576   // we remember the raised page to restore when the source is selected.
00577   // This ivar is set and used by vtkPVWindow.
00578   int SavedRaisedNotebookPageId;
00579 
00580   char* SourceList;
00581   vtkSetStringMacro(SourceList);
00582   vtkGetStringMacro(SourceList);
00583 
00584   // The name is just for display.
00585   char      *Name;
00586   char      *MenuName;
00587   char      *Label;
00588   char      *ShortHelp;
00589   char      *LongHelp;
00590   int       OverideAutoAccept;
00591 
00592   // This is the module name.
00593   char      *ModuleName;
00594 
00595   
00596   vtkPVWidgetCollection *Widgets;
00597 
00598   char *SourceClassName;
00599 
00600   vtkSMSourceProxy* Proxy;
00601 
00602   // Whether the source should make its input invisible.
00603   int ReplaceInput;
00604 
00605   int VisitedFlag;
00606 
00607   // Number of instances cloned from this prototype
00608   int PrototypeInstanceCount;
00609 
00610   int IsPermanent;
00611   
00612   // Flag for whether we are currently in AcceptCallback.
00613   int AcceptCallbackFlag;
00614 
00615   // Flag to tell whether the source is grabbed or not.
00616   int SourceGrabbed;
00617 
00618   virtual int ClonePrototypeInternal(vtkPVSource*& clone);
00619 
00620   int ToolbarModule;
00621 
00622   // This ivar is here so that Probe will not have any sources which
00623   // have more than one part. A value of -1 means no restrictions.
00624   int RequiredNumberOfInputParts;
00625   // This value is set by the xml <input quantity="..."/> attributes
00626   // to characterize the VTK source.  a value of 1 (set by "Multiple")
00627   // indicates any number of inputs can be had with the AddInput method.
00628   int VTKMultipleInputsFlag;
00629   vtkCollection* InputProperties;
00630 
00631   int VTKMultipleProcessFlag;
00632   
00633   // Taking responsibility of saving inputs away from input menu.
00634   void SetInputsInBatchScript(ofstream *file);
00635 
00636   int UpdateSourceInBatch;
00637 
00638   int LabelSetByUser;
00639   int ResetInSelect;
00640   
00641   // CubeAxes should be moved into a display of its own.
00642   vtkSMCubeAxesDisplayProxy* CubeAxesDisplayProxy;
00643   vtkSMPointLabelDisplayProxy* PointLabelDisplayProxy;
00644 
00645 //BTX
00646   friend class vtkPVWindow;
00647 //ETX 
00648 
00649   vtkPVLookmark *Lookmark;
00650 
00651   int ColorByScalars(
00652     vtkPVDataSetAttributesInformation* attrInfo,
00653     vtkPVDataSetAttributesInformation* inAttrInfo,
00654     int field);
00655 
00656 private:
00657   vtkPVSource(const vtkPVSource&); // Not implemented
00658   void operator=(const vtkPVSource&); // Not implemented
00659 };
00660 
00661 #endif

Generated on Tue May 30 12:31:40 2006 for ParaView by doxygen 1.3.5