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 -------------------------------------------------------------------------*/
00049 #ifndef __vtkParallelCoordinatesRepresentation_h
00050 #define __vtkParallelCoordinatesRepresentation_h
00051 
00052 #include "vtkViewsInfovisModule.h" // For export macro
00053 #include "vtkRenderedRepresentation.h"
00054 
00055 class vtkActor;
00056 class vtkActor2D;
00057 class vtkArrayData;
00058 class vtkAxisActor2D;
00059 class vtkBivariateLinearTableThreshold;
00060 class vtkCollection;
00061 class vtkCoordinate;
00062 class vtkExtractSelectedPolyDataIds;
00063 class vtkFieldData;
00064 class vtkDataArray;
00065 class vtkDataObject;
00066 class vtkDoubleArray;
00067 class vtkIdList;
00068 class vtkIdTypeArray;
00069 class vtkIntArray;
00070 class vtkLookupTable;
00071 class vtkOutlineCornerSource;
00072 class vtkPoints;
00073 class vtkPolyData;
00074 class vtkPolyDataMapper2D;
00075 class vtkPropCollection;
00076 class vtkSelection;
00077 class vtkSelectionNode;
00078 class vtkTextMapper;
00079 class vtkTimeStamp;
00080 class vtkUnsignedIntArray;
00081 class vtkViewport;
00082 class vtkWindow;
00083 
00084 class VTKVIEWSINFOVIS_EXPORT vtkParallelCoordinatesRepresentation : public vtkRenderedRepresentation
00085 {
00086 public:
00087   static vtkParallelCoordinatesRepresentation* New();
00088   vtkTypeMacro(vtkParallelCoordinatesRepresentation, vtkRenderedRepresentation);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090 
00094   virtual void ApplyViewTheme(vtkViewTheme* theme);
00095 
00097   virtual const char* GetHoverText(vtkView* view, int x, int y);
00098 
00100 
00101   int SetPositionAndSize(double* position, double* size);
00102   int GetPositionAndSize(double* position, double* size);
00104 
00106 
00107   void SetAxisTitles(vtkStringArray*);
00108   void SetAxisTitles(vtkAlgorithmOutput*);
00110 
00112   void SetPlotTitle(const char*);
00113 
00115 
00116   vtkGetMacro(NumberOfAxes,int);
00118 
00120 
00121   vtkGetMacro(NumberOfSamples,int);
00123 
00125 
00126   void SetNumberOfAxisLabels(int num);
00127   vtkGetMacro(NumberOfAxisLabels,int);
00129 
00131 
00133   virtual int SwapAxisPositions(int position1, int position2);
00134   int SetXCoordinateOfPosition(int position, double xcoord);
00135   double GetXCoordinateOfPosition(int axis);
00136   void GetXCoordinatesOfPositions(double* coords);
00137   int GetPositionNearXCoordinate(double xcoord);
00139 
00141 
00142   vtkSetMacro(UseCurves,int);
00143   vtkGetMacro(UseCurves,int);
00144   vtkBooleanMacro(UseCurves,int);
00146 
00148 
00149   vtkSetMacro(CurveResolution,int);
00150   vtkGetMacro(CurveResolution,int);
00152 
00154 
00155   vtkGetMacro(LineOpacity,double)
00156   vtkGetMacro(FontSize,double);
00157   vtkGetVector3Macro(LineColor,double);
00158   vtkGetVector3Macro(AxisColor,double);
00159   vtkGetVector3Macro(AxisLabelColor,double);
00160   vtkSetMacro(LineOpacity,double);
00161   vtkSetMacro(FontSize,double);
00162   vtkSetVector3Macro(LineColor,double);
00163   vtkSetVector3Macro(AxisColor,double);
00164   vtkSetVector3Macro(AxisLabelColor,double);
00166 
00168 
00170   vtkSetMacro(AngleBrushThreshold,double);
00171   vtkGetMacro(AngleBrushThreshold,double);
00173 
00175 
00177   vtkSetMacro(FunctionBrushThreshold,double);
00178   vtkGetMacro(FunctionBrushThreshold,double);
00180 
00182 
00183   int GetRangeAtPosition(int position, double range[2]);
00184   virtual int SetRangeAtPosition(int position, double range[2]);
00186 
00188   void ResetAxes();
00189 
00191 
00193   virtual void LassoSelect(int brushClass, int brushOperator, vtkPoints* brushPoints);
00194   virtual void AngleSelect(int brushClass, int brushOperator, double *p1, double *p2);
00195   virtual void FunctionSelect(int brushClass, int brushOperator, double *p1, double *p2, double *q1, double *q2);
00196   virtual void RangeSelect(int brushClass, int brushOperator, double *p1, double *p2);
00198 
00199 //BTX
00200   enum InputPorts
00201   {
00202     INPUT_DATA=0,
00203     INPUT_TITLES,
00204     NUM_INPUT_PORTS
00205   };
00206 //ETX
00207 
00208 protected:
00209   vtkParallelCoordinatesRepresentation();
00210   virtual ~vtkParallelCoordinatesRepresentation();
00211 
00212   virtual int FillInputPortInformation(int port, vtkInformation* info);
00213 
00214   virtual int RequestData(
00215     vtkInformation*,
00216     vtkInformationVector**,
00217     vtkInformationVector*);
00218 
00220 
00221   virtual bool AddToView(vtkView* view);
00222   virtual bool RemoveFromView(vtkView* view);
00223   virtual void PrepareForRendering(vtkRenderView* view);
00225 
00228   void UpdateHoverHighlight(vtkView* view, int x, int y);
00229 
00231 
00232   virtual int AllocatePolyData(vtkPolyData* polyData,
00233                                int numLines,
00234                                int numPointsPerLine,
00235                                int numStrips,
00236                                int numPointsPerStrip,
00237                                int numQuads,
00238                                int numPoints,
00239                                int numCellScalars,
00240                                int numPointScalars);
00242 
00244   int PlaceAxes();
00245 
00247 
00250   virtual int PlaceLines(vtkPolyData* polyData, vtkTable* data, vtkIdTypeArray* idsToPlot);
00251   virtual int PlaceCurves(vtkPolyData* polyData, vtkTable* data, vtkIdTypeArray* idsToPlot);
00253 
00257   virtual int PlaceSelection(vtkPolyData* polyData, vtkTable* data, vtkSelectionNode* selectionNode);
00258 
00260   virtual int ComputeDataProperties();
00261 
00263   virtual int UpdatePlotProperties(vtkStringArray* inputTitles);
00264 
00266   virtual int ReallocateInternals();
00267 
00269 
00271   int ComputePointPosition(double* p);
00272   int ComputeLinePosition(double* p1, double* p2);
00274 
00276 
00278   virtual void SelectRows(vtkIdType brushClass, vtkIdType brushOperator, vtkIdTypeArray* rowIds);
00279   virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
00280   virtual void BuildInverseSelection();
00281   virtual vtkPolyDataMapper2D* InitializePlotMapper(vtkPolyData* input, vtkActor2D* actor, bool forceStandard=false);
00283 
00287   void BuildDefaultSCurve(vtkDoubleArray* array, int numValues);
00288 
00291   virtual void LassoSelectInternal(vtkPoints* brushPoints, vtkIdTypeArray* outIds);
00292 
00294   virtual void UpdateSelectionActors();
00295 
00296   vtkPolyDataMapper2D* GetSelectionMapper(int idx);
00297   int GetNumberOfSelections();
00298 
00299 
00300   //BTX
00301   vtkSmartPointer<vtkPolyData>         PlotData;
00302   vtkSmartPointer<vtkPolyDataMapper2D> PlotMapper;
00303   vtkSmartPointer<vtkActor2D>          PlotActor;
00304   vtkSmartPointer<vtkTextMapper> PlotTitleMapper;
00305   vtkSmartPointer<vtkActor2D> PlotTitleActor;
00306   vtkSmartPointer<vtkTextMapper> FunctionTextMapper;
00307   vtkSmartPointer<vtkActor2D> FunctionTextActor;
00308 
00309   vtkSmartPointer<vtkSelection> InverseSelection;
00310   vtkSmartPointer<vtkBivariateLinearTableThreshold> LinearThreshold;
00311 
00312   class Internals;
00313   Internals* I;
00314   //ETX
00315 
00316   int NumberOfAxes;
00317   int NumberOfAxisLabels;
00318   int NumberOfSamples;
00319   double YMin;
00320   double YMax;
00321 
00322   int CurveResolution;
00323   int UseCurves;
00324   double AngleBrushThreshold;
00325   double FunctionBrushThreshold;
00326   double SwapThreshold;
00327 
00328   // Indexed by screen position
00329   double* Xs;
00330   double* Mins;
00331   double* Maxs;
00332   double* MinOffsets;
00333   double* MaxOffsets;
00334 
00335   //BTX
00336   vtkSmartPointer<vtkAxisActor2D>* Axes;
00337   vtkSmartPointer<vtkTable> InputArrayTable;
00338   vtkSmartPointer<vtkStringArray> AxisTitles;
00339   //ETX
00340 
00341   vtkTimeStamp BuildTime;
00342 
00343   double LineOpacity;
00344   double FontSize;
00345   double LineColor[3];
00346   double AxisColor[3];
00347   double AxisLabelColor[3];
00348 
00349   vtkGetStringMacro(InternalHoverText);
00350   vtkSetStringMacro(InternalHoverText);
00351   char* InternalHoverText;
00352 
00353 private:
00354   vtkParallelCoordinatesRepresentation(const vtkParallelCoordinatesRepresentation&); // Not implemented
00355   void operator=(const vtkParallelCoordinatesRepresentation&);   // Not implemented
00356 };
00357 
00358 #endif
00359