1 /* 2 This file is a part of the RepSnapper project. 3 Copyright (C) 2010 Kulitorum 4 Copyright (C) 2011-12 martin.dieringer@gmx.de 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along 17 with this program; if not, write to the Free Software Foundation, Inc., 18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 */ 20 21 #pragma once 22 23 #include "stdafx.h" 24 25 #include "triangle.h" 26 27 28 void save_locales(); 29 void set_locales(const char * loc); 30 void reset_locales(); 31 32 33 using namespace Glib; 34 35 enum filetype_t{ 36 ASCII_STL, 37 BINARY_STL, 38 NONE_STL, 39 VRML, 40 SVG, 41 AMF, 42 UNKNOWN_TYPE 43 }; 44 45 46 class File 47 { 48 public: File()49 File(){}; 50 File(Glib::RefPtr<Gio::File> file); ~File()51 virtual ~File(){}; 52 53 Glib::RefPtr<Gio::File> _file; 54 ustring _path; 55 filetype_t _type; 56 57 static filetype_t getFileType(ustring path); 58 59 void loadTriangles(vector< vector<Triangle> > &triangles, 60 vector<ustring> &names, 61 uint max_triangles=0); 62 63 64 bool load_asciiSTL(vector< vector<Triangle> > &triangles, 65 vector<ustring> &names, 66 uint max_triangles=0, bool readnormals=false); 67 68 bool load_binarySTL(vector<Triangle> &triangles, 69 uint max_triangles=0, bool readnormals=false); 70 71 bool load_VRML(vector<Triangle> &triangles, uint max_triangles=0); 72 73 bool load_AMF (vector< vector<Triangle> > &triangles, 74 vector<ustring> &names, 75 uint max_triangles=0); 76 77 static bool save_AMF (ustring filename, 78 const vector< vector<Triangle> > &triangles, 79 const vector<ustring> &names, 80 bool compressed = true); 81 82 static bool parseSTLtriangles_ascii(istream &text, 83 uint max_triangles, bool readnormals, 84 vector<Triangle> &triangles, 85 ustring &name); 86 87 88 /* static bool loadVRMLtriangles(ustring filename, */ 89 /* uint max_triangles, */ 90 /* vector<Triangle> &triangles); */ 91 92 93 94 static bool saveBinarySTL(ustring filename, const vector<Triangle> &triangles, 95 const Matrix4d &T); 96 97 }; 98