00001 /*===========================================================================*\ 00002 * * 00003 * OpenMesh * 00004 * Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen * 00005 * www.openmesh.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenMesh. * 00009 * * 00010 * OpenMesh is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenMesh is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenMesh. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 325 $ * 00038 * $Date: 2010-06-17 12:45:58 +0200 (Do, 17 Jun 2010) $ * 00039 * * 00040 \*===========================================================================*/ 00041 00042 00043 //============================================================================= 00044 // 00045 // Implements a writer module for STL ascii files 00046 // 00047 //============================================================================= 00048 // $Id: STLWriter.hh,v 1.2 2007-05-18 15:17:43 habbecke Exp $ 00049 00050 #ifndef __STLWRITER_HH__ 00051 #define __STLWRITER_HH__ 00052 00053 00054 //=== INCLUDES ================================================================ 00055 00056 // -------------------- STL 00057 #if defined( OM_CC_MIPS ) 00058 # include <stdio.h> 00059 #else 00060 # include <cstdio> 00061 #endif 00062 #include <string> 00063 // -------------------- OpenMesh 00064 #include <OpenMesh/Core/System/config.h> 00065 #include <OpenMesh/Core/Utils/SingletonT.hh> 00066 #include <OpenMesh/Core/IO/exporter/BaseExporter.hh> 00067 #include <OpenMesh/Core/IO/writer/BaseWriter.hh> 00068 00069 00070 //== NAMESPACES =============================================================== 00071 00072 00073 namespace OpenMesh { 00074 namespace IO { 00075 00076 00077 //=== IMPLEMENTATION ========================================================== 00078 00079 00084 class _STLWriter_ : public BaseWriter 00085 { 00086 public: 00087 00088 _STLWriter_(); 00089 00091 virtual ~_STLWriter_() {}; 00092 00093 std::string get_description() const { return "Stereolithography Format"; } 00094 std::string get_extensions() const { return "stla stlb"; } 00095 00096 bool write(const std::string&, BaseExporter&, Options) const; 00097 00098 bool write(std::ostream&, BaseExporter&, Options) const; 00099 00100 size_t binary_size(BaseExporter&, Options) const; 00101 00102 private: 00103 bool write_stla(const std::string&, BaseExporter&, Options) const; 00104 bool write_stlb(const std::string&, BaseExporter&, Options) const; 00105 }; 00106 00107 00108 //== TYPE DEFINITION ========================================================== 00109 00110 00111 // Declare the single entity of STL writer. 00112 extern _STLWriter_ __STLWriterInstance; 00113 _STLWriter_& STLWriter(); 00114 00115 00116 //============================================================================= 00117 } // namespace IO 00118 } // namespace OpenMesh 00119 //============================================================================= 00120 #endif 00121 //=============================================================================