mirror of
https://github.com/Viglino/ol-ext.git
synced 2026-01-25 17:36:21 +00:00
88 lines
3.0 KiB
HTML
88 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<!----------------------------------------------------------
|
|
|
|
Copyright (c) 2015 Jean-Marc VIGLINO,
|
|
released under CeCILL-B (french BSD like) licence: http://www.cecill.info/
|
|
|
|
------------------------------------------------------------>
|
|
<title>ol-ext: Swipe control</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<meta name="description" content="ol.control.Permalink add a premalink control to the map." />
|
|
<meta name="keywords" content="ol3, control, permalink, anchor" />
|
|
|
|
<link rel="stylesheet" href="../style.css" />
|
|
|
|
<!-- jQuery -->
|
|
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
|
|
|
|
<!-- Openlayers -->
|
|
<link rel="stylesheet" href="https://openlayers.org/en/latest/css/ol.css" />
|
|
<script type="text/javascript" src="https://openlayers.org/en/latest/build/ol.js"></script>
|
|
|
|
<!-- ol-ext -->
|
|
<link rel="stylesheet" href="../../dist/ol-ext.css" />
|
|
<script type="text/javascript" src="../../dist/ol-ext.js"></script>
|
|
|
|
</head>
|
|
<body >
|
|
<a href="https://github.com/Viglino/ol3-ext"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
|
|
|
|
<a href="../../index.html">
|
|
<h1>ol-ext: Swipe control</h1>
|
|
</a>
|
|
<div class="info">
|
|
<i>ol.control.Swipe</i> is a control that add a split screen to compare two map overlays.
|
|
<br/>
|
|
Layers can be added to left (top) or right (bottom) side of the map.
|
|
Layers that are not added are displayed on both sides.
|
|
</div>
|
|
|
|
<!-- Map div -->
|
|
<div id="map" style="width:600px; height:400px;"></div>
|
|
|
|
<div class="options" >
|
|
<ul><li>
|
|
<input id="ori" type="checkbox" onchange="ctrl.set('orientation',$(this).prop('checked')?'horizontal':'vertical')" /><label for="ori"> horizontal swipe</label>
|
|
</li><li>
|
|
<button type="button" onclick="ctrl.set('position', 0.5);">Reset position</button>
|
|
</li></ul>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
// Layers
|
|
var osm = new ol.layer.Tile(
|
|
{ source: new ol.source.OSM()
|
|
});
|
|
var stamen = new ol.layer.Tile(
|
|
{ source: new ol.source.Stamen({ layer: 'watercolor' })
|
|
});
|
|
var label = new ol.layer.Tile(
|
|
{ source: new ol.source.Stamen({ layer: 'terrain-labels' })
|
|
});
|
|
|
|
// The map
|
|
var map = new ol.Map
|
|
({ target: 'map',
|
|
view: new ol.View
|
|
({ zoom: 12,
|
|
center: [270701, 6247637]
|
|
}),
|
|
layers: [ stamen, osm, label ]
|
|
});
|
|
|
|
// Control
|
|
var ctrl = new ol.control.Swipe();
|
|
map.addControl(ctrl);
|
|
// Set stamen on left
|
|
ctrl.addLayer(stamen);
|
|
// OSM on right
|
|
ctrl.addLayer(osm, true);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|