Changeset f10cf8f in git


Ignore:
Timestamp:
14/01/14 02:50:07 (6 years ago)
Author:
Olly Betts <olly@…>
Branches:
line_contents, master, stereo, travis-osx
Children:
110f59c
Parents:
5dc0378
Message:

src/: Pass the numeric datestamp to ExportFilter::header(), and use
it to set a timestamp in exported GPX files.

Files:
15 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5dc0378 rf10cf8f  
     1Tue Jan 14 02:48:59 GMT 2014  Olly Betts <olly@survex.com>
     2
     3        * src/: Pass the numeric datestamp to ExportFilter::header(), and use
     4          it to set a timestamp in exported GPX files.
     5
    16Tue Jan 14 01:18:42 GMT 2014  Olly Betts <olly@survex.com>
    27
  • src/avenprcore.h

    r5dc0378 rf10cf8f  
    5959    wxString title;
    6060    wxString datestamp;
     61    time_t datestamp_numeric;
    6162    double Scale;
    6263    int rot, tilt;
  • src/export.cc

    r5dc0378 rf10cf8f  
    131131    const int * passes() const;
    132132    bool fopen(const char *fnm_out);
    133     void header(const char *, const char *);
     133    void header(const char *, const char *, time_t);
    134134    void line(const img_point *, const img_point *, bool, bool);
    135135    void label(const img_point *, const char *, bool, int);
     
    160160
    161161void
    162 DXF::header(const char *, const char *)
     162DXF::header(const char *, const char *, time_t)
    163163{
    164164   fprintf(fh, "0\nSECTION\n"
     
    394394    Skencil() { }
    395395    const int * passes() const;
    396     void header(const char *, const char *);
     396    void header(const char *, const char *, time_t);
    397397    void start_pass(int layer);
    398398    void line(const img_point *, const img_point *, bool, bool);
     
    410410
    411411void
    412 Skencil::header(const char *, const char *)
     412Skencil::header(const char *, const char *, time_t)
    413413{
    414414   fprintf(fh, "##Sketch 1 2\n"); /* File format version */
     
    549549    SVG() : to_close(NULL), close_g(false) { pending[0] = '\0'; }
    550550    const int * passes() const;
    551     void header(const char *, const char *);
     551    void header(const char *, const char *, time_t);
    552552    void start_pass(int layer);
    553553    void line(const img_point *, const img_point *, bool, bool);
     
    571571
    572572void
    573 SVG::header(const char * title, const char *)
     573SVG::header(const char * title, const char *, time_t)
    574574{
    575575   size_t i;
     
    735735    PLT() { }
    736736    const int * passes() const;
    737     void header(const char *, const char *);
     737    void header(const char *, const char *, time_t);
    738738    void line(const img_point *, const img_point *, bool, bool);
    739739    void label(const img_point *, const char *, bool, int);
     
    749749
    750750void
    751 PLT::header(const char *title, const char *)
     751PLT::header(const char *title, const char *, time_t)
    752752{
    753753   size_t i;
     
    830830  public:
    831831    EPS() { }
    832     void header(const char *, const char *);
     832    void header(const char *, const char *, time_t);
    833833    void line(const img_point *, const img_point *, bool, bool);
    834834    void label(const img_point *, const char *, bool, int);
     
    838838
    839839void
    840 EPS::header(const char *title, const char *)
     840EPS::header(const char *title, const char *, time_t)
    841841{
    842842   const char * fontname_labels = "helvetica"; // FIXME
     
    11201120bool
    11211121Export(const wxString &fnm_out, const wxString &title,
    1122        const wxString &datestamp, const MainFrm * mainfrm,
     1122       const wxString &datestamp, time_t datestamp_numeric,
     1123       const MainFrm * mainfrm,
    11231124       double pan, double tilt, int show_mask, export_format format,
    11241125       const char * input_projection,
     
    12811282
    12821283   /* Header */
    1283    filt->header(title.mb_str(), datestamp.mb_str());
     1284   filt->header(title.mb_str(), datestamp.mb_str(), datestamp_numeric);
    12841285
    12851286   p1.x = p1.y = p1.z = 0; /* avoid compiler warning */
  • src/export.h

    r5dc0378 rf10cf8f  
    2525
    2626#include "wx.h"
     27
     28#include <time.h>
    2729
    2830class MainFrm;
     
    6062
    6163bool Export(const wxString &fnm_out, const wxString &title,
    62             const wxString &datestamp, const MainFrm * mainfrm,
     64            const wxString &datestamp, time_t datestamp_numeric,
     65            const MainFrm * mainfrm,
    6366            double pan, double tilt, int show_mask, export_format format,
    6467            const char * input_projection,
  • src/exportfilter.h

    r5dc0378 rf10cf8f  
    4040        return (fh != NULL);
    4141    }
    42     virtual void header(const char *, const char *) { }
     42    virtual void header(const char *, const char *, time_t) { }
    4343    virtual void start_pass(int) { }
    4444    virtual void line(const img_point *, const img_point *, bool, bool) = 0;
  • src/gfxcore.cc

    r5dc0378 rf10cf8f  
    55//
    66//  Copyright (C) 2000-2003,2005,2006 Mark R. Shinwell
    7 //  Copyright (C) 2001-2003,2004,2005,2006,2007,2010,2011,2012 Olly Betts
     7//  Copyright (C) 2001-2003,2004,2005,2006,2007,2010,2011,2012,2014 Olly Betts
    88//  Copyright (C) 2005 Martin Green
    99//
     
    28772877void
    28782878GfxCore::OnPrint(const wxString &filename, const wxString &title,
    2879                  const wxString &datestamp)
     2879                 const wxString &datestamp, time_t datestamp_numeric)
    28802880{
    28812881    svxPrintDlg * p;
    2882     p = new svxPrintDlg(m_Parent, filename, title, datestamp,
     2882    p = new svxPrintDlg(m_Parent, filename, title,
     2883                        datestamp, datestamp_numeric,
    28832884                        m_PanAngle, m_TiltAngle,
    28842885                        m_Names, m_Crosses, m_Legs, m_Surface, m_Tubes,
     
    28902891void
    28912892GfxCore::OnExport(const wxString &filename, const wxString &title,
    2892                   const wxString &datestamp)
     2893                  const wxString &datestamp, time_t datestamp_numeric)
    28932894{
    28942895    // Fill in "right_bearing" for each cross-section.
     
    29012902
    29022903    svxPrintDlg * p;
    2903     p = new svxPrintDlg(m_Parent, filename, title, datestamp,
     2904    p = new svxPrintDlg(m_Parent, filename, title,
     2905                        datestamp, datestamp_numeric,
    29042906                        m_PanAngle, m_TiltAngle,
    29052907                        m_Names, m_Crosses, m_Legs, m_Surface, m_Tubes,
  • src/gfxcore.h

    r5dc0378 rf10cf8f  
    55//
    66//  Copyright (C) 2000-2001,2002,2005 Mark R. Shinwell.
    7 //  Copyright (C) 2001-2004,2005,2006,2007,2010,2011,2012,2013 Olly Betts
     7//  Copyright (C) 2001-2004,2005,2006,2007,2010,2011,2012,2013,2014 Olly Betts
    88//  Copyright (C) 2005 Martin Green
    99//
     
    2727
    2828#include <float.h>
     29#include <time.h>
    2930
    3031#include "img_hosted.h"
     
    487488    bool ExportMovie(const wxString & fnm);
    488489    void OnPrint(const wxString &filename, const wxString &title,
    489                  const wxString &datestamp);
     490                 const wxString &datestamp, time_t datestamp_numeric);
    490491    void OnExport(const wxString &filename, const wxString &title,
    491                   const wxString &datestamp);
     492                  const wxString &datestamp, time_t datestamp_numeric);
    492493    void SetCursor(GfxCore::cursor new_cursor);
    493494    bool MeasuringLineActive() const;
  • src/gpx.cc

    r5dc0378 rf10cf8f  
    33 */
    44/* Copyright (C) 2012 Olaf Kähler
    5  * Copyright (C) 2012,2013 Olly Betts
     5 * Copyright (C) 2012,2013,2014 Olly Betts
    66 *
    77 * This program is free software; you can redistribute it and/or modify
     
    3030#include <stdio.h>
    3131#include <string>
     32#include <time.h>
    3233#include <math.h>
    3334
     
    9697
    9798/* Initialise GPX routines. */
    98 void GPX::header(const char * title, const char *)
     99void GPX::header(const char * title, const char *, time_t datestamp_numeric)
    99100{
    100101    fputs(
     
    109110        html_escape(fh, title);
    110111        fputs("</name>\n", fh);
     112    }
     113    if (datestamp_numeric != time_t(-1)) {
     114        struct tm * tm = gmtime(&datestamp_numeric);
     115        if (tm) {
     116            char buf[32];
     117            if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", tm)) {
     118                fputs("<time>", fh);
     119                fputs(buf, fh);
     120                fputs("</time>\n", fh);
     121            }
     122        }
    111123    }
    112124    // FIXME: optional in GPX, but perhaps useful:
  • src/gpx.h

    r5dc0378 rf10cf8f  
    3131    ~GPX();
    3232    const int * passes() const;
    33     void header(const char *, const char *);
     33    void header(const char *, const char *, time_t);
    3434    void line(const img_point *, const img_point *, bool, bool);
    3535    void label(const img_point *, const char *, bool, int);
  • src/hpgl.cc

    r5dc0378 rf10cf8f  
    4949/* Check if this line intersects the current page */
    5050/* Initialise HPGL routines. */
    51 void HPGL::header(const char *, const char *)
     51void HPGL::header(const char *, const char *, time_t)
    5252{
    5353   // FIXME: mm_across_page, mm_down_page, origin_in_centre, scale
  • src/hpgl.h

    r5dc0378 rf10cf8f  
    2525  public:
    2626    HPGL() {}
    27     void header(const char *, const char *);
     27    void header(const char *, const char *, time_t);
    2828    void line(const img_point *, const img_point *, bool, bool);
    2929    void label(const img_point *, const char *, bool, int);
  • src/mainfrm.cc

    r5dc0378 rf10cf8f  
    13351335    separator = survey->separator;
    13361336    m_Title = wxString(survey->title, wxConvUTF8);
     1337    m_DateStamp_numeric = survey->datestamp_numeric;
    13371338    if (strcmp(survey->datestamp, "?") == 0) {
    13381339        m_DateStamp = wmsg(/*Date and time not available.*/108);
    13391340    } else if (survey->datestamp[0] == '@') {
    1340         const struct tm * tm = localtime(&survey->datestamp_numeric);
     1341        const struct tm * tm = localtime(&m_DateStamp_numeric);
    13411342        char buf[256];
    13421343        strftime(buf, 256, msg(/*%a,%Y.%m.%d %H:%M:%S %Z*/107), tm);
     
    18461847void MainFrm::OnPrint(wxCommandEvent&)
    18471848{
    1848     m_Gfx->OnPrint(m_File, m_Title, m_DateStamp);
     1849    m_Gfx->OnPrint(m_File, m_Title, m_DateStamp, m_DateStamp_numeric);
    18491850}
    18501851
     
    18591860void MainFrm::OnExport(wxCommandEvent&)
    18601861{
    1861     m_Gfx->OnExport(m_File, m_Title, m_DateStamp);
     1862    m_Gfx->OnExport(m_File, m_Title, m_DateStamp, m_DateStamp_numeric);
    18621863}
    18631864
  • src/mainfrm.h

    r5dc0378 rf10cf8f  
    55//
    66//  Copyright (C) 2000-2003,2005 Mark R. Shinwell
    7 //  Copyright (C) 2001-2003,2004,2005,2006,2010,2011,2012,2013 Olly Betts
     7//  Copyright (C) 2001-2003,2004,2005,2006,2010,2011,2012,2013,2014 Olly Betts
    88//
    99//  This program is free software; you can redistribute it and/or modify
     
    4747
    4848#include <math.h>
     49#include <time.h>
    4950
    5051#define MARK_FIRST 1
     
    242243    wxString m_File;
    243244    wxString m_Title, m_DateStamp;
     245    time_t m_DateStamp_numeric;
    244246    wxChar separator; // character separating survey levels (often '.')
    245247    Vector3 m_Offsets;
  • src/printwx.cc

    r5dc0378 rf10cf8f  
    278278// User <-> wx - this should possibly be done in a separate file
    279279svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
    280                          const wxString & title, const wxString & datestamp,
     280                         const wxString & title,
     281                         const wxString & datestamp, time_t datestamp_numeric,
    281282                         double angle, double tilt_angle,
    282283                         bool labels, bool crosses, bool legs, bool surf,
     
    311312    m_layout.show_mask = show_mask;
    312313    m_layout.datestamp = datestamp;
     314    m_layout.datestamp_numeric = datestamp_numeric;
    313315    m_layout.rot = int(angle);
    314316    m_layout.title = title;
     
    575577        double marker_size = 0.8;
    576578
    577         if (!Export(dlg.GetPath(), m_layout.title, m_layout.datestamp, mainfrm,
     579        if (!Export(dlg.GetPath(), m_layout.title,
     580                    m_layout.datestamp, m_layout.datestamp_numeric, mainfrm,
    578581                    m_layout.rot, m_layout.tilt, m_layout.show_mask,
    579582                    export_format(format_idx), input_projection.mb_str(),
  • src/printwx.h

    r5dc0378 rf10cf8f  
    22/* Device dependent part of Survex wxWidgets driver */
    33/* Copyright (C) 2004 Philip Underwood
    4  * Copyright (C) 2004,2005,2006,2011,2012,2013 Olly Betts
     4 * Copyright (C) 2004,2005,2006,2011,2012,2013,2014 Olly Betts
    55 *
    66 * This program is free software; you can redistribute it and/or modify
     
    2121#include "wx.h"
    2222#include <wx/dialog.h>
     23
     24#include <time.h>
    2325
    2426#include "avenprcore.h"
     
    5557 public:
    5658        svxPrintDlg(MainFrm* parent, const wxString & filename,
    57                     const wxString & title, const wxString & datestamp,
     59                    const wxString & title,
     60                    const wxString & datestamp, time_t datestamp_numeric,
    5861                    double angle, double tilt_angle,
    5962                    bool labels, bool crosses, bool legs, bool surf,
Note: See TracChangeset for help on using the changeset viewer.