VTK
dox/Views/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 "vtkRenderedRepresentation.h"
00053 
00054 class vtkActor;
00055 class vtkActor2D;
00056 class vtkArrayData;
00057 class vtkAxisActor2D;
00058 class vtkBivariateLinearTableThreshold;
00059 class vtkCollection;
00060 class vtkCoordinate;
00061 class vtkExtractSelectedPolyDataIds;
00062 class vtkFieldData;
00063 class vtkDataArray;
00064 class vtkDataObject;
00065 class vtkDoubleArray;
00066 class vtkIdList;
00067 class vtkIdTypeArray;
00068 class vtkIntArray;
00069 class vtkLookupTable;
00070 class vtkOutlineCornerSource;
00071 class vtkPoints;
00072 class vtkPolyData;
00073 class vtkPolyDataMapper2D;
00074 class vtkPropCollection;
00075 class vtkSelection;
00076 class vtkSelectionNode;
00077 class vtkTextMapper;
00078 class vtkTimeStamp;
00079 class vtkUnsignedIntArray;
00080 class vtkViewport;
00081 class vtkWindow;
00082 
00083 class VTK_VIEWS_EXPORT vtkParallelCoordinatesRepresentation : public vtkRenderedRepresentation
00084 {
00085 public:
00086   static vtkParallelCoordinatesRepresentation* New();
00087   vtkTypeMacro(vtkParallelCoordinatesRepresentation, vtkRenderedRepresentation);
00088   void PrintSelf(ostream& os, vtkIndent indent);
00089 
00093   virtual void ApplyViewTheme(vtkViewTheme* theme);
00094 
00096   virtual const char* GetHoverText(vtkView* view, int x, int y);
00097 
00099 
00100   int SetPositionAndSize(double* position, double* size);
00101   int GetPositionAndSize(double* position, double* size);
00103 
00105 
00106   void SetAxisTitles(vtkStringArray*);
00107   void SetAxisTitles(vtkAlgorithmOutput*);
00109 
00111   void SetPlotTitle(const char*);
00112 
00114 
00115   vtkGetMacro(NumberOfAxes,int);
00117 
00119 
00120   vtkGetMacro(NumberOfSamples,int);
00122 
00124 
00125   void SetNumberOfAxisLabels(int num);
00126   vtkGetMacro(NumberOfAxisLabels,int);
00128 
00130 
00132   virtual int SwapAxisPositions(int position1, int position2);
00133   int SetXCoordinateOfPosition(int position, double xcoord);
00134   double GetXCoordinateOfPosition(int axis);
00135   void GetXCoordinatesOfPositions(double* coords);
00136   int GetPositionNearXCoordinate(double xcoord);
00138 
00140 
00141   vtkSetMacro(UseCurves,int);
00142   vtkGetMacro(UseCurves,int);
00143   vtkBooleanMacro(UseCurves,int);
00145 
00147 
00148   vtkSetMacro(CurveResolution,int);
00149   vtkGetMacro(CurveResolution,int);
00151 
00153 
00154   vtkGetMacro(LineOpacity,double)
00155   vtkGetMacro(FontSize,double);
00156   vtkGetVector3Macro(LineColor,double);
00157   vtkGetVector3Macro(AxisColor,double);
00158   vtkGetVector3Macro(AxisLabelColor,double);
00159   vtkSetMacro(LineOpacity,double);
00160   vtkSetMacro(FontSize,double);
00161   vtkSetVector3Macro(LineColor,double);
00162   vtkSetVector3Macro(AxisColor,double);
00163   vtkSetVector3Macro(AxisLabelColor,double);
00165 
00167 
00169   vtkSetMacro(AngleBrushThreshold,double);
00170   vtkGetMacro(AngleBrushThreshold,double);
00172 
00174 
00176   vtkSetMacro(FunctionBrushThreshold,double);
00177   vtkGetMacro(FunctionBrushThreshold,double);
00179 
00181 
00182   int GetRangeAtPosition(int position, double range[2]);
00183   virtual int SetRangeAtPosition(int position, double range[2]);
00185 
00187   void ResetAxes();
00188 
00190 
00192   virtual void LassoSelect(int brushClass, int brushOperator, vtkPoints* brushPoints);
00193   virtual void AngleSelect(int brushClass, int brushOperator, double *p1, double *p2);
00194   virtual void FunctionSelect(int brushClass, int brushOperator, double *p1, double *p2, double *q1, double *q2);
00195   virtual void RangeSelect(int brushClass, int brushOperator, double *p1, double *p2);
00197 
00198 //BTX
00199   enum InputPorts
00200   {
00201     INPUT_DATA=0,
00202     INPUT_TITLES,
00203     NUM_INPUT_PORTS
00204   };
00205 //ETX
00206 
00207 protected:
00208   vtkParallelCoordinatesRepresentation();
00209   virtual ~vtkParallelCoordinatesRepresentation();
00210 
00211   virtual int FillInputPortInformation(int port, vtkInformation* info);
00212 
00213   virtual int RequestData(
00214     vtkInformation*,
00215     vtkInformationVector**,
00216     vtkInformationVector*);
00217 
00219 
00220   virtual bool AddToView(vtkView* view);
00221   virtual bool RemoveFromView(vtkView* view);
00222   virtual void PrepareForRendering(vtkRenderView* view);
00224 
00227   void UpdateHoverHighlight(vtkView* view, int x, int y);
00228 
00230 
00231   virtual int AllocatePolyData(vtkPolyData* polyData, 
00232                                int numLines, 
00233                                int numPointsPerLine, 
00234                                int numStrips, 
00235                                int numPointsPerStrip, 
00236                                int numQuads, 
00237                                int numPoints,
00238                                int numCellScalars,
00239                                int numPointScalars);
00241 
00243   int PlaceAxes();
00244 
00246 
00249   virtual int PlaceLines(vtkPolyData* polyData, vtkTable* data, vtkIdTypeArray* idsToPlot);
00250   virtual int PlaceCurves(vtkPolyData* polyData, vtkTable* data, vtkIdTypeArray* idsToPlot);
00252 
00256   virtual int PlaceSelection(vtkPolyData* polyData, vtkTable* data, vtkSelectionNode* selectionNode);
00257   
00259   virtual int ComputeDataProperties();
00260 
00262   virtual int UpdatePlotProperties(vtkStringArray* inputTitles);
00263 
00265   virtual int ReallocateInternals();
00266 
00268 
00270   int ComputePointPosition(double* p);
00271   int ComputeLinePosition(double* p1, double* p2);
00273 
00275 
00277   virtual void SelectRows(vtkIdType brushClass, vtkIdType brushOperator, vtkIdTypeArray* rowIds);
00278   virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
00279   virtual void BuildInverseSelection();
00280   virtual vtkPolyDataMapper2D* InitializePlotMapper(vtkPolyData* input, vtkActor2D* actor, bool forceStandard=false);
00282 
00286   void BuildDefaultSCurve(vtkDoubleArray* array, int numValues);
00287 
00290   virtual void LassoSelectInternal(vtkPoints* brushPoints, vtkIdTypeArray* outIds);
00291 
00293   virtual void UpdateSelectionActors();
00294 
00295   vtkPolyDataMapper2D* GetSelectionMapper(int idx);
00296   int GetNumberOfSelections();
00297 
00298 
00299   //BTX
00300   vtkSmartPointer<vtkPolyData>         PlotData;
00301   vtkSmartPointer<vtkPolyDataMapper2D> PlotMapper;
00302   vtkSmartPointer<vtkActor2D>          PlotActor;
00303   vtkSmartPointer<vtkTextMapper> PlotTitleMapper;
00304   vtkSmartPointer<vtkActor2D> PlotTitleActor;
00305   vtkSmartPointer<vtkTextMapper> FunctionTextMapper;
00306   vtkSmartPointer<vtkActor2D> FunctionTextActor;
00307 
00308   vtkSmartPointer<vtkSelection> InverseSelection;
00309   vtkSmartPointer<vtkBivariateLinearTableThreshold> LinearThreshold;
00310 
00311   class Internals;
00312   Internals* I;
00313   //ETX
00314 
00315   int NumberOfAxes;
00316   int NumberOfAxisLabels;
00317   int NumberOfSamples;
00318   double YMin;
00319   double YMax;
00320 
00321   int CurveResolution;
00322   int UseCurves;
00323   double AngleBrushThreshold;
00324   double FunctionBrushThreshold;
00325   double SwapThreshold;
00326 
00327   // Indexed by screen position
00328   double* Xs;
00329   double* Mins;
00330   double* Maxs;
00331   double* MinOffsets;
00332   double* MaxOffsets;
00333 
00334   //BTX
00335   vtkSmartPointer<vtkAxisActor2D>* Axes;
00336   vtkSmartPointer<vtkTable> InputArrayTable;
00337   vtkSmartPointer<vtkStringArray> AxisTitles;
00338   //ETX
00339 
00340   vtkTimeStamp BuildTime;
00341 
00342   double LineOpacity;
00343   double FontSize;
00344   double LineColor[3];
00345   double AxisColor[3];
00346   double AxisLabelColor[3];
00347 
00348   vtkGetStringMacro(InternalHoverText);
00349   vtkSetStringMacro(InternalHoverText);
00350   char* InternalHoverText;
00351   
00352 private:
00353   vtkParallelCoordinatesRepresentation(const vtkParallelCoordinatesRepresentation&); // Not implemented
00354   void operator=(const vtkParallelCoordinatesRepresentation&);   // Not implemented
00355 };
00356 
00357 #endif
00358