This commit is contained in:
Tom Payne
2012-11-04 18:26:22 +01:00
parent 10e299148e
commit 80887d9deb
20 changed files with 1225 additions and 0 deletions

View File

@@ -0,0 +1 @@
.ol-attribution{position:absolute;font-size:10px;text-align:right;color:#eee;bottom:0;right:0;background:#130085;background:rgba(0,60,136,0.3);filter:alpha(opacity=30);font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;padding:2px 4px}.ol-attribution a{color:white;text-decoration:none}.ol-attribution li{display:inline;list-style:none}.ol-attribution li{display:inline}.ol-attribution li:not(:last-child):after{content:"\2003"}.ol-dragbox{position:absolute;border:2px solid red}.ol-renderer-webgl-canvas{width:100%;height:100%}.ol-viewport .ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ol-zoom{position:absolute;top:8px;left:8px;background:rgba(255,255,255,0.4);border-radius:4px;padding:2px}.ol-zoom a{display:block;margin:1px;padding:0;color:white;font-size:18px;font-family:'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;font-weight:bold;text-decoration:none;text-align:center;height:22px;width:22px;line-height:19px;background:#130085;background:rgba(0,60,136,0.5);filter:alpha(opacity=80)}.ol-zoom a:hover{background:#130085;background:rgba(0,60,136,0.7);filter:alpha(opacity=100)}@media only screen and (max-width:600px){.ol-zoom a:hover{background:rgba(0,60,136,0.5)}}.ol-zoom-in{border-radius:4px 4px 0 0}.ol-zoom-out{border-radius:0 0 4px 4px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
var info={"index": {"and": {"2": 1, "3": 1, "4": 1}, "layer": {"3": 1, "5": 1}, "projection": {"4": 3}, "ed": {"2": 1, "3": 1}, "national": {"4": 1}, "sync": {"2": 2, "3": 1}, "21781": {"4": 1}, "openaerial": {"0": 1, "1": 1}, "tilelayer": {"0": 1, "4": 1, "5": 1}, "popup": {"1": 1}, "mapquest": {"0": 1, "1": 1}, "overlays": {"1": 1}, "layers": {"3": 2, "4": 1}, "fullscreen": {"0": 1}, "overlay": {"1": 2}, "wms": {"4": 3, "5": 3}, "demonstrates": {"1": 1}, "webgl": {"2": 2, "3": 1}, "two": {"3": 2, "4": 1}, "parks": {"4": 1}, "custom": {"4": 1}, "1": {"4": 2}, "maps": {"2": 1, "3": 1}, "pixelmap": {"4": 1}, "tile": {"0": 1, "4": 1, "5": 1}, "map": {"0": 1}, "full": {"0": 2}, "screen": {"0": 2}, "object": {"2": 1}, "000": {"4": 2}, "tiled": {"4": 2, "5": 2}, "using": {"4": 1}, "tilejson": {"3": 1}, "with": {"3": 1, "4": 1}, "by": {"2": 3}, "bingmaps": {"3": 1}, "a": {"0": 1, "5": 1}, "dom": {"2": 2, "3": 1}, "of": {"0": 1, "4": 1, "5": 1}, "bing": {"3": 1}, "example": {"0": 2, "1": 1, "2": 1, "3": 1, "4": 2, "5": 2}, "epsg": {"4": 1}, "the": {"4": 1}, "side": {"2": 6}}, "examples": [{"author": "\u00c9ric Lemoine", "tags": "fullscreen, mapquest, openaerial, tile, tilelayer", "modified": "2012-10-21T21:11:27+0200", "classes": [], "link": "full-screen.html", "shortdesc": "Example of a full-screen map.", "title": "Full-screen example", "example": "full-screen.html"}, {"author": "\u00c9ric Lemoine", "tags": "overlay, popup, mapquest, openaerial", "modified": "2012-10-21T21:11:27+0200", "classes": [], "link": "overlay-and-popup.html", "shortdesc": "Demonstrates Overlays.", "title": "Overlay example", "example": "overlay-and-popup.html"}, {"author": "\u00c9ric Lemoine", "tags": "side-by-side, webgl, dom, sync, object", "modified": "2012-10-20T21:43:34+0200", "classes": [], "link": "side-by-side.html", "shortdesc": "Side-by-side DOM and WebGL sync'ed maps.", "title": "Side-by-side example", "example": "side-by-side.html"}, {"author": "\u00c9ric Lemoine", "tags": "layers, tilejson, bing, bingmaps", "modified": "2012-10-20T21:43:34+0200", "classes": [], "link": "two-layers.html", "shortdesc": "Sync'ed DOM and WebGL maps with two layers.", "title": "Two-layer example", "example": "two-layers.html"}, {"author": "ahocevar", "tags": "wms, tile, tilelayer, projection", "modified": "2012-10-29T09:33:00+0100", "classes": [], "link": "wms-custom-proj.html", "shortdesc": "Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.", "title": "Tiled WMS with custom projection example", "example": "wms-custom-proj.html"}, {"author": "ahocevar", "tags": "wms, tile, tilelayer", "modified": "2012-10-26T21:36:30+0200", "classes": [], "link": "wms.html", "shortdesc": "Example of a tiled WMS layer.", "title": "Tiled WMS example", "example": "wms.html"}]}

View File

@@ -0,0 +1 @@
<?xml version="1.0" ?><feed xmlns="http://www.w3.org/2005/Atom"><title>OpenLayers Examples</title><id>http://openlayers.github.com/ol3/master/examples/example-list.xml#2012-11-04T05:10:07Z</id><updated>2012-11-04T05:10:07Z</updated><entry><title>Tiled WMS with custom projection example</title><tags>wms, tile, tilelayer, projection</tags><link href="http://openlayers.github.com/ol3/master/examples/wms-custom-proj.html"/><summary>Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</summary><updated>2012-10-29T09:33:00+0100</updated><author><name>ahocevar</name></author><id>http://openlayers.github.com/ol3/master/examples/wms-custom-proj.html#2012-10-29T09:33:00+0100</id></entry><entry><title>Tiled WMS example</title><tags>wms, tile, tilelayer</tags><link href="http://openlayers.github.com/ol3/master/examples/wms.html"/><summary>Example of a tiled WMS layer.</summary><updated>2012-10-26T21:36:30+0200</updated><author><name>ahocevar</name></author><id>http://openlayers.github.com/ol3/master/examples/wms.html#2012-10-26T21:36:30+0200</id></entry><entry><title>Full-screen example</title><tags>fullscreen, mapquest, openaerial, tile, tilelayer</tags><link href="http://openlayers.github.com/ol3/master/examples/full-screen.html"/><summary>Example of a full-screen map.</summary><updated>2012-10-21T21:11:27+0200</updated><author><name>Éric Lemoine</name></author><id>http://openlayers.github.com/ol3/master/examples/full-screen.html#2012-10-21T21:11:27+0200</id></entry><entry><title>Overlay example</title><tags>overlay, popup, mapquest, openaerial</tags><link href="http://openlayers.github.com/ol3/master/examples/overlay-and-popup.html"/><summary>Demonstrates Overlays.</summary><updated>2012-10-21T21:11:27+0200</updated><author><name>Éric Lemoine</name></author><id>http://openlayers.github.com/ol3/master/examples/overlay-and-popup.html#2012-10-21T21:11:27+0200</id></entry><entry><title>Side-by-side example</title><tags>side-by-side, webgl, dom, sync, object</tags><link href="http://openlayers.github.com/ol3/master/examples/side-by-side.html"/><summary>Side-by-side DOM and WebGL sync'ed maps.</summary><updated>2012-10-20T21:43:34+0200</updated><author><name>Éric Lemoine</name></author><id>http://openlayers.github.com/ol3/master/examples/side-by-side.html#2012-10-20T21:43:34+0200</id></entry><entry><title>Two-layer example</title><tags>layers, tilejson, bing, bingmaps</tags><link href="http://openlayers.github.com/ol3/master/examples/two-layers.html"/><summary>Sync'ed DOM and WebGL maps with two layers.</summary><updated>2012-10-20T21:43:34+0200</updated><author><name>Éric Lemoine</name></author><id>http://openlayers.github.com/ol3/master/examples/two-layers.html#2012-10-20T21:43:34+0200</id></entry></feed>

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; 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="style.css" type="text/css">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#text {
position: absolute;
top: 8px;
right: 8px;
z-index: 20000;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
border-radius: 4px;
}
@media only screen and (max-width: 600px) {
#text {
display: none;
}
}
</style>
<title>Full-screen example</title>
</head>
<body>
<div id="map">
<div id="text">
<h1 id="title">Full-screen example</h1>
<div id="shortdesc">Example of a full-screen map.</div>
<div id="docs">
<p>See the
<a href="full-screen.js" target="_blank">full-screen.js source</a>
to see how this is done.</p>
</div>
</div>
</div>
<div id="tags">fullscreen, mapquest, openaerial, tile, tilelayer</div>
<script src="loader.js?id=full-screen" type="text/javascript"></script>
</body>
</html>

View 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
});

View File

@@ -0,0 +1,296 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- This is the example list source: if you are trying to look at the
source of an example, YOU ARE IN THE WRONG PLACE. -->
<title>OpenLayers Examples</title>
<link rel="alternate" href="example-list.xml" type="application/atom+xml" />
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
html, body {
margin: 0;
padding: 0;
line-height: 1.25em;
}
#logo {
text-shadow: 2px 2px 3px gray;
color: white;
vertical-align: middle;
position: absolute;
top: 5px;
left: 5px;
font-size: 34px;
font-family: "Trebuchet MS",Helvetica,Arial,sans-serif;
}
#logo img {
vertical-align: middle;
}
.ex_container{
}
.ex_container a {
text-decoration: none;
padding: 5px 1em;
display: block;
}
.ex_container a:hover {
background-color: #eeeeee;
}
.ex_title{
display: inline;
font-weight: bold;
color: #333;
}
.ex_tags{
display: inline;
font-size: smaller;
font-style: italic;
color: #333;
}
.ex_filename {
font-weight: normal;
font-size: 0.8em;
color: #ccc
}
.ex_description{
color: #222;
padding: 3px;
}
.ex_classes{
font-size: .7em;
color: gray;
display: none;
}
#toc {
width: 100%;
height: 100%;
}
#filter {
position: fixed;
text-align: center;
top: 0px;
background: #9D9FA1;
width: 100%;
padding: 1.3em 0;
}
#examples {
overflow: auto;
list-style: none;
margin: 0;
padding: 0;
}
#examples ul {
list-style: none;
margin: 0;
padding: 0;
margin-top: 4em;
}
#examples ul li {
display: inline;
float: left;
width: 350px;
margin: 10px 0 0 10px;
padding: 0;
border: 1px solid #ddd;
border-radius: 3px;
}
#examples .mainlink {
height: 8em;
overflow: auto;
}
#exwin {
position: absolute;
top: 0;
left: 30%;
width: 70%;
height: 100%;
border: none;
border-left: 1px solid #cccccc;
margin: 0;
}
@media only screen and (max-width: 600px) {
#examples ul {
margin-top: 100px;
}
#filter {
padding-top: 50px;
}
#examples ul li {
margin-left: 0;
border-radius: 0;
border-width: 1px 0;
width: 100%;
}
#examples .mainlink {
height: auto;
}
#examples .ex_tags, #examples .ex_filename {
display: none;
}
}
</style>
<script type="text/javascript" src="Jugl.js"></script>
<script type="text/javascript" src="example-list.js"></script>
<script type="text/javascript">
var template, target;
function listExamples(examples) {
target.innerHTML = "";
var node = template.process({
context: {examples: examples},
clone: true,
parent: target
});
document.getElementById("count").innerHTML = "(" + examples.length + ")";
}
var timerId;
function inputChange() {
if(timerId) {
window.clearTimeout(timerId);
}
var text = this.value;
timerId = window.setTimeout(function() {
filterList(text);
}, 500);
}
function filterList(text) {
var examples;
if(text.length < 2) {
examples = info.examples;
} else {
var words = text.split(/\W+/);
var scores = {};
for(var i=0; i<words.length; ++i) {
var word = words[i].toLowerCase();
var dict = info.index[word];
var updateScores = function() {
for(exIndex in dict) {
var count = dict[exIndex];
if(scores[exIndex]) {
if(scores[exIndex][word]) {
scores[exIndex][word] += count;
} else {
scores[exIndex][word] = count;
}
} else {
scores[exIndex] = {};
scores[exIndex][word] = count;
}
}
};
if(dict) {
updateScores();
} else {
var r;
for (idx in info.index) {
r = new RegExp(word);
if (r.test(idx)) {
dict = info.index[idx];
updateScores();
}
}
}
}
examples = [];
for(var j in scores) {
var ex = info.examples[j];
ex.score = scores[j];
examples.push(ex);
}
// sort examples by first by number of words matched, then
// by word frequency
examples.sort(function(a, b) {
var cmp;
var aWords = 0, bWords = 0;
var aScore = 0, bScore = 0;
for(var i in a.score) {
aScore += a.score[i];
aWords += 1;
}
for(var j in b.score) {
bScore += b.score[j];
bWords += 1;
}
if(aWords == bWords) {
cmp = bScore - aScore;
} else {
cmp = bWords - aWords;
}
return cmp;
});
}
listExamples(examples);
}
function showAll() {
document.getElementById("keywords").value = "";
listExamples(info.examples);
}
function parseQuery() {
var params = {};
var list = window.location.search.substring(1).split("&");
for(var i=0; i<list.length; ++i) {
var pair = list[i].split("=");
if(pair.length == 2) {
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
}
}
if(params["q"]) {
var input = document.getElementById("keywords");
input.value = params["q"];
inputChange.call(input);
}
}
window.onload = function() {
//document.getElementById('keywords').focus();
template = new jugl.Template("template");
target = document.getElementById("examples");
listExamples(info.examples);
document.getElementById("keywords").onkeyup = inputChange;
parseQuery();
};
</script>
</head>
<body>
<div id="toc">
<div id="filter">
<div id="logo">
<img src="http://www.openlayers.org/images/OpenLayers.trac.png"
/>
OpenLayers 3
</div>
<input autofocus placeholder="filter by keywords..." type="text" id="keywords" />
<span id="count"></span>
<a href="javascript:void showAll();">show all</a>
</div>
<div id="examples"></div>
</div>
<div style="display: none;">
<ul id="template">
<li class="ex_container" jugl:repeat="example examples">
<a jugl:attributes="href example.link" class="mainlink"
target="_blank">
<h5 class="ex_title">
<span jugl:replace="example.title">title</span><br>
<span class="ex_filename" jugl:content="'(' + example.example + ')'">filename</span>
</h5>
<div class="ex_description" jugl:content="example.shortdesc">
Short Description goes here
</div>
<p class="ex_classes" jugl:content="example.classes">
Related Classes go here
</p>
<div class="ex_tags" jugl:content="'...tagged with ' + example.tags">
</div>
</a>
</li>
</ul>
</div>
</body>
</html>

View 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>');
}());

View File

@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; 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="style.css" type="text/css">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#text {
position: absolute;
top: 8px;
right: 8px;
z-index: 20000;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
border-radius: 4px;
}
@media only screen and (max-width: 600px) {
#text {
display: none;
}
}
.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>Overlay example</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 id="text">
<h1 id="title">Overlay example</h1>
<div id="shortdesc">Demonstrates Overlays.</div>
<div id="docs">
<p>See the
<a href="overlay-and-popup.js" target="_blank">overlay-and-popup.js source</a>
to see how this is done.</p>
</div>
</div>
</div>
<div id="tags">overlay, popup, mapquest, openaerial</div>
<script src="loader.js?id=overlay-and-popup" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,47 @@
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.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.Coordinate.toStringHDMS(ol.Projection.transformWithCodes(
coordinate, 'EPSG:3857', 'EPSG:4326'));
popup.setCoordinate(coordinate);
});

View File

@@ -0,0 +1,77 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<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>Side-by-side example</title>
</head>
<body>
<h1 id="title">Side-by-side example</h1>
<div id="shortdesc">Side-by-side DOM and WebGL sync'ed maps.</div>
<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>
<div id="docs">
<p>See the
<a href="side-by-side.js" target="_blank">side-by-side.js source</a> to
see how this is done.</p>
</div>
<div id="tags">side-by-side, webgl, dom, sync, object</div>
<script src="loader.js?id=side-by-side" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,101 @@
goog.require('goog.debug.Console');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Logger.Level');
goog.require('ol.Coordinate');
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.Coordinate.toStringHDMS,
projection: ol.Projection.getFromCode('EPSG:4326'),
target: document.getElementById('domMousePosition'),
undefinedHtml: '&nbsp;'
}));
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.Coordinate.toStringHDMS,
projection: ol.Projection.getFromCode('EPSG:4326'),
target: document.getElementById('webglMousePosition'),
undefinedHtml: '&nbsp;'
}));
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);

View File

@@ -0,0 +1,62 @@
/**
* 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;
}
#tags {
display: none;
}
#shortdesc {
margin-bottom: 2em;
}

View File

@@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<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 id="title">Two-layer example</h1>
<div id="shortdesc">Sync'ed DOM and WebGL maps with two layers.</div>
<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>
<div id="docs">
<p>See the
<a href="two-layers.js" target="_blank">two-layers.js source</a>
to see how this is done.</p>
</div>
<div id="tags">layers, tilejson, bing, bingmaps</div>
<script src="loader.js?id=two-layers" type="text/javascript"></script>
</body>
</html>

View 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);

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; 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="style.css" type="text/css">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#text {
position: absolute;
top: 8px;
right: 8px;
z-index: 20000;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
border-radius: 4px;
}
@media only screen and (max-width: 600px) {
#text {
display: none;
}
}
</style>
<title>Tiled WMS with custom projection example</title>
</head>
<body>
<div id="map">
<div id="text">
<h1 id="title">Tiled WMS with custom projection example</h1>
<div id="shortdesc">Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</div>
<div id="docs">
<p>See the
<a href="wms-custom-proj.js" target="_blank">wms-custom-proj.js source</a>
to see how this is done.</p>
</div>
</div>
</div>
<div id="tags">wms, tile, tilelayer, projection</div>
<script src="loader.js?id=wms-custom-proj" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,61 @@
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.Projection');
goog.require('ol.source.TiledWMS');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
var epsg21781 = new ol.Projection('EPSG:21781', ol.ProjectionUnits.METERS,
// Validity extent from http://spatialreference.org
new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864));
ol.Projection.addProjection(epsg21781);
var extent = new ol.Extent(420000, 30000, 900000, 350000);
var layers = new ol.Collection([
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
url: 'http://wms.geo.admin.ch/?',
attributions: [new ol.Attribution(
'&copy; ' +
'<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'
},
projection: epsg21781,
extent: extent
})
}),
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
url: 'http://wms.geo.admin.ch/?',
attributions: [new ol.Attribution(
'&copy; ' +
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
'National parks / geo.admin.ch</a>')],
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
projection: epsg21781,
extent: extent
})
})
]);
var map = new ol.Map({
center: new ol.Coordinate(660000, 190000),
projection: epsg21781,
// By setting userProjection to the same as projection, we do not need
// proj4js because we do not need any transforms.
userProjection: epsg21781,
layers: layers,
target: 'map',
zoom: 9
});

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; 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="style.css" type="text/css">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#text {
position: absolute;
top: 8px;
right: 8px;
z-index: 20000;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
border-radius: 4px;
}
@media only screen and (max-width: 600px) {
#text {
display: none;
}
}
</style>
<title>wms example</title>
</head>
<body>
<div id="map">
<div id="text">
<h1 id="title">Tiled WMS example</h1>
<div id="shortdesc">Example of a tiled WMS layer.</div>
<div id="docs">
<p>See the
<a href="wms.js" target="_blank">wms.js source</a>
to see how this is done.</p>
</div>
</div>
</div>
<div id="tags">wms, tile, tilelayer</div>
<script src="loader.js?id=wms" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,36 @@
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');
goog.require('ol.source.TiledWMS');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
var layers = new ol.Collection([
new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
}),
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
crossOrigin: null,
params: {'LAYERS': 'topp:states', 'TILED': true},
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
})
})
]);
var map = new ol.Map({
renderer: ol.RendererHint.DOM,
layers: layers,
target: 'map',
center: new ol.Coordinate(-10997148, 4569099),
zoom: 4
});