VTK
dox/Charts/Core/vtkCompositeControlPointsItem.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCompositeControlPointsItem.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 =========================================================================*/
00015 
00032 #ifndef __vtkCompositeControlPointsItem_h
00033 #define __vtkCompositeControlPointsItem_h
00034 
00035 #include "vtkChartsCoreModule.h" // For export macro
00036 #include "vtkColorTransferControlPointsItem.h"
00037 
00038 class vtkPiecewiseFunction;
00039 class vtkPiecewisePointHandleItem;
00040 
00041 class VTKCHARTSCORE_EXPORT vtkCompositeControlPointsItem:
00042   public vtkColorTransferControlPointsItem
00043 {
00044 public:
00045   vtkTypeMacro(vtkCompositeControlPointsItem, vtkColorTransferControlPointsItem);
00046   virtual void PrintSelf(ostream &os, vtkIndent indent);
00047 
00049   static vtkCompositeControlPointsItem* New();
00050 
00052   virtual void SetColorTransferFunction(vtkColorTransferFunction* function);
00053 
00055 
00056   void SetOpacityFunction(vtkPiecewiseFunction* opacity);
00057   vtkGetObjectMacro(OpacityFunction, vtkPiecewiseFunction);
00059 
00060   enum PointsFunctionType{
00061     ColorPointsFunction = 1,
00062     OpacityPointsFunction = 2,
00063     ColorAndOpacityPointsFunction = 3
00064   };
00066 
00074   vtkSetMacro(PointsFunction, int);
00075   vtkGetMacro(PointsFunction, int);
00077 
00081   virtual vtkIdType AddPoint(double* newPos);
00082 
00086   virtual vtkIdType RemovePoint(double* pos);
00087 
00089 
00093   vtkSetMacro(UseOpacityPointHandles, bool);
00094   vtkGetMacro(UseOpacityPointHandles, bool);
00096 
00098 
00099   virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00100   virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse);
00101   virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00103 
00104 protected:
00105   vtkCompositeControlPointsItem();
00106   virtual ~vtkCompositeControlPointsItem();
00107 
00108   virtual void emitEvent(unsigned long event, void* params);
00109 
00110   virtual unsigned long int GetControlPointsMTime();
00111 
00112   virtual vtkIdType GetNumberOfPoints()const;
00113   virtual void DrawPoint(vtkContext2D* painter, vtkIdType index);
00114   virtual void GetControlPoint(vtkIdType index, double* pos)const;
00115   virtual void SetControlPoint(vtkIdType index, double *point);
00116   virtual void EditPoint(float tX, float tY);
00117   virtual void EditPointCurve(vtkIdType idx);
00118 
00119   void MergeTransferFunctions();
00120   void SilentMergeTransferFunctions();
00121 
00122   int                   PointsFunction;
00123   vtkPiecewiseFunction* OpacityFunction;
00124   vtkPiecewisePointHandleItem* OpacityPointHandle;
00125   bool UseOpacityPointHandles;
00126 
00127 private:
00128   vtkCompositeControlPointsItem(const vtkCompositeControlPointsItem &); // Not implemented.
00129   void operator=(const vtkCompositeControlPointsItem &);   // Not implemented.
00130 };
00131 
00132 #endif