OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkContourFilter.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkContourFilter.h,v $
5   Language:  C++
6   Date:      $Date: 2003/01/09 19:21:05 $
7   Version:   $Revision: 1.69 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkContourFilter - generate isosurfaces/isolines from scalar values
19 // .SECTION Description
20 // vtkContourFilter is a filter that takes as input any dataset and 
21 // generates on output isosurfaces and/or isolines. The exact form 
22 // of the output depends upon the dimensionality of the input data. 
23 // Data consisting of 3D cells will generate isosurfaces, data 
24 // consisting of 2D cells will generate isolines, and data with 1D 
25 // or 0D cells will generate isopoints. Combinations of output type 
26 // are possible if the input dimension is mixed.
27 //
28 // To use this filter you must specify one or more contour values.
29 // You can either use the method SetValue() to specify each contour
30 // value, or use GenerateValues() to generate a series of evenly
31 // spaced contours. It is also possible to accelerate the operation of
32 // this filter (at the cost of extra memory) by using a
33 // vtkScalarTree. A scalar tree is used to quickly locate cells that
34 // contain a contour surface. This is especially effective if multiple
35 // contours are being extracted. If you want to use a scalar tree,
36 // invoke the method UseScalarTreeOn().
37 //<P>
38 // If the input data is structured, consider using a filter that is
39 // optimized for structured data. These can be found in the patented
40 // classes of vtk.
41
42 // .SECTION Caveats
43 // For unstructured data or structured grids, normals and gradients
44 // are not computed. Use vtkPolyDataNormals to compute the surface
45 // normals.
46
47 // .SECTION See Also
48 // vtkMarchingContourFilter vtkKitwareContourFilter
49 // vtkMarchingCubes vtkSliceCubes vtkDividingCubes vtkMarchingSquares
50 // vtkImageMarchingCubes
51
52 #ifndef __vtkContourFilter_h
53 #define __vtkContourFilter_h
54
55 #include "vtkDataSetToPolyDataFilter.h"
56
57 #include "vtkContourValues.h" // Needed for inline methods
58
59 class vtkPointLocator;
60 class vtkScalarTree;
61
62 class VTK_GRAPHICS_EXPORT vtkContourFilter : public vtkDataSetToPolyDataFilter
63 {
64 public:
65   vtkTypeRevisionMacro(vtkContourFilter,vtkDataSetToPolyDataFilter);
66   void PrintSelf(ostream& os, vtkIndent indent);
67
68   // Description:
69   // Construct object with initial range (0,1) and single contour value
70   // of 0.0.
71   static vtkContourFilter *New();
72
73   // Description:
74   // Methods to set / get contour values.
75   void SetValue(int i, float value);
76   float GetValue(int i);
77   float *GetValues();
78   void GetValues(float *contourValues);
79   void SetNumberOfContours(int number);
80   int GetNumberOfContours();
81   void GenerateValues(int numContours, float range[2]);
82   void GenerateValues(int numContours, float rangeStart, float rangeEnd);
83
84   // Description:
85   // Modified GetMTime Because we delegate to vtkContourValues
86   unsigned long GetMTime();
87
88   // Description:
89   // Set/Get the computation of normals. Normal computation is fairly
90   // expensive in both time and storage. If the output data will be
91   // processed by filters that modify topology or geometry, it may be
92   // wise to turn Normals and Gradients off.
93   vtkSetMacro(ComputeNormals,int);
94   vtkGetMacro(ComputeNormals,int);
95   vtkBooleanMacro(ComputeNormals,int);
96
97   // Description:
98   // Set/Get the computation of gradients. Gradient computation is
99   // fairly expensive in both time and storage. Note that if
100   // ComputeNormals is on, gradients will have to be calculated, but
101   // will not be stored in the output dataset.  If the output data
102   // will be processed by filters that modify topology or geometry, it
103   // may be wise to turn Normals and Gradients off.
104   vtkSetMacro(ComputeGradients,int);
105   vtkGetMacro(ComputeGradients,int);
106   vtkBooleanMacro(ComputeGradients,int);
107
108   // Description:
109   // Set/Get the computation of scalars.
110   vtkSetMacro(ComputeScalars,int);
111   vtkGetMacro(ComputeScalars,int);
112   vtkBooleanMacro(ComputeScalars,int);
113
114   // Description:
115   // Enable the use of a scalar tree to accelerate contour extraction.
116   vtkSetMacro(UseScalarTree,int);
117   vtkGetMacro(UseScalarTree,int);
118   vtkBooleanMacro(UseScalarTree,int);
119
120   // Description:
121   // Enable the use of a scalar tree to accelerate contour extraction.
122   virtual void SetScalarTree(vtkScalarTree*);
123   vtkGetObjectMacro(ScalarTree,vtkScalarTree);
124
125   // Description:
126   // Set / get a spatial locator for merging points. By default, 
127   // an instance of vtkMergePoints is used.
128   void SetLocator(vtkPointLocator *locator);
129   vtkGetObjectMacro(Locator,vtkPointLocator);
130
131   // Description:
132   // Create default locator. Used to create one when none is
133   // specified. The locator is used to merge coincident points.
134   void CreateDefaultLocator();
135
136 protected:
137   vtkContourFilter();
138   ~vtkContourFilter();
139
140   void Execute();
141
142   vtkContourValues *ContourValues;
143   int ComputeNormals;
144   int ComputeGradients;
145   int ComputeScalars;
146   vtkPointLocator *Locator;
147   int UseScalarTree;
148   vtkScalarTree *ScalarTree;
149   
150   char *InputScalarsSelection;
151   vtkSetStringMacro(InputScalarsSelection);
152
153 //BTX
154
155   // This is temporary solution. The sub-classes must be able
156   // to call SelectInputScalars() on other instances.
157   friend class vtkKitwareContourFilter;
158
159   // Description:
160   // If you want to contour by an arbitrary array, then set its name here.
161   // By default this in NULL and the filter will use the active scalar array.
162   vtkGetStringMacro(InputScalarsSelection);
163   virtual void SelectInputScalars(const char *fieldName) 
164     {this->SetInputScalarsSelection(fieldName);}
165
166 //ETX
167
168 private:
169   vtkContourFilter(const vtkContourFilter&);  // Not implemented.
170   void operator=(const vtkContourFilter&);  // Not implemented.
171 };
172
173 // Description:
174 // Set a particular contour value at contour number i. The index i ranges 
175 // between 0<=i<NumberOfContours.
176 inline void vtkContourFilter::SetValue(int i, float value)
177 {this->ContourValues->SetValue(i,value);}
178
179 // Description:
180 // Get the ith contour value.
181 inline float vtkContourFilter::GetValue(int i)
182 {return this->ContourValues->GetValue(i);}
183
184 // Description:
185 // Get a pointer to an array of contour values. There will be
186 // GetNumberOfContours() values in the list.
187 inline float *vtkContourFilter::GetValues()
188 {return this->ContourValues->GetValues();}
189
190 // Description:
191 // Fill a supplied list with contour values. There will be
192 // GetNumberOfContours() values in the list. Make sure you allocate
193 // enough memory to hold the list.
194 inline void vtkContourFilter::GetValues(float *contourValues)
195 {this->ContourValues->GetValues(contourValues);}
196
197 // Description:
198 // Set the number of contours to place into the list. You only really
199 // need to use this method to reduce list size. The method SetValue()
200 // will automatically increase list size as needed.
201 inline void vtkContourFilter::SetNumberOfContours(int number)
202 {this->ContourValues->SetNumberOfContours(number);}
203
204 // Description:
205 // Get the number of contours in the list of contour values.
206 inline int vtkContourFilter::GetNumberOfContours()
207 {return this->ContourValues->GetNumberOfContours();}
208
209 // Description:
210 // Generate numContours equally spaced contour values between specified
211 // range. Contour values will include min/max range values.
212 inline void vtkContourFilter::GenerateValues(int numContours, float range[2])
213 {this->ContourValues->GenerateValues(numContours, range);}
214
215 // Description:
216 // Generate numContours equally spaced contour values between specified
217 // range. Contour values will include min/max range values.
218 inline void vtkContourFilter::GenerateValues(int numContours, float
219                                              rangeStart, float rangeEnd)
220 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
221
222
223 #endif
224
225