1
/*=========================================================================
3
Program: Visualization Toolkit
4
Module: $RCSfile: vtkSource.h,v $
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
14
=========================================================================*/
15
// .NAME vtkSource - abstract class specifies interface for visualization network source
16
// .SECTION Description
17
// vtkSource is an abstract object that specifies behavior and interface
18
// of source objects. Source objects are objects that begin visualization
19
// pipeline. Sources include readers (read data from file or communications
20
// port) and procedural sources (generate data programmatically). vtkSource
21
// objects are also objects that generate output data. In this sense
22
// vtkSource is used as a superclass to vtkFilter.
24
// Concrete subclasses of vtkSource must define Update() and Execute()
25
// methods. The public method Update() invokes network execution and will
26
// bring the network up-to-date. The protected Execute() method actually
27
// does the work of data creation/generation. The difference between the two
28
// methods is that Update() implements input consistency checks and modified
29
// time comparisons and then invokes the Execute() which is an implementation
30
// of a particular algorithm.
32
// An important feature of subclasses of vtkSource is that it is possible
33
// to control the memory-management model (i.e., retain output versus delete
34
// output data). If enabled the ReleaseDataFlag enables the deletion of the
35
// output data once the downstream process object finishes processing the
36
// data (please see text).
39
// vtkProcessObject vtkDataSetReader vtkFilter vtkPolyDataSource
40
// vtkStructuredGridSource vtkStructuredPointsSource vtkUnstructuredGridSource
45
#include "vtkProcessObject.h"
48
class vtkDataObjectToSourceFriendship;
50
class VTK_FILTERING_EXPORT vtkSource : public vtkProcessObject
53
vtkTypeRevisionMacro(vtkSource,vtkProcessObject);
54
void PrintSelf(ostream& os, vtkIndent indent);
57
// Bring object up-to-date before execution. Update() checks modified
58
// time against last execution time, and re-executes object if necessary.
59
virtual void Update();
62
// Like update, but make sure the update extent is the whole extent in
64
virtual void UpdateWholeExtent();
67
// Updates any global information about the data
68
// (like spacing for images)
69
virtual void UpdateInformation();
72
virtual void PropagateUpdateExtent(vtkDataObject *output);
75
virtual void TriggerAsynchronousUpdate();
78
virtual void UpdateData(vtkDataObject *output);
81
// What is the input update extent that is required to produce the
82
// desired output? By default, the whole input is always required but
83
// this is overridden in many subclasses.
84
virtual void ComputeInputUpdateExtents( vtkDataObject *output );
87
// Turn on/off flag to control whether this object's data is released
88
// after being used by a source.
89
virtual void SetReleaseDataFlag(int);
90
virtual int GetReleaseDataFlag();
91
vtkBooleanMacro(ReleaseDataFlag,int);
94
// Return an array with all the inputs of this process object.
95
// This is useful for tracing back in the pipeline to construct
97
vtkDataObject **GetOutputs();
98
vtkGetMacro(NumberOfOutputs,int);
101
// Release/disconnect all outputs of this source. This is intended to be
102
// called prior to Delete() if the user is concerned about outputs holding
103
// on to the filter/source.
104
void UnRegisterAllOutputs(void);
107
// Return what index output the passed in output is, return -1 if it
108
// does not match any of the outputs
109
int GetOutputIndex(vtkDataObject *out);
112
// Set this algorithm's executive. This algorithm is removed from
113
// any executive to which it has previously been assigned and then
114
// assigned to the given executive.
115
virtual void SetExecutive(vtkExecutive* executive);
118
// Transform pipeline requests from executives into old-style
119
// pipeline calls. This works with the
120
// vtkStreamingDemandDrivenPipeline executive to maintain backward
121
// compatibility for filters written as subclasses of vtkSource.
122
virtual int ProcessRequest(vtkInformation*,
123
vtkInformationVector**,
124
vtkInformationVector*);
131
// This method is the one that should be used by subclasses, right now the
132
// default implementation is to call the backwards compatibility method
133
virtual void ExecuteData(vtkDataObject *output);
136
// This method is the old style execute method
137
virtual void Execute();
139
// By default, UpdateInformation calls this method to copy information
140
// unmodified from the input to the output.
141
virtual void ExecuteInformation();
143
// Called after ExecuteData to call DataHasBeenGenerated on the
144
// outputs. It can be overridden by subclasses to call
145
// DataHasBeenGenerated on only a subset of the outputs. The
146
// argument is the pointer to the output data object that was passed
148
virtual void MarkGeneratedOutputs(vtkDataObject*);
150
// Called to allocate the input array. Copies old inputs.
151
void SetNumberOfOutputs(int num);
153
// method used internally for getting an output.
154
vtkDataObject *GetOutput(int idx);
156
// protected methods for setting inputs.
157
virtual void SetNthOutput(int num, vtkDataObject *output);
158
virtual void AddOutput(vtkDataObject *output);
159
virtual void RemoveOutput(vtkDataObject *output);
161
vtkDataObject **Outputs; // An Array of the outputs to the filter
164
// Time when ExecuteInformation was last called.
165
vtkTimeStamp InformationTime;
167
virtual void ReportReferences(vtkGarbageCollector*);
169
// Output port information must match the current outputs.
170
int FillOutputPortInformation(int, vtkInformation*);
172
// Reimplemented from vtkAlgorithm to maintain backward
173
// compatibility for vtkProcessObject.
174
virtual void SetNumberOfOutputPorts(int n);
177
friend class vtkDataObjectToSourceFriendship;
181
vtkSource(const vtkSource&); // Not implemented.
182
void operator=(const vtkSource&); // Not implemented.