Format name and creator

This commit is contained in:
Norbert Renner 2021-03-19 12:22:20 +01:00
parent da9ffd9224
commit 265583e0c5
6 changed files with 12 additions and 4 deletions

View file

@ -46,13 +46,14 @@ BR.Export = L.Class.extend({
_export: function (e) {
var exportForm = document.forms['export'];
var format = exportForm['format'].value || $('#export-format input:radio:checked').val();
var name = encodeURIComponent(exportForm['trackname'].value);
var name = exportForm['trackname'].value;
var nameUri = encodeURIComponent(name);
var includeWaypoints = exportForm['include-waypoints'].checked;
e.preventDefault();
if (true) {
var uri = this.router.getUrl(this.latLngs, this.pois.getMarkers(), null, format, name, includeWaypoints);
var uri = this.router.getUrl(this.latLngs, this.pois.getMarkers(), null, format, nameUri, includeWaypoints);
// var evt = document.createEvent('MouseEvents');
// evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
@ -69,6 +70,9 @@ BR.Export = L.Class.extend({
_formatTrack: function (format, name, includeWaypoints) {
const track = BR.Export._concatTotalTrack(this.segments);
if (name) {
track.features[0].properties.name = name;
}
this._addPois(track);
if (includeWaypoints) {
this._addRouteWaypoints(track);

View file

@ -49,6 +49,7 @@ BR.Gpx = {
const gpxTransform = new GpxTransform(voiceHintsTransform);
let gpx = togpx(geoJson, {
creator: 'BRouter-Web ' + BR.version,
featureTitle: function () {},
featureDescription: function () {},
featureCoordTimes: function () {},

View file

@ -95,7 +95,7 @@ BR.Diff.diffPrettyHtml = function (diffs, contextLen = 2) {
// TODO remove
// copied from Gpx.test.js
BR.Diff.adoptGpx = function (gpx, replaceCreator = true) {
const creator = 'togpx';
const creator = 'BRouter-Web 0.15.1';
const name = 'Track';
const newline = '\n';