00001 /*===========================================================================*\ 00002 * * 00003 * OpenMesh * 00004 * Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen * 00005 * www.openmesh.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * * 00009 * License * 00010 * * 00011 * This library is free software; you can redistribute it and/or modify it * 00012 * under the terms of the GNU Library General Public License as published * 00013 * by the Free Software Foundation, version 2. * 00014 * * 00015 * This library is distributed in the hope that it will be useful, but * 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00018 * Library General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU Library General Public * 00021 * License along with this library; if not, write to the Free Software * 00022 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00023 * * 00024 \*===========================================================================*/ 00025 00026 00027 //============================================================================= 00028 // 00029 // Implements a writer module for STL ascii files 00030 // 00031 //============================================================================= 00032 // $Id: STLWriter.hh,v 1.2 2005/02/18 09:08:21 botsch Exp $ 00033 00034 #ifndef __STLWRITER_HH__ 00035 #define __STLWRITER_HH__ 00036 00037 00038 //=== INCLUDES ================================================================ 00039 00040 // -------------------- STL 00041 #if defined( OM_CC_MIPS ) 00042 # include <stdio.h> 00043 #else 00044 # include <cstdio> 00045 #endif 00046 #include <string> 00047 // -------------------- OpenMesh 00048 #include <OpenMesh/Core/System/config.hh> 00049 #include <OpenMesh/Core/Utils/SingletonT.hh> 00050 #include <OpenMesh/Core/IO/exporter/BaseExporter.hh> 00051 #include <OpenMesh/Core/IO/writer/BaseWriter.hh> 00052 00053 00054 //== NAMESPACES =============================================================== 00055 00056 00057 namespace OpenMesh { 00058 namespace IO { 00059 00060 00061 //=== IMPLEMENTATION ========================================================== 00062 00063 00068 class _STLWriter_ : public BaseWriter 00069 { 00070 public: 00071 00072 _STLWriter_(); 00073 00074 std::string get_description() const { return "Stereolithography Format"; } 00075 std::string get_extensions() const { return "stl stla stlb"; } 00076 00077 bool write(const std::string&, BaseExporter&, Options) const; 00078 00079 size_t binary_size(BaseExporter&, Options) const; 00080 00081 private: 00082 bool write_stla(const std::string&, BaseExporter&, Options) const; 00083 bool write_stlb(const std::string&, BaseExporter&, Options) const; 00084 }; 00085 00086 00087 //== TYPE DEFINITION ========================================================== 00088 00089 00090 // Declare the single entity of STL writer. 00091 extern _STLWriter_ __STLWriterInstance; 00092 _STLWriter_& STLWriter(); 00093 00094 00095 //============================================================================= 00096 } // namespace IO 00097 } // namespace OpenMesh 00098 //============================================================================= 00099 #endif 00100 //=============================================================================