[40f1e82] | 1 | /* exportfilter.h |
---|
[9fc1cac] | 2 | * Export to CAD-like formats (DXF, Skencil, SVG, EPS, HPGL) and also Compass |
---|
[40f1e82] | 3 | * PLT. |
---|
| 4 | */ |
---|
| 5 | |
---|
[b2257ba] | 6 | /* Copyright (C) 2005,2012,2013,2014,2015,2016 Olly Betts |
---|
[40f1e82] | 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or modify |
---|
| 9 | * it under the terms of the GNU General Public License as published by |
---|
| 10 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | * (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #ifndef SURVEX_EXPORTFILTER_H |
---|
| 24 | #define SURVEX_EXPORTFILTER_H |
---|
| 25 | |
---|
| 26 | #include <stdio.h> |
---|
[b2257ba] | 27 | #include "wx.h" |
---|
[40f1e82] | 28 | |
---|
[a405bc1] | 29 | #include "img_hosted.h" |
---|
[40f1e82] | 30 | |
---|
| 31 | class ExportFilter { |
---|
| 32 | protected: |
---|
| 33 | FILE * fh; |
---|
| 34 | public: |
---|
| 35 | ExportFilter() : fh(NULL) { } |
---|
| 36 | // FIXME: deal with errors closing file... (safe_fclose?) |
---|
| 37 | virtual ~ExportFilter() { if (fh) fclose(fh); } |
---|
| 38 | virtual const int * passes() const; |
---|
[b2257ba] | 39 | virtual bool fopen(const wxString& fnm_out) { |
---|
| 40 | fh = wxFopen(fnm_out.fn_str(), wxT("wb")); |
---|
[40f1e82] | 41 | return (fh != NULL); |
---|
| 42 | } |
---|
[355df41] | 43 | virtual void header(const char* title, |
---|
| 44 | const char* datestamp_string, |
---|
| 45 | time_t datestamp, |
---|
| 46 | double min_x, double min_y, double min_z, |
---|
| 47 | double max_x, double max_y, double max_z); |
---|
| 48 | virtual void start_pass(int); |
---|
| 49 | virtual void line(const img_point *, const img_point *, unsigned, bool); |
---|
[8c4cefb] | 50 | virtual void label(const img_point* p, const wxString& s, |
---|
[355df41] | 51 | bool fSurface, int type) = 0; |
---|
[8c4cefb] | 52 | virtual void cross(const img_point *, const wxString&, bool); |
---|
[355df41] | 53 | virtual void xsect(const img_point *, double, double, double); |
---|
| 54 | virtual void wall(const img_point *, double, double); |
---|
| 55 | virtual void passage(const img_point *, double, double, double); |
---|
| 56 | virtual void tube_end(); |
---|
| 57 | virtual void footer(); |
---|
[40f1e82] | 58 | }; |
---|
| 59 | |
---|
[355df41] | 60 | inline void |
---|
| 61 | ExportFilter::header(const char*, |
---|
| 62 | const char*, |
---|
| 63 | time_t, |
---|
| 64 | double, double, double, |
---|
| 65 | double, double, double) { } |
---|
| 66 | |
---|
| 67 | inline void |
---|
| 68 | ExportFilter::start_pass(int) { } |
---|
| 69 | |
---|
| 70 | inline void |
---|
| 71 | ExportFilter::line(const img_point *, const img_point *, unsigned, bool) { } |
---|
| 72 | |
---|
| 73 | inline void |
---|
[8c4cefb] | 74 | ExportFilter::cross(const img_point *, const wxString&, bool) { } |
---|
[355df41] | 75 | |
---|
| 76 | inline void |
---|
| 77 | ExportFilter::xsect(const img_point *, double, double, double) { } |
---|
| 78 | |
---|
| 79 | inline void |
---|
| 80 | ExportFilter::wall(const img_point *, double, double) { } |
---|
| 81 | |
---|
| 82 | inline void |
---|
| 83 | ExportFilter::passage(const img_point *, double, double, double) { } |
---|
| 84 | |
---|
| 85 | inline void |
---|
| 86 | ExportFilter::tube_end() { } |
---|
| 87 | |
---|
| 88 | inline void |
---|
| 89 | ExportFilter::footer() { } |
---|
| 90 | |
---|
[40f1e82] | 91 | #endif |
---|