]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/RendererWidget.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / QT / RendererWidget.h
diff --git a/lib/cpExtensions/QT/RendererWidget.h b/lib/cpExtensions/QT/RendererWidget.h
new file mode 100644 (file)
index 0000000..2a5b145
--- /dev/null
@@ -0,0 +1,138 @@
+#ifndef __cpExtensions__QT__RendererWidget__h__
+#define __cpExtensions__QT__RendererWidget__h__
+
+#include <cpExtensions/Config.h>
+#include <cpExtensions/QT/ActorsWidgetInterface.h>
+#include <vtkSmartPointer.h>
+#include <map>
+#include <set>
+#include <string>
+
+// -------------------------------------------------------------------------
+class vtkCamera;
+class vtkInteractorStyle;
+class vtkOrientationMarkerWidget;
+class vtkProp;
+class vtkPropCollection;
+
+// -------------------------------------------------------------------------
+namespace cpExtensions
+{
+  namespace Visualization
+  {
+    class LUTImageActor;
+    class WindowLevelImageActor;
+  }
+
+  namespace QT
+  {
+    /**
+     */
+    class cpExtensions_EXPORT RendererWidget
+      : public cpExtensions_QVTKWidget,
+        public ActorsWidgetInterface
+    {
+      Q_OBJECT;
+    public:
+      typedef RendererWidget          Self;
+      typedef cpExtensions_QVTKWidget Superclass;
+      typedef ActorsWidgetInterface   Superclass2;
+
+      typedef std::set< vtkSmartPointer< vtkProp > > TProps;
+      typedef std::map< std::string, TProps >        TPropCollection;
+
+      typedef cpExtensions::Visualization::LUTImageActor         TLUTActor;
+      typedef cpExtensions::Visualization::WindowLevelImageActor TWLActor;
+
+    public:
+      explicit RendererWidget(
+        QWidget* parent = NULL, Qt::WindowFlags f = 0
+        );
+      virtual ~RendererWidget( );
+
+      int GetQuadrant( ) const;
+      void SetQuadrant( int q );
+
+      vtkRenderer* GetRenderer( );
+      const vtkRenderer* GetRenderer( ) const;
+
+      vtkInteractorStyle* GetStyle( );
+      const vtkInteractorStyle* GetStyle( ) const;
+      void SetStyle( vtkInteractorStyle* style );
+
+      vtkCamera* GetActiveCamera( );
+      const vtkCamera* GetActiveCamera( ) const;
+
+      void AddViewProp( vtkProp* prop, const std::string& name = "" );
+      void AddViewProps(
+        vtkPropCollection* props, const std::string& name = ""
+        );
+      void AddAuxViewProp( vtkProp* prop, const std::string& name = "" );
+      void AddAuxViewProps(
+        vtkPropCollection* props, const std::string& name = ""
+        );
+
+      TProps& GetViewProps( const std::string& name );
+      const TProps& GetViewProps( const std::string& name ) const;
+      TProps& GetAuxViewProps( const std::string& name );
+      const TProps& GetAuxViewProps( const std::string& name ) const;
+
+      void RemoveViewProps( const std::string& name );
+      void RemoveViewProps( );
+
+      virtual void HideViewProps( const std::string& name );
+      virtual void ShowViewProps( const std::string& name );
+
+      virtual void ResetCamera( );
+      virtual void Render( );
+
+      virtual std::set< vtkRenderWindowInteractor* > GetInteractors( ) const cpExtensions_OVERRIDE;
+      virtual std::set< std::string > GetActorsNames( ) const cpExtensions_OVERRIDE;
+      virtual bool IsWindowLevelImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual bool IsLUTImageActor( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual bool Is3DActor( const std::string& name ) const cpExtensions_OVERRIDE;
+
+      virtual void GetScalarRange( const std::string& name, double r[ 2 ] ) const cpExtensions_OVERRIDE;
+      virtual void GetWindowLevel( const std::string& name, double wl[ 2 ] ) const cpExtensions_OVERRIDE;
+      virtual double GetWindow( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual double GetLevel( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual char GetImageInterpolation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+      virtual void GetColor( const std::string& name, double& r, double& g, double& b ) const cpExtensions_OVERRIDE;
+      virtual double GetOpacity( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual double GetPointSize( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual double GetLineWidth( const std::string& name ) const cpExtensions_OVERRIDE;
+      virtual int GetRepresentation( const std::string& name ) const cpExtensions_OVERRIDE;
+
+      virtual void SetScalarRange( const std::string& name, double r[ 2 ] ) cpExtensions_OVERRIDE;
+      virtual void SetScalarRange( const std::string& name, double min, double max ) cpExtensions_OVERRIDE;
+      virtual void SetWindowLevel( const std::string& name, double wl[ 2 ] ) cpExtensions_OVERRIDE;
+      virtual void SetWindowLevel( const std::string& name, double w, double l ) cpExtensions_OVERRIDE;
+      virtual void SetWindow( const std::string& name, double w ) cpExtensions_OVERRIDE;
+      virtual void SetLevel( const std::string& name, double l ) cpExtensions_OVERRIDE;
+      virtual void SetImageInterpolation( const std::string& name, char i ) cpExtensions_OVERRIDE;
+
+      virtual void SetColor( const std::string& name, double r, double g, double b ) cpExtensions_OVERRIDE;
+      virtual void SetOpacity( const std::string& name, double o ) cpExtensions_OVERRIDE;
+      virtual void SetPointSize( const std::string& name, double s ) cpExtensions_OVERRIDE;
+      virtual void SetLineWidth( const std::string& name, double w ) cpExtensions_OVERRIDE;
+      virtual void SetRepresentationToPoints( const std::string& name ) cpExtensions_OVERRIDE;
+      virtual void SetRepresentationToSurface( const std::string& name ) cpExtensions_OVERRIDE;
+      virtual void SetRepresentationToWireframe( const std::string& name ) cpExtensions_OVERRIDE;
+
+    protected:
+      vtkSmartPointer< vtkRenderer >                m_Renderer;
+      vtkSmartPointer< vtkOrientationMarkerWidget > m_Marker;
+      int m_Quadrant;
+
+      TPropCollection m_ViewProps;
+      TPropCollection m_AuxViewProps;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __cpExtensions__QT__RendererWidget__h__
+
+// eof - $RCSfile$