Skip to content

Commit

Permalink
Merge pull request #23 from Wilkins/master
Browse files Browse the repository at this point in the history
Fixing issues #10 and #21
  • Loading branch information
Wilkins authored Mar 17, 2017
2 parents 12ea9fa + a52ec41 commit a9d0346
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ css/.sass-cache
*.swp
.grunt
_SpecRunner.html
TODO.md
21 changes: 5 additions & 16 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ grunt.initConfig({
console: true,
module: true
},
"-W099": true, //ignora tabs e space warning
"-W099": true, //ignora tabs and spaces warning
"-W033": true,
"-W044": true //ignore regexp
},
Expand All @@ -31,7 +31,6 @@ grunt.initConfig({
dist: {
files: {
'dist/jquery.cookie.min.js': ['vendor/jquery-cookie/jquery.cookie.js'],
//'dist/L.Control.Sidebar.min.js': ['vendor/leaflet-sidebar/src/L.Control.Sidebar.js'],
'dist/togeojson.min.js': ['vendor/togeojson/togeojson.js'],
'dist/togpx.min.js': ['vendor/togpx/togpx.js'],
'dist/pretty-data.min.js': ['vendor/pretty-data/index.js'],
Expand Down Expand Up @@ -73,7 +72,7 @@ grunt.initConfig({
'vendor/bootstrap-slider/dist/bootstrap-slider.min.js',
'vendor/jquery-autocomplete/dist/jquery.autocomplete.min.js',
'dist/i18next.min.js',
'dist/gpx-parse.min.js',
'dist/gpx-parse.min.js'
],
dest: 'dist/libs.min.js'
},
Expand Down Expand Up @@ -127,21 +126,11 @@ grunt.initConfig({
options: {
vendor: [
'http://code.jquery.com/jquery-1.8.3.min.js',
// Here we use the non minified source
// Here we use the non minified source to help debugging
'http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js',
'vendor/simplify-geometry/simplifygeometry-0.0.1.min.js',
'dist/jquery.cookie.min.js',
'dist/togeojson.min.js',
'dist/togpx.min.js',
'dist/pretty-data.min.js',
'dist/tokml.min.js',
'dist/geojson-to-path.min.js',
'dist/leaflet.filelayer.min.js',
'dist/FileSaver.min.js',
'dist/i18next.min.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
'dist/libs.min.js',
'dist/i18n.min.js',
'dist/gpx-parse.min.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js'
],
specs: 'tests/*.js',
keepRunner : false,
Expand Down
4 changes: 2 additions & 2 deletions dist/app.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/i18n.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/formats/gpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ function gpxParser(content, format) {
console.log("This GPX file has no tracks. It may be a route... Can not load as true GPX file.");
parsedGPX = convertToGeoJSON(content);
} else {
//console.log('Lecture data GPX ok : '+data.tracks.length);
for (trackNum = 0; trackNum<data.tracks.length; trackNum++) {
var track = data.tracks[trackNum];
for (segmentNum = 0; segmentNum<track.segments.length; segmentNum++) {
var segment = track.segments[segmentNum];
for (pointNum = 0; pointNum<segment.length; pointNum++) {
var point = segment[pointNum];
RAW_DATA[point.lat+','+point.lon] = point;
//console.log("RAW_DATA["+point.lat+','+point.lon+"] = "+pointNum);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/i18n.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$.i18n.init({
//lng: 'en',
ns: { namespaces: [ 'ns.special'], defaultNs: 'ns.special'},
useLocalStorage: false,
// We load in synchronous mode to be able to build the page with i18n text
getAsync: false,
lng: 'en',
fallbackLng: 'en',
debug: false
}, function(t) {
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var map = new L.Map('map', {
zoomControl: false,
attributionControl: false
})
.setView(L.latLng(40,0), 2)
.setView(L.latLng(41.9,12.5),3)
.on('click', hideAll);

// For Debugging
Expand Down
16 changes: 16 additions & 0 deletions tests/fixtures/testcase5-gpx-with-time-data2-optimization-1.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions tests/fixtures/testcase5-gpx-with-time-data2-optimization0.1.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions tests/fixtures/testcase5-gpx-with-time-data2-optimization0.json

Large diffs are not rendered by default.

27 changes: 25 additions & 2 deletions tests/formatsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("Testing fixtures conversion", function() {
window.map = L.map('map');
window.map.hasLayer = function() { return true; }

/*
describe('Checking fixture 1 (optimization -1)', function() {
checkFormatFixture('testcase1-classic-geojson-optimization-1.json');
});
Expand Down Expand Up @@ -78,6 +79,28 @@ describe("Testing fixtures conversion", function() {
describe('Checking fixture 4 (optimization 0.5)', function() {
checkFormatFixture('testcase4-gpx-with-time-data-optimization0.5.json', gpxParser);
});
*/

/*
*/
describe('Checking fixture 5 (optimization -1)', function() {
checkFormatFixture('testcase5-gpx-with-time-data2-optimization-1.json', gpxParser);
});
describe('Checking fixture 5 (optimization 0)', function() {
checkFormatFixture('testcase5-gpx-with-time-data2-optimization0.json', gpxParser);
});
describe('Checking fixture 5 (optimization 0.0005)', function() {
checkFormatFixture('testcase5-gpx-with-time-data2-optimization0.0005.json', gpxParser);
});
describe('Checking fixture 5 (optimization 0.001)', function() {
checkFormatFixture('testcase5-gpx-with-time-data2-optimization0.001.json', gpxParser);
});
describe('Checking fixture 5 (optimization 0.005)', function() {
checkFormatFixture('testcase5-gpx-with-time-data2-optimization0.005.json', gpxParser);
});
describe('Checking fixture 5 (optimization 0.1)', function() {
checkFormatFixture('testcase5-gpx-with-time-data2-optimization0.1.json', gpxParser);
});
});

function checkFormatFixture(file, parser) {
Expand All @@ -102,7 +125,6 @@ function checkFormatFixture(file, parser) {
it('Converts GeoJSON to GPX with correct estimated size', function() {
checkSizePrecision(gpx, fixture.gpx, counters, Layer);
});

it('Converts GeoJSON to Mediawiki properly', function() {
checkExportFormat(mediawiki, Layer, fixture.mediawiki);
});
Expand All @@ -116,13 +138,14 @@ function checkFormatFixture(file, parser) {
it('Converts GeoJSON to KML with correct estimated size', function() {
checkSizePrecision(kml, fixture.kml, counters, Layer);
});

it('Converts GeoJSON to GeoJSON properly', function() {
checkExportFormat(geojson, Layer, fixture.geojson);
});
it('Converts GeoJSON to GeoJSON with correct estimated size', function() {
checkSizePrecision(geojson, fixture.geojson, counters, Layer);
});
/*
*/
}

/**
Expand Down
2 changes: 1 addition & 1 deletion vendor/Leaflet.FileLayer
2 changes: 1 addition & 1 deletion vendor/togpx
Submodule togpx updated 6 files
+4 −0 CHANGELOG.md
+4 −4 README.md
+44 −9 index.js
+1 −1 package.json
+95 −1 test/test.js
+48 −13 togpx.js

0 comments on commit a9d0346

Please sign in to comment.