00001 /* BurrTools 00002 * 00003 * BurrTools is the legal property of its developers, whose 00004 * names are listed in the COPYRIGHT file, which is included 00005 * within the source distribution. 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 */ 00021 #ifndef __STL_H__ 00022 #define __STL_H__ 00023 00024 #include <vector> 00025 00026 #include <stdio.h> 00027 00028 class voxel_c; 00029 class Polyhedron; 00030 00032 class stlException_c { 00033 00034 public: 00035 00036 const char * comment; 00037 00038 stlException_c(const char * c) : comment(c) {} 00039 00040 }; 00041 00051 class faceList_c; 00052 class stlExporter_c { 00053 00054 public: 00055 00057 stlExporter_c(void) : binaryMode(true) {} 00058 virtual ~stlExporter_c(void) {} 00059 00063 void write(const char * basename, const voxel_c & shape, const faceList_c & holes); 00064 00068 typedef enum 00069 { 00070 PAR_TYP_DOUBLE, 00071 PAR_TYP_POS_DOUBLE, 00072 PAR_TYP_POS_INTEGER, 00073 PAR_TYP_SWITCH 00074 } parameterTypes; 00075 00076 /* some functions to set some parameters for the output all parameters mus tbe double 00077 * values 00078 */ 00079 00081 virtual unsigned int numParameters(void) const = 0; 00083 virtual const char * getParameterName(unsigned int idx) const = 0; 00085 virtual const char * getParameterTooltip(unsigned int /*idx*/) const { return ""; } 00087 virtual parameterTypes getParameterType(unsigned int /*idx*/) const { return PAR_TYP_DOUBLE; } 00089 virtual double getParameter(unsigned int idx) const = 0; 00091 virtual void setParameter(unsigned int idx, double value) = 0; 00092 00094 void setBinaryMode(bool on) { binaryMode = on; } 00096 bool getBinaryMode(void) { return binaryMode; } 00097 00098 virtual Polyhedron * getMesh(const voxel_c & v, const faceList_c & holes) const = 0; 00099 00100 private: 00101 00102 bool binaryMode; 00103 00104 private: 00105 00106 // no copying and assigning 00107 stlExporter_c(const stlExporter_c&); 00108 void operator=(const stlExporter_c&); 00109 }; 00110 00111 #endif