2017-04-27 18:26:05 +00:00
|
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-05-20 16:33:32 +00:00
|
|
|
|
#include <QFileDialog>
|
2014-05-21 12:41:46 +00:00
|
|
|
|
#include <QShortcut>
|
2014-05-24 14:12:03 +00:00
|
|
|
|
#include <QSettings>
|
2015-01-30 19:42:33 +00:00
|
|
|
|
#include <QtConcurrent>
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
#include <string.h> // Allows string comparisons and substitutions in TeX export
|
2015-02-22 16:30:34 +00:00
|
|
|
|
|
2014-05-20 16:33:32 +00:00
|
|
|
|
#include "ui_divelogexportdialog.h"
|
2019-08-05 18:07:10 +00:00
|
|
|
|
#include "core/divelogexportlogic.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
|
#include "core/worldmap-save.h"
|
|
|
|
|
#include "core/save-html.h"
|
2018-08-18 18:00:55 +00:00
|
|
|
|
#include "core/settings/qPrefDisplay.h"
|
2019-03-30 19:59:28 +00:00
|
|
|
|
#include "core/save-profiledata.h"
|
2019-03-04 22:20:29 +00:00
|
|
|
|
#include "core/divesite.h"
|
2019-08-05 17:41:15 +00:00
|
|
|
|
#include "core/errorhelper.h"
|
2019-08-05 18:07:10 +00:00
|
|
|
|
#include "core/file.h"
|
2019-05-30 16:29:36 +00:00
|
|
|
|
#include "core/tag.h"
|
2019-08-05 18:07:10 +00:00
|
|
|
|
#include "desktop-widgets/mainwindow.h"
|
|
|
|
|
#include "desktop-widgets/divelogexportdialog.h"
|
|
|
|
|
#include "desktop-widgets/diveshareexportdialog.h"
|
|
|
|
|
#include "desktop-widgets/subsurfacewebservices.h"
|
|
|
|
|
#include "profile-widget/profilewidget2.h"
|
2016-10-03 15:08:02 +00:00
|
|
|
|
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
// Retrieves the current unit settings defined in the Subsurface preferences.
|
|
|
|
|
#define GET_UNIT(name, field, f, t) \
|
|
|
|
|
v = settings.value(QString(name)); \
|
|
|
|
|
if (v.isValid()) \
|
2014-10-17 20:46:33 +00:00
|
|
|
|
field = (v.toInt() == 0) ? (t) : (f); \
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
else \
|
2014-10-17 20:46:33 +00:00
|
|
|
|
field = default_prefs.units.field
|
|
|
|
|
|
2014-05-22 18:40:22 +00:00
|
|
|
|
DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
|
2014-06-10 11:02:55 +00:00
|
|
|
|
ui(new Ui::DiveLogExportDialog)
|
2014-05-20 16:33:32 +00:00
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
2014-05-24 13:42:10 +00:00
|
|
|
|
showExplanation();
|
2014-05-21 12:41:46 +00:00
|
|
|
|
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
|
2015-05-25 19:01:57 +00:00
|
|
|
|
connect(quit, SIGNAL(activated()), MainWindow::instance(), SLOT(close()));
|
2014-05-21 12:41:46 +00:00
|
|
|
|
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
|
|
|
|
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
2014-06-01 04:38:59 +00:00
|
|
|
|
|
|
|
|
|
/* the names are not the actual values exported to the json files,The font-family property should hold several
|
|
|
|
|
font names as a "fallback" system, to ensure maximum compatibility between browsers/operating systems */
|
|
|
|
|
ui->fontSelection->addItem("Arial", "Arial, Helvetica, sans-serif");
|
|
|
|
|
ui->fontSelection->addItem("Impact", "Impact, Charcoal, sans-serif");
|
|
|
|
|
ui->fontSelection->addItem("Georgia", "Georgia, serif");
|
|
|
|
|
ui->fontSelection->addItem("Courier", "Courier, monospace");
|
|
|
|
|
ui->fontSelection->addItem("Verdana", "Verdana, Geneva, sans-serif");
|
2014-06-02 15:38:35 +00:00
|
|
|
|
|
|
|
|
|
QSettings settings;
|
|
|
|
|
settings.beginGroup("HTML");
|
|
|
|
|
if (settings.contains("fontSelection")) {
|
|
|
|
|
ui->fontSelection->setCurrentIndex(settings.value("fontSelection").toInt());
|
|
|
|
|
}
|
|
|
|
|
if (settings.contains("fontSizeSelection")) {
|
|
|
|
|
ui->fontSizeSelection->setCurrentIndex(settings.value("fontSizeSelection").toInt());
|
|
|
|
|
}
|
|
|
|
|
if (settings.contains("themeSelection")) {
|
|
|
|
|
ui->themeSelection->setCurrentIndex(settings.value("themeSelection").toInt());
|
|
|
|
|
}
|
2014-08-10 04:10:19 +00:00
|
|
|
|
if (settings.contains("subsurfaceNumbers")) {
|
|
|
|
|
ui->exportSubsurfaceNumber->setChecked(settings.value("subsurfaceNumbers").toBool());
|
|
|
|
|
}
|
|
|
|
|
if (settings.contains("yearlyStatistics")) {
|
|
|
|
|
ui->exportStatistics->setChecked(settings.value("yearlyStatistics").toBool());
|
|
|
|
|
}
|
|
|
|
|
if (settings.contains("listOnly")) {
|
|
|
|
|
ui->exportListOnly->setChecked(settings.value("listOnly").toBool());
|
|
|
|
|
}
|
2015-03-13 13:36:52 +00:00
|
|
|
|
if (settings.contains("exportPhotos")) {
|
|
|
|
|
ui->exportPhotos->setChecked(settings.value("exportPhotos").toBool());
|
|
|
|
|
}
|
2014-06-02 15:38:35 +00:00
|
|
|
|
settings.endGroup();
|
2014-05-20 16:33:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DiveLogExportDialog::~DiveLogExportDialog()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-24 13:42:10 +00:00
|
|
|
|
void DiveLogExportDialog::showExplanation()
|
2014-05-23 20:28:08 +00:00
|
|
|
|
{
|
|
|
|
|
if (ui->exportUDDF->isChecked()) {
|
2014-07-10 23:06:44 +00:00
|
|
|
|
ui->description->setText(tr("Generic format that is used for data exchange between a variety of diving related programs."));
|
2014-05-23 20:28:08 +00:00
|
|
|
|
} else if (ui->exportCSV->isChecked()) {
|
2014-12-29 15:45:29 +00:00
|
|
|
|
ui->description->setText(tr("Comma separated values describing the dive profile."));
|
2014-12-29 15:45:28 +00:00
|
|
|
|
} else if (ui->exportCSVDetails->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Comma separated values of the dive information. This includes most of the dive details but no profile information."));
|
2014-05-23 20:28:08 +00:00
|
|
|
|
} else if (ui->exportDivelogs->isChecked()) {
|
2014-07-10 23:06:44 +00:00
|
|
|
|
ui->description->setText(tr("Send the dive data to divelogs.de website."));
|
2014-09-21 14:11:58 +00:00
|
|
|
|
} else if (ui->exportDiveshare->isChecked()) {
|
2017-02-20 09:31:03 +00:00
|
|
|
|
ui->description->setText(tr("Send the dive data to dive-share.appspot.com website."));
|
2014-05-23 20:28:08 +00:00
|
|
|
|
} else if (ui->exportWorldMap->isChecked()) {
|
2014-07-10 23:06:44 +00:00
|
|
|
|
ui->description->setText(tr("HTML export of the dive locations, visualized on a world map."));
|
2014-05-24 14:12:03 +00:00
|
|
|
|
} else if (ui->exportSubsurfaceXML->isChecked()) {
|
2014-07-10 23:06:44 +00:00
|
|
|
|
ui->description->setText(tr("Subsurface native XML format."));
|
2019-04-06 19:05:18 +00:00
|
|
|
|
} else if (ui->exportSubsurfaceSitesXML->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Subsurface dive sites native XML format."));
|
2014-09-28 21:47:41 +00:00
|
|
|
|
} else if (ui->exportImageDepths->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Write depths of images to file."));
|
2016-10-03 15:08:02 +00:00
|
|
|
|
} else if (ui->exportTeX->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Write dive as TeX macros to file."));
|
2019-01-03 09:23:24 +00:00
|
|
|
|
} else if (ui->exportLaTeX->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Write dive as LaTeX macros to file."));
|
2019-02-03 14:47:52 +00:00
|
|
|
|
} else if (ui->exportProfile->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Write the profile image as PNG file."));
|
2019-03-30 19:59:28 +00:00
|
|
|
|
} else if (ui->exportProfileData->isChecked()) {
|
|
|
|
|
ui->description->setText(tr("Write profile data to a CSV file."));
|
2014-05-23 20:28:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-10 11:02:55 +00:00
|
|
|
|
void DiveLogExportDialog::exportHtmlInit(const QString &filename)
|
2014-06-01 04:38:59 +00:00
|
|
|
|
{
|
2015-06-16 13:34:40 +00:00
|
|
|
|
struct htmlExportSetting hes;
|
|
|
|
|
hes.themeFile = (ui->themeSelection->currentText() == tr("Light")) ? "light.css" : "sand.css";
|
|
|
|
|
hes.exportPhotos = ui->exportPhotos->isChecked();
|
|
|
|
|
hes.selectedOnly = ui->exportSelectedDives->isChecked();
|
|
|
|
|
hes.listOnly = ui->exportListOnly->isChecked();
|
|
|
|
|
hes.fontFamily = ui->fontSelection->itemData(ui->fontSelection->currentIndex()).toString();
|
|
|
|
|
hes.fontSize = ui->fontSizeSelection->currentText();
|
|
|
|
|
hes.themeSelection = ui->themeSelection->currentIndex();
|
|
|
|
|
hes.subsurfaceNumbers = ui->exportSubsurfaceNumber->isChecked();
|
|
|
|
|
hes.yearlyStatistics = ui->exportStatistics->isChecked();
|
|
|
|
|
|
|
|
|
|
exportHtmlInitLogic(filename, hes);
|
2014-06-01 04:38:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-21 16:09:09 +00:00
|
|
|
|
void DiveLogExportDialog::on_exportGroup_buttonClicked(QAbstractButton*)
|
2014-05-24 13:42:10 +00:00
|
|
|
|
{
|
|
|
|
|
showExplanation();
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-21 12:10:53 +00:00
|
|
|
|
static std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly)
|
|
|
|
|
{
|
|
|
|
|
std::vector<const dive_site *> res;
|
2019-09-21 12:35:24 +00:00
|
|
|
|
|
|
|
|
|
if (selectedOnly && MultiFilterSortModel::instance()->diveSiteMode()) {
|
|
|
|
|
// Special case in dive site mode: export all selected dive sites,
|
|
|
|
|
// not the dive sites of selected dives.
|
|
|
|
|
QVector<dive_site *> sites = MultiFilterSortModel::instance()->filteredDiveSites();
|
|
|
|
|
res.reserve(sites.size());
|
|
|
|
|
for (const dive_site *ds: sites)
|
|
|
|
|
res.push_back(ds);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-21 12:10:53 +00:00
|
|
|
|
res.reserve(dive_site_table.nr);
|
|
|
|
|
for (int i = 0; i < dive_site_table.nr; i++) {
|
|
|
|
|
struct dive_site *ds = get_dive_site(i, &dive_site_table);
|
|
|
|
|
if (dive_site_is_empty(ds))
|
|
|
|
|
continue;
|
|
|
|
|
if (selectedOnly && !is_dive_site_selected(ds))
|
|
|
|
|
continue;
|
|
|
|
|
res.push_back(ds);
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-20 16:33:32 +00:00
|
|
|
|
void DiveLogExportDialog::on_buttonBox_accepted()
|
|
|
|
|
{
|
|
|
|
|
QString filename;
|
|
|
|
|
QString stylesheet;
|
2014-05-24 14:12:03 +00:00
|
|
|
|
QString lastDir = QDir::homePath();
|
|
|
|
|
|
2018-08-18 18:00:55 +00:00
|
|
|
|
if (QDir(qPrefDisplay::lastDir()).exists())
|
|
|
|
|
lastDir = qPrefDisplay::lastDir();
|
2014-05-20 16:33:32 +00:00
|
|
|
|
|
2014-06-01 04:38:59 +00:00
|
|
|
|
switch (ui->tabWidget->currentIndex()) {
|
|
|
|
|
case 0:
|
|
|
|
|
if (ui->exportUDDF->isChecked()) {
|
|
|
|
|
stylesheet = "uddf-export.xslt";
|
2014-07-10 23:06:43 +00:00
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export UDDF file as"), lastDir,
|
2017-10-27 12:52:27 +00:00
|
|
|
|
tr("UDDF files") + " (*.uddf)");
|
2014-06-01 04:38:59 +00:00
|
|
|
|
} else if (ui->exportCSV->isChecked()) {
|
|
|
|
|
stylesheet = "xml2csv.xslt";
|
2014-07-10 23:06:43 +00:00
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export CSV file as"), lastDir,
|
2017-10-27 12:52:27 +00:00
|
|
|
|
tr("CSV files") + " (*.csv)");
|
2014-12-22 01:53:18 +00:00
|
|
|
|
} else if (ui->exportCSVDetails->isChecked()) {
|
|
|
|
|
stylesheet = "xml2manualcsv.xslt";
|
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export CSV file as"), lastDir,
|
2017-10-27 12:52:27 +00:00
|
|
|
|
tr("CSV files") + " (*.csv)");
|
2014-06-01 04:38:59 +00:00
|
|
|
|
} else if (ui->exportDivelogs->isChecked()) {
|
|
|
|
|
DivelogsDeWebServices::instance()->prepareDivesForUpload(ui->exportSelected->isChecked());
|
2014-09-21 14:11:58 +00:00
|
|
|
|
} else if (ui->exportDiveshare->isChecked()) {
|
|
|
|
|
DiveShareExportDialog::instance()->prepareDivesForUpload(ui->exportSelected->isChecked());
|
2014-06-01 04:38:59 +00:00
|
|
|
|
} else if (ui->exportWorldMap->isChecked()) {
|
2014-07-10 23:06:43 +00:00
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export world map"), lastDir,
|
2017-10-27 12:52:27 +00:00
|
|
|
|
tr("HTML files") + " (*.html)");
|
2014-06-01 04:38:59 +00:00
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
2018-02-25 12:51:41 +00:00
|
|
|
|
export_worldmap_HTML(qPrintable(filename), ui->exportSelected->isChecked());
|
2014-06-01 04:38:59 +00:00
|
|
|
|
} else if (ui->exportSubsurfaceXML->isChecked()) {
|
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export Subsurface XML"), lastDir,
|
2017-10-27 12:52:27 +00:00
|
|
|
|
tr("Subsurface files") + " (*.ssrf *.xml)");
|
2014-06-01 04:38:59 +00:00
|
|
|
|
if (!filename.isNull() && !filename.isEmpty()) {
|
2014-07-31 17:38:36 +00:00
|
|
|
|
if (!filename.contains('.'))
|
|
|
|
|
filename.append(".ssrf");
|
2014-06-01 04:38:59 +00:00
|
|
|
|
QByteArray bt = QFile::encodeName(filename);
|
2018-09-10 12:47:56 +00:00
|
|
|
|
save_dives_logic(bt.data(), ui->exportSelected->isChecked(), ui->anonymize->isChecked());
|
2014-06-01 04:38:59 +00:00
|
|
|
|
}
|
2019-04-06 19:05:18 +00:00
|
|
|
|
} else if (ui->exportSubsurfaceSitesXML->isChecked()) {
|
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export Subsurface dive sites XML"), lastDir,
|
|
|
|
|
tr("Subsurface files") + " (*.xml)");
|
|
|
|
|
if (!filename.isNull() && !filename.isEmpty()) {
|
|
|
|
|
if (!filename.contains('.'))
|
|
|
|
|
filename.append(".xml");
|
|
|
|
|
QByteArray bt = QFile::encodeName(filename);
|
2019-09-21 12:10:53 +00:00
|
|
|
|
std::vector<const dive_site *> sites = getDiveSitesToExport(ui->exportSelected->isChecked());
|
|
|
|
|
save_dive_sites_logic(bt.data(), &sites[0], (int)sites.size(), ui->anonymize->isChecked());
|
2019-04-06 19:05:18 +00:00
|
|
|
|
}
|
2014-09-28 21:47:41 +00:00
|
|
|
|
} else if (ui->exportImageDepths->isChecked()) {
|
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Save image depths"), lastDir);
|
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
2018-02-25 12:51:41 +00:00
|
|
|
|
export_depths(qPrintable(filename), ui->exportSelected->isChecked());
|
2019-01-03 09:23:24 +00:00
|
|
|
|
} else if (ui->exportTeX->isChecked() || ui->exportLaTeX->isChecked()) {
|
2017-10-27 12:52:27 +00:00
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export to TeX file"), lastDir, tr("TeX files") + " (*.tex)");
|
2016-10-03 15:08:02 +00:00
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
2019-01-03 09:23:24 +00:00
|
|
|
|
export_TeX(qPrintable(filename), ui->exportSelected->isChecked(), ui->exportTeX->isChecked());
|
2019-02-02 13:41:53 +00:00
|
|
|
|
} else if (ui->exportProfile->isChecked()) {
|
2019-02-03 14:47:52 +00:00
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Save profile image"), lastDir);
|
2019-02-02 13:41:53 +00:00
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
|
|
|
|
exportProfile(qPrintable(filename), ui->exportSelected->isChecked());
|
2019-03-30 19:59:28 +00:00
|
|
|
|
} else if (ui->exportProfileData->isChecked()) {
|
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Save profile data"), lastDir);
|
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
|
|
|
|
save_profiledata(qPrintable(filename), ui->exportSelected->isChecked());
|
2014-05-24 14:12:03 +00:00
|
|
|
|
}
|
2014-06-01 04:38:59 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2014-06-10 15:55:07 +00:00
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export HTML files as"), lastDir,
|
2017-10-27 12:52:27 +00:00
|
|
|
|
tr("HTML files") + " (*.html)");
|
2014-05-23 18:49:49 +00:00
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
2014-06-01 04:38:59 +00:00
|
|
|
|
exportHtmlInit(filename);
|
|
|
|
|
break;
|
2014-05-24 14:12:03 +00:00
|
|
|
|
}
|
2014-05-23 18:49:49 +00:00
|
|
|
|
|
2014-05-24 14:12:03 +00:00
|
|
|
|
if (!filename.isNull() && !filename.isEmpty()) {
|
|
|
|
|
// remember the last export path
|
|
|
|
|
QFileInfo fileInfo(filename);
|
2018-08-18 18:00:55 +00:00
|
|
|
|
qPrefDisplay::set_lastDir(fileInfo.dir().path());
|
2014-05-24 14:12:03 +00:00
|
|
|
|
// the non XSLT exports are called directly above, the XSLT based ons are called here
|
2015-02-26 14:07:39 +00:00
|
|
|
|
if (!stylesheet.isEmpty()) {
|
2018-09-10 12:47:56 +00:00
|
|
|
|
future = QtConcurrent::run(export_dives_xslt, filename.toUtf8(), ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8(), ui->anonymize->isChecked());
|
2015-09-04 22:25:35 +00:00
|
|
|
|
MainWindow::instance()->getNotificationWidget()->showNotification(tr("Please wait, exporting..."), KMessageWidget::Information);
|
2015-02-26 14:07:39 +00:00
|
|
|
|
MainWindow::instance()->getNotificationWidget()->setFuture(future);
|
|
|
|
|
}
|
2014-05-20 16:33:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-28 21:47:41 +00:00
|
|
|
|
|
|
|
|
|
void DiveLogExportDialog::export_depths(const char *filename, const bool selected_only)
|
|
|
|
|
{
|
|
|
|
|
FILE *f;
|
|
|
|
|
struct dive *dive;
|
|
|
|
|
depth_t depth;
|
|
|
|
|
int i;
|
2015-01-25 14:47:50 +00:00
|
|
|
|
const char *unit = NULL;
|
2014-09-28 21:47:41 +00:00
|
|
|
|
|
2016-03-10 04:28:56 +00:00
|
|
|
|
struct membuffer buf = {};
|
2014-09-28 21:47:41 +00:00
|
|
|
|
|
|
|
|
|
for_each_dive (i, dive) {
|
|
|
|
|
if (selected_only && !dive->selected)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
FOR_EACH_PICTURE (dive) {
|
|
|
|
|
int n = dive->dc.samples;
|
|
|
|
|
struct sample *s = dive->dc.sample;
|
|
|
|
|
depth.mm = 0;
|
2014-10-27 20:41:20 +00:00
|
|
|
|
while (--n >= 0 && (int32_t)s->time.seconds <= picture->offset.seconds) {
|
2014-09-28 21:47:41 +00:00
|
|
|
|
depth.mm = s->depth.mm;
|
|
|
|
|
s++;
|
|
|
|
|
}
|
2015-01-25 14:47:51 +00:00
|
|
|
|
put_format(&buf, "%s\t%.1f", picture->filename, get_depth_units(depth.mm, NULL, &unit));
|
|
|
|
|
put_format(&buf, "%s\n", unit);
|
2014-09-28 21:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
f = subsurface_fopen(filename, "w+");
|
|
|
|
|
if (!f) {
|
2018-02-25 12:51:41 +00:00
|
|
|
|
report_error(qPrintable(tr("Can't open file %s")), filename);
|
2014-09-28 21:47:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
flush_buffer(&buf, f); /*check for writing errors? */
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
free_buffer(&buf);
|
|
|
|
|
}
|
2016-10-03 15:08:02 +00:00
|
|
|
|
|
2019-02-03 14:47:52 +00:00
|
|
|
|
void DiveLogExportDialog::exportProfile(QString filename, const bool selected_only)
|
2019-02-02 13:41:53 +00:00
|
|
|
|
{
|
|
|
|
|
struct dive *dive;
|
|
|
|
|
int i;
|
|
|
|
|
int count = 0;
|
2019-02-03 14:47:52 +00:00
|
|
|
|
if (!filename.endsWith(".png", Qt::CaseInsensitive))
|
|
|
|
|
filename = filename.append(".png");
|
2019-02-02 13:41:53 +00:00
|
|
|
|
QFileInfo fi(filename);
|
|
|
|
|
|
|
|
|
|
for_each_dive (i, dive) {
|
|
|
|
|
if (selected_only && !dive->selected)
|
|
|
|
|
continue;
|
|
|
|
|
if (count)
|
2019-02-03 14:47:52 +00:00
|
|
|
|
saveProfile(dive, fi.path() + QDir::separator() + fi.completeBaseName().append(QString("-%1.").arg(count)) + fi.suffix());
|
2019-02-02 13:41:53 +00:00
|
|
|
|
else
|
|
|
|
|
saveProfile(dive, filename);
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DiveLogExportDialog::saveProfile(const struct dive *dive, const QString filename)
|
|
|
|
|
{
|
|
|
|
|
ProfileWidget2 *profile = MainWindow::instance()->graphics;
|
2019-02-02 20:23:52 +00:00
|
|
|
|
profile->plotDive(dive, true, false, true);
|
2019-02-02 13:41:53 +00:00
|
|
|
|
profile->setToolTipVisibile(false);
|
|
|
|
|
QPixmap pix = profile->grab();
|
|
|
|
|
profile->setToolTipVisibile(true);
|
|
|
|
|
pix.save(filename);
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-03 09:03:12 +00:00
|
|
|
|
void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_only, bool plain)
|
2016-10-03 15:08:02 +00:00
|
|
|
|
{
|
|
|
|
|
FILE *f;
|
2017-12-11 10:00:41 +00:00
|
|
|
|
QDir texdir = QFileInfo(filename).dir();
|
2016-10-03 15:08:02 +00:00
|
|
|
|
struct dive *dive;
|
2018-09-02 19:21:29 +00:00
|
|
|
|
const struct units *units = get_units();
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
const char *unit;
|
2019-01-03 09:03:12 +00:00
|
|
|
|
const char *ssrf;
|
2016-10-03 15:08:02 +00:00
|
|
|
|
int i;
|
|
|
|
|
bool need_pagebreak = false;
|
|
|
|
|
|
|
|
|
|
struct membuffer buf = {};
|
|
|
|
|
|
2019-01-03 09:03:12 +00:00
|
|
|
|
if (plain) {
|
|
|
|
|
ssrf = "";
|
|
|
|
|
put_format(&buf, "\\input subsurfacetemplate\n");
|
|
|
|
|
put_format(&buf, "%% This is a plain TeX file. Compile with pdftex, not pdflatex!\n");
|
|
|
|
|
put_format(&buf, "%% You will also need a subsurfacetemplate.tex in the current directory.\n");
|
|
|
|
|
} else {
|
|
|
|
|
ssrf = "ssrf";
|
2019-01-04 21:44:10 +00:00
|
|
|
|
put_format(&buf, "\\input subsurfacelatextemplate\n");
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "%% This is a plain LaTeX file. Compile with pdflatex, not pdftex!\n");
|
|
|
|
|
put_format(&buf, "%% You will also need a subsurfacelatextemplate.tex in the current directory.\n");
|
|
|
|
|
}
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
put_format(&buf, "%% You can download an example from http://www.atdotde.de/~robert/subsurfacetemplate\n%%\n");
|
|
|
|
|
put_format(&buf, "%%\n");
|
|
|
|
|
put_format(&buf, "%% Notes: TeX/LaTex will not render the degree symbol correctly by default. In LaTeX, you may\n");
|
|
|
|
|
put_format(&buf, "%% add the following line to the end of the preamble of your template to ensure correct output:\n");
|
|
|
|
|
put_format(&buf, "%% \\usepackage[utf8]{inputenc}\n");
|
|
|
|
|
put_format(&buf, "%% \\usepackage{gensymb}\n");
|
2017-08-08 06:32:05 +00:00
|
|
|
|
put_format(&buf, "%% \\DeclareUnicodeCharacter{00B0}{\\degree}\n"); //replaces ° with \degree
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
put_format(&buf, "%%\n");
|
|
|
|
|
|
|
|
|
|
/* Define text fields with the units used for export. These values are set in the Subsurface Preferences
|
|
|
|
|
* and the text fields created here are included in the data fields below.
|
|
|
|
|
*/
|
|
|
|
|
put_format(&buf, "\n%% These fields contain the units used in other fields below. They may be\n");
|
|
|
|
|
put_format(&buf, "%% referenced as needed in TeX templates.\n");
|
|
|
|
|
put_format(&buf, "%% \n");
|
|
|
|
|
put_format(&buf, "%% By default, Subsurface exports units of volume as \"ℓ\" and \"cuft\", which do\n");
|
|
|
|
|
put_format(&buf, "%% not render well in TeX/LaTeX. The code below substitutes \"L\" and \"ft$^{3}$\",\n");
|
|
|
|
|
put_format(&buf, "%% respectively. If you wish to display the original values, you may edit this\n");
|
|
|
|
|
put_format(&buf, "%% list and all calls to those units will be updated in your document.\n");
|
|
|
|
|
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sdepthunit{\\%sunit%s}", ssrf, ssrf, units->length == units::METERS ? "meter" : "ft");
|
|
|
|
|
put_format(&buf, "\\def\\%sweightunit{\\%sunit%s}",ssrf, ssrf, units->weight == units::KG ? "kg" : "lb");
|
|
|
|
|
put_format(&buf, "\\def\\%spressureunit{\\%sunit%s}", ssrf, ssrf, units->pressure == units::BAR ? "bar" : "psi");
|
2019-01-22 19:23:11 +00:00
|
|
|
|
put_format(&buf, "\\def\\%stemperatureunit{\\%sunit%s}", ssrf, ssrf, units->temperature == units::CELSIUS ? "centigrade" : "fahrenheit");
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%svolumeunit{\\%sunit%s}", ssrf, ssrf, units->volume == units::LITER ? "liter" : "cuft");
|
|
|
|
|
put_format(&buf, "\\def\\%sverticalspeedunit{\\%sunit%s}", ssrf, ssrf, units->length == units::METERS ? "meterpermin" : "ftpermin");
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
|
|
|
|
|
put_format(&buf, "\n%%%%%%%%%% Begin Dive Data: %%%%%%%%%%\n");
|
|
|
|
|
|
2016-10-03 15:08:02 +00:00
|
|
|
|
for_each_dive (i, dive) {
|
|
|
|
|
if (selected_only && !dive->selected)
|
|
|
|
|
continue;
|
|
|
|
|
|
2019-02-02 13:41:53 +00:00
|
|
|
|
saveProfile(dive, texdir.filePath(QString("profile%1.png").arg(dive->number)));
|
2016-10-03 15:08:02 +00:00
|
|
|
|
struct tm tm;
|
|
|
|
|
utc_mkdate(dive->when, &tm);
|
|
|
|
|
|
2018-10-26 15:03:54 +00:00
|
|
|
|
dive_site *site = dive->dive_site;
|
2016-10-19 18:56:01 +00:00
|
|
|
|
QRegExp ct("countrytag: (\\w+)");
|
|
|
|
|
QString country;
|
2019-10-27 11:28:57 +00:00
|
|
|
|
if (site && ct.indexIn(site->notes) >= 0)
|
2016-10-19 18:56:01 +00:00
|
|
|
|
country = ct.cap(1);
|
|
|
|
|
else
|
|
|
|
|
country = "";
|
2016-10-03 15:08:02 +00:00
|
|
|
|
|
|
|
|
|
pressure_t delta_p = {.mbar = 0};
|
|
|
|
|
|
|
|
|
|
QString star = "*";
|
|
|
|
|
QString viz = star.repeated(dive->visibility);
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
QString rating = star.repeated(dive->rating);
|
2016-10-03 15:08:02 +00:00
|
|
|
|
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
int i;
|
|
|
|
|
int qty_cyl;
|
|
|
|
|
int qty_weight;
|
Unify float calulations: use double
Internal floating point (FP) calculations should be performed using double
unless there is a very good reason. This avoids headaches with conversions.
Indeed, the vast majority of FP calculations were already done using double.
This patch adapts most remaining calculations. Not converted where things
that were based on binary representations and variables which weren't used
anyway.
An analysis of all instances follows:
core/plannernotes.c, l.404:
This was a comparison between two floats. On the left side, first an integer
was cast to float then multiplied with and integer and divided by a constant
double. The right hand side was an integer cast to a float. Simply divide by
1000.0 first to convert to double and continue with calculations. On the right
hand side, remove the cast, because the integer will be implicitely cast to
double for comparison. This conversion actually emits less instructions,
because no conversion to double and back is performed.
core/planner.c, l.613:
Same analysis as previous case.
subsurface-desktop-main.cpp, l.155:
A local variable representing the version OpenGL version. Turn this into
integer logic. Not only does this avoid dreaded FP rounding issues, it also
works correctly for minor version > 10 (not that such a thing is to be
expected anytime soon).
abstractpreferenceswidget.[h/cpp]:
A widget where the position is described as a float. Turn into double.
desktop-widgets/divelogexportdialog.cpp, l.313:
total_weight is described as float. Use double arithmetics instead. This
instance fixes a truncation warning emitted by gcc.
2017-11-20 20:39:50 +00:00
|
|
|
|
double total_weight;
|
2016-10-03 15:08:02 +00:00
|
|
|
|
|
2019-01-04 21:44:10 +00:00
|
|
|
|
if (need_pagebreak) {
|
|
|
|
|
if (plain)
|
|
|
|
|
put_format(&buf, "\\vfill\\eject\n");
|
2019-01-03 09:03:12 +00:00
|
|
|
|
|
2019-01-04 21:44:10 +00:00
|
|
|
|
else
|
|
|
|
|
put_format(&buf, "\\newpage\n");
|
|
|
|
|
}
|
2016-10-03 15:08:02 +00:00
|
|
|
|
need_pagebreak = true;
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
put_format(&buf, "\n%% Time, Date, and location:\n");
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sdate{%04u-%02u-%02u}\n", ssrf,
|
2016-10-03 15:08:02 +00:00
|
|
|
|
tm.tm_year, tm.tm_mon+1, tm.tm_mday);
|
2019-01-04 21:52:35 +00:00
|
|
|
|
put_format(&buf, "\\def\\%shour{%02u}\n", ssrf, tm.tm_hour);
|
|
|
|
|
put_format(&buf, "\\def\\%sminute{%02u}\n", ssrf, tm.tm_min);
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%snumber{%d}\n", ssrf, dive->number);
|
|
|
|
|
put_format(&buf, "\\def\\%splace{%s}\n", ssrf, site ? site->name : "");
|
|
|
|
|
put_format(&buf, "\\def\\%sspot{}\n", ssrf);
|
|
|
|
|
put_format(&buf, "\\def\\%ssitename{%s}\n", ssrf, site ? site->name : "");
|
|
|
|
|
site ? put_format(&buf, "\\def\\%sgpslat{%f}\n", ssrf, site->location.lat.udeg / 1000000.0) : put_format(&buf, "\\def\\%sgpslat{}\n", ssrf);
|
|
|
|
|
site ? put_format(&buf, "\\def\\%sgpslon{%f}\n", ssrf, site->location.lon.udeg / 1000000.0) : put_format(&buf, "\\def\\gpslon{}\n");
|
|
|
|
|
put_format(&buf, "\\def\\%scomputer{%s}\n", ssrf, dive->dc.model);
|
|
|
|
|
put_format(&buf, "\\def\\%scountry{%s}\n", ssrf, qPrintable(country));
|
|
|
|
|
put_format(&buf, "\\def\\%stime{%u:%02u}\n", ssrf, FRACTION(dive->duration.seconds, 60));
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
|
|
|
|
|
put_format(&buf, "\n%% Dive Profile Details:\n");
|
2019-01-03 09:03:12 +00:00
|
|
|
|
dive->maxtemp.mkelvin ? put_format(&buf, "\\def\\%smaxtemp{%.1f\\%stemperatureunit}\n", ssrf, get_temp_units(dive->maxtemp.mkelvin, &unit), ssrf) : put_format(&buf, "\\def\\%smaxtemp{}\n", ssrf);
|
|
|
|
|
dive->mintemp.mkelvin ? put_format(&buf, "\\def\\%smintemp{%.1f\\%stemperatureunit}\n", ssrf, get_temp_units(dive->mintemp.mkelvin, &unit), ssrf) : put_format(&buf, "\\def\\%ssrfmintemp{}\n", ssrf);
|
|
|
|
|
dive->watertemp.mkelvin ? put_format(&buf, "\\def\\%swatertemp{%.1f\\%stemperatureunit}\n", ssrf, get_temp_units(dive->watertemp.mkelvin, &unit), ssrf) : put_format(&buf, "\\def\\%swatertemp{}\n", ssrf);
|
|
|
|
|
dive->airtemp.mkelvin ? put_format(&buf, "\\def\\%sairtemp{%.1f\\%stemperatureunit}\n", ssrf, get_temp_units(dive->airtemp.mkelvin, &unit), ssrf) : put_format(&buf, "\\def\\%sairtemp{}\n", ssrf);
|
|
|
|
|
dive->maxdepth.mm ? put_format(&buf, "\\def\\%smaximumdepth{%.1f\\%sdepthunit}\n", ssrf, get_depth_units(dive->maxdepth.mm, NULL, &unit), ssrf) : put_format(&buf, "\\def\\%smaximumdepth{}\n", ssrf);
|
|
|
|
|
dive->meandepth.mm ? put_format(&buf, "\\def\\%smeandepth{%.1f\\%sdepthunit}\n", ssrf, get_depth_units(dive->meandepth.mm, NULL, &unit), ssrf) : put_format(&buf, "\\def\\%smeandepth{}\n", ssrf);
|
|
|
|
|
|
2019-01-04 22:04:36 +00:00
|
|
|
|
struct tag_entry *tag = dive->tag_list;
|
|
|
|
|
QString tags;
|
|
|
|
|
if (tag) {
|
|
|
|
|
tags = tag->tag->name;
|
|
|
|
|
while ((tag = tag->next))
|
|
|
|
|
tags += QString(", ") + QString(tag->tag->name);
|
|
|
|
|
}
|
|
|
|
|
put_format(&buf, "\\def\\%stype{%s}\n", ssrf, qPrintable(tags));
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sviz{%s}\n", ssrf, qPrintable(viz));
|
|
|
|
|
put_format(&buf, "\\def\\%srating{%s}\n", ssrf, qPrintable(rating));
|
|
|
|
|
put_format(&buf, "\\def\\%splot{\\includegraphics[width=9cm,height=4cm]{profile%d}}\n", ssrf, dive->number);
|
2019-01-21 15:00:02 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sprofilename{profile%d}\n", ssrf, dive->number);
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%scomment{%s}\n", ssrf, dive->notes ? dive->notes : "");
|
|
|
|
|
put_format(&buf, "\\def\\%sbuddy{%s}\n", ssrf, dive->buddy ? dive->buddy : "");
|
|
|
|
|
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->divemaster ? dive->divemaster : "");
|
|
|
|
|
put_format(&buf, "\\def\\%ssuit{%s}\n", ssrf, dive->suit ? dive->suit : "");
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
|
2017-08-08 06:32:05 +00:00
|
|
|
|
// Print cylinder data
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
put_format(&buf, "\n%% Gas use information:\n");
|
|
|
|
|
qty_cyl = 0;
|
2019-08-04 16:44:57 +00:00
|
|
|
|
for (i = 0; i < dive->cylinders.nr; i++){
|
2019-08-04 20:13:49 +00:00
|
|
|
|
const cylinder_t &cyl = *get_cylinder(dive, i);
|
2019-08-04 16:44:57 +00:00
|
|
|
|
if (is_cylinder_used(dive, i) || (prefs.display_unused_tanks && cyl.type.description)){
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cdescription{%s}\n", ssrf, 'a' + i, cyl.type.description);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cgasname{%s}\n", ssrf, 'a' + i, gasname(cyl.gasmix));
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cmixO2{%.1f\\%%}\n", ssrf, 'a' + i, get_o2(cyl.gasmix)/10.0);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cmixHe{%.1f\\%%}\n", ssrf, 'a' + i, get_he(cyl.gasmix)/10.0);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cmixN2{%.1f\\%%}\n", ssrf, 'a' + i, (100.0 - (get_o2(cyl.gasmix)/10.0) - (get_he(cyl.gasmix)/10.0)));
|
|
|
|
|
delta_p.mbar += cyl.start.mbar - cyl.end.mbar;
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cstartpress{%.1f\\%spressureunit}\n", ssrf, 'a' + i, get_pressure_units(cyl.start.mbar, &unit)/1.0, ssrf);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cendpress{%.1f\\%spressureunit}\n", ssrf, 'a' + i, get_pressure_units(cyl.end.mbar, &unit)/1.0, ssrf);
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
qty_cyl += 1;
|
2017-08-08 06:32:05 +00:00
|
|
|
|
} else {
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%scyl%cdescription{}\n", ssrf, 'a' + i);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cgasname{}\n", ssrf, 'a' + i);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cmixO2{}\n", ssrf, 'a' + i);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cmixHe{}\n", ssrf, 'a' + i);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cmixN2{}\n", ssrf, 'a' + i);
|
2019-08-04 16:44:57 +00:00
|
|
|
|
delta_p.mbar += cyl.start.mbar - cyl.end.mbar;
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%scyl%cstartpress{}\n", ssrf, 'a' + i);
|
|
|
|
|
put_format(&buf, "\\def\\%scyl%cendpress{}\n", ssrf, 'a' + i);
|
2017-08-08 06:32:05 +00:00
|
|
|
|
qty_cyl += 1;
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sqtycyl{%d}\n", ssrf, qty_cyl);
|
|
|
|
|
put_format(&buf, "\\def\\%sgasuse{%.1f\\%spressureunit}\n", ssrf, get_pressure_units(delta_p.mbar, &unit)/1.0, ssrf);
|
|
|
|
|
put_format(&buf, "\\def\\%ssac{%.2f\\%svolumeunit/min}\n", ssrf, get_volume_units(dive->sac, NULL, &unit), ssrf);
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
|
|
|
|
|
//Code block prints all weights listed in dive.
|
|
|
|
|
put_format(&buf, "\n%% Weighting information:\n");
|
|
|
|
|
qty_weight = 0;
|
|
|
|
|
total_weight = 0;
|
2019-06-26 15:21:03 +00:00
|
|
|
|
for (i = 0; i < dive->weightsystems.nr; i++) {
|
|
|
|
|
weightsystem_t w = dive->weightsystems.weightsystems[i];
|
|
|
|
|
put_format(&buf, "\\def\\%sweight%ctype{%s}\n", ssrf, 'a' + i, w.description);
|
|
|
|
|
put_format(&buf, "\\def\\%sweight%camt{%.3f\\%sweightunit}\n", ssrf, 'a' + i, get_weight_units(w.weight.grams, NULL, &unit), ssrf);
|
|
|
|
|
qty_weight += 1;
|
|
|
|
|
total_weight += get_weight_units(w.weight.grams, NULL, &unit);
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
}
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sqtyweights{%d}\n", ssrf, qty_weight);
|
|
|
|
|
put_format(&buf, "\\def\\%stotalweight{%.2f\\%sweightunit}\n", ssrf, total_weight, ssrf);
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
unit = "";
|
|
|
|
|
|
2017-08-08 06:32:05 +00:00
|
|
|
|
// Legacy fields
|
2019-01-03 09:03:12 +00:00
|
|
|
|
put_format(&buf, "\\def\\%sspot{}\n", ssrf);
|
|
|
|
|
put_format(&buf, "\\def\\%sentrance{}\n", ssrf);
|
|
|
|
|
put_format(&buf, "\\def\\%splace{%s}\n", ssrf, site ? site->name : "");
|
|
|
|
|
dive->maxdepth.mm ? put_format(&buf, "\\def\\%sdepth{%.1f\\%sdepthunit}\n", ssrf, get_depth_units(dive->maxdepth.mm, NULL, &unit), ssrf) : put_format(&buf, "\\def\\%sdepth{}\n", ssrf);
|
Add additional data to TeX-export
The purpose of this work is to allow for generation of more complete log
pages using TeX/LaTeX.
Previously, the exporting to TeX generated a document that contained
very limited information about the dive. For example: the only details
reported about air consumption were delta pressure and SAC. In addition
no data was reported about what equipment (weights, tanks, suit) was
used.
Per feedback, code was updated to use helper functions, and now exports
data with the units set by the user in the Subsurface preferences. Some
characters (Degree symbol) do not render correctly by default in LaTeX,
so sample code to address this was included in the top comments. Volume
units do not export an ideal character string, so another string was
substituted.
This update adds the following information:
* GPS Location
* Dive computer used
* Max, Min, Air, and Water Temperatures
* Average depth
* Number of cylinders listed, mix, and start/end pressure for each
* Total weight used, and the description and quantity of each weight
* Dive rating (previously, only visibility was reported)
* Buddy
* Dive master
* Suit
This update moved several fields that had no output or had unexpected
names (i.e. "spot", "place") into a "Deprecated section"
Future work:
* The export currently only includes the first entry in the tag list.
* Future versions should export all tags.
* Ideally, this would export a screenshot of the dive location.
* Create a table of correct size for weights and cylinders.
* It would be nice to have a bit more control over the generation of
profile images, but that may be beyond me.
Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-08-06 17:22:04 +00:00
|
|
|
|
|
2019-01-04 21:44:10 +00:00
|
|
|
|
put_format(&buf, "\\%spage\n", ssrf);
|
|
|
|
|
|
2016-10-03 15:08:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-03 09:03:12 +00:00
|
|
|
|
if (plain)
|
|
|
|
|
put_format(&buf, "\\bye\n");
|
|
|
|
|
else
|
2019-01-04 21:44:10 +00:00
|
|
|
|
put_format(&buf, "\\end{document}\n");
|
2016-10-03 15:08:02 +00:00
|
|
|
|
|
|
|
|
|
f = subsurface_fopen(filename, "w+");
|
|
|
|
|
if (!f) {
|
2018-02-25 12:51:41 +00:00
|
|
|
|
report_error(qPrintable(tr("Can't open file %s")), filename);
|
2016-10-03 15:08:02 +00:00
|
|
|
|
} else {
|
|
|
|
|
flush_buffer(&buf, f); /*check for writing errors? */
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
free_buffer(&buf);
|
|
|
|
|
}
|