#ifndef _vtkDataManager_h_ #define _vtkDataManager_h_ #include #include #include #include class vtkMetaDataSet; class vtkMetaDataSetSequence; /** \class vtkDataManager vtkDataManager.h "vtkDataManager.h" \brief usefull class to handle several datasets, and dataset sequences \author Nicolas Toussaint This class is a powerfull vtk tool to manage datasets. \see vtkMetaImageData vtkMetaSurfaceMesh vtkMetaVolumeMesh vtkMetaDataSetSequence vtkMetaDataSet */ class VTK_EXPORT vtkDataManager: public vtkObject { public: static vtkDataManager* New(); vtkTypeRevisionMacro(vtkDataManager,vtkObject); virtual void PrintSelf(ostream& os, vtkIndent indent); /** Primary method to get a metadataset of the manager from its index. returns NULL object if out of range. */ vtkMetaDataSet* GetMetaDataSet (unsigned int i) const; /** Secondary method to get a metadataset of the manager from the metadataset's name. returns NULL object if the name is not referenced in datamanager. */ vtkMetaDataSet* GetMetaDataSet (const char* name) const; /** Primary method to add a metadataset to the manager. The metadataset is added at the end of the list. */ void AddMetaDataSet ( vtkMetaDataSet* metadataset); /** Only method to remove a metadataset from the datamanager. This method simply unreferences the object by calling a delete. */ void RemoveMetaDataSet ( vtkMetaDataSet* metadataset); /** Only method to get a sequence of the manager from its index. returns NULL pointer if out of range. */ virtual vtkMetaDataSet* ReadFile (const char* filename, const char* name = NULL); /** Call this method to scan an entire directory. This will add every dataset that is readable in the manager. */ void ScanDirectory (const char* dirname); /** Call this method to scan an entire directory where files belong to a sequence. This will add every dataset that is readable in a sequence, set it to the given duration and add the sequence to the manager. */ vtkMetaDataSetSequence* ScanDirectoryForSequence (const char* dirname, double duration = 2.0); /** returns true if the given metadataset is referenced in the manager. if yes, returns the its index in the list. */ bool IsInManager (vtkMetaDataSet* metadataset, unsigned int &id) const; /** returns true if the given name is used in the manager. if yes, returns the its index in the list. */ bool IsNameInManager (const char* name, unsigned int &id) const; /** returns the number of metadatasets referenced in the manager */ unsigned int GetNumberOfMetaDataSet (void) const; /** returns the number of metadatasets referenced in the manager for a specific type. This type can be : VTK_META_IMAGE_DATA, VTK_META_SURFACE_MESH or VTK_META_VOLUME_MESH. */ unsigned int GetNumberOfTypedMetaDataSet (unsigned int type) const; /** Method to update the current time of all sequences referenced in the manager. NB : can be accessed directly from the vtkMetaDataSetSequence. */ void UpdateSequencesToTime (double); /** Get the minimum time flag from all sequences referenced in the manager. */ double GetSequencesRangeMin(); /** Get the maximum time flag from all sequences referenced in the manager. */ double GetSequencesRangeMax(); /** Get the maximum number of metadatasets from all sequences referenced in the manager. */ unsigned int GetSequencesMaxNumber(); //BTX /** access to the list of metadatasets referenced in the manager. Use this method carefully. */ std::vector GetMetaDataSetList (void) const { return MetaDataSetList; } /** access to the list of metadatasets of a specific type referenced in the manager. Use this method carefully. The type can be : VTK_META_IMAGE_DATA, VTK_META_SURFACE_MESH or VTK_META_VOLUME_MESH. */ std::vector GetTypedMetaDataSetList (unsigned int type) const; //ETX /** returns a string of characters corresponding to the default name to be used when adding a metadataset. Use this method to avoid two metadatasets with the same name. */ const char* CreateDefaultName (unsigned int type, const char* filename = NULL); //BTX /** enum for the events that can appear in one of the referenced metadatasets in the manager. */ enum EventIds { MetaDataSetPickEvent=(vtkCommand::UserEvent+1), MetaDataChangedPickEvent }; //ETX protected: vtkDataManager(); ~vtkDataManager(); private: vtkDataManager(const vtkDataManager&); // Not implemented. void operator=(const vtkDataManager&); // Not implemented. //BTX std::vector MetaDataSetList; //ETX }; #endif