00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // Copyright (C) 2003-2010 by the IPLT authors 00006 // 00007 // This library is free software; you can redistribute it and/or modify it under 00008 // the terms of the GNU Lesser General Public License as published by the Free 00009 // Software Foundation; either version 3.0 of the License, or (at your option) 00010 // any later version. 00011 // This library is distributed in the hope that it will be useful, but WITHOUT 00012 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00014 // details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with this library; if not, write to the Free Software Foundation, Inc., 00018 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 //------------------------------------------------------------------------------ 00020 00021 /* 00022 convenience null data class 00023 00024 Author: Ansgar Philippsen 00025 */ 00026 00027 #ifndef IMG_NULL_DATA_H 00028 #define IMG_NULL_DATA_H 00029 00030 #include "data.hh" 00031 #include "pixel_sampling.hh" 00032 #include "image_factory.hh" 00033 #include "image_handle.hh" 00034 00035 namespace ost { namespace img { 00036 00038 00044 class DLLEXPORT_OST_IMG_BASE NullData: public Data 00045 { 00046 public: 00047 virtual DataType GetType() const {return REAL;} 00048 00049 virtual DataDomain GetDomain() const {return SPATIAL;} 00050 00051 virtual Extent GetExtent() const {return Extent();} 00052 00053 virtual Real GetReal(const Point &p) const {return 0.0;} 00054 00055 virtual Complex GetComplex(const Point &p) const {return 0.0;} 00056 00057 virtual Real GetIntpolReal(const Vec3 &v) const {return 0.0;} 00058 virtual Real GetIntpolReal(const Vec2 &v) const {return 0.0;} 00059 virtual Real GetIntpolReal(const Real &d) const {return 0.0;} 00060 00061 virtual Complex GetIntpolComplex(const Vec3 &v) const {return 0.0;} 00062 virtual Complex GetIntpolComplex(const Vec2 &v) const {return 0.0;} 00063 virtual Complex GetIntpolComplex(const Real &d) const {return 0.0;} 00064 00065 virtual void Apply(NonModAlgorithm& a) const {} 00066 virtual void ApplyIP(NonModAlgorithm& a) const {} 00067 00068 virtual void SetSpatialOrigin(const Point& o) {} 00069 00070 virtual Point GetSpatialOrigin() const {return Point();} 00071 00072 virtual void Attach(DataObserver *o) const {} 00073 00074 virtual void Detach(DataObserver *o) const {} 00075 00076 virtual void Notify() const {} 00077 00078 virtual ImageHandle Crop(const Extent& e) const { 00079 return CreateImage(); 00080 } 00081 00082 static Data& Instance() { 00083 static NullData instance; 00084 return instance; 00085 } 00086 00087 protected: 00088 virtual PixelSampling& Sampling() { 00089 return sampling_; 00090 } 00091 virtual const PixelSampling& Sampling() const { 00092 return sampling_; 00093 } 00094 00095 private: 00096 PixelSampling sampling_; 00097 }; 00098 00099 }} // namespace 00100 00101 #endif