Update
This commit is contained in:
21
master/examples/full-screen.html
Normal file
21
master/examples/full-screen.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<style type="text/css">
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<title>ol3 full-screen demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<script src="loader.js?id=full-screen" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
24
master/examples/full-screen.js
Normal file
24
master/examples/full-screen.js
Normal file
@@ -0,0 +1,24 @@
|
||||
goog.require('goog.debug.Console');
|
||||
goog.require('goog.debug.Logger');
|
||||
goog.require('goog.debug.Logger.Level');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
|
||||
if (goog.DEBUG) {
|
||||
goog.debug.Console.autoInstall();
|
||||
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
|
||||
}
|
||||
|
||||
|
||||
var layer = new ol.layer.TileLayer({
|
||||
source: new ol.source.MapQuestOpenAerial()
|
||||
});
|
||||
var map = new ol.Map({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
layers: new ol.Collection([layer]),
|
||||
target: 'map',
|
||||
zoom: 2
|
||||
});
|
||||
46
master/examples/loader.js
Normal file
46
master/examples/loader.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
*
|
||||
* Loader to add ol.css, ol.js and the example-specific js file to the
|
||||
* documents.
|
||||
*
|
||||
* This loader is used for the hosted examples. It is used in place of the
|
||||
* development loader (examples/loader.js).
|
||||
*
|
||||
* ol.css and ol.js are built with Plovr/Closure, based build/ol.json.
|
||||
* (`make build` should build them). They are located in the ../build/
|
||||
* directory, relatively to this script.
|
||||
*
|
||||
* The script should be named loader.js. So it needs to be renamed to
|
||||
* loader.js from loader_hosted_examples.js.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* <script src="../loader.js?id=my-demo"></script>
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
|
||||
var i, src, index, search, chunks, pair, params = {};
|
||||
for (i = scripts.length - 1; i >= 0; --i) {
|
||||
src = scripts[i].getAttribute('src');
|
||||
if (~(index = src.indexOf('loader.js?'))) {
|
||||
search = src.substr(index + 10);
|
||||
chunks = search ? search.split('&') : [];
|
||||
for (i = chunks.length - 1; i >= 0; --i) {
|
||||
pair = chunks[i].split('=');
|
||||
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
document.write('<link rel="stylesheet" href="../build/ol.css" '+
|
||||
'type="text/css">');
|
||||
document.write('<scr' + 'ipt type="text/javascript" ' +
|
||||
'src="../build/ol.js">' +
|
||||
'</scr' + 'ipt>');
|
||||
document.write('<scr' + 'ipt type="text/javascript" ' +
|
||||
'src="' + encodeURIComponent(params.id) + '.js">' +
|
||||
'</scr' + 'ipt>');
|
||||
}());
|
||||
80
master/examples/overlay-and-popup.html
Normal file
80
master/examples/overlay-and-popup.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<style type="text/css">
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.overlay {
|
||||
display: none;
|
||||
font-size: 10pt;
|
||||
}
|
||||
.ol-overlaycontainer .overlay {
|
||||
display: block;
|
||||
}
|
||||
#vienna {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
font-size: 11pt;
|
||||
font-weight: bold;
|
||||
text-shadow: black 0.1em 0.1em 0.2em;
|
||||
}
|
||||
#popup {
|
||||
width: 200px;
|
||||
margin-left: -107px;
|
||||
margin-bottom: 12px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
||||
/* Popup CSS generated with http://cssarrowplease.com/ */
|
||||
|
||||
.arrow_box {
|
||||
position: relative;
|
||||
background: #88b7d5;
|
||||
border: 2px solid #c2e1f5;
|
||||
}
|
||||
.arrow_box:after, .arrow_box:before {
|
||||
top: 100%;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.arrow_box:after {
|
||||
border-color: rgba(136, 183, 213, 0);
|
||||
border-top-color: #88b7d5;
|
||||
border-width: 10px;
|
||||
left: 50%;
|
||||
margin-left: -10px;
|
||||
}
|
||||
.arrow_box:before {
|
||||
border-color: rgba(194, 225, 245, 0);
|
||||
border-top-color: #c2e1f5;
|
||||
border-width: 13px;
|
||||
left: 50%;
|
||||
margin-left: -13px;
|
||||
}
|
||||
</style>
|
||||
<title>ol3 overlay-and-popup demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map">
|
||||
<!-- Clickable label for Vienna -->
|
||||
<a class="overlay" id="vienna" target="_blank" href="http://en.wikipedia.org/wiki/Vienna">Vienna</a>
|
||||
<!-- Popup -->
|
||||
<div class="overlay arrow_box" id="popup"></div>
|
||||
</div>
|
||||
<script src="loader.js?id=overlay-and-popup" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
48
master/examples/overlay-and-popup.js
Normal file
48
master/examples/overlay-and-popup.js
Normal file
@@ -0,0 +1,48 @@
|
||||
goog.require('goog.debug.Console');
|
||||
goog.require('goog.debug.Logger');
|
||||
goog.require('goog.debug.Logger.Level');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.CoordinateFormat');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.overlay.Overlay');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
|
||||
if (goog.DEBUG) {
|
||||
goog.debug.Console.autoInstall();
|
||||
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
|
||||
}
|
||||
|
||||
|
||||
var layer = new ol.layer.TileLayer({
|
||||
source: new ol.source.MapQuestOpenAerial()
|
||||
});
|
||||
var map = new ol.Map({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
layers: new ol.Collection([layer]),
|
||||
target: 'map',
|
||||
zoom: 2
|
||||
});
|
||||
|
||||
// Vienna label
|
||||
var vienna = new ol.overlay.Overlay({
|
||||
map: map,
|
||||
coordinate: ol.Projection.transformWithCodes(
|
||||
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
||||
element: document.getElementById('vienna')
|
||||
});
|
||||
|
||||
// Popup showing the position the user clicked
|
||||
var popup = new ol.overlay.Overlay({
|
||||
map: map,
|
||||
element: document.getElementById('popup')
|
||||
});
|
||||
map.addEventListener('click', function(evt) {
|
||||
var coordinate = evt.getCoordinate();
|
||||
popup.getElement().innerHTML =
|
||||
'Welcome to ol3. The location you clicked was<br>' +
|
||||
ol.CoordinateFormat.hdms(ol.Projection.transformWithCodes(
|
||||
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||
popup.setCoordinate(coordinate);
|
||||
});
|
||||
69
master/examples/side-by-side.html
Normal file
69
master/examples/side-by-side.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<style type="text/css">
|
||||
.map {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
border: thin solid #cccccc;
|
||||
margin: 1em;
|
||||
}
|
||||
</style>
|
||||
<title>ol3 side-by-side demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>ol3 side-by-side demo</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th>DOM</th>
|
||||
<th>WebGL</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div id="domMap" class="map"></div></td>
|
||||
<td><div id="webglMap" class="map"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div id="domMousePosition" class="mouseposition"></div></td>
|
||||
<td><div id="webglMousePosition" class="mouseposition"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Pan:</td>
|
||||
<td>drag, arrow keys</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Zoom:</td>
|
||||
<td>double-click, <code>Shift</code>+double-click, mouse wheel, <code>+</code>/<code>-</code> keys; <code>Shift</code>+drag</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rotate:</td>
|
||||
<td><code>Alt</code>+drag, <code>r</code> to reset</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Brightness/contrast:</td>
|
||||
<td><code>b</code>/<code>B</code>/<code>c</code>/<code>C</code> keys (WebGL only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hue/saturation:</td>
|
||||
<td><code>h</code>/<code>H</code>/<code>s</code>/<code>S</code> keys (WebGL only)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Opacity:</td>
|
||||
<td><code>o</code>/<code>O</code> keys</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Visibility:</td>
|
||||
<td><code>v</code>/<code>V</code> keys</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Reset</td>
|
||||
<td><code>0</code> key</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><b>Notes:</b> The two maps share the same center, resolution, rotation and layers.</p>
|
||||
<script src="loader.js?id=side-by-side" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
101
master/examples/side-by-side.js
Normal file
101
master/examples/side-by-side.js
Normal file
@@ -0,0 +1,101 @@
|
||||
goog.require('goog.debug.Console');
|
||||
goog.require('goog.debug.Logger');
|
||||
goog.require('goog.debug.Logger.Level');
|
||||
goog.require('ol.CoordinateFormat');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.control.MousePosition');
|
||||
goog.require('ol.interaction.Keyboard');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
|
||||
if (goog.DEBUG) {
|
||||
goog.debug.Console.autoInstall();
|
||||
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
|
||||
}
|
||||
|
||||
|
||||
var layer = new ol.layer.TileLayer({
|
||||
source: new ol.source.MapQuestOpenAerial()
|
||||
});
|
||||
|
||||
var domMap = new ol.Map({
|
||||
center: new ol.Coordinate(0, 0),
|
||||
layers: new ol.Collection([layer]),
|
||||
renderer: ol.RendererHint.DOM,
|
||||
target: 'domMap',
|
||||
zoom: 1
|
||||
});
|
||||
|
||||
domMap.getControls().push(new ol.control.MousePosition({
|
||||
coordinateFormat: ol.CoordinateFormat.hdms,
|
||||
projection: ol.Projection.getFromCode('EPSG:4326'),
|
||||
target: document.getElementById('domMousePosition'),
|
||||
undefinedHtml: ' '
|
||||
}));
|
||||
|
||||
var webglMap = new ol.Map({
|
||||
renderer: ol.RendererHint.WEBGL,
|
||||
target: 'webglMap'
|
||||
});
|
||||
if (webglMap !== null) {
|
||||
webglMap.bindTo('center', domMap);
|
||||
webglMap.bindTo('layers', domMap);
|
||||
webglMap.bindTo('resolution', domMap);
|
||||
webglMap.bindTo('rotation', domMap);
|
||||
}
|
||||
|
||||
webglMap.getControls().push(new ol.control.MousePosition({
|
||||
coordinateFormat: ol.CoordinateFormat.hdms,
|
||||
projection: ol.Projection.getFromCode('EPSG:4326'),
|
||||
target: document.getElementById('webglMousePosition'),
|
||||
undefinedHtml: ' '
|
||||
}));
|
||||
|
||||
var keyboardInteraction = new ol.interaction.Keyboard();
|
||||
keyboardInteraction.addCallback('0', function() {
|
||||
layer.setBrightness(0);
|
||||
layer.setContrast(0);
|
||||
layer.setHue(0);
|
||||
layer.setSaturation(0);
|
||||
layer.setOpacity(1);
|
||||
layer.setVisible(true);
|
||||
});
|
||||
keyboardInteraction.addCallback('b', function() {
|
||||
layer.setBrightness(layer.getBrightness() - 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('B', function() {
|
||||
layer.setBrightness(layer.getBrightness() + 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('c', function() {
|
||||
layer.setContrast(layer.getContrast() - 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('C', function() {
|
||||
layer.setContrast(layer.getContrast() + 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('h', function() {
|
||||
layer.setHue(layer.getHue() - 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('H', function() {
|
||||
layer.setHue(layer.getHue() + 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('o', function() {
|
||||
layer.setOpacity(layer.getOpacity() - 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('O', function() {
|
||||
layer.setOpacity(layer.getOpacity() + 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('r', function() {
|
||||
webglMap.setRotation(0);
|
||||
});
|
||||
keyboardInteraction.addCallback('s', function() {
|
||||
layer.setSaturation(layer.getSaturation() - 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('S', function() {
|
||||
layer.setSaturation(layer.getSaturation() + 0.1);
|
||||
});
|
||||
keyboardInteraction.addCallback('vV', function() {
|
||||
layer.setVisible(!layer.getVisible());
|
||||
});
|
||||
domMap.getInteractions().push(keyboardInteraction);
|
||||
56
master/examples/style.css
Normal file
56
master/examples/style.css
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Basic Typography
|
||||
*/
|
||||
body {
|
||||
font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
|
||||
font-size: 85%;
|
||||
color: #222;
|
||||
background: #fff;
|
||||
margin: 1em 1.5em;
|
||||
}
|
||||
pre, code {
|
||||
margin: 1.5em 0;
|
||||
white-space: pre;
|
||||
}
|
||||
pre, code {
|
||||
font: 1em 'andale mono', 'lucida console', monospace;
|
||||
line-height:1.5;
|
||||
}
|
||||
a {
|
||||
color: #436976;
|
||||
background-color: transparent;
|
||||
}
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #003a6b;
|
||||
background-color: transparent;
|
||||
font: 100% Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
|
||||
margin: 0;
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
h1 {
|
||||
font-size: 130%;
|
||||
margin-bottom: 0.5em;
|
||||
border-bottom: 1px solid #fcb100;
|
||||
}
|
||||
h2 {
|
||||
font-size: 120%;
|
||||
margin-bottom: 0.5em;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
h3 {
|
||||
font-size: 110%;
|
||||
margin-bottom: 0.5em;
|
||||
text-decoration: underline;
|
||||
}
|
||||
h4 {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
h5 {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
h6 {
|
||||
font-size: 80%;
|
||||
font-weight: bold;
|
||||
}
|
||||
30
master/examples/two-layers.html
Normal file
30
master/examples/two-layers.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<style type="text/css">
|
||||
.map {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
border: thin solid #cccccc;
|
||||
margin: 1em;
|
||||
}
|
||||
</style>
|
||||
<title>ol3 two-layers demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>ol3 two-layers demo</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th>DOM</th>
|
||||
<th>WebGL</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div id="domMap" class="map"></div></td>
|
||||
<td><div id="webglMap" class="map"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<script src="loader.js?id=two-layers" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
41
master/examples/two-layers.js
Normal file
41
master/examples/two-layers.js
Normal file
@@ -0,0 +1,41 @@
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.RendererHint');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.source.BingMaps');
|
||||
goog.require('ol.source.TileJSON');
|
||||
|
||||
|
||||
var layers = new ol.Collection([
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.BingMaps({
|
||||
key: 'Ak0kFwyFsvMr0dVwuaURTqKAXytSSN47KOdj4uVpaWBhK-DT6Zo-FeHCiJUL0tYL',
|
||||
style: ol.BingMapsStyle.AERIAL
|
||||
})
|
||||
}),
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.TileJSON({
|
||||
uri: 'http://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.jsonp'
|
||||
})
|
||||
})
|
||||
]);
|
||||
|
||||
var webglMap = new ol.Map({
|
||||
center: ol.Projection.transformWithCodes(
|
||||
new ol.Coordinate(-77.93255, 37.9555), 'EPSG:4326', 'EPSG:3857'),
|
||||
layers: layers,
|
||||
renderer: ol.RendererHint.WEBGL,
|
||||
target: 'webglMap',
|
||||
zoom: 5
|
||||
});
|
||||
|
||||
var domMap = new ol.Map({
|
||||
renderer: ol.RendererHint.DOM,
|
||||
target: 'domMap'
|
||||
});
|
||||
domMap.bindTo('center', webglMap);
|
||||
domMap.bindTo('layers', webglMap);
|
||||
domMap.bindTo('resolution', webglMap);
|
||||
domMap.bindTo('rotation', webglMap);
|
||||
Reference in New Issue
Block a user