Transformed
This commit is contained in:
+37
-37
@@ -1,18 +1,18 @@
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.control');
|
||||
goog.require('ol.format.IGC');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.source.OSM');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Circle');
|
||||
goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_format_IGC_ from '../src/ol/format/IGC.js';
|
||||
import _ol_geom_LineString_ from '../src/ol/geom/LineString.js';
|
||||
import _ol_geom_Point_ from '../src/ol/geom/Point.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
import _ol_source_Vector_ from '../src/ol/source/Vector.js';
|
||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||
import _ol_style_Fill_ from '../src/ol/style/Fill.js';
|
||||
import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
|
||||
import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
|
||||
|
||||
var colors = {
|
||||
@@ -28,8 +28,8 @@ var styleFunction = function(feature) {
|
||||
var color = colors[feature.get('PLT')];
|
||||
var style = styleCache[color];
|
||||
if (!style) {
|
||||
style = new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
style = new _ol_style_Style_({
|
||||
stroke: new _ol_style_Stroke_({
|
||||
color: color,
|
||||
width: 3
|
||||
})
|
||||
@@ -39,7 +39,7 @@ var styleFunction = function(feature) {
|
||||
return style;
|
||||
};
|
||||
|
||||
var vectorSource = new ol.source.Vector();
|
||||
var vectorSource = new _ol_source_Vector_();
|
||||
|
||||
var igcUrls = [
|
||||
'data/igc/Clement-Latour.igc',
|
||||
@@ -58,7 +58,7 @@ function get(url, callback) {
|
||||
client.send();
|
||||
}
|
||||
|
||||
var igcFormat = new ol.format.IGC();
|
||||
var igcFormat = new _ol_format_IGC_();
|
||||
for (var i = 0; i < igcUrls.length; ++i) {
|
||||
get(igcUrls[i], function(data) {
|
||||
var features = igcFormat.readFeatures(data,
|
||||
@@ -80,30 +80,30 @@ vectorSource.on('addfeature', function(event) {
|
||||
});
|
||||
|
||||
|
||||
var map = new ol.Map({
|
||||
var map = new _ol_Map_({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.OSM({
|
||||
new _ol_layer_Tile_({
|
||||
source: new _ol_source_OSM_({
|
||||
attributions: [
|
||||
'All maps © <a href="https://www.opencyclemap.org/">OpenCycleMap</a>',
|
||||
ol.source.OSM.ATTRIBUTION
|
||||
_ol_source_OSM_.ATTRIBUTION
|
||||
],
|
||||
url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' +
|
||||
'?apikey=0e6fc415256d4fbb9b5166a718591d71'
|
||||
})
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
new _ol_layer_Vector_({
|
||||
source: vectorSource,
|
||||
style: styleFunction
|
||||
})
|
||||
],
|
||||
target: 'map',
|
||||
controls: ol.control.defaults({
|
||||
controls: _ol_control_.defaults({
|
||||
attributionOptions: {
|
||||
collapsible: false
|
||||
}
|
||||
}),
|
||||
view: new ol.View({
|
||||
view: new _ol_View_({
|
||||
center: [703365.7089403362, 5714629.865071137],
|
||||
zoom: 9
|
||||
})
|
||||
@@ -123,7 +123,7 @@ var displaySnap = function(coordinate) {
|
||||
var geometry = closestFeature.getGeometry();
|
||||
var closestPoint = geometry.getClosestPoint(coordinate);
|
||||
if (point === null) {
|
||||
point = new ol.geom.Point(closestPoint);
|
||||
point = new _ol_geom_Point_(closestPoint);
|
||||
} else {
|
||||
point.setCoordinates(closestPoint);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ var displaySnap = function(coordinate) {
|
||||
closestFeature.get('PLT') + ' (' + date.toUTCString() + ')';
|
||||
var coordinates = [coordinate, [closestPoint[0], closestPoint[1]]];
|
||||
if (line === null) {
|
||||
line = new ol.geom.LineString(coordinates);
|
||||
line = new _ol_geom_LineString_(coordinates);
|
||||
} else {
|
||||
line.setCoordinates(coordinates);
|
||||
}
|
||||
@@ -152,13 +152,13 @@ map.on('click', function(evt) {
|
||||
displaySnap(evt.coordinate);
|
||||
});
|
||||
|
||||
var stroke = new ol.style.Stroke({
|
||||
var stroke = new _ol_style_Stroke_({
|
||||
color: 'rgba(255,0,0,0.9)',
|
||||
width: 1
|
||||
});
|
||||
var style = new ol.style.Style({
|
||||
var style = new _ol_style_Style_({
|
||||
stroke: stroke,
|
||||
image: new ol.style.Circle({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: 5,
|
||||
fill: null,
|
||||
stroke: stroke
|
||||
@@ -175,13 +175,13 @@ map.on('postcompose', function(evt) {
|
||||
}
|
||||
});
|
||||
|
||||
var featureOverlay = new ol.layer.Vector({
|
||||
source: new ol.source.Vector(),
|
||||
var featureOverlay = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_(),
|
||||
map: map,
|
||||
style: new ol.style.Style({
|
||||
image: new ol.style.Circle({
|
||||
style: new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: 5,
|
||||
fill: new ol.style.Fill({
|
||||
fill: new _ol_style_Fill_({
|
||||
color: 'rgba(255,0,0,0.9)'
|
||||
})
|
||||
})
|
||||
@@ -196,7 +196,7 @@ document.getElementById('time').addEventListener('input', function() {
|
||||
var coordinate = geometry.getCoordinateAtM(m, true);
|
||||
var highlight = feature.get('highlight');
|
||||
if (highlight === undefined) {
|
||||
highlight = new ol.Feature(new ol.geom.Point(coordinate));
|
||||
highlight = new _ol_Feature_(new _ol_geom_Point_(coordinate));
|
||||
feature.set('highlight', highlight);
|
||||
featureOverlay.getSource().addFeature(highlight);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user