#ifndef _vtkMetaDataSetSequence_h_ #define _vtkMetaDataSetSequence_h_ #include #include #include /** \class vtkMetaDataSetSequence vtkMetaDataSetSequence.h "vtkMetaDataSetSequence.h" \brief usefull class to handle a sequence (serie) of vtkMetaDataSet \author Nicolas Toussaint This class is a powerfull vtk Addon class that helps handling a serie of vtkDataSets. vtkMetaDataSet has a flag of time, that allows this class to handle a sequence of different vtkMetaDataSet (of the same type), the output dataset (got from GetDataSet()) can be updated to a specific time with UpdateToTime(). It does not compute any time interpolation. \see vtkMetaImageData vtkMetaSurfaceMesh vtkMetaVolumeMesh vtkMetaDataSet vtkDataManager */ class VTK_EXPORT vtkMetaDataSetSequence: public vtkMetaDataSet { public: static vtkMetaDataSetSequence* New(); vtkTypeRevisionMacro(vtkMetaDataSetSequence,vtkMetaDataSet); virtual void PrintSelf(ostream& os, vtkIndent indent); /** Read and Write the Sequence into a directory */ void Read (const char* dirname); void Write (const char* dirname); virtual void ReadPointData (unsigned int iter, const char* filename, const char* name = NULL); /** Insert a vtkMetaDataSet at the end of the sequence list As soon as the metadataset time flag is set, the list will be reordered with respect to the progress of time. The first vtkMetaDataSet added will determine the type of the sequence. adding new heterogeneous vtkMetaDataSet will fail. */ virtual void AddMetaDataSet (vtkMetaDataSet* metadataset); /** Remove a given vtkMetaDataSet from the sequence. This will unregister the given vtkMetaDataSet from the sequence. */ virtual void RemoveMetaDataSet (vtkMetaDataSet* metadataset); /** Clear the sequence, empty the list of vtkMetaDataSet. */ virtual void RemoveAllMetaDataSets (); /** Check if a given vtkMetaDataSet belong to this sequence. */ bool HasMetaDataSet (vtkMetaDataSet* metadataset); /** This method has to be called if the user wants to see the attributes of the output vtkDataSet (GetDataSet()) changing respecting the given time. No time interpolation is computed. Updating to an out of range time will set the output to the closest time available. */ void UpdateToTime (double time = 0); /** This method has the same effect as UpdateToTime() exept the argument is the index of the vtkMetaDataSet to use in the list. Out of range index will set the output to the closest index available. */ void UpdateToIndex (unsigned int id = 0); /** Access to one of the vtkMetaDataSet in the sequence list */ virtual vtkMetaDataSet* GetMetaDataSet (unsigned int i); /** Access to the entire list of vtkMetaDataSet. Use with care. */ //BTX std::vector GetMetaDataSetList (void) const { return MetaDataSetList; } //ETX /** Set some variables : SequenceDuration Not very usefull as soon as the duration is computed from the different time flags of the list of vtkMetaDataSet */ vtkSetMacro (SequenceDuration, double); /** Access to some variables : SequenceDuration */ vtkGetMacro (SequenceDuration, double); virtual const char* GetDataSetType (void) const { return "Sequence"; } /** Size of the vtkMetaDataSet list. */ unsigned int GetNumberOfMetaDataSets (void) const { return MetaDataSetList.size(); } /** Access to the minimal time flag of the sequence. */ double GetMinTime (void) const; /** Access to the maximal time flag of the sequence. */ double GetMaxTime (void) const; /** Access to the resolution of the sequence, i.e. the time step used. */ double GetTimeResolution (void); /** Internal use : Compute the time in case of loop. */ virtual double GetRelativeTime (double time); void ComputeSequenceDuration (void); //virtual void ColorByArray(const char* arrayname, vtkScalarsToColors* lut); virtual void ColorByArray(vtkDataArray* array); //void ReadGeometry(const char* filename); void BuildSequenceFromGeometry(const char* filename, unsigned int Niter); bool GetSameGeometryFlag (void) { return this->SameGeometryFlag; } void SetSameGeometryFlag ( bool flag) { this->SameGeometryFlag = flag; } protected: vtkMetaDataSetSequence(); ~vtkMetaDataSetSequence(); /** Internal use : Initialize sequence, not used yet. */ virtual void Initialize (void); /** Internal use : Build the output from a given vtkMetaDataSet. */ virtual void BuildMetaDataSetFromMetaDataSet (vtkMetaDataSet* metadataset); //BTX std::vector MetaDataSetList; //ETX private: vtkMetaDataSetSequence(const vtkMetaDataSetSequence&); // Not implemented. void operator=(const vtkMetaDataSetSequence&); // Not implemented. int CurrentId; double SequenceDuration; bool SameGeometryFlag; }; #endif