1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkFocalPlaneContourRepresentation.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 // .NAME vtkFocalPlaneContourRepresentation - represent a contour drawn on the
16 // focal plane.
17 //
18 // .SECTION Description
19 // The contour will stay on the focal plane irrespective of camera
20 // position/orientation changes. The class was written in order to be able to
21 // draw contours on a volume widget and have the contours overlayed on the
22 // focal plane in order to do contour segmentation. The superclass,
23 // vtkContourRepresentation handles contours that are drawn in actual world
24 // position co-ordinates, so they would rotate with the camera position/
25 // orientation changes
26 //
27 // .SECTION See Also
28 // vtkContourWidget vtkHandleRepresentation vtkContourRepresentation
29 
30 #ifndef vtkFocalPlaneContourRepresentation_h
31 #define vtkFocalPlaneContourRepresentation_h
32 
33 #include "vtkInteractionWidgetsModule.h" // For export macro
34 #include "vtkContourRepresentation.h"
35 
36 class vtkHandleRepresentation;
37 
38 class VTKINTERACTIONWIDGETS_EXPORT vtkFocalPlaneContourRepresentation : public vtkContourRepresentation
39 {
40 public:
41   // Description:
42   // Standard VTK methods.
43   vtkTypeMacro(vtkFocalPlaneContourRepresentation,vtkContourRepresentation);
44   void PrintSelf(ostream& os, vtkIndent indent);
45 
46   // Description:
47   // Get the world position of the intermediate point at
48   // index idx between nodes n and (n+1) (or n and 0 if
49   // n is the last node and the loop is closed). Returns
50   // 1 on success or 0 if n or idx are out of range.
51   virtual int GetIntermediatePointWorldPosition( int n,
52                                                  int idx, double point[3] );
53 
54   // Description:
55   // Get the world position of the intermediate point at
56   // index idx between nodes n and (n+1) (or n and 0 if
57   // n is the last node and the loop is closed). Returns
58   // 1 on success or 0 if n or idx are out of range.
59   virtual int GetIntermediatePointDisplayPosition( int n,
60                                                  int idx, double point[3] );
61 
62   // Description:
63   // Get the nth node's display position. Will return
64   // 1 on success, or 0 if there are not at least
65   // (n+1) nodes (0 based counting).
66   virtual int GetNthNodeDisplayPosition( int n, double pos[2] );
67 
68   // Description:
69   // Get the nth node's world position. Will return
70   // 1 on success, or 0 if there are not at least
71   // (n+1) nodes (0 based counting).
72   virtual int GetNthNodeWorldPosition( int n, double pos[3] );
73 
74   // Description:
75   // The class maintains its true contour locations based on display co-ords
76   // This method syncs the world co-ords data structure with the display co-ords.
77   virtual void UpdateContourWorldPositionsBasedOnDisplayPositions();
78 
79   // Description:
80   // The method must be called whenever the contour needs to be updated, usually
81   // from RenderOpaqueGeometry()
82   virtual int UpdateContour();
83 
84   virtual void UpdateLines( int index );
85 
86 protected:
87   vtkFocalPlaneContourRepresentation();
88   ~vtkFocalPlaneContourRepresentation();
89 
90 private:
91   vtkFocalPlaneContourRepresentation(const vtkFocalPlaneContourRepresentation&);  //Not implemented
92   void operator=(const vtkFocalPlaneContourRepresentation&);  //Not implemented
93 };
94 
95 #endif
96 
97