adds the ability for the user to give map options when reading a WMC document, those options are taken into account with higher priority\n this patch also introduces the new util method isElement, r=me,elemoine, thanks Eric (Closes #2339)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9794 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+7
-4
@@ -105,7 +105,9 @@
|
||||
} else {
|
||||
map.destroy();
|
||||
try {
|
||||
map = format.read(text, {map: "map"});
|
||||
var jsonFormat = new OpenLayers.Format.JSON();
|
||||
var mapOptions = jsonFormat.read(OpenLayers.Util.getElement('mapOptions').value);
|
||||
map = format.read(text, {map: mapOptions});
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
} catch(err) {
|
||||
document.getElementById("wmc").value = err;
|
||||
@@ -133,9 +135,10 @@
|
||||
Shows parsing of Web Map Context documents.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
<button onclick="writeWMC();">write</button>
|
||||
<button onclick="readWMC();">read as new map</button>
|
||||
<button onclick="readWMC(true);">read and merge</button>
|
||||
<button onclick="writeWMC();">write</button><br />
|
||||
<button onclick="readWMC();">read as new map</button> with the following extra map options : <input type="text" id="mapOptions" value='{"div": "map", "allOverlays": true}'/><br />
|
||||
<button onclick="readWMC(true);">read and merge</button><br />
|
||||
<button onclick="pasteWMC();">try with another WMC document</button><br />
|
||||
<textarea id="wmc">paste WMC doc here</textarea>
|
||||
<div id="docs">
|
||||
This is an example of parsing WMC documents. <br />
|
||||
|
||||
Reference in New Issue
Block a user