00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WDATASET_H 00026 #define WDATASET_H 00027 00028 #include <string> 00029 00030 #include <boost/shared_ptr.hpp> 00031 #include <boost/enable_shared_from_this.hpp> 00032 00033 #include <osg/ref_ptr> 00034 00035 #include "../common/WDefines.h" 00036 #include "../common/WProperties.h" 00037 #include "../common/WTransferable.h" 00038 #include "WDataTexture3D.h" 00039 #include "WExportDataHandler.h" 00040 00041 class WCondition; 00042 class WDataSetVector; 00043 00044 /** 00045 * Base class for all data set types. This class has a number of subclasses 00046 * specifying the different types of data sets. Two of the dataset types 00047 * represent single and time-dependent datasets (compound of several time 00048 * steps) respectively. 00049 * \ingroup dataHandler 00050 */ 00051 class OWDATAHANDLER_EXPORT WDataSet: public WTransferable, public boost::enable_shared_from_this< WDataSet > // NOLINT 00052 { 00053 public: 00054 /** 00055 * This constructor should be used if a dataSet does not stem from a file. 00056 * It presets the its correpsonding fileName as empty string. 00057 */ 00058 WDataSet(); 00059 00060 /** 00061 * Since WDataSet is a base class and thus should be polymorphic we add 00062 * virtual destructor. 00063 */ 00064 virtual ~WDataSet() 00065 { 00066 } 00067 00068 /** 00069 * Set the name of the file that this data set stems from. 00070 * \param fileName the string representing the name 00071 */ 00072 void setFileName( const std::string fileName ); 00073 00074 /** 00075 * Get the name of the file that this data set stems from. 00076 * 00077 * \return the filename. 00078 */ 00079 std::string getFileName() const; 00080 00081 /** 00082 * Determines whether this dataset can be used as a texture. 00083 * 00084 * \return true if usable as texture. 00085 */ 00086 virtual bool isTexture() const; 00087 00088 /** 00089 * Checks if this dataset is a vector dataset. 00090 * 00091 * \return Returns a nonempty shared_ptr to it if it is a vector dataset, otherwise the pointer is empty! 00092 */ 00093 virtual boost::shared_ptr< WDataSetVector > isVectorDataSet(); 00094 00095 /** 00096 * Returns the texture- representation of the dataset. May throw an exception if no texture is available. 00097 * 00098 * \return The texture. 00099 * \deprecated 00100 */ 00101 virtual osg::ref_ptr< WDataTexture3D > getTexture() const; 00102 00103 /** 00104 * Gets the name of this prototype. 00105 * 00106 * \return the name. 00107 */ 00108 virtual const std::string getName() const; 00109 00110 /** 00111 * Gets the description for this prototype. 00112 * 00113 * \return the description 00114 */ 00115 virtual const std::string getDescription() const; 00116 00117 /** 00118 * Returns a prototype instantiated with the true type of the deriving class. 00119 * 00120 * \return the prototype. 00121 */ 00122 static boost::shared_ptr< WPrototyped > getPrototype(); 00123 00124 /** 00125 * Return a pointer to the properties object of the dataset. Add all the modifiable settings here. This allows the user to modify several 00126 * properties of a dataset. 00127 * 00128 * \return the properties. 00129 */ 00130 boost::shared_ptr< WProperties > getProperties() const; 00131 00132 /** 00133 * Return a pointer to the information properties object of the dataset. The dataset intends these properties to not be modified. 00134 * 00135 * \return the properties. 00136 */ 00137 boost::shared_ptr< WProperties > getInformationProperties() const; 00138 00139 protected: 00140 00141 /** 00142 * The prototype as singleton. 00143 */ 00144 static boost::shared_ptr< WPrototyped > m_prototype; 00145 00146 /** 00147 * The property object for the dataset. 00148 */ 00149 boost::shared_ptr< WProperties > m_properties; 00150 00151 /** 00152 * The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". It is useful to define some property 00153 * to only be of informational nature. The GUI does not modify them. As it is a WProperties instance, you can use it the same way as 00154 * m_properties. 00155 */ 00156 boost::shared_ptr< WProperties > m_infoProperties; 00157 00158 private: 00159 /** 00160 * Name of the file this data set was loaded from. This information 00161 * may allow hollowing data sets later. DataSets that were not loaded 00162 * from a file should have the empty string stored here. 00163 */ 00164 std::string m_fileName; 00165 }; 00166 00167 #endif // WDATASET_H 00168