OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / include / vtk / vtkCutter.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkCutter.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:35:47 $
7   Version:   $Revision: 1.1.1.1 $
8
9
10 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
11
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
17
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
27
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
38
39
40 =========================================================================*/
41 // .NAME vtkCutter - Cut vtkDataSet with user-specified implicit function
42 // .SECTION Description
43 // vtkCutter is a filter to cut through data using any subclass of 
44 // vtkImplicitFunction. That is, a polygonal surface is created
45 // corresponding to the implicit function F(x,y,z) = value(s), where
46 // you can specify one or more values used to cut with.
47 // .SECTION See Also
48 // vtkImplicitFunction vtkClipPolyData
49
50 #ifndef __vtkCutter_h
51 #define __vtkCutter_h
52
53 #include "vtkDataSetToPolyDataFilter.h"
54 #include "vtkContourValues.h"
55
56 #define VTK_SORT_BY_VALUE 0
57 #define VTK_SORT_BY_CELL 1
58
59 class vtkImplicitFunction;
60
61 class VTK_EXPORT vtkCutter : public vtkDataSetToPolyDataFilter
62 {
63 public:
64   vtkCutter(vtkImplicitFunction *cf=NULL);
65   ~vtkCutter();
66   static vtkCutter *New() {return new vtkCutter;};
67   const char *GetClassName() {return "vtkCutter";};
68   void PrintSelf(ostream& os, vtkIndent indent);
69
70   // Methods to set contour values
71   void SetValue(int i, float value);
72   float GetValue(int i);
73   float *GetValues();
74   void GetValues(float *contourValues);
75   void SetNumberOfContours(int number);
76   int GetNumberOfContours();
77   void GenerateValues(int numContours, float range[2]);
78   void GenerateValues(int numContours, float rangeStart, float rangeEnd);
79
80   // Because we delegate to vtkContourValues & refer to vtkImplicitFunction
81   unsigned long int GetMTime();
82
83   // Description
84   // Specify the implicit function to perform the cutting.
85   vtkSetObjectMacro(CutFunction,vtkImplicitFunction);
86   vtkGetObjectMacro(CutFunction,vtkImplicitFunction);
87
88   // Description:
89   // If this flag is enabled, then the output scalar values will be interpolated
90   // from the implicit function values, and not the input scalar data.
91   vtkSetMacro(GenerateCutScalars,int);
92   vtkGetMacro(GenerateCutScalars,int);
93   vtkBooleanMacro(GenerateCutScalars,int);
94
95   void SetLocator(vtkPointLocator *locator);
96   void SetLocator(vtkPointLocator& locator) {this->SetLocator(&locator);};
97   vtkGetObjectMacro(Locator,vtkPointLocator);
98
99   // Description:
100   // Set the sorting order for the generated polydata. There are two
101   // possibilities:
102   //   Sort by value = 0 - This is the most efficient sort. For each cell,
103   //      all contour values are processed. This is the default.
104   //   Sort by cell = 1 - For each contour value, all cells are processed.
105   //      This order should be used if the extracted polygons must be rendered
106   //      in a back-to-front or front-to-back order. This is very problem 
107   //      dependent.
108   // For most applications, the default order is fine (and faster).
109   vtkSetClampMacro(SortBy,int,VTK_SORT_BY_VALUE,VTK_SORT_BY_CELL);
110   vtkGetMacro(SortBy,int);
111   void SetSortByToSortByValue() {this->SetSortBy(VTK_SORT_BY_VALUE);};
112   void SetSortByToSortByCell() {this->SetSortBy(VTK_SORT_BY_CELL);};
113   char *GetSortByAsString();
114
115   // Description:
116   // Create default locator. Used to create one when none is specified. The 
117   // locator is used to merge coincident points.
118   void CreateDefaultLocator();
119
120 protected:
121   void Execute();
122   vtkImplicitFunction *CutFunction;
123   
124   vtkPointLocator *Locator;
125   int SelfCreatedLocator;
126   int SortBy;
127   vtkContourValues *ContourValues;
128   int GenerateCutScalars;
129 };
130
131 // Description:
132 // Return the sorting procedure as a descriptive character string.
133 inline char *vtkCutter::GetSortByAsString(void)
134 {
135   if ( this->SortBy == VTK_SORT_BY_VALUE ) 
136     {
137     return "SortByValue";
138     }
139   else 
140     {
141     return "SortByCell";
142     }
143 }
144
145 // Description:
146 // Set a particular contour value at contour number i. The index i ranges 
147 // between 0<=i<NumberOfContours.
148 inline void vtkCutter::SetValue(int i, float value)
149 {this->ContourValues->SetValue(i,value);}
150
151 // Description:
152 // Get the ith contour value.
153 inline float vtkCutter::GetValue(int i)
154 {return this->ContourValues->GetValue(i);}
155
156 // Description:
157 // Get a pointer to an array of contour values. There will be
158 // GetNumberOfContours() values in the list.
159 inline float *vtkCutter::GetValues()
160 {return this->ContourValues->GetValues();}
161
162 // Description:
163 // Fill a supplied list with contour values. There will be
164 // GetNumberOfContours() values in the list. Make sure you allocate
165 // enough memory to hold the list.
166 inline void vtkCutter::GetValues(float *contourValues)
167 {this->ContourValues->GetValues(contourValues);}
168
169 // Description:
170 // Set the number of contours to place into the list. You only really
171 // need to use this method to reduce list size. The method SetValue()
172 // will automatically increase list size as needed.
173 inline void vtkCutter::SetNumberOfContours(int number)
174 {this->ContourValues->SetNumberOfContours(number);}
175
176 // Description:
177 // Get the number of contours in the list of contour values.
178 inline int vtkCutter::GetNumberOfContours()
179 {return this->ContourValues->GetNumberOfContours();}
180
181 // Description:
182 // Generate numContours equally spaced contour values between specified
183 // range. Contour values will include min/max range values.
184 inline void vtkCutter::GenerateValues(int numContours, float range[2])
185 {this->ContourValues->GenerateValues(numContours, range);}
186
187 // Description:
188 // Generate numContours equally spaced contour values between specified
189 // range. Contour values will include min/max range values.
190 inline void vtkCutter::GenerateValues(int numContours, float
191                                              rangeStart, float rangeEnd)
192 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
193
194 #endif
195
196