OpenWalnut
1.4.0
|
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 #include <string> 00026 00027 #include "../common/WAssert.h" 00028 #include "../common/WCondition.h" 00029 #include "../common/WTransferable.h" 00030 #include "exceptions/WDHException.h" 00031 #include "WDataSet.h" 00032 #include "WDataSetVector.h" 00033 #include "WDataTexture3D.h" 00034 00035 // prototype instance as singleton 00036 boost::shared_ptr< WPrototyped > WDataSet::m_prototype = boost::shared_ptr< WPrototyped >(); 00037 00038 WDataSet::WDataSet() 00039 : WTransferable(), 00040 m_properties( boost::shared_ptr< WProperties >( new WProperties( "Data-Set Properties", "Properties of a data-set" ) ) ), 00041 m_infoProperties( boost::shared_ptr< WProperties >( new WProperties( "Data-Set Info Properties", "Data-set's information properties" ) ) ), 00042 m_filename( "" ) 00043 { 00044 m_infoProperties->setPurpose( PV_PURPOSE_INFORMATION ); 00045 } 00046 00047 void WDataSet::setFileName( const std::string filename ) 00048 { 00049 setFilename( filename ); 00050 } 00051 00052 std::string WDataSet::getFileName() const 00053 { 00054 return getFilename(); 00055 } 00056 00057 void WDataSet::setFilename( const std::string filename ) 00058 { 00059 WAssert( filename != "", "No filename set for data set." ); 00060 m_filename = filename; 00061 } 00062 00063 std::string WDataSet::getFilename() const 00064 { 00065 return m_filename; 00066 } 00067 00068 bool WDataSet::isTexture() const 00069 { 00070 return false; 00071 } 00072 00073 osg::ref_ptr< WDataTexture3D > WDataSet::getTexture() const 00074 { 00075 throw WDHException( std::string( "This dataset does not provide a texture." ) ); 00076 } 00077 00078 const std::string WDataSet::getName() const 00079 { 00080 return "WDataSet"; 00081 } 00082 00083 const std::string WDataSet::getDescription() const 00084 { 00085 return "Encapsulates the whole common feature set of all datasets."; 00086 } 00087 00088 boost::shared_ptr< WPrototyped > WDataSet::getPrototype() 00089 { 00090 if( !m_prototype ) 00091 { 00092 m_prototype = boost::shared_ptr< WPrototyped >( new WDataSet() ); 00093 } 00094 00095 return m_prototype; 00096 } 00097 00098 boost::shared_ptr< WDataSetVector > WDataSet::isVectorDataSet() 00099 { 00100 return boost::shared_ptr< WDataSetVector >(); 00101 } 00102 00103 boost::shared_ptr< WProperties > WDataSet::getProperties() const 00104 { 00105 return m_properties; 00106 } 00107 00108 boost::shared_ptr< WProperties > WDataSet::getInformationProperties() const 00109 { 00110 return m_infoProperties; 00111 } 00112