Remove complex-geometry example
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
<title>Complex geometry example</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="map" class="map"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span12">
|
||||
<h4 id="title">Complex geometry example</h4>
|
||||
<p id="shortdesc">Example of rendering a complex geometry. Zoom into the purple lines to see more detail.</p>
|
||||
<div id="docs">
|
||||
<p>See the <a href="complex-geometry.js" target="_blank">complex-geometry.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">vector, simplification</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="jquery.min.js" type="text/javascript"></script>
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/defs/EPSG21781.js" type="text/javascript"></script>
|
||||
<script src="loader.js?id=complex-geometry" type="text/javascript"></script>
|
||||
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,135 +0,0 @@
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.control');
|
||||
goog.require('ol.control.ScaleLine');
|
||||
goog.require('ol.control.ScaleLineUnits');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.shape');
|
||||
goog.require('ol.source.GeoJSON');
|
||||
goog.require('ol.source.TileWMS');
|
||||
goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
|
||||
var projection = ol.proj.configureProj4jsProjection({
|
||||
code: 'EPSG:21781',
|
||||
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864]
|
||||
});
|
||||
|
||||
var vectorSource = new ol.source.GeoJSON({
|
||||
defaultProjection: projection,
|
||||
url: 'data/mtbland.geojson'
|
||||
});
|
||||
|
||||
var styleArray = [new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
color: 'rgba(128,0,128,0.8)',
|
||||
lineCap: 'round',
|
||||
lineJoin: 'round',
|
||||
width: 3
|
||||
})
|
||||
})];
|
||||
|
||||
var extent = [420000, 30000, 900000, 350000];
|
||||
var layers = [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.TileWMS({
|
||||
url: 'http://wms.geo.admin.ch/',
|
||||
crossOrigin: 'anonymous',
|
||||
attributions: [new ol.Attribution({
|
||||
html: '© ' +
|
||||
'<a href="http://www.geo.admin.ch/internet/geoportal/' +
|
||||
'en/home.html">' +
|
||||
'Pixelmap 1:1000000 / geo.admin.ch</a>'
|
||||
})],
|
||||
params: {
|
||||
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
|
||||
'FORMAT': 'image/jpeg'
|
||||
},
|
||||
extent: extent
|
||||
})
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
source: vectorSource,
|
||||
styleFunction: function(feature, resolution) {
|
||||
return styleArray;
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
var map = new ol.Map({
|
||||
controls: ol.control.defaults().extend([
|
||||
new ol.control.ScaleLine({
|
||||
units: ol.control.ScaleLineUnits.METRIC
|
||||
})
|
||||
]),
|
||||
layers: layers,
|
||||
renderer: ol.RendererHint.CANVAS,
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
projection: projection,
|
||||
center: [660000, 190000],
|
||||
extent: extent,
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
|
||||
var point = null;
|
||||
var line = null;
|
||||
var displaySnap = function(coordinate) {
|
||||
var closestFeature = vectorSource.getClosestFeatureToCoordinate(coordinate);
|
||||
if (closestFeature === null) {
|
||||
point = null;
|
||||
line = null;
|
||||
} else {
|
||||
var geometry = closestFeature.getGeometry();
|
||||
var closestPoint = geometry.getClosestPoint(coordinate);
|
||||
if (point === null) {
|
||||
point = new ol.geom.Point(closestPoint);
|
||||
} else {
|
||||
point.setCoordinates(closestPoint);
|
||||
}
|
||||
if (line === null) {
|
||||
line = new ol.geom.LineString([coordinate, closestPoint]);
|
||||
} else {
|
||||
line.setCoordinates([coordinate, closestPoint]);
|
||||
}
|
||||
}
|
||||
map.requestRenderFrame();
|
||||
};
|
||||
|
||||
$(map.getViewport()).on('mousemove', function(evt) {
|
||||
var coordinate = map.getEventCoordinate(evt.originalEvent);
|
||||
displaySnap(coordinate);
|
||||
});
|
||||
|
||||
map.on('singleclick', function(evt) {
|
||||
var coordinate = evt.getCoordinate();
|
||||
displaySnap(coordinate);
|
||||
});
|
||||
|
||||
var imageStyle = ol.shape.renderCircle(5, null, new ol.style.Stroke({
|
||||
color: 'rgba(255,0,0,0.9)',
|
||||
width: 1
|
||||
}));
|
||||
var strokeStyle = new ol.style.Stroke({
|
||||
color: 'rgba(255,0,0,0.9)',
|
||||
width: 1
|
||||
});
|
||||
map.on('postcompose', function(evt) {
|
||||
var render = evt.getRender();
|
||||
if (point !== null) {
|
||||
render.setImageStyle(imageStyle);
|
||||
render.drawPointGeometry(point);
|
||||
}
|
||||
if (line !== null) {
|
||||
render.setFillStrokeStyle(null, strokeStyle);
|
||||
render.drawLineStringGeometry(line);
|
||||
}
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user