OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / include / vtk / vtkProgrammableAttributeDataFilter.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkProgrammableAttributeDataFilter.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:35:49 $
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 vtkProgrammableAttributeDataFilter - manipulate attribute (cell and point) data via a user-specified function
42 // .SECTION Description
43 // vtkProgrammableAttributeDataFilter is a filter that allows you to write a
44 // custom procedure to manipulate attribute data - either point or cell
45 // data. For example, you could generate scalars based on a complex formula;
46 // convert vectors to normals; compute scalar values as a function of
47 // vectors, texture coords, and/or any other point data attribute; and so
48 // on. The filter takes multiple inputs (input plus an auxiliary input list),
49 // so you can write procedures that combine several datset point
50 // attributes. Note that the output of the filter is the same type
51 // (topology/geometry) as the input.
52 //
53 // The filter works as follows. It operates like any other filter (i.e.,
54 // checking and managing modified and execution times, processing Update()
55 // and Execute() methods, managing release of data, etc.), but the difference
56 // is that the Execute() method simply invokes a user-specified function with
57 // an optional (void *) argument (typically the "this" pointer in C++). It is
58 // also possible to specify a function to delete the argument via
59 // ExecuteMethodArgDelete().
60 //
61 // To use the filter, you write a procedure to process the input datasets,
62 // process the data, and generate output data. Typically, this means grabbing
63 // the input point or cell data (using GetInput() and maybe GetInputList()),
64 // operating on it (creating new point and cell attributes such as scalars,
65 // vectors, etc.), and then setting the point and/or cell attributes in the
66 // output dataset (you'll need to use GetOutput() to access the output).
67 // (Note: besides C++, it is possible to do the same thing in Tcl, Java, or
68 // other languages that wrap the C++ core.) Remember, proper filter protocol
69 // requires that you don't modify the input data - you create new output data
70 // from the input.
71 //
72 // .SECTION Caveats
73 // This filter operates on any combination of the filter input plus a list of
74 // additional inputs (at a minimum you must set the filter input via
75 // SetInput()).  It is up to you check whether the input is valid, and to
76 // insure that the output is valid. Also, you have to write the control
77 // structure for the traversal and operation on the point and cell attribute
78 // data.
79 //
80 // By default the output point and cell data will be copied through from the input
81 // point data (using reference counting).  You can control this using the
82 // output's CopyAllOff() flag, or by using individual flags for each point
83 // data field (i.e., scalars, vectors, etc.)
84 //
85 // The output of this filter is the abstract type vtkDataSet, even if your input 
86 // is a concrete type like vtkPolyData. Thus you may need to use vtkCastToConcrete
87 // to obtain the output as a particular concrete type, or one of the special
88 // methods of the superclass (e.g., vtkDataSetToDataSetFilter::GetPolyDataOutput)
89 // to retrieve output of the correct type.
90 //
91 // The filter correctly manages modified time and network execution in most
92 // cases. However, if you change the definition of the filter function,
93 // you'll want to send a manual Modified() method to the filter to force it
94 // to reexecute.
95
96 #ifndef __vtkProgrammableAttributeDataFilter_h
97 #define __vtkProgrammableAttributeDataFilter_h
98
99 #include "vtkDataSetToDataSetFilter.h"
100 #include "vtkDataSetCollection.h"
101
102 class VTK_EXPORT vtkProgrammableAttributeDataFilter : public vtkDataSetToDataSetFilter 
103 {
104 public:
105   vtkProgrammableAttributeDataFilter();
106   ~vtkProgrammableAttributeDataFilter();
107   static vtkProgrammableAttributeDataFilter *New() {return new vtkProgrammableAttributeDataFilter;};
108   const char *GetClassName() {return "vtkProgrammableAttributeDataFilter";};
109   void PrintSelf(ostream& os, vtkIndent indent);
110
111   void AddInput(vtkDataSet *in);
112   void AddInput(vtkDataSet& in) {this->AddInput(&in);};
113   void RemoveInput(vtkDataSet *in);
114   void RemoveInput(vtkDataSet& in) {this->RemoveInput(&in);};
115   vtkDataSetCollection *GetInputList() {return &(this->InputList);};
116
117   void SetExecuteMethod(void (*f)(void *), void *arg);
118   void SetExecuteMethodArgDelete(void (*f)(void *));
119
120   // filter interface - is different because of multiple input
121   void Update();
122
123 protected:
124   void Execute();
125   vtkDataSetCollection InputList; //list of datasets to process
126   void (*ExecuteMethod)(void *); //function to invoke
127   void (*ExecuteMethodArgDelete)(void *);
128   void *ExecuteMethodArg;
129
130 };
131
132 #endif
133
134