2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
examples/Jugl.js
|
||||
examples/resources/
|
||||
@@ -1,5 +1,4 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
@@ -14,7 +13,6 @@ env:
|
||||
|
||||
before_install:
|
||||
- "npm prune"
|
||||
- "sudo pip install -r requirements.txt"
|
||||
|
||||
before_script:
|
||||
- "rm src/ol/renderer/webgl/*shader.js"
|
||||
|
||||
@@ -26,10 +26,10 @@ The minimum requirements are:
|
||||
* GNU Make
|
||||
* Git
|
||||
* [Node.js](http://nodejs.org/) (0.10.x or higher)
|
||||
* Python 2.6 or 2.7 with a couple of extra modules (see below)
|
||||
* Python 2.6 or 2.7
|
||||
* Java 7 (JRE and JDK)
|
||||
|
||||
The executables `git`, `node`, `python` and `java` should be in your `PATH`.
|
||||
The executables `git`, `node`, and `java` should be in your `PATH`.
|
||||
|
||||
You can check your configuration by running:
|
||||
|
||||
@@ -39,17 +39,6 @@ To install the Node.js dependencies run
|
||||
|
||||
$ npm install
|
||||
|
||||
To install the extra Python modules, run:
|
||||
|
||||
$ sudo pip install -r requirements.txt
|
||||
or
|
||||
|
||||
$ cat requirements.txt | sudo xargs easy_install
|
||||
|
||||
depending on your OS and Python installation.
|
||||
|
||||
(You can also install the Python modules in a Python virtual environment if you want to.)
|
||||
|
||||
## Working with the build tool
|
||||
|
||||
As an ol3 developer you will use `make` to run build targets defined in the
|
||||
|
||||
19
Makefile
19
Makefile
@@ -93,8 +93,7 @@ compile-examples: build/compiled-examples/all.combined.js
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f build/timestamps/gjslint-timestamp
|
||||
rm -f build/timestamps/jshint-timestamp
|
||||
rm -f build/timestamps/eslint-timestamp
|
||||
rm -f build/timestamps/check-*-timestamp
|
||||
rm -f build/ol.css
|
||||
rm -f build/ol.js
|
||||
@@ -120,7 +119,7 @@ examples: $(BUILD_EXAMPLES)
|
||||
install: build/timestamps/node-modules-timestamp
|
||||
|
||||
.PHONY: lint
|
||||
lint: build/timestamps/gjslint-timestamp build/timestamps/jshint-timestamp \
|
||||
lint: build/timestamps/eslint-timestamp \
|
||||
build/timestamps/check-requires-timestamp \
|
||||
build/timestamps/check-whitespace-timestamp
|
||||
|
||||
@@ -231,13 +230,6 @@ build/timestamps/jsdoc-$(BRANCH)-timestamp: config/jsdoc/api/index.md \
|
||||
./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d $(BUILD_HOSTED)/apidoc
|
||||
@touch $@
|
||||
|
||||
build/timestamps/gjslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
$(EXAMPLES_JS)
|
||||
@mkdir -p $(@D)
|
||||
@echo "Running gjslint..."
|
||||
@gjslint --jslint_error=all --custom_jsdoc_tags=event,fires,function,classdesc,api,observable --strict $?
|
||||
@touch $@
|
||||
|
||||
$(BUILD_HOSTED_EXAMPLES_JS): $(BUILD_HOSTED)/examples/%.js: build/examples/%.js
|
||||
@mkdir -p $(@D)
|
||||
@python bin/split-example.py $< $(@D)
|
||||
@@ -271,13 +263,12 @@ $(BUILD_HOSTED)/build/ol-deps.js: host-libraries
|
||||
--root_with_prefix "$(BUILD_HOSTED)/closure-library/third_party ../../third_party" \
|
||||
--output_file $@
|
||||
|
||||
build/timestamps/jshint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
|
||||
$(TASKS_JS) $(EXAMPLES_JS) \
|
||||
examples/resources/common.js \
|
||||
build/timestamps/node-modules-timestamp
|
||||
@mkdir -p $(@D)
|
||||
@echo "Running jshint..."
|
||||
@./node_modules/.bin/jshint --verbose $?
|
||||
@echo "Running eslint..."
|
||||
@./node_modules/.bin/eslint $?
|
||||
@touch $@
|
||||
|
||||
build/timestamps/node-modules-timestamp: package.json
|
||||
|
||||
17
examples/.eslintrc
Normal file
17
examples/.eslintrc
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"globals": {
|
||||
"FastClick": false,
|
||||
"$": false,
|
||||
"arc": false,
|
||||
"common": false,
|
||||
"createMapboxStreetsV6Style": false,
|
||||
"d3": false,
|
||||
"jsPDF": false,
|
||||
"jsts": false,
|
||||
"topojson": false,
|
||||
"turf": false
|
||||
},
|
||||
"rules": {
|
||||
"no-unused-vars": [2, {"varsIgnorePattern": "^map"}]
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ var map = new ol.Map({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
controls: ol.control.defaults({ attribution: false }).extend([attribution]),
|
||||
controls: ol.control.defaults({attribution: false}).extend([attribution]),
|
||||
renderer: common.getRendererFromQueryString(),
|
||||
target: 'map',
|
||||
view: new ol.View({
|
||||
|
||||
@@ -85,8 +85,13 @@ var map = new ol.Map({
|
||||
})
|
||||
});
|
||||
|
||||
// Get the form elements and bind the listeners
|
||||
var select = document.getElementById('blend-mode');
|
||||
var affectRed = document.getElementById('affect-red');
|
||||
var affectGreen = document.getElementById('affect-green');
|
||||
var affectBlue = document.getElementById('affect-blue');
|
||||
|
||||
|
||||
// Various helper methods and event handlers
|
||||
/**
|
||||
* This method sets the globalCompositeOperation to the value of the select
|
||||
* field and it is bound to the precompose event of the layers.
|
||||
@@ -154,12 +159,6 @@ var affectLayerClicked = function() {
|
||||
};
|
||||
|
||||
|
||||
// Get the form elements and bind the listeners
|
||||
var select = document.getElementById('blend-mode');
|
||||
var affectRed = document.getElementById('affect-red');
|
||||
var affectGreen = document.getElementById('affect-green');
|
||||
var affectBlue = document.getElementById('affect-blue');
|
||||
|
||||
// Rerender map when blend mode changes
|
||||
select.addEventListener('change', function() {
|
||||
map.render();
|
||||
|
||||
@@ -48,7 +48,7 @@ map.addInteraction(dragBox);
|
||||
|
||||
var infoBox = document.getElementById('info');
|
||||
|
||||
dragBox.on('boxend', function(e) {
|
||||
dragBox.on('boxend', function() {
|
||||
// features that intersect the box are added to the collection of
|
||||
// selected features, and their names are displayed in the "info"
|
||||
// div
|
||||
@@ -64,7 +64,7 @@ dragBox.on('boxend', function(e) {
|
||||
});
|
||||
|
||||
// clear selection when drawing a new box and when clicking on the map
|
||||
dragBox.on('boxstart', function(e) {
|
||||
dragBox.on('boxstart', function() {
|
||||
selectedFeatures.clear();
|
||||
infoBox.innerHTML = ' ';
|
||||
});
|
||||
|
||||
@@ -65,14 +65,7 @@ zoomtoswitzerlandbest.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[0];
|
||||
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
polygon,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150],
|
||||
constrainResolution: false
|
||||
}
|
||||
);
|
||||
view.fit(polygon, size, {padding: [170, 50, 30, 150], constrainResolution: false});
|
||||
}, false);
|
||||
|
||||
var zoomtoswitzerlandconstrained =
|
||||
@@ -81,13 +74,7 @@ zoomtoswitzerlandconstrained.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[0];
|
||||
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
polygon,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150]
|
||||
}
|
||||
);
|
||||
view.fit(polygon, size, {padding: [170, 50, 30, 150]});
|
||||
}, false);
|
||||
|
||||
var zoomtoswitzerlandnearest =
|
||||
@@ -96,14 +83,7 @@ zoomtoswitzerlandnearest.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[0];
|
||||
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
polygon,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150],
|
||||
nearest: true
|
||||
}
|
||||
);
|
||||
view.fit(polygon, size, {padding: [170, 50, 30, 150], nearest: true});
|
||||
}, false);
|
||||
|
||||
var zoomtolausanne = document.getElementById('zoomtolausanne');
|
||||
@@ -111,14 +91,7 @@ zoomtolausanne.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[1];
|
||||
var point = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.fit(
|
||||
point,
|
||||
size,
|
||||
{
|
||||
padding: [170, 50, 30, 150],
|
||||
minResolution: 50
|
||||
}
|
||||
);
|
||||
view.fit(point, size, {padding: [170, 50, 30, 150], minResolution: 50});
|
||||
}, false);
|
||||
|
||||
var centerlausanne = document.getElementById('centerlausanne');
|
||||
@@ -126,9 +99,5 @@ centerlausanne.addEventListener('click', function() {
|
||||
var feature = source.getFeatures()[1];
|
||||
var point = /** @type {ol.geom.Point} */ (feature.getGeometry());
|
||||
var size = /** @type {ol.Size} */ (map.getSize());
|
||||
view.centerOn(
|
||||
point.getCoordinates(),
|
||||
size,
|
||||
[570, 500]
|
||||
);
|
||||
view.centerOn(point.getCoordinates(), size, [570, 500]);
|
||||
}, false);
|
||||
|
||||
@@ -34,7 +34,7 @@ var clusterSource = new ol.source.Cluster({
|
||||
var styleCache = {};
|
||||
var clusters = new ol.layer.Vector({
|
||||
source: clusterSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var size = feature.get('features').length;
|
||||
var style = styleCache[size];
|
||||
if (!style) {
|
||||
@@ -65,10 +65,6 @@ var raster = new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({layer: 'sat'})
|
||||
});
|
||||
|
||||
var raw = new ol.layer.Vector({
|
||||
source: source
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [raster, clusters],
|
||||
renderer: 'canvas',
|
||||
|
||||
@@ -138,6 +138,8 @@ var raster = new ol.source.Raster({
|
||||
}
|
||||
});
|
||||
|
||||
var controls = {};
|
||||
|
||||
raster.on('beforeoperations', function(event) {
|
||||
var data = event.data;
|
||||
for (var id in controls) {
|
||||
@@ -160,7 +162,6 @@ var map = new ol.Map({
|
||||
});
|
||||
|
||||
var controlIds = ['hue', 'chroma', 'lightness'];
|
||||
var controls = {};
|
||||
controlIds.forEach(function(id) {
|
||||
var control = document.getElementById(id);
|
||||
var output = document.getElementById(id + 'Out');
|
||||
|
||||
@@ -19,7 +19,6 @@ var app = window.app;
|
||||
//
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Control}
|
||||
@@ -33,7 +32,7 @@ app.RotateNorthControl = function(opt_options) {
|
||||
button.innerHTML = 'N';
|
||||
|
||||
var this_ = this;
|
||||
var handleRotateNorth = function(e) {
|
||||
var handleRotateNorth = function() {
|
||||
this_.getMap().getView().setRotation(0);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ goog.require('ol.style.Style');
|
||||
var app = {};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Pointer}
|
||||
@@ -72,7 +71,7 @@ app.Drag.prototype.handleDownEvent = function(evt) {
|
||||
var map = evt.map;
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
function(feature) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
@@ -89,13 +88,6 @@ app.Drag.prototype.handleDownEvent = function(evt) {
|
||||
* @param {ol.MapBrowserEvent} evt Map browser event.
|
||||
*/
|
||||
app.Drag.prototype.handleDragEvent = function(evt) {
|
||||
var map = evt.map;
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
var deltaX = evt.coordinate[0] - this.coordinate_[0];
|
||||
var deltaY = evt.coordinate[1] - this.coordinate_[1];
|
||||
|
||||
@@ -115,7 +107,7 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
|
||||
if (this.cursor_) {
|
||||
var map = evt.map;
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
function(feature) {
|
||||
return feature;
|
||||
});
|
||||
var element = evt.map.getTargetElement();
|
||||
@@ -133,10 +125,9 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} evt Map browser event.
|
||||
* @return {boolean} `false` to stop the drag sequence.
|
||||
*/
|
||||
app.Drag.prototype.handleUpEvent = function(evt) {
|
||||
app.Drag.prototype.handleUpEvent = function() {
|
||||
this.coordinate_ = null;
|
||||
this.feature_ = null;
|
||||
return false;
|
||||
|
||||
2
examples/d3.js
vendored
2
examples/d3.js
vendored
@@ -39,7 +39,7 @@ d3.json('data/topojson/us.json', function(error, us) {
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {ol.Size} size Size.
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {HTMLCanvasElement}
|
||||
* @return {HTMLCanvasElement} A canvas element.
|
||||
*/
|
||||
var canvasFunction = function(extent, resolution, pixelRatio,
|
||||
size, projection) {
|
||||
|
||||
@@ -39,7 +39,7 @@ el('track').addEventListener('change', function() {
|
||||
deviceOrientation.setTracking(this.checked);
|
||||
});
|
||||
|
||||
deviceOrientation.on('change', function(event) {
|
||||
deviceOrientation.on('change', function() {
|
||||
el('alpha').innerText = deviceOrientation.getAlpha() + ' [rad]';
|
||||
el('beta').innerText = deviceOrientation.getBeta() + ' [rad]';
|
||||
el('gamma').innerText = deviceOrientation.getGamma() + ' [rad]';
|
||||
|
||||
@@ -128,7 +128,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -124,7 +124,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -60,6 +60,8 @@ var modify = new ol.interaction.Modify({
|
||||
map.addInteraction(modify);
|
||||
|
||||
var draw; // global so we can remove it later
|
||||
var typeSelect = document.getElementById('type');
|
||||
|
||||
function addInteraction() {
|
||||
draw = new ol.interaction.Draw({
|
||||
features: features,
|
||||
@@ -68,14 +70,11 @@ function addInteraction() {
|
||||
map.addInteraction(draw);
|
||||
}
|
||||
|
||||
var typeSelect = document.getElementById('type');
|
||||
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
map.removeInteraction(draw);
|
||||
addInteraction();
|
||||
};
|
||||
|
||||
@@ -83,10 +83,9 @@ function addInteraction() {
|
||||
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
map.removeInteraction(draw);
|
||||
addInteraction();
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ function createEarthquakeStyle(feature) {
|
||||
});
|
||||
}
|
||||
|
||||
var maxFeatureCount;
|
||||
var maxFeatureCount, vector;
|
||||
function calculateClusterInfo(resolution) {
|
||||
maxFeatureCount = 0;
|
||||
var features = vector.getSource().getFeatures();
|
||||
@@ -65,7 +65,8 @@ function calculateClusterInfo(resolution) {
|
||||
feature = features[i];
|
||||
var originalFeatures = feature.get('features');
|
||||
var extent = ol.extent.createEmpty();
|
||||
for (var j = 0, jj = originalFeatures.length; j < jj; ++j) {
|
||||
var j, jj;
|
||||
for (j = 0, jj = originalFeatures.length; j < jj; ++j) {
|
||||
ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent());
|
||||
}
|
||||
maxFeatureCount = Math.max(maxFeatureCount, jj);
|
||||
@@ -104,7 +105,7 @@ function styleFunction(feature, resolution) {
|
||||
return style;
|
||||
}
|
||||
|
||||
function selectStyleFunction(feature, resolution) {
|
||||
function selectStyleFunction(feature) {
|
||||
var styles = [new ol.style.Style({
|
||||
image: new ol.style.Circle({
|
||||
radius: feature.get('radius'),
|
||||
@@ -120,7 +121,7 @@ function selectStyleFunction(feature, resolution) {
|
||||
return styles;
|
||||
}
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
vector = new ol.layer.Vector({
|
||||
source: new ol.source.Cluster({
|
||||
distance: 40,
|
||||
source: new ol.source.Vector({
|
||||
|
||||
@@ -14,7 +14,7 @@ goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var styleCache = {};
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
|
||||
// standards-violating <magnitude> tag in each Placemark. We extract it from
|
||||
// the Placemark's name instead.
|
||||
@@ -29,8 +29,8 @@ var styleFunction = function(feature, resolution) {
|
||||
/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')),
|
||||
{size: [size + 2, size + 2], pixelRatio: size / 10});
|
||||
render.setFillStrokeStyle(
|
||||
new ol.style.Fill({ color: 'rgba(255, 153, 0, 0.4)' }),
|
||||
new ol.style.Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }));
|
||||
new ol.style.Fill({color: 'rgba(255, 153, 0, 0.4)'}),
|
||||
new ol.style.Stroke({color: 'rgba(255, 204, 0, 0.2)', width: 1}));
|
||||
render.drawPolygonGeometry(new ol.geom.Polygon(
|
||||
[[[0, 0], [4, 2], [6, 0], [10, 5], [6, 3], [4, 5], [0, 0]]]));
|
||||
style = new ol.style.Style({
|
||||
|
||||
@@ -34,7 +34,7 @@ var map = new ol.Map({
|
||||
var exportPNGElement = document.getElementById('export-png');
|
||||
|
||||
if ('download' in exportPNGElement) {
|
||||
exportPNGElement.addEventListener('click', function(e) {
|
||||
exportPNGElement.addEventListener('click', function() {
|
||||
map.once('postcompose', function(event) {
|
||||
var canvas = event.context.canvas;
|
||||
exportPNGElement.href = canvas.toDataURL('image/png');
|
||||
|
||||
@@ -54,7 +54,7 @@ var loaded = 0;
|
||||
|
||||
var exportButton = document.getElementById('export-pdf');
|
||||
|
||||
exportButton.addEventListener('click', function(e) {
|
||||
exportButton.addEventListener('click', function() {
|
||||
|
||||
exportButton.disabled = true;
|
||||
document.body.style.cursor = 'progress';
|
||||
@@ -73,7 +73,7 @@ exportButton.addEventListener('click', function(e) {
|
||||
++loading;
|
||||
};
|
||||
|
||||
var tileLoadEnd = function(callback) {
|
||||
var tileLoadEnd = function() {
|
||||
++loaded;
|
||||
if (loading === loaded) {
|
||||
var canvas = this;
|
||||
|
||||
@@ -108,11 +108,16 @@ var styles = {
|
||||
})
|
||||
};
|
||||
|
||||
var animating = false;
|
||||
var speed, now;
|
||||
var speedInput = document.getElementById('speed');
|
||||
var startButton = document.getElementById('start-animation');
|
||||
|
||||
var vectorLayer = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
features: [routeFeature, geoMarker, startMarker, endMarker]
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
// hide geoMarker if animation is active
|
||||
if (animating && feature.get('type') === 'geoMarker') {
|
||||
return null;
|
||||
@@ -198,8 +203,4 @@ function stopAnimation(ended) {
|
||||
map.un('postcompose', moveFeature);
|
||||
}
|
||||
|
||||
var speed, now;
|
||||
var animating = false;
|
||||
var speedInput = document.getElementById('speed');
|
||||
var startButton = document.getElementById('start-animation');
|
||||
startButton.addEventListener('click', startAnimation, false);
|
||||
|
||||
@@ -35,6 +35,14 @@ var defaultStyle = new ol.style.Style({
|
||||
stroke: defaultStroke
|
||||
});
|
||||
|
||||
var flightsSource;
|
||||
var addLater = function(feature, timeout) {
|
||||
window.setTimeout(function() {
|
||||
feature.set('start', new Date().getTime());
|
||||
flightsSource.addFeature(feature);
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
var pointsPerMs = 0.1;
|
||||
var animateFlights = function(event) {
|
||||
var vectorContext = event.vectorContext;
|
||||
@@ -66,20 +74,13 @@ var animateFlights = function(event) {
|
||||
map.render();
|
||||
};
|
||||
|
||||
var addLater = function(feature, timeout) {
|
||||
window.setTimeout(function() {
|
||||
feature.set('start', new Date().getTime());
|
||||
flightsSource.addFeature(feature);
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
var flightsSource = new ol.source.Vector({
|
||||
flightsSource = new ol.source.Vector({
|
||||
wrapX: false,
|
||||
attributions: [new ol.Attribution({
|
||||
html: 'Flight data by ' +
|
||||
'<a href="http://openflights.org/data.html">OpenFlights</a>,'
|
||||
})],
|
||||
loader: function(extent, resolution, projection) {
|
||||
loader: function() {
|
||||
var url = 'data/openflights/flights.json';
|
||||
fetch(url).then(function(response) {
|
||||
return response.json();
|
||||
@@ -116,7 +117,7 @@ var flightsSource = new ol.source.Vector({
|
||||
|
||||
var flightsLayer = new ol.layer.Vector({
|
||||
source: flightsSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
// if the animation is still active for a feature, do not
|
||||
// render the feature with the layer style
|
||||
if (feature.get('finished')) {
|
||||
|
||||
@@ -85,7 +85,7 @@ var styles = {
|
||||
})
|
||||
};
|
||||
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
return styles[feature.getGeometry().getType()];
|
||||
};
|
||||
|
||||
@@ -97,79 +97,67 @@ var geojsonObject = {
|
||||
'name': 'EPSG:3857'
|
||||
}
|
||||
},
|
||||
'features': [
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], [-3e6, -1e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[1e6, -7.5e5], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
|
||||
[[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], [0, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [
|
||||
{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
},
|
||||
{
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
},
|
||||
{
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
|
||||
}
|
||||
]
|
||||
}
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], [-3e6, -1e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[1e6, -7.5e5], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
|
||||
[[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], [0, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
}, {
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
}, {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
|
||||
}]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var vectorSource = new ol.source.Vector({
|
||||
|
||||
@@ -58,7 +58,7 @@ var geolocation = new ol.Geolocation(/** @type {olx.GeolocationOptions} */ ({
|
||||
var deltaMean = 500; // the geolocation sampling period mean in ms
|
||||
|
||||
// Listen to position changes
|
||||
geolocation.on('change', function(evt) {
|
||||
geolocation.on('change', function() {
|
||||
var position = geolocation.getPosition();
|
||||
var accuracy = geolocation.getAccuracy();
|
||||
var heading = geolocation.getHeading() || 0;
|
||||
@@ -113,7 +113,7 @@ function addPosition(position, heading, m, speed) {
|
||||
// force the rotation change to be less than 180°
|
||||
if (Math.abs(headingDiff) > Math.PI) {
|
||||
var sign = (headingDiff >= 0) ? 1 : -1;
|
||||
headingDiff = - sign * (2 * Math.PI - Math.abs(headingDiff));
|
||||
headingDiff = -sign * (2 * Math.PI - Math.abs(headingDiff));
|
||||
}
|
||||
heading = prevHeading + headingDiff;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ geolocation.on('change:position', function() {
|
||||
new ol.geom.Point(coordinates) : null);
|
||||
});
|
||||
|
||||
var featuresOverlay = new ol.layer.Vector({
|
||||
new ol.layer.Vector({
|
||||
map: map,
|
||||
source: new ol.source.Vector({
|
||||
features: [accuracyFeature, positionFeature]
|
||||
|
||||
@@ -44,7 +44,7 @@ map.on('pointermove', function(evt) {
|
||||
return;
|
||||
}
|
||||
var pixel = map.getEventPixel(evt.originalEvent);
|
||||
var hit = map.forEachLayerAtPixel(pixel, function(layer) {
|
||||
var hit = map.forEachLayerAtPixel(pixel, function() {
|
||||
return true;
|
||||
});
|
||||
map.getTargetElement().style.cursor = hit ? 'pointer' : '';
|
||||
|
||||
@@ -44,7 +44,7 @@ map.on('pointermove', function(evt) {
|
||||
return;
|
||||
}
|
||||
var pixel = map.getEventPixel(evt.originalEvent);
|
||||
var hit = map.forEachLayerAtPixel(pixel, function(layer) {
|
||||
var hit = map.forEachLayerAtPixel(pixel, function() {
|
||||
return true;
|
||||
});
|
||||
map.getTargetElement().style.cursor = hit ? 'pointer' : '';
|
||||
|
||||
@@ -3,7 +3,6 @@ goog.require('ol.View');
|
||||
goog.require('ol.format.GPX');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.BingMaps');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.style.Circle');
|
||||
@@ -11,8 +10,6 @@ goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
var projection = ol.proj.get('EPSG:3857');
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.BingMaps({
|
||||
imagerySet: 'Aerial',
|
||||
@@ -52,7 +49,7 @@ var vector = new ol.layer.Vector({
|
||||
url: 'data/gpx/fells_loop.gpx',
|
||||
format: new ol.format.GPX()
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
return style[feature.getGeometry().getType()];
|
||||
}
|
||||
});
|
||||
@@ -68,7 +65,7 @@ var map = new ol.Map({
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -28,11 +28,13 @@ iconFeature.set('style', createStyle('data/icon.png', undefined));
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.Stamen({ layer: 'watercolor' })
|
||||
source: new ol.source.Stamen({layer: 'watercolor'})
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
style: function(feature) { return feature.get('style'); },
|
||||
source: new ol.source.Vector({ features: [iconFeature] })
|
||||
style: function(feature) {
|
||||
return feature.get('style');
|
||||
},
|
||||
source: new ol.source.Vector({features: [iconFeature]})
|
||||
})
|
||||
],
|
||||
target: document.getElementById('map'),
|
||||
@@ -44,7 +46,7 @@ var map = new ol.Map({
|
||||
|
||||
var selectStyle = {};
|
||||
var select = new ol.interaction.Select({
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var image = feature.get('style').getImage().getImage();
|
||||
if (!selectStyle[image.src]) {
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
@@ -95,7 +95,7 @@ for (i = 0; i < featureCount; i += 30) {
|
||||
overlayFeatures.push(clone);
|
||||
}
|
||||
|
||||
var featureOverlay = new ol.layer.Vector({
|
||||
new ol.layer.Vector({
|
||||
map: map,
|
||||
source: new ol.source.Vector({
|
||||
features: overlayFeatures
|
||||
@@ -112,8 +112,8 @@ map.on('click', function(evt) {
|
||||
|
||||
window.setTimeout(function() {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {
|
||||
features.push(features);
|
||||
map.forEachFeatureAtPixel(evt.pixel, function(feature) {
|
||||
features.push(feature);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ map.addOverlay(popup);
|
||||
// display popup on click
|
||||
map.on('click', function(evt) {
|
||||
var feature = map.forEachFeatureAtPixel(evt.pixel,
|
||||
function(feature, layer) {
|
||||
function(feature) {
|
||||
return feature;
|
||||
});
|
||||
if (feature) {
|
||||
|
||||
@@ -25,7 +25,7 @@ var colors = {
|
||||
};
|
||||
|
||||
var styleCache = {};
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
var color = colors[feature.get('PLT')];
|
||||
var style = styleCache[color];
|
||||
if (!style) {
|
||||
|
||||
@@ -4,7 +4,6 @@ goog.require('ol.layer.Image');
|
||||
goog.require('ol.source.ImageWMS');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Renders a progress bar.
|
||||
* @param {Element} el The target element.
|
||||
@@ -84,14 +83,14 @@ var source = new ol.source.ImageWMS({
|
||||
serverType: 'geoserver'
|
||||
});
|
||||
|
||||
source.on('imageloadstart', function(event) {
|
||||
source.on('imageloadstart', function() {
|
||||
progress.addLoading();
|
||||
});
|
||||
|
||||
source.on('imageloadend', function(event) {
|
||||
source.on('imageloadend', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
source.on('imageloaderror', function(event) {
|
||||
source.on('imageloaderror', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ var featureOverlay = new ol.layer.Vector({
|
||||
var highlight;
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var styleCache = {};
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
|
||||
// standards-violating <magnitude> tag in each Placemark. We extract it from
|
||||
// the Placemark's name instead.
|
||||
@@ -74,7 +74,7 @@ var displayFeatureInfo = function(pixel) {
|
||||
left: pixel[0] + 'px',
|
||||
top: (pixel[1] - 15) + 'px'
|
||||
});
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
if (feature) {
|
||||
|
||||
@@ -17,7 +17,7 @@ goog.require('ol.style.Style');
|
||||
* currently midnight would have an opacity of 0. This doesn't account for
|
||||
* daylight savings, so don't use it to plan your vacation.
|
||||
*/
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
var offset = 0;
|
||||
var name = feature.get('name'); // e.g. GMT -08:30
|
||||
var match = name.match(/([\-+]\d{2}):(\d{2})$/);
|
||||
@@ -81,7 +81,7 @@ var displayFeatureInfo = function(pixel) {
|
||||
left: pixel[0] + 'px',
|
||||
top: (pixel[1] - 15) + 'px'
|
||||
});
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
if (feature) {
|
||||
|
||||
@@ -35,7 +35,7 @@ var map = new ol.Map({
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -16,7 +16,7 @@ var raster = new ol.layer.Tile({
|
||||
|
||||
var source = new ol.source.Vector();
|
||||
|
||||
var styleFunction = function(feature, resolution) {
|
||||
var styleFunction = function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
var styles = [
|
||||
// linestring
|
||||
|
||||
@@ -96,7 +96,7 @@ var continueLineMsg = 'Click to continue drawing the line';
|
||||
|
||||
/**
|
||||
* Handle pointer move.
|
||||
* @param {ol.MapBrowserEvent} evt
|
||||
* @param {ol.MapBrowserEvent} evt The event.
|
||||
*/
|
||||
var pointerMoveHandler = function(evt) {
|
||||
if (evt.dragging) {
|
||||
@@ -140,6 +140,66 @@ var typeSelect = document.getElementById('type');
|
||||
var geodesicCheckbox = document.getElementById('geodesic');
|
||||
|
||||
var draw; // global so we can remove it later
|
||||
|
||||
|
||||
/**
|
||||
* Format length output.
|
||||
* @param {ol.geom.LineString} line The line.
|
||||
* @return {string} The formatted length.
|
||||
*/
|
||||
var formatLength = function(line) {
|
||||
var length;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var coordinates = line.getCoordinates();
|
||||
length = 0;
|
||||
var sourceProj = map.getView().getProjection();
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
var c1 = ol.proj.transform(coordinates[i], sourceProj, 'EPSG:4326');
|
||||
var c2 = ol.proj.transform(coordinates[i + 1], sourceProj, 'EPSG:4326');
|
||||
length += wgs84Sphere.haversineDistance(c1, c2);
|
||||
}
|
||||
} else {
|
||||
length = Math.round(line.getLength() * 100) / 100;
|
||||
}
|
||||
var output;
|
||||
if (length > 100) {
|
||||
output = (Math.round(length / 1000 * 100) / 100) +
|
||||
' ' + 'km';
|
||||
} else {
|
||||
output = (Math.round(length * 100) / 100) +
|
||||
' ' + 'm';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Format length output.
|
||||
* @param {ol.geom.Polygon} polygon The polygon.
|
||||
* @return {string} Formatted area.
|
||||
*/
|
||||
var formatArea = function(polygon) {
|
||||
var area;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var sourceProj = map.getView().getProjection();
|
||||
var geom = /** @type {ol.geom.Polygon} */(polygon.clone().transform(
|
||||
sourceProj, 'EPSG:4326'));
|
||||
var coordinates = geom.getLinearRing(0).getCoordinates();
|
||||
area = Math.abs(wgs84Sphere.geodesicArea(coordinates));
|
||||
} else {
|
||||
area = polygon.getArea();
|
||||
}
|
||||
var output;
|
||||
if (area > 10000) {
|
||||
output = (Math.round(area / 1000000 * 100) / 100) +
|
||||
' ' + 'km<sup>2</sup>';
|
||||
} else {
|
||||
output = (Math.round(area * 100) / 100) +
|
||||
' ' + 'm<sup>2</sup>';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
function addInteraction() {
|
||||
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
|
||||
draw = new ol.interaction.Draw({
|
||||
@@ -186,7 +246,7 @@ function addInteraction() {
|
||||
output = formatArea(/** @type {ol.geom.Polygon} */ (geom));
|
||||
tooltipCoord = geom.getInteriorPoint().getCoordinates();
|
||||
} else if (geom instanceof ol.geom.LineString) {
|
||||
output = formatLength( /** @type {ol.geom.LineString} */ (geom));
|
||||
output = formatLength(/** @type {ol.geom.LineString} */ (geom));
|
||||
tooltipCoord = geom.getLastCoordinate();
|
||||
}
|
||||
measureTooltipElement.innerHTML = output;
|
||||
@@ -195,7 +255,7 @@ function addInteraction() {
|
||||
}, this);
|
||||
|
||||
draw.on('drawend',
|
||||
function(evt) {
|
||||
function() {
|
||||
measureTooltipElement.className = 'tooltip tooltip-static';
|
||||
measureTooltip.setOffset([0, -7]);
|
||||
// unset sketch
|
||||
@@ -246,70 +306,10 @@ function createMeasureTooltip() {
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
* @param {Event} e Change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
map.removeInteraction(draw);
|
||||
addInteraction();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* format length output
|
||||
* @param {ol.geom.LineString} line
|
||||
* @return {string}
|
||||
*/
|
||||
var formatLength = function(line) {
|
||||
var length;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var coordinates = line.getCoordinates();
|
||||
length = 0;
|
||||
var sourceProj = map.getView().getProjection();
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
var c1 = ol.proj.transform(coordinates[i], sourceProj, 'EPSG:4326');
|
||||
var c2 = ol.proj.transform(coordinates[i + 1], sourceProj, 'EPSG:4326');
|
||||
length += wgs84Sphere.haversineDistance(c1, c2);
|
||||
}
|
||||
} else {
|
||||
length = Math.round(line.getLength() * 100) / 100;
|
||||
}
|
||||
var output;
|
||||
if (length > 100) {
|
||||
output = (Math.round(length / 1000 * 100) / 100) +
|
||||
' ' + 'km';
|
||||
} else {
|
||||
output = (Math.round(length * 100) / 100) +
|
||||
' ' + 'm';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* format length output
|
||||
* @param {ol.geom.Polygon} polygon
|
||||
* @return {string}
|
||||
*/
|
||||
var formatArea = function(polygon) {
|
||||
var area;
|
||||
if (geodesicCheckbox.checked) {
|
||||
var sourceProj = map.getView().getProjection();
|
||||
var geom = /** @type {ol.geom.Polygon} */(polygon.clone().transform(
|
||||
sourceProj, 'EPSG:4326'));
|
||||
var coordinates = geom.getLinearRing(0).getCoordinates();
|
||||
area = Math.abs(wgs84Sphere.geodesicArea(coordinates));
|
||||
} else {
|
||||
area = polygon.getArea();
|
||||
}
|
||||
var output;
|
||||
if (area > 10000) {
|
||||
output = (Math.round(area / 1000000 * 100) / 100) +
|
||||
' ' + 'km<sup>2</sup>';
|
||||
} else {
|
||||
output = (Math.round(area * 100) / 100) +
|
||||
' ' + 'm<sup>2</sup>';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
addInteraction();
|
||||
|
||||
@@ -54,7 +54,7 @@ var styleFunction = (function() {
|
||||
}),
|
||||
image: image
|
||||
});
|
||||
return function(feature, resolution) {
|
||||
return function(feature) {
|
||||
return styles[feature.getGeometry().getType()] || styles['default'];
|
||||
};
|
||||
})();
|
||||
@@ -67,94 +67,81 @@ var geojsonObject = {
|
||||
'name': 'EPSG:3857'
|
||||
}
|
||||
},
|
||||
'features': [
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPoint',
|
||||
'coordinates': [[-2e6, 0], [0, -2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [9e6, 2e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [8e6, 3e6]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
|
||||
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
|
||||
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
|
||||
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]],
|
||||
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-3e6, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [
|
||||
{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
},
|
||||
{
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
},
|
||||
{
|
||||
'type': 'Polygon',
|
||||
'coordinates': [
|
||||
[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6], [1e6, -6e6]]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
'coordinates': [0, 0]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPoint',
|
||||
'coordinates': [[-2e6, 0], [0, -2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [9e6, 2e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
'coordinates': [[4e6, -2e6], [8e6, 2e6], [8e6, 3e6]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
|
||||
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
|
||||
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiLineString',
|
||||
'coordinates': [
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
|
||||
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
|
||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'MultiPolygon',
|
||||
'coordinates': [
|
||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]],
|
||||
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-3e6, 6e6]]],
|
||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': [{
|
||||
'type': 'LineString',
|
||||
'coordinates': [[-5e6, -5e6], [0, -5e6]]
|
||||
}, {
|
||||
'type': 'Point',
|
||||
'coordinates': [4e6, -5e6]
|
||||
}, {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [
|
||||
[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6], [1e6, -6e6]]
|
||||
]
|
||||
}]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var source = new ol.source.Vector({
|
||||
@@ -224,7 +211,7 @@ var overlayStyle = (function() {
|
||||
|
||||
styles['GeometryCollection'] = styles['Polygon'].concat(styles['Point']);
|
||||
|
||||
return function(feature, resolution) {
|
||||
return function(feature) {
|
||||
return styles[feature.getGeometry().getType()];
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -10,7 +10,7 @@ goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var format = new ol.format.TopoJSON();
|
||||
var tileGrid = ol.tilegrid.createXYZ({ maxZoom: 19 });
|
||||
var tileGrid = ol.tilegrid.createXYZ({maxZoom: 19});
|
||||
var roadStyleCache = {};
|
||||
var roadColor = {
|
||||
'major_road': '#776',
|
||||
@@ -51,7 +51,7 @@ var map = new ol.Map({
|
||||
url: 'http://{a-c}.tile.openstreetmap.us/' +
|
||||
'vectiles-highroad/{z}/{x}/{y}.topojson'
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var kind = feature.get('kind');
|
||||
var railway = feature.get('railway');
|
||||
var sort_key = feature.get('sort_key');
|
||||
@@ -97,7 +97,7 @@ var map = new ol.Map({
|
||||
'vectiles-land-usages/{z}/{x}/{y}.topojson'
|
||||
}),
|
||||
visible: false,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var kind = feature.get('kind');
|
||||
var styleKey = kind;
|
||||
var style = landuseStyleCache[styleKey];
|
||||
|
||||
@@ -49,40 +49,35 @@ var geojsonObject = {
|
||||
'name': 'EPSG:3857'
|
||||
}
|
||||
},
|
||||
'features': [
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-2e6, 6e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
|
||||
[0, -1e6], [-2e6, -1e6]]]
|
||||
}
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||
[-3e6, 6e6], [-5e6, 6e6]]]
|
||||
}
|
||||
]
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||
[0, 6e6], [-2e6, 6e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||
[3e6, 6e6], [1e6, 6e6]]]
|
||||
}
|
||||
}, {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
|
||||
[0, -1e6], [-2e6, -1e6]]]
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
var source = new ol.source.Vector({
|
||||
|
||||
@@ -15,17 +15,6 @@ var content = document.getElementById('popup-content');
|
||||
var closer = document.getElementById('popup-closer');
|
||||
|
||||
|
||||
/**
|
||||
* Add a click handler to hide the popup.
|
||||
* @return {boolean} Don't follow the href.
|
||||
*/
|
||||
closer.onclick = function() {
|
||||
overlay.setPosition(undefined);
|
||||
closer.blur();
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create an overlay to anchor the popup to the map.
|
||||
*/
|
||||
@@ -38,6 +27,17 @@ var overlay = new ol.Overlay(/** @type {olx.OverlayOptions} */ ({
|
||||
}));
|
||||
|
||||
|
||||
/**
|
||||
* Add a click handler to hide the popup.
|
||||
* @return {boolean} Don't follow the href.
|
||||
*/
|
||||
closer.onclick = function() {
|
||||
overlay.setPosition(undefined);
|
||||
closer.blur();
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create the map.
|
||||
*/
|
||||
|
||||
@@ -61,6 +61,12 @@ var bing = new ol.source.BingMaps({
|
||||
*/
|
||||
var raster = new ol.source.Raster({
|
||||
sources: [bing],
|
||||
/**
|
||||
* Run calculations on pixel data.
|
||||
* @param {Array} pixels List of pixels (one per source).
|
||||
* @param {Object} data User data object.
|
||||
* @return {Array} The output pixel.
|
||||
*/
|
||||
operation: function(pixels, data) {
|
||||
var pixel = pixels[0];
|
||||
var value = vgi(pixel);
|
||||
|
||||
@@ -31,7 +31,7 @@ function growRegion(inputs, data) {
|
||||
// As noted in the Raster source constructor, this function is provided
|
||||
// using the `lib` option. Other functions will NOT be visible unless
|
||||
// provided using the `lib` option.
|
||||
var next = nextEdges(edge[i]);
|
||||
var next = next4Edges(edge[i]);
|
||||
for (var j = 0, jj = next.length; j < jj; j++) {
|
||||
var s = next[j][0], t = next[j][1];
|
||||
if (s >= 0 && s < width && t >= 0 && t < height) {
|
||||
@@ -85,7 +85,7 @@ var raster = new ol.source.Raster({
|
||||
// Functions in the `lib` object will be available to the operation run in
|
||||
// the web worker.
|
||||
lib: {
|
||||
nextEdges: next4Edges
|
||||
next4Edges: next4Edges
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,6 +110,8 @@ map.on('click', function(event) {
|
||||
raster.changed();
|
||||
});
|
||||
|
||||
var thresholdControl = document.getElementById('threshold');
|
||||
|
||||
raster.on('beforeoperations', function(event) {
|
||||
// the event.data object will be passed to operations
|
||||
var data = event.data;
|
||||
@@ -119,8 +121,6 @@ raster.on('beforeoperations', function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
var thresholdControl = document.getElementById('threshold');
|
||||
|
||||
function updateControlValue() {
|
||||
document.getElementById('threshold-value').innerText = thresholdControl.value;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ goog.require('ol.style.Stroke');
|
||||
var canvas = document.getElementById('canvas');
|
||||
var render = ol.render.toContext(canvas.getContext('2d'), {size: [100, 100]});
|
||||
|
||||
var fill = new ol.style.Fill({ color: 'blue' });
|
||||
var stroke = new ol.style.Stroke({ color: 'black' });
|
||||
var fill = new ol.style.Fill({color: 'blue'});
|
||||
var stroke = new ol.style.Stroke({color: 'black'});
|
||||
render.setFillStrokeStyle(fill, stroke);
|
||||
render.setImageStyle(new ol.style.Circle({
|
||||
radius: 10,
|
||||
|
||||
@@ -7,7 +7,6 @@ goog.require('ol.source.MapQuest');
|
||||
goog.require('ol.source.TileImage');
|
||||
|
||||
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
@@ -89,18 +88,19 @@ function search(query) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} e Change event.
|
||||
* Handle click event.
|
||||
* @param {Event} event The event.
|
||||
*/
|
||||
searchButton.onclick = function(e) {
|
||||
searchButton.onclick = function(event) {
|
||||
search(queryInput.value);
|
||||
e.preventDefault();
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
renderEdgesCheckbox.onchange = function(e) {
|
||||
renderEdgesCheckbox.onchange = function() {
|
||||
map.getLayers().forEach(function(layer) {
|
||||
if (layer instanceof ol.layer.Tile) {
|
||||
var source = layer.getSource();
|
||||
|
||||
@@ -192,9 +192,9 @@ function updateViewProjection() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
viewProjSelect.onchange = function(e) {
|
||||
viewProjSelect.onchange = function() {
|
||||
updateViewProjection();
|
||||
};
|
||||
|
||||
@@ -211,9 +211,9 @@ var updateRenderEdgesOnLayer = function(layer) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
baseLayerSelect.onchange = function(e) {
|
||||
baseLayerSelect.onchange = function() {
|
||||
var layer = layers[baseLayerSelect.value];
|
||||
if (layer) {
|
||||
layer.setOpacity(1);
|
||||
@@ -224,9 +224,9 @@ baseLayerSelect.onchange = function(e) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
overlayLayerSelect.onchange = function(e) {
|
||||
overlayLayerSelect.onchange = function() {
|
||||
var layer = layers[overlayLayerSelect.value];
|
||||
if (layer) {
|
||||
layer.setOpacity(0.7);
|
||||
@@ -237,9 +237,9 @@ overlayLayerSelect.onchange = function(e) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} e Change event.
|
||||
* Handle change event.
|
||||
*/
|
||||
renderEdgesCheckbox.onchange = function(e) {
|
||||
renderEdgesCheckbox.onchange = function() {
|
||||
renderEdges = renderEdgesCheckbox.checked;
|
||||
map.getLayers().forEach(function(layer) {
|
||||
updateRenderEdgesOnLayer(layer);
|
||||
|
||||
@@ -5,7 +5,7 @@ goog.require('ol.layer.Tile');
|
||||
goog.require('ol.source.MapQuest');
|
||||
|
||||
|
||||
var domMap = new ol.Map({
|
||||
var map1 = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.MapQuest({layer: 'sat'})
|
||||
@@ -19,12 +19,18 @@ var domMap = new ol.Map({
|
||||
})
|
||||
});
|
||||
|
||||
var map2 = new ol.Map({
|
||||
target: 'canvasMap',
|
||||
layers: map1.getLayers(),
|
||||
view: map1.getView()
|
||||
});
|
||||
|
||||
if (ol.has.WEBGL) {
|
||||
var webglMap = new ol.Map({
|
||||
var map3 = new ol.Map({
|
||||
renderer: 'webgl',
|
||||
target: 'webglMap',
|
||||
layers: domMap.getLayers(),
|
||||
view: domMap.getView()
|
||||
layers: map1.getLayers(),
|
||||
view: map1.getView()
|
||||
});
|
||||
} else {
|
||||
var info = document.getElementById('no-webgl');
|
||||
@@ -33,9 +39,3 @@ if (ol.has.WEBGL) {
|
||||
*/
|
||||
info.style.display = '';
|
||||
}
|
||||
|
||||
var canvasMap = new ol.Map({
|
||||
target: 'canvasMap',
|
||||
layers: domMap.getLayers(),
|
||||
view: domMap.getView()
|
||||
});
|
||||
|
||||
@@ -72,6 +72,7 @@ var Modify = {
|
||||
};
|
||||
Modify.init();
|
||||
|
||||
var optionsForm = document.getElementById('options-form');
|
||||
|
||||
var Draw = {
|
||||
init: function() {
|
||||
@@ -111,8 +112,6 @@ var Draw = {
|
||||
};
|
||||
Draw.init();
|
||||
|
||||
var optionsForm = document.getElementById('options-form');
|
||||
|
||||
|
||||
/**
|
||||
* Let user change the geometry type.
|
||||
|
||||
@@ -39,6 +39,6 @@ var map = new ol.Map({
|
||||
})
|
||||
});
|
||||
|
||||
var graticule = new ol.Graticule({
|
||||
new ol.Graticule({
|
||||
map: map
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ var vectorSource = new ol.source.Vector({
|
||||
});
|
||||
var vector = new ol.layer.Vector({
|
||||
source: vectorSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
return styles[feature.get('size')];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +4,6 @@ goog.require('ol.layer.Tile');
|
||||
goog.require('ol.source.TileJSON');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Renders a progress bar.
|
||||
* @param {Element} el The target element.
|
||||
@@ -83,14 +82,14 @@ var source = new ol.source.TileJSON({
|
||||
crossOrigin: 'anonymous'
|
||||
});
|
||||
|
||||
source.on('tileloadstart', function(event) {
|
||||
source.on('tileloadstart', function() {
|
||||
progress.addLoading();
|
||||
});
|
||||
|
||||
source.on('tileloadend', function(event) {
|
||||
source.on('tileloadend', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
source.on('tileloaderror', function(event) {
|
||||
source.on('tileloaderror', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ var vector = new ol.layer.Vector({
|
||||
url: 'data/topojson/world-110m.json',
|
||||
format: new ol.format.TopoJSON()
|
||||
}),
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
// don't want to render the full world polygon, which repeats all countries
|
||||
return feature.getId() !== undefined ? style : null;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,19 @@ var vector = new ol.layer.Vector({
|
||||
source: vectorSource
|
||||
});
|
||||
|
||||
var attribution = new ol.Attribution({
|
||||
html: 'Tiles © <a href="http://services.arcgisonline.com/ArcGIS/' +
|
||||
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
|
||||
});
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.XYZ({
|
||||
attributions: [attribution],
|
||||
url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' +
|
||||
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
|
||||
})
|
||||
});
|
||||
|
||||
var draw = new ol.interaction.Draw({
|
||||
source: vectorSource,
|
||||
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
||||
@@ -67,14 +80,23 @@ var modify = new ol.interaction.Modify({
|
||||
});
|
||||
modify.setActive(false);
|
||||
|
||||
var map = new ol.Map({
|
||||
interactions: ol.interaction.defaults().extend([draw, select, modify]),
|
||||
layers: [raster, vector],
|
||||
target: document.getElementById('map'),
|
||||
view: new ol.View({
|
||||
center: ol.proj.transform([-122.619, 45.512], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 12
|
||||
})
|
||||
});
|
||||
|
||||
var typeSelect = document.getElementById('type');
|
||||
|
||||
|
||||
/**
|
||||
* Let user change the interaction type.
|
||||
* @param {Event} e Change event.
|
||||
*/
|
||||
typeSelect.onchange = function(e) {
|
||||
typeSelect.onchange = function() {
|
||||
draw.setActive(typeSelect.value === 'DRAW');
|
||||
select.setActive(typeSelect.value === 'MODIFY');
|
||||
modify.setActive(typeSelect.value === 'MODIFY');
|
||||
@@ -97,7 +119,7 @@ selected.on('remove', function(evt) {
|
||||
featureProjection: map.getView().getProjection()
|
||||
}) + ']';
|
||||
var url = serviceUrl + layer + '/updateFeatures';
|
||||
$.post(url, { f: 'json', features: payload }).done(function(data) {
|
||||
$.post(url, {f: 'json', features: payload}).done(function(data) {
|
||||
var result = JSON.parse(data);
|
||||
if (result.updateResults && result.updateResults.length > 0) {
|
||||
if (result.updateResults[0].success !== true) {
|
||||
@@ -117,7 +139,7 @@ draw.on('drawend', function(evt) {
|
||||
featureProjection: map.getView().getProjection()
|
||||
}) + ']';
|
||||
var url = serviceUrl + layer + '/addFeatures';
|
||||
$.post(url, { f: 'json', features: payload }).done(function(data) {
|
||||
$.post(url, {f: 'json', features: payload}).done(function(data) {
|
||||
var result = JSON.parse(data);
|
||||
if (result.addResults && result.addResults.length > 0) {
|
||||
if (result.addResults[0].success === true) {
|
||||
@@ -130,26 +152,3 @@ draw.on('drawend', function(evt) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var attribution = new ol.Attribution({
|
||||
html: 'Tiles © <a href="http://services.arcgisonline.com/ArcGIS/' +
|
||||
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
|
||||
});
|
||||
|
||||
var raster = new ol.layer.Tile({
|
||||
source: new ol.source.XYZ({
|
||||
attributions: [attribution],
|
||||
url: 'http://server.arcgisonline.com/ArcGIS/rest/services/' +
|
||||
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
|
||||
})
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
interactions: ol.interaction.defaults().extend([draw, select, modify]),
|
||||
layers: [raster, vector],
|
||||
target: document.getElementById('map'),
|
||||
view: new ol.View({
|
||||
center: ol.proj.transform([-122.619, 45.512], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 12
|
||||
})
|
||||
});
|
||||
|
||||
@@ -89,7 +89,7 @@ var vectorSource = new ol.source.Vector({
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: vectorSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
var classify = feature.get('activeprod');
|
||||
return styleCache[classify];
|
||||
}
|
||||
@@ -120,7 +120,7 @@ var map = new ol.Map({
|
||||
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
var features = [];
|
||||
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
features.push(feature);
|
||||
});
|
||||
if (features.length > 0) {
|
||||
|
||||
@@ -215,7 +215,8 @@ String.prototype.trunc = String.prototype.trunc ||
|
||||
function stringDivider(str, width, spaceReplacer) {
|
||||
if (str.length > width) {
|
||||
var p = width;
|
||||
for (; p > 0 && (str[p] != ' ' && str[p] != '-'); p--) {
|
||||
while (p > 0 && (str[p] != ' ' && str[p] != '-')) {
|
||||
p--;
|
||||
}
|
||||
if (p > 0) {
|
||||
var left;
|
||||
|
||||
@@ -92,7 +92,7 @@ var featureOverlay = new ol.layer.Vector({
|
||||
var highlight;
|
||||
var displayFeatureInfo = function(pixel) {
|
||||
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
|
||||
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ var vectorSource = new ol.source.Vector({
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: vectorSource,
|
||||
style: function(feature, resolution) {
|
||||
style: function(feature) {
|
||||
for (var key in styles) {
|
||||
var value = feature.get(key);
|
||||
if (value !== undefined) {
|
||||
|
||||
@@ -10,10 +10,9 @@ goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
|
||||
|
||||
var vectorSource = new ol.source.Vector({
|
||||
format: new ol.format.GeoJSON(),
|
||||
url: function(extent, resolution, projection) {
|
||||
url: function(extent) {
|
||||
return 'http://demo.boundlessgeo.com/geoserver/wfs?service=WFS&' +
|
||||
'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
|
||||
'outputFormat=application/json&srsname=EPSG:3857&' +
|
||||
|
||||
@@ -9,7 +9,6 @@ goog.require('ol.proj.Projection');
|
||||
goog.require('ol.source.TileWMS');
|
||||
|
||||
|
||||
|
||||
// By default OpenLayers does not know about the EPSG:21781 (Swiss) projection.
|
||||
// So we create a projection instance for EPSG:21781 and pass it to
|
||||
// ol.proj.addProjection to make it available to the library for lookup by its
|
||||
@@ -97,7 +96,6 @@ var map = new ol.Map({
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Swiss projection transform functions downloaded from
|
||||
* http://www.swisstopo.admin.ch/internet/swisstopo/en/home/products/software/products/skripts.html
|
||||
@@ -202,19 +200,6 @@ function CHtoWGSlng(y, x) {
|
||||
}
|
||||
|
||||
|
||||
// Convert SEX DMS angle to DEC
|
||||
function SEXtoDEC(angle) {
|
||||
|
||||
// Extract DMS
|
||||
var deg = parseInt(angle, 10);
|
||||
var min = parseInt((angle - deg) * 100, 10);
|
||||
var sec = (((angle - deg) * 100) - min) * 100;
|
||||
|
||||
// Result in degrees sex (dd.mmss)
|
||||
return deg + (sec / 60 + min) / 60;
|
||||
|
||||
}
|
||||
|
||||
// Convert DEC angle to SEX DMS
|
||||
function DECtoSEX(angle) {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ goog.require('ol.source.Zoomify');
|
||||
var imgWidth = 9911;
|
||||
var imgHeight = 6100;
|
||||
|
||||
var imgCenter = [imgWidth / 2, - imgHeight / 2];
|
||||
var imgCenter = [imgWidth / 2, -imgHeight / 2];
|
||||
|
||||
// Maps always need a projection, but Zoomify layers are not geo-referenced, and
|
||||
// are only measured in pixels. So, we create a fake projection that the map
|
||||
|
||||
@@ -12,7 +12,7 @@ goog.require('ol.source.MapQuest');
|
||||
* @return {ol.Map} The ol.Map instance.
|
||||
*/
|
||||
var createMap = function(divId) {
|
||||
var source, layer, map, zoomslider, resolutions;
|
||||
var source, layer, map, zoomslider;
|
||||
|
||||
source = new ol.source.MapQuest({layer: 'sat'});
|
||||
layer = new ol.layer.Tile({
|
||||
|
||||
20
package.json
20
package.json
@@ -12,6 +12,7 @@
|
||||
"install": "node tasks/install.js",
|
||||
"postinstall": "closure-util update",
|
||||
"start": "node tasks/serve.js",
|
||||
"pretest": "eslint tasks test test_rendering src examples",
|
||||
"test": "node tasks/test.js",
|
||||
"debug-server": "node tasks/serve-lib.js"
|
||||
},
|
||||
@@ -53,11 +54,12 @@
|
||||
"clean-css": "3.4.9",
|
||||
"coveralls": "2.11.6",
|
||||
"debounce": "^1.0.0",
|
||||
"eslint": "v2.0.0-beta.1",
|
||||
"eslint-config-openlayers": "^2.0.0",
|
||||
"expect.js": "0.3.1",
|
||||
"gaze": "^0.5.1",
|
||||
"istanbul": "0.4.1",
|
||||
"jquery": "2.1.4",
|
||||
"jshint": "2.8.0",
|
||||
"mocha": "2.3.4",
|
||||
"mocha-phantomjs-core": "^1.3.0",
|
||||
"mustache": "2.2.1",
|
||||
@@ -68,6 +70,22 @@
|
||||
"slimerjs-edge": "0.10.0-pre-3",
|
||||
"wrench": "1.5.8"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "openlayers",
|
||||
"globals": {
|
||||
"ArrayBuffer": false,
|
||||
"Uint16Array": false,
|
||||
"Uint32Array": false,
|
||||
"Uint8Array": false,
|
||||
"Uint8ClampedArray": false,
|
||||
"ol": false,
|
||||
"goog": false,
|
||||
"proj4": false
|
||||
},
|
||||
"rules": {
|
||||
"no-constant-condition": 0
|
||||
}
|
||||
},
|
||||
"ext": [
|
||||
"rbush",
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
|
||||
@@ -4,7 +4,6 @@ goog.require('goog.math');
|
||||
goog.require('ol.TileRange');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* An attribution for a layer source.
|
||||
@@ -59,8 +58,7 @@ ol.Attribution.prototype.getHTML = function() {
|
||||
* @param {!ol.proj.Projection} projection Projection.
|
||||
* @return {boolean} Intersects any tile range.
|
||||
*/
|
||||
ol.Attribution.prototype.intersectsAnyTileRange =
|
||||
function(tileRanges, tileGrid, projection) {
|
||||
ol.Attribution.prototype.intersectsAnyTileRange = function(tileRanges, tileGrid, projection) {
|
||||
if (!this.tileRanges_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ ol.CenterConstraintType;
|
||||
|
||||
/**
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @return {ol.CenterConstraintType}
|
||||
* @return {ol.CenterConstraintType} The constraint.
|
||||
*/
|
||||
ol.CenterConstraint.createExtent = function(extent) {
|
||||
return (
|
||||
|
||||
@@ -31,7 +31,6 @@ ol.CollectionEventType = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link ol.Collection} instances are instances of this
|
||||
@@ -67,7 +66,6 @@ ol.CollectionProperty = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* An expanded version of standard JS Array, adding convenience methods for
|
||||
|
||||
@@ -145,9 +145,6 @@ ol.color.equals = function(color1, color2) {
|
||||
* @return {ol.Color} Color.
|
||||
*/
|
||||
ol.color.fromString = (
|
||||
/**
|
||||
* @return {function(string): ol.Color}
|
||||
*/
|
||||
function() {
|
||||
|
||||
// We maintain a small cache of parsed strings. To provide cheap LRU-like
|
||||
|
||||
@@ -5,7 +5,6 @@ goog.require('ol.ResolutionConstraintType');
|
||||
goog.require('ol.RotationConstraintType');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.CenterConstraintType} centerConstraint Center constraint.
|
||||
@@ -14,8 +13,7 @@ goog.require('ol.RotationConstraintType');
|
||||
* @param {ol.RotationConstraintType} rotationConstraint
|
||||
* Rotation constraint.
|
||||
*/
|
||||
ol.Constraints =
|
||||
function(centerConstraint, resolutionConstraint, rotationConstraint) {
|
||||
ol.Constraints = function(centerConstraint, resolutionConstraint, rotationConstraint) {
|
||||
|
||||
/**
|
||||
* @type {ol.CenterConstraintType}
|
||||
|
||||
@@ -16,7 +16,6 @@ goog.require('ol.css');
|
||||
goog.require('ol.source.Tile');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Control to show all the attributions associated with the layer sources
|
||||
@@ -238,16 +237,14 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
this.attributionElementRenderedVisible_[attributionKey] = true;
|
||||
}
|
||||
delete visibleAttributions[attributionKey];
|
||||
}
|
||||
else if (attributionKey in hiddenAttributions) {
|
||||
} else if (attributionKey in hiddenAttributions) {
|
||||
if (this.attributionElementRenderedVisible_[attributionKey]) {
|
||||
goog.style.setElementShown(
|
||||
this.attributionElements_[attributionKey], false);
|
||||
delete this.attributionElementRenderedVisible_[attributionKey];
|
||||
}
|
||||
delete hiddenAttributions[attributionKey];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
goog.dom.removeNode(this.attributionElements_[attributionKey]);
|
||||
delete this.attributionElements_[attributionKey];
|
||||
delete this.attributionElementRenderedVisible_[attributionKey];
|
||||
|
||||
@@ -7,7 +7,6 @@ goog.require('ol.MapEventType');
|
||||
goog.require('ol.Object');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A control is a visible widget with a DOM element in a fixed position on the
|
||||
|
||||
@@ -12,7 +12,6 @@ goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Provides a button that when clicked fills up the full screen with the map.
|
||||
|
||||
@@ -23,7 +23,6 @@ ol.control.MousePositionProperty = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A control to show the 2D coordinates of the mouse cursor. By default, these
|
||||
|
||||
@@ -23,7 +23,6 @@ goog.require('ol.css');
|
||||
goog.require('ol.extent');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new control with a map acting as an overview map for an other
|
||||
* defined map.
|
||||
|
||||
@@ -11,7 +11,6 @@ goog.require('ol.css');
|
||||
goog.require('ol.easing');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control to reset rotation to 0.
|
||||
|
||||
@@ -37,7 +37,6 @@ ol.control.ScaleLineUnits = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A control displaying rough x-axis distances, calculated for the center of the
|
||||
|
||||
@@ -9,7 +9,6 @@ goog.require('ol.css');
|
||||
goog.require('ol.easing');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A control with 2 buttons, one for zoom in and one for zoom out.
|
||||
|
||||
@@ -21,7 +21,6 @@ goog.require('ol.easing');
|
||||
goog.require('ol.math');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A slider type of control for zooming.
|
||||
|
||||
@@ -8,7 +8,6 @@ goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control which, when pressed, changes the map view to a specific
|
||||
|
||||
@@ -20,7 +20,6 @@ ol.DeviceOrientationProperty = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* The ol.DeviceOrientation class provides access to information from
|
||||
|
||||
@@ -14,7 +14,7 @@ goog.require('ol');
|
||||
* Create an html canvas element and returns its 2d context.
|
||||
* @param {number=} opt_width Canvas width.
|
||||
* @param {number=} opt_height Canvas height.
|
||||
* @return {CanvasRenderingContext2D}
|
||||
* @return {CanvasRenderingContext2D} The context.
|
||||
*/
|
||||
ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
|
||||
var canvas = document.createElement('CANVAS');
|
||||
@@ -196,7 +196,7 @@ ol.dom.transformElement2D = function(element, transform, opt_precision) {
|
||||
* padding and border.
|
||||
* Equivalent to jQuery's `$(el).outerWidth(true)`.
|
||||
* @param {!Element} element Element.
|
||||
* @return {number}
|
||||
* @return {number} The width.
|
||||
*/
|
||||
ol.dom.outerWidth = function(element) {
|
||||
var width = element.offsetWidth;
|
||||
@@ -212,7 +212,7 @@ ol.dom.outerWidth = function(element) {
|
||||
* padding and border.
|
||||
* Equivalent to jQuery's `$(el).outerHeight(true)`.
|
||||
* @param {!Element} element Element.
|
||||
* @return {number}
|
||||
* @return {number} The height.
|
||||
*/
|
||||
ol.dom.outerHeight = function(element) {
|
||||
var height = element.offsetHeight;
|
||||
|
||||
@@ -301,8 +301,7 @@ ol.extent.createOrUpdateFromCoordinates = function(coordinates, opt_extent) {
|
||||
* @param {ol.Extent=} opt_extent Extent.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.extent.createOrUpdateFromFlatCoordinates =
|
||||
function(flatCoordinates, offset, end, stride, opt_extent) {
|
||||
ol.extent.createOrUpdateFromFlatCoordinates = function(flatCoordinates, offset, end, stride, opt_extent) {
|
||||
var extent = ol.extent.createOrUpdateEmpty(opt_extent);
|
||||
return ol.extent.extendFlatCoordinates(
|
||||
extent, flatCoordinates, offset, end, stride);
|
||||
@@ -411,8 +410,7 @@ ol.extent.extendCoordinates = function(extent, coordinates) {
|
||||
* @param {number} stride Stride.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.extent.extendFlatCoordinates =
|
||||
function(extent, flatCoordinates, offset, end, stride) {
|
||||
ol.extent.extendFlatCoordinates = function(extent, flatCoordinates, offset, end, stride) {
|
||||
for (; offset < end; offset += stride) {
|
||||
ol.extent.extendXY(
|
||||
extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
|
||||
@@ -572,8 +570,7 @@ ol.extent.getEnlargedArea = function(extent1, extent2) {
|
||||
* @param {ol.Extent=} opt_extent Destination extent.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
ol.extent.getForViewAndSize =
|
||||
function(center, resolution, rotation, size, opt_extent) {
|
||||
ol.extent.getForViewAndSize = function(center, resolution, rotation, size, opt_extent) {
|
||||
var dx = resolution * size[0] / 2;
|
||||
var dy = resolution * size[1] / 2;
|
||||
var cosRotation = Math.cos(rotation);
|
||||
|
||||
@@ -10,7 +10,6 @@ goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A vector object for geographic features with a geometry and other
|
||||
|
||||
@@ -20,7 +20,6 @@ goog.require('ol.geom.flat.orient');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the EsriJSON format.
|
||||
@@ -353,8 +352,7 @@ ol.format.EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) {
|
||||
* @private
|
||||
* @return {EsriJSONPolyline} EsriJSON geometry.
|
||||
*/
|
||||
ol.format.EsriJSON.writeMultiLineStringGeometry_ =
|
||||
function(geometry, opt_options) {
|
||||
ol.format.EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString,
|
||||
'geometry should be an ol.geom.MultiLineString');
|
||||
var hasZM = ol.format.EsriJSON.getHasZM_(geometry);
|
||||
@@ -688,8 +686,7 @@ ol.format.EsriJSON.prototype.writeFeatures;
|
||||
* @return {Object} EsriJSON Object.
|
||||
* @api
|
||||
*/
|
||||
ol.format.EsriJSON.prototype.writeFeaturesObject =
|
||||
function(features, opt_options) {
|
||||
ol.format.EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
var objects = [];
|
||||
var i, ii;
|
||||
|
||||
@@ -4,7 +4,6 @@ goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
|
||||
@@ -18,7 +18,6 @@ goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the GeoJSON format.
|
||||
@@ -243,8 +242,7 @@ ol.format.GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
|
||||
* @private
|
||||
* @return {GeoJSONGeometry} GeoJSON geometry.
|
||||
*/
|
||||
ol.format.GeoJSON.writeMultiLineStringGeometry_ =
|
||||
function(geometry, opt_options) {
|
||||
ol.format.GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString,
|
||||
'geometry should be an ol.geom.MultiLineString');
|
||||
return /** @type {GeoJSONGeometry} */ ({
|
||||
@@ -572,8 +570,7 @@ ol.format.GeoJSON.prototype.writeFeatures;
|
||||
* @return {GeoJSONFeatureCollection} GeoJSON Object.
|
||||
* @api stable
|
||||
*/
|
||||
ol.format.GeoJSON.prototype.writeFeaturesObject =
|
||||
function(features, opt_options) {
|
||||
ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
var objects = [];
|
||||
var i, ii;
|
||||
|
||||
@@ -9,7 +9,6 @@ goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the GML format,
|
||||
@@ -120,8 +119,7 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML2.prototype.innerBoundaryIsParser_ =
|
||||
function(node, objectStack) {
|
||||
ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
||||
@@ -146,8 +144,7 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ =
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML2.prototype.outerBoundaryIsParser_ =
|
||||
function(node, objectStack) {
|
||||
ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
||||
|
||||
@@ -23,7 +23,6 @@ goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the GML format
|
||||
@@ -224,8 +223,7 @@ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
||||
* @private
|
||||
* @return {Array.<number>|undefined} flat coordinates.
|
||||
*/
|
||||
ol.format.GML3.prototype.readLineStringSegment_ =
|
||||
function(node, objectStack) {
|
||||
ol.format.GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'LineStringSegment',
|
||||
@@ -661,7 +659,7 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
||||
/**
|
||||
* @param {Array.<number>} point Point geometry.
|
||||
* @param {string=} opt_srsName Optional srsName
|
||||
* @return {string}
|
||||
* @return {string} The coords string.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
|
||||
@@ -758,8 +756,7 @@ ol.format.GML3.prototype.writeEnvelope = function(node, extent, objectStack) {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeLinearRing_ =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.GML3.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var srsName = context['srsName'];
|
||||
@@ -779,8 +776,7 @@ ol.format.GML3.prototype.writeLinearRing_ =
|
||||
* @return {Node} Node.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.RING_NODE_FACTORY_ =
|
||||
function(value, objectStack, opt_nodeName) {
|
||||
ol.format.GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var parentNode = context.node;
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
@@ -799,8 +795,7 @@ ol.format.GML3.prototype.RING_NODE_FACTORY_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeSurfaceOrPolygon_ =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var srsName = context['srsName'];
|
||||
@@ -829,8 +824,7 @@ ol.format.GML3.prototype.writeSurfaceOrPolygon_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeCurveOrLineString_ =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.GML3.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var srsName = context['srsName'];
|
||||
@@ -857,8 +851,7 @@ ol.format.GML3.prototype.writeCurveOrLineString_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var srsName = context['srsName'];
|
||||
@@ -902,8 +895,7 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeMultiCurveOrLineString_ =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var srsName = context['srsName'];
|
||||
@@ -938,8 +930,7 @@ ol.format.GML3.prototype.writeRing_ = function(node, ring, objectStack) {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeSurfaceOrPolygonMember_ =
|
||||
function(node, polygon, objectStack) {
|
||||
ol.format.GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var child = this.GEOMETRY_NODE_FACTORY_(
|
||||
@@ -957,8 +948,7 @@ ol.format.GML3.prototype.writeSurfaceOrPolygonMember_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writePointMember_ =
|
||||
function(node, point, objectStack) {
|
||||
ol.format.GML3.prototype.writePointMember_ = function(node, point, objectStack) {
|
||||
var child = ol.xml.createElementNS(node.namespaceURI, 'Point');
|
||||
node.appendChild(child);
|
||||
this.writePoint_(child, point, objectStack);
|
||||
@@ -971,8 +961,7 @@ ol.format.GML3.prototype.writePointMember_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeLineStringOrCurveMember_ =
|
||||
function(node, line, objectStack) {
|
||||
ol.format.GML3.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
|
||||
@@ -989,8 +978,7 @@ ol.format.GML3.prototype.writeLineStringOrCurveMember_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeSurfacePatches_ =
|
||||
function(node, polygon, objectStack) {
|
||||
ol.format.GML3.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
var child = ol.xml.createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
node.appendChild(child);
|
||||
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
|
||||
@@ -1003,8 +991,7 @@ ol.format.GML3.prototype.writeSurfacePatches_ =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeCurveSegments_ =
|
||||
function(node, line, objectStack) {
|
||||
ol.format.GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
|
||||
var child = ol.xml.createElementNS(node.namespaceURI,
|
||||
'LineStringSegment');
|
||||
node.appendChild(child);
|
||||
@@ -1017,8 +1004,7 @@ ol.format.GML3.prototype.writeCurveSegments_ =
|
||||
* @param {ol.geom.Geometry|ol.Extent} geometry Geometry.
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
ol.format.GML3.prototype.writeGeometryElement =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var item = goog.object.clone(context);
|
||||
@@ -1049,8 +1035,7 @@ ol.format.GML3.prototype.writeGeometryElement =
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
ol.format.GML3.prototype.writeFeatureElement =
|
||||
function(node, feature, objectStack) {
|
||||
ol.format.GML3.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
var fid = feature.getId();
|
||||
if (fid) {
|
||||
node.setAttribute('fid', fid);
|
||||
@@ -1099,8 +1084,7 @@ ol.format.GML3.prototype.writeFeatureElement =
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.writeFeatureMembers_ =
|
||||
function(node, features, objectStack) {
|
||||
ol.format.GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var featureType = context['featureType'];
|
||||
@@ -1225,8 +1209,7 @@ ol.format.GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
|
||||
* @return {Node|undefined} Node.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ =
|
||||
function(value, objectStack, opt_nodeName) {
|
||||
ol.format.GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
goog.asserts.assert(ol.xml.isNode(parentNode),
|
||||
'parentNode should be a node');
|
||||
@@ -1243,8 +1226,7 @@ ol.format.GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ =
|
||||
* @return {Node|undefined} Node.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ =
|
||||
function(value, objectStack, opt_nodeName) {
|
||||
ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var multiSurface = context['multiSurface'];
|
||||
@@ -1341,7 +1323,6 @@ ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the GML format
|
||||
|
||||
@@ -24,7 +24,6 @@ goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
@@ -340,8 +339,7 @@ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GMLBase.prototype.lineStringMemberParser_ =
|
||||
function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'lineStringMember' ||
|
||||
@@ -357,8 +355,7 @@ ol.format.GMLBase.prototype.lineStringMemberParser_ =
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GMLBase.prototype.polygonMemberParser_ =
|
||||
function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'polygonMember' ||
|
||||
@@ -472,8 +469,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
* @private
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ =
|
||||
function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
|
||||
@@ -583,8 +579,7 @@ ol.format.GMLBase.prototype.RING_PARSERS = Object({
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.GMLBase.prototype.readGeometryFromNode =
|
||||
function(node, opt_options) {
|
||||
ol.format.GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
|
||||
var geometry = this.readGeometryElement(node,
|
||||
[this.getReadOptions(node, opt_options ? opt_options : {})]);
|
||||
return geometry ? geometry : null;
|
||||
@@ -606,8 +601,7 @@ ol.format.GMLBase.prototype.readFeatures;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.GMLBase.prototype.readFeaturesFromNode =
|
||||
function(node, opt_options) {
|
||||
ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
var options = {
|
||||
featureType: this.featureType,
|
||||
featureNS: this.featureNS
|
||||
|
||||
@@ -15,7 +15,6 @@ goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the GPX format.
|
||||
@@ -413,7 +412,7 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<ol.Feature>} features
|
||||
* @param {Array.<ol.Feature>} features List of features.
|
||||
* @private
|
||||
*/
|
||||
ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
|
||||
@@ -551,12 +550,12 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
|
||||
ol.xml.setAttributeNS(node, null, 'lat', coordinate[1]);
|
||||
ol.xml.setAttributeNS(node, null, 'lon', coordinate[0]);
|
||||
var geometryLayout = context['geometryLayout'];
|
||||
/* jshint -W086 */
|
||||
switch (geometryLayout) {
|
||||
case ol.geom.GeometryLayout.XYZM:
|
||||
if (coordinate[3] !== 0) {
|
||||
properties['time'] = coordinate[3];
|
||||
}
|
||||
// fall through
|
||||
case ol.geom.GeometryLayout.XYZ:
|
||||
if (coordinate[2] !== 0) {
|
||||
properties['ele'] = coordinate[2];
|
||||
@@ -566,8 +565,10 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
|
||||
if (coordinate[2] !== 0) {
|
||||
properties['time'] = coordinate[2];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// pass
|
||||
}
|
||||
/* jshint +W086 */
|
||||
var orderedKeys = ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
|
||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
|
||||
|
||||
@@ -23,7 +23,6 @@ ol.format.IGCZ = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for `*.igc` flight recording files.
|
||||
|
||||
@@ -6,7 +6,6 @@ goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.FormatType');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
|
||||
@@ -57,7 +57,6 @@ ol.format.KMLVec2_;
|
||||
ol.format.KMLGxTrackObject_;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading and writing data in the KML format.
|
||||
@@ -1164,8 +1163,8 @@ ol.format.KML.readStyle_ = function(node, objectStack) {
|
||||
* Reads an array of geometries and creates arrays for common geometry
|
||||
* properties. Then sets them to the multi geometry.
|
||||
* @param {ol.geom.MultiPoint|ol.geom.MultiLineString|ol.geom.MultiPolygon}
|
||||
* multiGeometry
|
||||
* @param {Array.<ol.geom.Geometry>} geometries
|
||||
* multiGeometry A multi-geometry.
|
||||
* @param {Array.<ol.geom.Geometry>} geometries List of geometries.
|
||||
* @private
|
||||
*/
|
||||
ol.format.KML.setCommonGeometryProperties_ = function(multiGeometry,
|
||||
@@ -2137,8 +2136,7 @@ ol.format.KML.writeColorTextNode_ = function(node, color) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.KML.writeCoordinatesTextNode_ =
|
||||
function(node, coordinates, objectStack) {
|
||||
ol.format.KML.writeCoordinatesTextNode_ = function(node, coordinates, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
|
||||
@@ -2322,8 +2320,7 @@ ol.format.KML.writeLineStyle_ = function(node, style, objectStack) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
*/
|
||||
ol.format.KML.writeMultiGeometry_ =
|
||||
function(node, geometry, objectStack) {
|
||||
ol.format.KML.writeMultiGeometry_ = function(node, geometry, objectStack) {
|
||||
goog.asserts.assert(
|
||||
(geometry instanceof ol.geom.MultiPoint) ||
|
||||
(geometry instanceof ol.geom.MultiLineString) ||
|
||||
@@ -2605,9 +2602,8 @@ ol.format.KML.ICON_SEQUENCE_ = ol.xml.makeStructureNS(
|
||||
ol.format.KML.NAMESPACE_URIS_, [
|
||||
'href'
|
||||
],
|
||||
ol.xml.makeStructureNS(
|
||||
ol.format.KML.GX_NAMESPACE_URIS_, [
|
||||
'x', 'y', 'w', 'h'
|
||||
ol.xml.makeStructureNS(ol.format.KML.GX_NAMESPACE_URIS_, [
|
||||
'x', 'y', 'w', 'h'
|
||||
]));
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ goog.require('ol.proj.Units');
|
||||
goog.require('ol.render.Feature');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading data in the Mapbox MVT format.
|
||||
@@ -207,11 +206,11 @@ ol.format.MVT.prototype.setLayers = function(layers) {
|
||||
ol.format.MVT.calculateFlatCoordinates_ = function(
|
||||
coords, flatCoordinates, ends) {
|
||||
var end = 0;
|
||||
var line, coord;
|
||||
for (var i = 0, ii = coords.length; i < ii; ++i) {
|
||||
line = coords[i];
|
||||
for (var j = 0, jj = line.length; j < jj; ++j) {
|
||||
coord = line[j];
|
||||
var line = coords[i];
|
||||
var j, jj;
|
||||
for (j = 0, jj = line.length; j < jj; ++j) {
|
||||
var coord = line[j];
|
||||
// Non-tilespace coords can be calculated here when a TileGrid and
|
||||
// TileCoord are known.
|
||||
flatCoordinates.push(coord.x, coord.y);
|
||||
|
||||
@@ -16,7 +16,6 @@ goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Feature format for reading data in the
|
||||
@@ -128,7 +127,6 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) {
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
* @return {ol.Feature|undefined} Track.
|
||||
*/
|
||||
ol.format.OSMXML.readNd_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
@@ -143,7 +141,6 @@ ol.format.OSMXML.readNd_ = function(node, objectStack) {
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
* @return {ol.Feature|undefined} Track.
|
||||
*/
|
||||
ol.format.OSMXML.readTag_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user