/usr/include/vtk-6.1/vtkChart.h is in libvtk6-dev 6.1.0+dfsg2-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkChart.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkChart - Factory class for drawing 2D charts
//
// .SECTION Description
// This defines the interface for a chart.
#ifndef __vtkChart_h
#define __vtkChart_h
#include "vtkChartsCoreModule.h" // For export macro
#include "vtkContextItem.h"
#include "vtkRect.h" // For vtkRectf
#include "vtkStdString.h" // For vtkStdString ivars
#include "vtkSmartPointer.h" // For SP ivars
class vtkTransform2D;
class vtkContextScene;
class vtkPlot;
class vtkAxis;
class vtkBrush;
class vtkTextProperty;
class vtkChartLegend;
class vtkInteractorStyle;
class vtkAnnotationLink;
class VTKCHARTSCORE_EXPORT vtkChart : public vtkContextItem
{
public:
vtkTypeMacro(vtkChart, vtkContextItem);
virtual void PrintSelf(ostream &os, vtkIndent indent);
//BTX
// Description:
// Enum of the available chart types
enum {
LINE,
POINTS,
BAR,
STACKED,
BAG,
FUNCTIONALBAG};
// Description:
// Enum of valid chart action types.
//
// PAN - moves the axis range
// ZOOM - zooms to a selected rectangle
// ZOOM_AXIS - zooms the x and y axis range
// SELECT_RECTANGLE - selects points within a rectangle
// SELECT_POLYGON - selects points within a polygon
// SELECT - alias for SELECT_RECTANGLE
// NOTIFY - Post vtkCommand::InteractionEvent on selection of a point
enum {
PAN = 0,
ZOOM,
ZOOM_AXIS,
SELECT,
SELECT_RECTANGLE = SELECT,
SELECT_POLYGON,
NOTIFY
};
// Description:
// Enum of event type that are triggered by the charts
enum EventIds {
UpdateRange = 1002
};
//ETX
// Description:
// Paint event for the chart, called whenever the chart needs to be drawn
virtual bool Paint(vtkContext2D *painter) = 0;
// Description:
// Add a plot to the chart, defaults to using the name of the y column
virtual vtkPlot* AddPlot(int type);
// Description:
// Add a plot to the chart. Return the index of the plot, -1 if it failed.
virtual vtkIdType AddPlot(vtkPlot* plot);
// Description:
// Remove the plot at the specified index, returns true if successful,
// false if the index was invalid.
virtual bool RemovePlot(vtkIdType index);
// Description:
// Remove the given plot. Returns true if successful, false if the plot
// was not contained in this chart. Note, the base implementation of
// this method performs a linear search to locate the plot.
virtual bool RemovePlotInstance(vtkPlot* plot);
// Description:
// Remove all plots from the chart.
virtual void ClearPlots();
// Description:
// Get the plot at the specified index, returns null if the index is invalid.
virtual vtkPlot* GetPlot(vtkIdType index);
// Description:
// Get the number of plots the chart contains.
virtual vtkIdType GetNumberOfPlots();
// Description:
// Get the axis specified by axisIndex. 0 is x, 1 is y. This should probably
// be improved either using a string or enum to select the axis.
virtual vtkAxis* GetAxis(int axisIndex);
// Description:
// Get the number of axes in the current chart.
virtual vtkIdType GetNumberOfAxes();
// Description:
// Request that the chart recalculates the range of its axes. Especially
// useful in applications after the parameters of plots have been modified.
virtual void RecalculateBounds();
// Description:
// Enumeration of the possible selection methods in a chart. SELECTION_ROWS
// is the default and simply selects the row in a table in all plots showing
// that table. SELECTION_PLOTS will make a selection in each plot, and that
// selection remains specific to the plot object.
enum {
SELECTION_ROWS,
SELECTION_PLOTS
};
// Description:
// Set the selection method, which controls how selections are handled by the
// chart. The default is SELECTION_ROWS which selects all points in all plots
// in a chart that have values in the rows selected. SELECTION_PLOTS allows
// for finer-grained selections specific to each plot, and so to each XY
// column pair.
virtual void SetSelectionMethod(int method);
virtual int GetSelectionMethod();
// Description:
// Set the vtkAnnotationLink for the chart.
virtual void SetAnnotationLink(vtkAnnotationLink *link);
// Description:
// Get the vtkAnnotationLink for the chart.
vtkGetObjectMacro(AnnotationLink, vtkAnnotationLink);
// Description:
// Set/get the width and the height of the chart.
vtkSetVector2Macro(Geometry, int);
vtkGetVector2Macro(Geometry, int);
// Description:
// Set/get the first point in the chart (the bottom left).
vtkSetVector2Macro(Point1, int);
vtkGetVector2Macro(Point1, int);
// Description:
// Set/get the second point in the chart (the top right).
vtkSetVector2Macro(Point2, int);
vtkGetVector2Macro(Point2, int);
// Description:
// Set/get whether the chart should draw a legend.
virtual void SetShowLegend(bool visible);
virtual bool GetShowLegend();
// Description:
// Get the legend for the chart, if available. Can return NULL if there is no
// legend.
virtual vtkChartLegend * GetLegend();
// Description:
// Get/set the title text of the chart.
virtual void SetTitle(const vtkStdString &title);
virtual vtkStdString GetTitle();
// Description:
// Get the vtkTextProperty that governs how the chart title is displayed.
vtkGetObjectMacro(TitleProperties, vtkTextProperty);
// Description:
// Set/get the borders of the chart (space in pixels around the chart).
void SetBottomBorder(int border);
void SetTopBorder(int border);
void SetLeftBorder(int border);
void SetRightBorder(int border);
// Description:
// Set/get the borders of the chart (space in pixels around the chart).
void SetBorders(int left, int bottom, int right, int top);
// Description:
// Set the size of the chart. The rect argument specifies the bottom corner,
// width and height of the chart. The borders will be laid out within the
// specified rectangle.
void SetSize(const vtkRectf &rect);
// Description:
// Get the current size of the chart.
vtkRectf GetSize();
// Description:
// Enum of the available layout strategies for the charts.
enum {
FILL_SCENE, // Attempt to fill the entire scene.
FILL_RECT, // Attempt to supply the supplied vtkRectf in Size.
AXES_TO_RECT // Put the corners of the axes on the vtkRectf in Size.
};
// Description:
// Set/get the layout strategy that should be used by the chart. As we don't
// support enums this can take any value in the integer range, but the only
// valid enums are FILL_SCENE, FILL_RECT and AXES_TO_RECT.
vtkSetMacro(LayoutStrategy, int);
vtkGetMacro(LayoutStrategy, int);
// Description:
// Set/get whether the chart should automatically resize to fill the current
// render window. Default is true.
virtual void SetAutoSize(bool isAutoSized)
{
this->LayoutStrategy = isAutoSized ? vtkChart::FILL_SCENE :
vtkChart::FILL_RECT;
}
virtual bool GetAutoSize()
{
return this->LayoutStrategy == vtkChart::FILL_SCENE ? true : false;
}
// Description:
// Set/get whether the chart should still render its axes and decorations
// even if the chart has no visible plots. Default is false (do not render
// an empty plot).
//
// Note that if you wish to render axes for an empty plot you should also
// set AutoSize to false, as that will hide all axes for an empty plot.
vtkSetMacro(RenderEmpty, bool);
vtkGetMacro(RenderEmpty, bool);
// Description:
// Assign action types to mouse buttons. Available action types are PAN, ZOOM
// and SELECT in the chart enum, the default assigns the LEFT_BUTTON to
// PAN, MIDDLE_BUTTON to ZOOM and RIGHT_BUTTON to SELECT. Valid mouse enums
// are in the vtkContextMouseEvent class.
//
// Note that only one mouse button can be assigned to each action, an action
// will have -1 (invalid button) assigned if it had the same button as the one
// assigned to a different action.
virtual void SetActionToButton(int action, int button);
// Description:
// Get the mouse button associated with the supplied action. The mouse button
// enum is from vtkContextMouseEvent, and the action enum is from vtkChart.
virtual int GetActionToButton(int action);
// Description:
// Assign action types to single mouse clicks. Available action types are
// SELECT and NOTIFY in the chart enum. The default assigns the LEFT_BUTTON
// to NOTIFY, and the RIGHT_BUTTON to SELECT.
virtual void SetClickActionToButton(int action, int button);
// Description:
// Get the mouse button associated with the supplied click action. The mouse
// button enum is from vtkContextMouseEvent, and the action enum is from
// vtkChart.
virtual int GetClickActionToButton(int action);
// Description:
// Set/Get the brush to use for the background color.
void SetBackgroundBrush(vtkBrush *brush);
vtkBrush* GetBackgroundBrush();
// Description:
// Set/get the Selection Mode that will be used by the chart while doing
// selection. The only valid enums are vtkContextScene::SELECTION_NONE,
// SELECTION_DEFAULT, SELECTION_ADDITION, SELECTION_SUBTRACTION, SELECTION_TOGGLE
virtual void SetSelectionMode(int);
vtkGetMacro(SelectionMode, int);
protected:
vtkChart();
~vtkChart();
// Description:
// Given the x and y vtkAxis, and a transform, calculate the transform that
// the points in a chart would need to be drawn within the axes. This assumes
// that the axes have the correct start and end positions, and that they are
// perpendicular.
bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y,
vtkTransform2D *transform);
// Description:
// Calculate the unshifted, and unscaled plot transform for the x and y axis.
bool CalculateUnscaledPlotTransform(vtkAxis *x, vtkAxis *y,
vtkTransform2D *transform);
// Description:
// Attach axis range listener so we can forward those events at the chart level
void AttachAxisRangeListener(vtkAxis*);
void AxisRangeForwarderCallback(vtkObject*,unsigned long, void*);
// Description:
// Our annotation link, used for sharing selections etc.
vtkAnnotationLink *AnnotationLink;
// Description:
// The width and the height of the chart.
int Geometry[2];
// Description:
// The position of the lower left corner of the chart.
int Point1[2];
// Description:
// The position of the upper right corner of the chart.
int Point2[2];
// Description:
// Display the legend?
bool ShowLegend;
// Description:
// The title of the chart
vtkStdString Title;
// Description:
// The text properties associated with the chart
vtkTextProperty* TitleProperties;
vtkRectf Size;
// The layout strategy to employ when fitting the chart into the space.
int LayoutStrategy;
bool RenderEmpty;
// Description:
// Brush to use for drawing the background.
vtkSmartPointer<vtkBrush> BackgroundBrush;
// The mode when the chart is doing selection.
int SelectionMode;
// How plot selections are handled, SELECTION_ROWS (default) or
// SELECTION_PLOTS - based on the plot that created the selection.
int SelectionMethod;
// Description:
// Hold mouse action mappings.
class MouseActions
{
public:
MouseActions();
enum { MaxAction = 5 };
short& Pan() { return Data[0]; }
short& Zoom() { return Data[1]; }
short& ZoomAxis() { return Data[2]; }
short& Select() { return Data[3]; }
short& SelectPolygon() { return Data[4]; }
short& operator[](int index) { return Data[index]; }
short Data[MaxAction];
};
class MouseClickActions
{
public:
MouseClickActions();
short& Notify() { return Data[0]; }
short& Select() { return Data[1]; }
short& operator[](int index) { return Data[index]; }
short Data[2];
};
MouseActions Actions;
MouseClickActions ActionsClick;
private:
vtkChart(const vtkChart &); // Not implemented.
void operator=(const vtkChart &); // Not implemented.
};
#endif //__vtkChart_h
|