Add overviewmap example, simple use case

This commit is contained in:
Alexandre Dubé
2014-10-09 10:10:27 -04:00
parent ddc6138dbf
commit f17bb1a852
2 changed files with 63 additions and 0 deletions

41
examples/overviewmap.html Normal file
View File

@@ -0,0 +1,41 @@
<!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>ol3 OverviewMap control 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">
<h4 id="title">OverviewMap control</h4>
<div id="map" class="map"></div>
<div class="row-fluid">
<p id="shortdesc">Example of OverviewMap control.</p>
<div id="docs">
<p>See the <a href="overviewmap.js" target="_blank">overviewmap.js source</a> to see how this is done.</p>
</div>
<div id="tags">overview, overviewmap</div>
</div>
</div>
<script src="../resources/jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=overviewmap" type="text/javascript"></script>
</body>
</html>

22
examples/overviewmap.js Normal file
View File

@@ -0,0 +1,22 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control');
goog.require('ol.control.OverviewMap');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
controls: ol.control.defaults().extend([
new ol.control.OverviewMap()
]),
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
center: [500000, 6000000],
zoom: 7
})
});