VTK
dox/Views/Infovis/vtkParallelCoordinatesRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkParallelCoordinatesRepresentation.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 /*-------------------------------------------------------------------------
00016   Copyright 2009 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00052 #ifndef __vtkParallelCoordinatesRepresentation_h
00053 #define __vtkParallelCoordinatesRepresentation_h
00054 
00055 #include "vtkViewsInfovisModule.h" // For export macro
00056 #include "vtkRenderedRepresentation.h"
00057 
00058 class vtkActor;
00059 class vtkActor2D;
00060 class vtkArrayData;
00061 class vtkAxisActor2D;
00062 class vtkBivariateLinearTableThreshold;
00063 class vtkCollection;
00064 class vtkCoordinate;
00065 class vtkExtractSelectedPolyDataIds;
00066 class vtkFieldData;
00067 class vtkDataArray;
00068 class vtkDataObject;
00069 class vtkDoubleArray;
00070 class vtkIdList;
00071 class vtkIdTypeArray;
00072 class vtkIntArray;
00073 class vtkLookupTable;
00074 class vtkOutlineCornerSource;
00075 class vtkPoints;
00076 class vtkPolyData;
00077 class vtkPolyDataMapper2D;
00078 class vtkPropCollection;
00079 class vtkSelection;
00080 class vtkSelectionNode;
00081 class vtkTextMapper;
00082 class vtkTimeStamp;
00083 class vtkUnsignedIntArray;
00084 class vtkViewport;
00085 class vtkWindow;
00086 
00087 class VTKVIEWSINFOVIS_EXPORT vtkParallelCoordinatesRepresentation : public vtkRenderedRepresentation
00088 {
00089 public:
00090   static vtkParallelCoordinatesRepresentation* New();
00091   vtkTypeMacro(vtkParallelCoordinatesRepresentation, vtkRenderedRepresentation);
00092   void PrintSelf(ostream& os, vtkIndent indent);
00093 
00097   virtual void ApplyViewTheme(vtkViewTheme* theme);
00098 
00100   virtual const char* GetHoverText(vtkView* view, int x, int y);
00101 
00103 
00104   int SetPositionAndSize(double* position, double* size);
00105   int GetPositionAndSize(double* position, double* size);
00107 
00109 
00110   void SetAxisTitles(vtkStringArray*);
00111   void SetAxisTitles(vtkAlgorithmOutput*);
00113 
00115   void SetPlotTitle(const char*);
00116 
00118 
00119   vtkGetMacro(NumberOfAxes,int);
00121 
00123 
00124   vtkGetMacro(NumberOfSamples,int);
00126 
00128 
00129   void SetNumberOfAxisLabels(int num);
00130   vtkGetMacro(NumberOfAxisLabels,int);
00132 
00134 
00136   virtual int SwapAxisPositions(int position1, int position2);
00137   int SetXCoordinateOfPosition(int position, double xcoord);
00138   double GetXCoordinateOfPosition(int axis);
00139   void GetXCoordinatesOfPositions(double* coords);
00140   int GetPositionNearXCoordinate(double xcoord);
00142 
00144 
00145   vtkSetMacro(UseCurves,int);
00146   vtkGetMacro(UseCurves,int);
00147   vtkBooleanMacro(UseCurves,int);
00149 
00151 
00152   vtkSetMacro(CurveResolution,int);
00153   vtkGetMacro(CurveResolution,int);
00155 
00157 
00158   vtkGetMacro(LineOpacity,double)
00159   vtkGetMacro(FontSize,double);
00160   vtkGetVector3Macro(LineColor,double);
00161   vtkGetVector3Macro(AxisColor,double);
00162   vtkGetVector3Macro(AxisLabelColor,double);
00163   vtkSetMacro(LineOpacity,double);
00164   vtkSetMacro(FontSize,double);
00165   vtkSetVector3Macro(LineColor,double);
00166   vtkSetVector3Macro(AxisColor,double);
00167   vtkSetVector3Macro(AxisLabelColor,double);
00169 
00171 
00173   vtkSetMacro(AngleBrushThreshold,double);
00174   vtkGetMacro(AngleBrushThreshold,double);
00176 
00178 
00180   vtkSetMacro(FunctionBrushThreshold,double);
00181   vtkGetMacro(FunctionBrushThreshold,double);
00183 
00185 
00186   int GetRangeAtPosition(int position, double range[2]);
00187   virtual int SetRangeAtPosition(int position, double range[2]);
00189 
00191   void ResetAxes();
00192 
00194 
00196   virtual void LassoSelect(int brushClass, int brushOperator, vtkPoints* brushPoints);
00197   virtual void AngleSelect(int brushClass, int brushOperator, double *p1, double *p2);
00198   virtual void FunctionSelect(int brushClass, int brushOperator, double *p1, double *p2, double *q1, double *q2);
00199   virtual void RangeSelect(int brushClass, int brushOperator, double *p1, double *p2);
00201 
00202 //BTX
00203   enum InputPorts
00204   {
00205     INPUT_DATA=0,
00206     INPUT_TITLES,
00207     NUM_INPUT_PORTS
00208   };
00209 //ETX
00210 
00211 protected:
00212   vtkParallelCoordinatesRepresentation();
00213   virtual ~vtkParallelCoordinatesRepresentation();
00214 
00215   virtual int FillInputPortInformation(int port, vtkInformation* info);
00216 
00217   virtual int RequestData(
00218     vtkInformation*,
00219     vtkInformationVector**,
00220     vtkInformationVector*);
00221 
00223 
00224   virtual bool AddToView(vtkView* view);
00225   virtual bool RemoveFromView(vtkView* view);
00226   virtual void PrepareForRendering(vtkRenderView* view);
00228 
00231   void UpdateHoverHighlight(vtkView* view, int x, int y);
00232 
00234 
00235   virtual int AllocatePolyData(vtkPolyData* polyData,
00236                                int numLines,
00237                                int numPointsPerLine,
00238                                int numStrips,
00239                                int numPointsPerStrip,
00240                                int numQuads,
00241                                int numPoints,
00242                                int numCellScalars,
00243                                int numPointScalars);
00245 
00247   int PlaceAxes();
00248 
00250 
00253   virtual int PlaceLines(vtkPolyData* polyData, vtkTable* data, vtkIdTypeArray* idsToPlot);
00254   virtual int PlaceCurves(vtkPolyData* polyData, vtkTable* data, vtkIdTypeArray* idsToPlot);
00256 
00260   virtual int PlaceSelection(vtkPolyData* polyData, vtkTable* data, vtkSelectionNode* selectionNode);
00261 
00263   virtual int ComputeDataProperties();
00264 
00266   virtual int UpdatePlotProperties(vtkStringArray* inputTitles);
00267 
00269   virtual int ReallocateInternals();
00270 
00272 
00274   int ComputePointPosition(double* p);
00275   int ComputeLinePosition(double* p1, double* p2);
00277 
00279 
00281   virtual void SelectRows(vtkIdType brushClass, vtkIdType brushOperator, vtkIdTypeArray* rowIds);
00282   virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
00283   virtual void BuildInverseSelection();
00284   virtual vtkPolyDataMapper2D* InitializePlotMapper(vtkPolyData* input, vtkActor2D* actor, bool forceStandard=false);
00286 
00290   void BuildDefaultSCurve(vtkDoubleArray* array, int numValues);
00291 
00294   virtual void LassoSelectInternal(vtkPoints* brushPoints, vtkIdTypeArray* outIds);
00295 
00297   virtual void UpdateSelectionActors();
00298 
00299   vtkPolyDataMapper2D* GetSelectionMapper(int idx);
00300   int GetNumberOfSelections();
00301 
00302 
00303   //BTX
00304   vtkSmartPointer<vtkPolyData>         PlotData;
00305   vtkSmartPointer<vtkPolyDataMapper2D> PlotMapper;
00306   vtkSmartPointer<vtkActor2D>          PlotActor;
00307   vtkSmartPointer<vtkTextMapper> PlotTitleMapper;
00308   vtkSmartPointer<vtkActor2D> PlotTitleActor;
00309   vtkSmartPointer<vtkTextMapper> FunctionTextMapper;
00310   vtkSmartPointer<vtkActor2D> FunctionTextActor;
00311 
00312   vtkSmartPointer<vtkSelection> InverseSelection;
00313   vtkSmartPointer<vtkBivariateLinearTableThreshold> LinearThreshold;
00314 
00315   class Internals;
00316   Internals* I;
00317   //ETX
00318 
00319   int NumberOfAxes;
00320   int NumberOfAxisLabels;
00321   int NumberOfSamples;
00322   double YMin;
00323   double YMax;
00324 
00325   int CurveResolution;
00326   int UseCurves;
00327   double AngleBrushThreshold;
00328   double FunctionBrushThreshold;
00329   double SwapThreshold;
00330 
00331   // Indexed by screen position
00332   double* Xs;
00333   double* Mins;
00334   double* Maxs;
00335   double* MinOffsets;
00336   double* MaxOffsets;
00337 
00338   //BTX
00339   vtkSmartPointer<vtkAxisActor2D>* Axes;
00340   vtkSmartPointer<vtkTable> InputArrayTable;
00341   vtkSmartPointer<vtkStringArray> AxisTitles;
00342   //ETX
00343 
00344   vtkTimeStamp BuildTime;
00345 
00346   double LineOpacity;
00347   double FontSize;
00348   double LineColor[3];
00349   double AxisColor[3];
00350   double AxisLabelColor[3];
00351 
00352   vtkGetStringMacro(InternalHoverText);
00353   vtkSetStringMacro(InternalHoverText);
00354   char* InternalHoverText;
00355 
00356 private:
00357   vtkParallelCoordinatesRepresentation(const vtkParallelCoordinatesRepresentation&); // Not implemented
00358   void operator=(const vtkParallelCoordinatesRepresentation&);   // Not implemented
00359 };
00360 
00361 #endif
00362