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