1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkScalarBarRepresentation.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 /**
17  * @class   vtkXYPlotRepresentation
18  * @brief   represent XY plot for vtkXYPlotWidget
19  *
20  *
21  *
22  * This class represents a XY plot for a vtkXYPlotWidget.  This class
23  * provides support for interactively placing a XY plot on the 2D overlay
24  * plane.  The XY plot is defined by an instance of vtkXYPlotActor.
25  *
26  * @sa
27  * vtkXYPlotWidget vtkWidgetRepresentation vtkXYPlotActor
28  *
29  * @par Thanks:
30  * This class was written by Philippe Pebay, Kitware SAS 2012
31  */
32 
33 #ifndef vtkXYPlotRepresentation_h
34 #define vtkXYPlotRepresentation_h
35 
36 #include "vtkBorderRepresentation.h"
37 #include "vtkInteractionWidgetsModule.h" // For export macro
38 
39 class vtkXYPlotActor;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkXYPlotRepresentation : public vtkBorderRepresentation
42 {
43 public:
44   vtkTypeMacro(vtkXYPlotRepresentation, vtkBorderRepresentation);
45   virtual void PrintSelf(ostream& os, vtkIndent indent);
46   static vtkXYPlotRepresentation* New();
47 
48   ///@{
49   /**
50    * The prop that is placed in the renderer.
51    */
52   vtkGetObjectMacro(XYPlotActor, vtkXYPlotActor);
53   virtual void SetXYPlotActor(vtkXYPlotActor*);
54   ///@}
55 
56   ///@{
57   /**
58    * Satisfy the superclass' API.
59    */
60   void BuildRepresentation() override;
61   void WidgetInteraction(double eventPos[2]) override;
GetSize(double size[2])62   void GetSize(double size[2]) override
63   {
64     size[0] = 2.0;
65     size[1] = 2.0;
66   }
67   ///@}
68 
69   ///@{
70   /**
71    * These methods are necessary to make this representation behave as
72    * a vtkProp.
73    */
74   virtual int GetVisibility();
75   virtual void SetVisibility(int);
76   virtual void GetActors2D(vtkPropCollection* collection);
77   virtual void ReleaseGraphicsResources(vtkWindow* window);
78   virtual int RenderOverlay(vtkViewport*);
79   virtual int RenderOpaqueGeometry(vtkViewport*);
80   virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
81   virtual vtkTypeBool HasTranslucentPolygonalGeometry();
82   ///@}
83 
84   ///@{
85   /**
86    * Set glyph properties
87    */
88   void SetGlyphSize(double x);
89   void SetPlotGlyphType(int curve, int glyph);
90   ///@}
91 
92   ///@{
93   /**
94    * Set title properties
95    */
96   void SetTitle(const char* title);
97   void SetTitleColor(double r, double g, double b);
98   void SetTitleFontFamily(int x);
99   void SetTitleBold(int x);
100   void SetTitleItalic(int x);
101   void SetTitleShadow(int x);
102   void SetTitleFontSize(int x);
103   void SetTitleJustification(int x);
104   void SetTitleVerticalJustification(int x);
105   void SetAdjustTitlePosition(int x);
106   void SetTitlePosition(double x, double y);
107   ///@}
108 
109   ///@{
110   /**
111    * Set/Get axis properties
112    */
113   void SetXAxisColor(double r, double g, double b);
114   void SetYAxisColor(double r, double g, double b);
115   void SetXTitle(const char* ytitle);
116   char* GetXTitle();
117   void SetXRange(double min, double max);
118   void SetYTitle(const char* ytitle);
119   char* GetYTitle();
120   void SetYRange(double min, double max);
121   void SetYTitlePosition(int pos);
122   int GetYTitlePosition() const;
123   void SetXValues(int x);
124   ///@}
125 
126   ///@{
127   /**
128    * Set axis title properties
129    */
130   void SetAxisTitleColor(double r, double g, double b);
131   void SetAxisTitleFontFamily(int x);
132   void SetAxisTitleBold(int x);
133   void SetAxisTitleItalic(int x);
134   void SetAxisTitleShadow(int x);
135   void SetAxisTitleFontSize(int x);
136   void SetAxisTitleJustification(int x);
137   void SetAxisTitleVerticalJustification(int x);
138   ///@}
139 
140   ///@{
141   /**
142    * Set axis label properties
143    */
144   void SetAxisLabelColor(double r, double g, double b);
145   void SetAxisLabelFontFamily(int x);
146   void SetAxisLabelBold(int x);
147   void SetAxisLabelItalic(int x);
148   void SetAxisLabelShadow(int x);
149   void SetAxisLabelFontSize(int x);
150   void SetAxisLabelJustification(int x);
151   void SetAxisLabelVerticalJustification(int x);
152   void SetXLabelFormat(const char* _arg);
153   void SetYLabelFormat(const char* _arg);
154   ///@}
155 
156   ///@{
157   /**
158    * Set various properties
159    */
160   void SetBorder(int x);
161   void RemoveAllActiveCurves();
162   void AddUserCurvesPoint(double c, double x, double y);
163   void SetLegend(int x);
164   void SetLegendBorder(int b);
165   void SetLegendBox(int b);
166   void SetLegendBoxColor(double r, double g, double b);
167   void SetLegendPosition(double x, double y);
168   void SetLegendPosition2(double x, double y);
169   void SetLineWidth(double w);
170   void SetPlotColor(int i, int r, int g, int b);
171   void SetPlotLines(int i);
172   void SetPlotPoints(int i);
173   void SetPlotLabel(int i, const char* label);
174   ///@}
175 
176 protected:
177   vtkXYPlotRepresentation();
178   ~vtkXYPlotRepresentation() override;
179 
180   vtkXYPlotActor* XYPlotActor;
181 
182 private:
183   vtkXYPlotRepresentation(const vtkXYPlotRepresentation&) = delete;
184   void operator=(const vtkXYPlotRepresentation&) = delete;
185 };
186 
187 #endif // vtkXYPlotRepresentation_h
188