OpenWalnut 1.3.1
|
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 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 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 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 * 00071 * \param filename the string representing the name 00072 */ 00073 void setFilename( const std::string filename ); 00074 00075 /** 00076 * Get the name of the file that this data set stems from. 00077 * 00078 * \return the filename. 00079 */ 00080 std::string getFilename() const; 00081 00082 /** 00083 * Set the name of the file that this data set stems from. 00084 * 00085 * \param filename the string representing the name 00086 * 00087 * \deprecated use setFilename instead 00088 */ 00089 OW_API_DEPRECATED void setFileName( const std::string filename ); 00090 00091 /** 00092 * Get the name of the file that this data set stems from. 00093 * 00094 * \deprecated use getFilename instead 00095 * \return the filename. 00096 */ 00097 OW_API_DEPRECATED std::string getFileName() const; 00098 00099 /** 00100 * Determines whether this dataset can be used as a texture. 00101 * 00102 * \return true if usable as texture. 00103 */ 00104 virtual bool isTexture() const; 00105 00106 /** 00107 * Checks if this dataset is a vector dataset. 00108 * 00109 * \return Returns a nonempty shared_ptr to it if it is a vector dataset, otherwise the pointer is empty! 00110 */ 00111 virtual boost::shared_ptr< WDataSetVector > isVectorDataSet(); 00112 00113 /** 00114 * Returns the texture- representation of the dataset. May throw an exception if no texture is available. 00115 * 00116 * \return The texture. 00117 * \deprecated 00118 */ 00119 virtual osg::ref_ptr< WDataTexture3D > getTexture() const; 00120 00121 /** 00122 * Gets the name of this prototype. 00123 * 00124 * \return the name. 00125 */ 00126 virtual const std::string getName() const; 00127 00128 /** 00129 * Gets the description for this prototype. 00130 * 00131 * \return the description 00132 */ 00133 virtual const std::string getDescription() const; 00134 00135 /** 00136 * Returns a prototype instantiated with the true type of the deriving class. 00137 * 00138 * \return the prototype. 00139 */ 00140 static boost::shared_ptr< WPrototyped > getPrototype(); 00141 00142 /** 00143 * Return a pointer to the properties object of the dataset. Add all the modifiable settings here. This allows the user to modify several 00144 * properties of a dataset. 00145 * 00146 * \return the properties. 00147 */ 00148 boost::shared_ptr< WProperties > getProperties() const; 00149 00150 /** 00151 * Return a pointer to the information properties object of the dataset. The dataset intends these properties to not be modified. 00152 * 00153 * \return the properties. 00154 */ 00155 boost::shared_ptr< WProperties > getInformationProperties() const; 00156 00157 protected: 00158 /** 00159 * The prototype as singleton. 00160 */ 00161 static boost::shared_ptr< WPrototyped > m_prototype; 00162 00163 /** 00164 * The property object for the dataset. 00165 */ 00166 boost::shared_ptr< WProperties > m_properties; 00167 00168 /** 00169 * The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". It is useful to define some property 00170 * 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 00171 * m_properties. 00172 */ 00173 boost::shared_ptr< WProperties > m_infoProperties; 00174 00175 private: 00176 /** 00177 * Name of the file this data set was loaded from. This information 00178 * may allow hollowing data sets later. DataSets that were not loaded 00179 * from a file should have the empty string stored here. 00180 */ 00181 std::string m_filename; 00182 }; 00183 00184 #endif // WDATASET_H 00185