Use urls option in igc example

This commit is contained in:
Tom Payne
2014-01-02 22:41:21 +01:00
parent 699cfb3e31
commit d25ee8df0a

View File

@@ -2,27 +2,17 @@ goog.require('ol.Attribution');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.RendererHint'); goog.require('ol.RendererHint');
goog.require('ol.View2D'); goog.require('ol.View2D');
goog.require('ol.format.IGC');
goog.require('ol.geom.LineString'); goog.require('ol.geom.LineString');
goog.require('ol.geom.Point'); goog.require('ol.geom.Point');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector'); goog.require('ol.layer.Vector');
goog.require('ol.proj'); goog.require('ol.source.IGC');
goog.require('ol.source.OSM'); goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
goog.require('ol.style.Circle'); goog.require('ol.style.Circle');
goog.require('ol.style.Stroke'); goog.require('ol.style.Stroke');
goog.require('ol.style.Style'); goog.require('ol.style.Style');
var tracklogs = [
'data/igc/Clement-Latour.igc',
'data/igc/Damien-de-Baenst.igc',
'data/igc/Sylvain-Dhonneur.igc',
'data/igc/Tom-Payne.igc',
'data/igc/Ulrich-Prinz.igc'
];
var colors = { var colors = {
'Clement Latour': 'rgba(0, 0, 255, 0.7)', 'Clement Latour': 'rgba(0, 0, 255, 0.7)',
'Damien de Baesnt': 'rgba(0, 215, 255, 0.7)', 'Damien de Baesnt': 'rgba(0, 215, 255, 0.7)',
@@ -47,7 +37,15 @@ var styleFunction = function(feature, resolution) {
return styleArray; return styleArray;
}; };
var vectorSource = new ol.source.Vector(); var vectorSource = new ol.source.IGC({
urls: [
'data/igc/Clement-Latour.igc',
'data/igc/Damien-de-Baenst.igc',
'data/igc/Sylvain-Dhonneur.igc',
'data/igc/Tom-Payne.igc',
'data/igc/Ulrich-Prinz.igc'
]
});
var map = new ol.Map({ var map = new ol.Map({
layers: [ layers: [
@@ -77,18 +75,6 @@ var map = new ol.Map({
}); });
var transform = ol.proj.getTransform('EPSG:4326', 'EPSG:3857');
var i, ii;
for (i = 0, ii = tracklogs.length; i < ii; ++i) {
$.get(tracklogs[i], function(data) {
var format = new ol.format.IGC();
var feature = format.readFeature(data);
feature.getGeometry().transform(transform);
vectorSource.addFeature(feature);
});
}
var point = null; var point = null;
var line = null; var line = null;
var displaySnap = function(coordinate) { var displaySnap = function(coordinate) {