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 // 00008 // This library is free software; you can redistribute it and/or modify it under 00009 // the terms of the GNU Lesser General Public License as published by the Free 00010 // Software Foundation; either version 3.0 of the License, or (at your option) 00011 // any later version. 00012 // This library is distributed in the hope that it will be useful, but WITHOUT 00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00014 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00015 // details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public License 00018 // along with this library; if not, write to the Free Software Foundation, Inc., 00019 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 //------------------------------------------------------------------------------ 00021 #ifndef DX_IO_MAP_IO_PLUGIN_OST_HH 00022 #define DX_IO_MAP_IO_PLUGIN_OST_HH 00023 00024 #include "map_io_handler.hh" 00025 00026 namespace ost { namespace io { 00027 00028 class DLLEXPORT_OST_IO DX: public ImageFormatBase 00029 { 00030 public: 00031 00032 DX(bool normalize_on_save = false); 00033 00034 bool GetNormalizeOnSave() const; 00035 void SetNormalizeOnSave(bool normalize_on_save); 00036 static String FORMAT_STRING; 00037 static String FORMAT_NAME_STRING; 00038 static String FORMAT_DESCRIPTION_STRING; 00039 00040 private: 00041 00042 bool normalize_on_save_; 00043 }; 00044 00045 class DLLEXPORT_OST_IO MapIODxHandler: public MapIOHandler 00046 { 00047 public: 00056 virtual void Import(img::MapHandle& sh, const boost::filesystem::path& loc, 00057 const ImageFormatBase& formatstruct); 00058 virtual void Import(img::MapHandle& sh, std::istream& loc,const ImageFormatBase& formatstruct); 00059 virtual void Export(const img::MapHandle& sh, 00060 const boost::filesystem::path& loc,const ImageFormatBase& formatstruct) const; 00061 virtual void Export(const img::MapHandle& sh, 00062 std::ostream& loc, const ImageFormatBase& formatstruct) const; 00063 static bool MatchContent(unsigned char* header); 00064 static bool MatchType(const ImageFormatBase& type); 00065 static bool MatchSuffix(const String& locx); 00066 static bool ProvidesImport() { return true; } 00067 static bool ProvidesExport() { return true; } 00068 00069 static String GetFormatName() { return String("Dx"); }; 00070 static String GetFormatDescription() { return String("Format used by the OpenDX software package"); }; 00071 00072 }; 00073 00074 typedef MapIOHandlerFactory<MapIODxHandler> MapIODxHandlerFactory; 00075 00076 }} // ns 00077 00078 #endif