Allow source to be set after layer construction
This commit is contained in:
73
examples/lazy-source.html
Normal file
73
examples/lazy-source.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<!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>Lazy Source</title>
|
||||
<style>
|
||||
button.code {
|
||||
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
|
||||
font-size: 12px;
|
||||
padding: 5px;
|
||||
margin: 0 5px;
|
||||
}
|
||||
</style>
|
||||
</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">Lazy source example</h4>
|
||||
<p id="shortdesc">Example of setting a layer source after construction.</p>
|
||||
<div id="docs">
|
||||
<p>
|
||||
Typically, the source for a layer is provided to the layer constructor.
|
||||
If you need to set a layer source after construction, this can be
|
||||
done with the <code>layer.setSource()</code> method.
|
||||
</p>
|
||||
<p>
|
||||
The layer in the map above is constructed with no source. Use the
|
||||
links below to set/unset the layer source. A layer is not rendered
|
||||
until its source is set.
|
||||
</p>
|
||||
<p>
|
||||
<button id="set-source" class="code">layer.setSource(source)</button>
|
||||
<button id="unset-source" class="code">layer.setSource(null)</button>
|
||||
</p>
|
||||
<p>See the <a href="lazy-source.js" target="_blank">lazy-source.js source</a> for details on how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">source</div>
|
||||
</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=lazy-source" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user