propset svn:eol-style native recursively throughout trunk. enjoy\!
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2978 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1,96 +1,96 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
#controlToggle li {
|
||||
list-style: none;
|
||||
}
|
||||
p {
|
||||
width: 512px;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map, drawControls;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
|
||||
var lineLayer = new OpenLayers.Layer.Vector("Line Layer");
|
||||
var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
|
||||
|
||||
map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
|
||||
var options = {handlerOptions: {freehand: true}};
|
||||
drawControls = {
|
||||
point: new OpenLayers.Control.DrawFeature(pointLayer,
|
||||
OpenLayers.Handler.Point),
|
||||
line: new OpenLayers.Control.DrawFeature(lineLayer,
|
||||
OpenLayers.Handler.Path, options),
|
||||
polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
|
||||
OpenLayers.Handler.Polygon, options)
|
||||
};
|
||||
|
||||
for(var key in drawControls) {
|
||||
map.addControl(drawControls[key]);
|
||||
}
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||
|
||||
document.getElementById('noneToggle').checked = true;
|
||||
}
|
||||
|
||||
function toggleControl(element) {
|
||||
for(key in drawControls) {
|
||||
var control = drawControls[key];
|
||||
if(element.value == key && element.checked) {
|
||||
control.activate();
|
||||
} else {
|
||||
control.deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Feature Example</h1>
|
||||
<div id="map"></div>
|
||||
<ul id="controlToggle">
|
||||
<li>
|
||||
<input type="radio" name="type" value="none" id="noneToggle"
|
||||
onclick="toggleControl(this);" checked="checked" />
|
||||
<label for="noneToggle">navigate</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="point" id="pointToggle" onclick="toggleControl(this);" />
|
||||
<label for="pointToggle">draw point</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="line" id="lineToggle" onclick="toggleControl(this);" />
|
||||
<label for="lineToggle">draw line</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="polygon" id="polygonToggle" onclick="toggleControl(this);" />
|
||||
<label for="polygonToggle">draw polygon</label>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Feature digitizing is in freehand mode by default. In freehand mode, the mouse is treated as a pen.
|
||||
Drawing begins on mouse down, continues with every mouse move, and ends with mouse up.</p>
|
||||
<p>To turn freehand mode off, hold down the shift key while digitizing. With freehand mode off, one
|
||||
vertex is added with each click and double-clicks finish drawing. Freehand mode can be toggled on and off
|
||||
at any time while drawing.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
#controlToggle li {
|
||||
list-style: none;
|
||||
}
|
||||
p {
|
||||
width: 512px;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map, drawControls;
|
||||
OpenLayers.Util.onImageLoadErrorColor = "transparent";
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
|
||||
var lineLayer = new OpenLayers.Layer.Vector("Line Layer");
|
||||
var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
|
||||
|
||||
map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
|
||||
var options = {handlerOptions: {freehand: true}};
|
||||
drawControls = {
|
||||
point: new OpenLayers.Control.DrawFeature(pointLayer,
|
||||
OpenLayers.Handler.Point),
|
||||
line: new OpenLayers.Control.DrawFeature(lineLayer,
|
||||
OpenLayers.Handler.Path, options),
|
||||
polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
|
||||
OpenLayers.Handler.Polygon, options)
|
||||
};
|
||||
|
||||
for(var key in drawControls) {
|
||||
map.addControl(drawControls[key]);
|
||||
}
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||
|
||||
document.getElementById('noneToggle').checked = true;
|
||||
}
|
||||
|
||||
function toggleControl(element) {
|
||||
for(key in drawControls) {
|
||||
var control = drawControls[key];
|
||||
if(element.value == key && element.checked) {
|
||||
control.activate();
|
||||
} else {
|
||||
control.deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Feature Example</h1>
|
||||
<div id="map"></div>
|
||||
<ul id="controlToggle">
|
||||
<li>
|
||||
<input type="radio" name="type" value="none" id="noneToggle"
|
||||
onclick="toggleControl(this);" checked="checked" />
|
||||
<label for="noneToggle">navigate</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="point" id="pointToggle" onclick="toggleControl(this);" />
|
||||
<label for="pointToggle">draw point</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="line" id="lineToggle" onclick="toggleControl(this);" />
|
||||
<label for="lineToggle">draw line</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="polygon" id="polygonToggle" onclick="toggleControl(this);" />
|
||||
<label for="polygonToggle">draw polygon</label>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Feature digitizing is in freehand mode by default. In freehand mode, the mouse is treated as a pen.
|
||||
Drawing begins on mouse down, continues with every mouse move, and ends with mouse up.</p>
|
||||
<p>To turn freehand mode off, hold down the shift key while digitizing. With freehand mode off, one
|
||||
vertex is added with each click and double-clicks finish drawing. Freehand mode can be toggled on and off
|
||||
at any time while drawing.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function init(){
|
||||
var map = new OpenLayers.Map('map');
|
||||
|
||||
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com:80/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
|
||||
"http://wms.jpl.nasa.gov/wms.cgi",
|
||||
{layers: "modis,global_mosaic"});
|
||||
|
||||
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
|
||||
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
|
||||
{layers: "bathymetry,land_fn,park,drain_fn,drainage," +
|
||||
"prov_bound,fedlimit,rail,road,popplace",
|
||||
transparent: "true", format: "image/png" });
|
||||
|
||||
map.addLayers([ol_wms, jpl_wms, dm_wms]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
// map.setCenter(new OpenLayers.LonLat(0, 0), 0);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function init(){
|
||||
var map = new OpenLayers.Map('map');
|
||||
|
||||
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com:80/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
|
||||
"http://wms.jpl.nasa.gov/wms.cgi",
|
||||
{layers: "modis,global_mosaic"});
|
||||
|
||||
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
|
||||
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
|
||||
{layers: "bathymetry,land_fn,park,drain_fn,drainage," +
|
||||
"prov_bound,fedlimit,rail,road,popplace",
|
||||
transparent: "true", format: "image/png" });
|
||||
|
||||
map.addLayers([ol_wms, jpl_wms, dm_wms]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
// map.setCenter(new OpenLayers.LonLat(0, 0), 0);
|
||||
map.zoomToMaxExtent();
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map, drawControl, g;
|
||||
function serialize(feature) {
|
||||
feature.attributes = {};
|
||||
var name = prompt("Title for feature?");
|
||||
feature.attributes['title'] = name;
|
||||
s = new XMLSerializer();
|
||||
var data = g.write(feature.layer.features);
|
||||
$("gml").value = s.serializeToString(data);
|
||||
}
|
||||
function init(){
|
||||
g = new OpenLayers.Format.GeoRSS();
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
|
||||
pointLayer.onFeatureInsert = serialize;
|
||||
|
||||
map.addLayers([wmsLayer, pointLayer]);
|
||||
map.addControl(new OpenLayers.Control.EditingToolbar(pointLayer));
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Point Example</h1>
|
||||
<div style="float:right">
|
||||
<textarea id="gml" cols="80" rows="30"></textarea>
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map, drawControl, g;
|
||||
function serialize(feature) {
|
||||
feature.attributes = {};
|
||||
var name = prompt("Title for feature?");
|
||||
feature.attributes['title'] = name;
|
||||
s = new XMLSerializer();
|
||||
var data = g.write(feature.layer.features);
|
||||
$("gml").value = s.serializeToString(data);
|
||||
}
|
||||
function init(){
|
||||
g = new OpenLayers.Format.GeoRSS();
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
|
||||
pointLayer.onFeatureInsert = serialize;
|
||||
|
||||
map.addLayers([wmsLayer, pointLayer]);
|
||||
map.addControl(new OpenLayers.Control.EditingToolbar(pointLayer));
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Point Example</h1>
|
||||
<div style="float:right">
|
||||
<textarea id="gml" cols="80" rows="30"></textarea>
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map, drawControl, g;
|
||||
function serialize(feature) {
|
||||
feature.attributes = {};
|
||||
var name = prompt("Name for feature?");
|
||||
feature.attributes['name'] = name;
|
||||
s = new XMLSerializer();
|
||||
var data = g.write(feature.layer.features);
|
||||
$("gml").value = s.serializeToString(data);
|
||||
}
|
||||
function init(){
|
||||
g = new OpenLayers.Format.GML();
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
|
||||
pointLayer.onFeatureInsert = serialize;
|
||||
|
||||
map.addLayers([wmsLayer, pointLayer]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
|
||||
drawControls = {
|
||||
point: new OpenLayers.Control.DrawFeature(pointLayer,
|
||||
OpenLayers.Handler.Point),
|
||||
line: new OpenLayers.Control.DrawFeature(pointLayer,
|
||||
OpenLayers.Handler.Path)
|
||||
};
|
||||
|
||||
for(var key in drawControls) {
|
||||
map.addControl(drawControls[key]);
|
||||
}
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||
}
|
||||
|
||||
function toggleControl(element) {
|
||||
for(key in drawControls) {
|
||||
var control = drawControls[key];
|
||||
if(element.value == key && element.checked) {
|
||||
control.activate();
|
||||
} else {
|
||||
control.deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Point Example</h1>
|
||||
<div style="float:right">
|
||||
<ul id="controlToggle">
|
||||
<li>
|
||||
<input type="radio" name="type" value="none" id="noneToggle"
|
||||
onclick="toggleControl(this);" checked="checked" />
|
||||
<label for="noneToggle">navigate</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="point" id="pointToggle" onclick="toggleControl(this);" />
|
||||
<label for="pointToggle">draw point</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="line" id="lineToggle" onclick="toggleControl(this);" />
|
||||
<label for="lineToggle">draw line</label>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Check the box to draw points. Uncheck to navigate normally.</p>
|
||||
<textarea id="gml" cols="80" rows="30"></textarea>
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 512px;
|
||||
height: 350px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map, drawControl, g;
|
||||
function serialize(feature) {
|
||||
feature.attributes = {};
|
||||
var name = prompt("Name for feature?");
|
||||
feature.attributes['name'] = name;
|
||||
s = new XMLSerializer();
|
||||
var data = g.write(feature.layer.features);
|
||||
$("gml").value = s.serializeToString(data);
|
||||
}
|
||||
function init(){
|
||||
g = new OpenLayers.Format.GML();
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||
|
||||
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
|
||||
pointLayer.onFeatureInsert = serialize;
|
||||
|
||||
map.addLayers([wmsLayer, pointLayer]);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
map.addControl(new OpenLayers.Control.MousePosition());
|
||||
|
||||
drawControls = {
|
||||
point: new OpenLayers.Control.DrawFeature(pointLayer,
|
||||
OpenLayers.Handler.Point),
|
||||
line: new OpenLayers.Control.DrawFeature(pointLayer,
|
||||
OpenLayers.Handler.Path)
|
||||
};
|
||||
|
||||
for(var key in drawControls) {
|
||||
map.addControl(drawControls[key]);
|
||||
}
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||
}
|
||||
|
||||
function toggleControl(element) {
|
||||
for(key in drawControls) {
|
||||
var control = drawControls[key];
|
||||
if(element.value == key && element.checked) {
|
||||
control.activate();
|
||||
} else {
|
||||
control.deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Draw Point Example</h1>
|
||||
<div style="float:right">
|
||||
<ul id="controlToggle">
|
||||
<li>
|
||||
<input type="radio" name="type" value="none" id="noneToggle"
|
||||
onclick="toggleControl(this);" checked="checked" />
|
||||
<label for="noneToggle">navigate</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="point" id="pointToggle" onclick="toggleControl(this);" />
|
||||
<label for="pointToggle">draw point</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="type" value="line" id="lineToggle" onclick="toggleControl(this);" />
|
||||
<label for="lineToggle">draw line</label>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Check the box to draw points. Uncheck to navigate normally.</p>
|
||||
<textarea id="gml" cols="80" rows="30"></textarea>
|
||||
</div>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,156 +1,156 @@
|
||||
<?xml version='1.0' encoding="ISO-8859-1" ?>
|
||||
<wfs:FeatureCollection
|
||||
xmlns:bsc="http://www.bsc-eoc.org/bsc"
|
||||
xmlns:wfs="http://www.opengis.net/wfs"
|
||||
xmlns:gml="http://www.opengis.net/gml"
|
||||
xmlns:ogc="http://www.opengis.net/ogc"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd
|
||||
http://www.bsc-eoc.org/bsc http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=OWLS&OUTPUTFORMAT=XMLSCHEMA">
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-89.817223,45.005555 -74.755001,51.701388</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<gml:featureMember><bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.771668,45.891110 -79.771668,45.891110</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.771668,45.891110</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.755834,46.365277 -83.755834,46.365277</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:owlname>owl</bsc:owlname>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.755834,46.365277</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.808612,46.175277 -83.808612,46.175277</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.808612,46.175277</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-84.111112,46.309166 -84.111112,46.309166</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-84.111112,46.309166</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.678612,46.821110 -83.678612,46.821110</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.678612,46.821110</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.664445,46.518888 -83.664445,46.518888</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.664445,46.518888</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-80.613334,46.730277 -80.613334,46.730277</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-80.613334,46.730277</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.676946,45.428054 -79.676946,45.428054</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.676946,45.428054</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.853056,46.236944 -83.853056,46.236944</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.853056,46.236944</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-82.289167,45.896388 -82.289167,45.896388</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-82.289167,45.896388</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
</wfs:FeatureCollection>
|
||||
|
||||
<?xml version='1.0' encoding="ISO-8859-1" ?>
|
||||
<wfs:FeatureCollection
|
||||
xmlns:bsc="http://www.bsc-eoc.org/bsc"
|
||||
xmlns:wfs="http://www.opengis.net/wfs"
|
||||
xmlns:gml="http://www.opengis.net/gml"
|
||||
xmlns:ogc="http://www.opengis.net/ogc"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd
|
||||
http://www.bsc-eoc.org/bsc http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=OWLS&OUTPUTFORMAT=XMLSCHEMA">
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-89.817223,45.005555 -74.755001,51.701388</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<gml:featureMember><bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.771668,45.891110 -79.771668,45.891110</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.771668,45.891110</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.755834,46.365277 -83.755834,46.365277</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:owlname>owl</bsc:owlname>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.755834,46.365277</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.808612,46.175277 -83.808612,46.175277</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.808612,46.175277</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-84.111112,46.309166 -84.111112,46.309166</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-84.111112,46.309166</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.678612,46.821110 -83.678612,46.821110</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.678612,46.821110</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.664445,46.518888 -83.664445,46.518888</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.664445,46.518888</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-80.613334,46.730277 -80.613334,46.730277</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-80.613334,46.730277</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.676946,45.428054 -79.676946,45.428054</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-79.676946,45.428054</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.853056,46.236944 -83.853056,46.236944</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-83.853056,46.236944</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
<gml:featureMember>
|
||||
<bsc:OWLS>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:4326">
|
||||
<gml:coordinates>-82.289167,45.896388 -82.289167,45.896388</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<bsc:msGeometry>
|
||||
<gml:Point srsName="EPSG:4326">
|
||||
<gml:coordinates>-82.289167,45.896388</gml:coordinates>
|
||||
</gml:Point>
|
||||
</bsc:msGeometry>
|
||||
</bsc:OWLS>
|
||||
</gml:featureMember>
|
||||
</wfs:FeatureCollection>
|
||||
|
||||
|
||||
@@ -1,267 +1,267 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://earth.google.com/kml/2.0">
|
||||
<Document>
|
||||
<name>KML Samples</name>
|
||||
<open>1</open>
|
||||
<description>Unleash your creativity with the help of these examples!</description>
|
||||
<Style id="downArrowIcon">
|
||||
<IconStyle>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pal4/icon28.png</href>
|
||||
</Icon>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Style id="globeIcon">
|
||||
<IconStyle>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pal3/icon19.png</href>
|
||||
</Icon>
|
||||
</IconStyle>
|
||||
<LineStyle>
|
||||
<width>2</width>
|
||||
</LineStyle>
|
||||
</Style>
|
||||
<Style id="transPurpleLineGreenPoly">
|
||||
<LineStyle>
|
||||
<color>7fff00ff</color>
|
||||
<width>4</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7f00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="yellowLineGreenPoly">
|
||||
<LineStyle>
|
||||
<color>7f00ffff</color>
|
||||
<width>4</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7f00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="thickBlackLine">
|
||||
<LineStyle>
|
||||
<color>87000000</color>
|
||||
<width>10</width>
|
||||
</LineStyle>
|
||||
</Style>
|
||||
<Style id="redLineBluePoly">
|
||||
<LineStyle>
|
||||
<color>ff0000ff</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>ffff0000</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="blueLineRedPoly">
|
||||
<LineStyle>
|
||||
<color>ffff0000</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>ff0000ff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transRedPoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7d0000ff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transBluePoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7dff0000</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transGreenPoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7d00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transYellowPoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7d00ffff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="noDrivingDirections">
|
||||
<BalloonStyle>
|
||||
<text><![CDATA[
|
||||
<b>$[name]</b>
|
||||
<br /><br />
|
||||
$[description]
|
||||
]]></text>
|
||||
</BalloonStyle>
|
||||
</Style>
|
||||
<Folder>
|
||||
<name>Paths</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Examples of paths. Note that the tessellate tag is by default
|
||||
set to 0. If you want to create tessellated lines, they must be authored
|
||||
(or edited) directly in KML.</description>
|
||||
<Placemark>
|
||||
<name>Tessellated</name>
|
||||
<visibility>0</visibility>
|
||||
<description><![CDATA[If the <tessellate> tag has a value of 1, the line will contour to the underlying terrain]]></description>
|
||||
<LookAt>
|
||||
<longitude>-112.0822680013139</longitude>
|
||||
<latitude>36.09825589333556</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2889.145007690472</range>
|
||||
<tilt>62.04855796276328</tilt>
|
||||
<heading>103.8120432044965</heading>
|
||||
</LookAt>
|
||||
<LineString>
|
||||
<tessellate>1</tessellate>
|
||||
<coordinates> -112.0814237830345,36.10677870477137,0
|
||||
-112.0870267752693,36.0905099328766,0 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Untessellated</name>
|
||||
<visibility>0</visibility>
|
||||
<description><![CDATA[If the <tessellate> tag has a value of 0, the line follow a simple straight-line path from point to point]]></description>
|
||||
<LookAt>
|
||||
<longitude>-112.0822680013139</longitude>
|
||||
<latitude>36.09825589333556</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2889.145007690472</range>
|
||||
<tilt>62.04855796276328</tilt>
|
||||
<heading>103.8120432044965</heading>
|
||||
</LookAt>
|
||||
<LineString>
|
||||
<tessellate>0</tessellate>
|
||||
<coordinates> -112.080622229595,36.10673460007995,0
|
||||
-112.085242575315,36.09049598612422,0 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Absolute</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Transparent purple line</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2719329043177</longitude>
|
||||
<latitude>36.08890633450894</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2569.386744398339</range>
|
||||
<tilt>44.60763714063257</tilt>
|
||||
<heading>-106.8161545998597</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#transPurpleLineGreenPoly</styleUrl>
|
||||
<LineString>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>absolute</altitudeMode>
|
||||
<coordinates> -112.265654928602,36.09447672602546,2357
|
||||
-112.2660384528238,36.09342608838671,2357
|
||||
-112.2668139013453,36.09251058776881,2357
|
||||
-112.2677826834445,36.09189827357996,2357
|
||||
-112.2688557510952,36.0913137941187,2357
|
||||
-112.2694810717219,36.0903677207521,2357
|
||||
-112.2695268555611,36.08932171487285,2357
|
||||
-112.2690144567276,36.08850916060472,2357
|
||||
-112.2681528815339,36.08753813597956,2357
|
||||
-112.2670588176031,36.08682685262568,2357
|
||||
-112.2657374587321,36.08646312301303,2357 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Absolute Extruded</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Transparent green wall with yellow outlines</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2643334742529</longitude>
|
||||
<latitude>36.08563154742419</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>4451.842204068102</range>
|
||||
<tilt>44.61038665812578</tilt>
|
||||
<heading>-125.7518698668815</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#yellowLineGreenPoly</styleUrl>
|
||||
<LineString>
|
||||
<extrude>1</extrude>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>absolute</altitudeMode>
|
||||
<coordinates> -112.2550785337791,36.07954952145647,2357
|
||||
-112.2549277039738,36.08117083492122,2357
|
||||
-112.2552505069063,36.08260761307279,2357
|
||||
-112.2564540158376,36.08395660588506,2357
|
||||
-112.2580238976449,36.08511401044813,2357
|
||||
-112.2595218489022,36.08584355239394,2357
|
||||
-112.2608216347552,36.08612634548589,2357
|
||||
-112.262073428656,36.08626019085147,2357
|
||||
-112.2633204928495,36.08621519860091,2357
|
||||
-112.2644963846444,36.08627897945274,2357
|
||||
-112.2656969554589,36.08649599090644,2357 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Relative</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Black line (10 pixels wide), height tracks terrain</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2580438551384</longitude>
|
||||
<latitude>36.1072674824385</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2927.61105910266</range>
|
||||
<tilt>44.61324882043339</tilt>
|
||||
<heading>4.947421249553717</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#thickBlackLine</styleUrl>
|
||||
<LineString>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>relativeToGround</altitudeMode>
|
||||
<coordinates> -112.2532845153347,36.09886943729116,645
|
||||
-112.2540466121145,36.09919570465255,645
|
||||
-112.254734666947,36.09984998366178,645
|
||||
-112.255493345654,36.10051310621746,645
|
||||
-112.2563157098468,36.10108441943419,645
|
||||
-112.2568033076439,36.10159722088088,645
|
||||
-112.257494011321,36.10204323542867,645
|
||||
-112.2584106072308,36.10229131995655,645
|
||||
-112.2596588987972,36.10240001286358,645
|
||||
-112.2610581199487,36.10213176873407,645
|
||||
-112.2626285262793,36.10157011437219,645 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Relative Extruded</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Opaque blue walls with red outline, height tracks terrain</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2683594333433</longitude>
|
||||
<latitude>36.09884362144909</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2184.193522571467</range>
|
||||
<tilt>44.60855445139561</tilt>
|
||||
<heading>-72.24271551768405</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#redLineBluePoly</styleUrl>
|
||||
<LineString>
|
||||
<extrude>1</extrude>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>relativeToGround</altitudeMode>
|
||||
<coordinates> -112.2656634181359,36.09445214722695,630
|
||||
-112.2652238941097,36.09520916122063,630
|
||||
-112.2645079986395,36.09580763864907,630
|
||||
-112.2638827428817,36.09628572284063,630
|
||||
-112.2635746835406,36.09679275951239,630
|
||||
-112.2635711822407,36.09740038871899,630
|
||||
-112.2640296531825,36.09804913435539,630
|
||||
-112.264327720538,36.09880337400301,630
|
||||
-112.2642436562271,36.09963644790288,630
|
||||
-112.2639148687042,36.10055381117246,630
|
||||
-112.2626894973474,36.10149062823369,630 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
</Folder>
|
||||
</Document>
|
||||
</kml>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://earth.google.com/kml/2.0">
|
||||
<Document>
|
||||
<name>KML Samples</name>
|
||||
<open>1</open>
|
||||
<description>Unleash your creativity with the help of these examples!</description>
|
||||
<Style id="downArrowIcon">
|
||||
<IconStyle>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pal4/icon28.png</href>
|
||||
</Icon>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
<Style id="globeIcon">
|
||||
<IconStyle>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/pal3/icon19.png</href>
|
||||
</Icon>
|
||||
</IconStyle>
|
||||
<LineStyle>
|
||||
<width>2</width>
|
||||
</LineStyle>
|
||||
</Style>
|
||||
<Style id="transPurpleLineGreenPoly">
|
||||
<LineStyle>
|
||||
<color>7fff00ff</color>
|
||||
<width>4</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7f00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="yellowLineGreenPoly">
|
||||
<LineStyle>
|
||||
<color>7f00ffff</color>
|
||||
<width>4</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7f00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="thickBlackLine">
|
||||
<LineStyle>
|
||||
<color>87000000</color>
|
||||
<width>10</width>
|
||||
</LineStyle>
|
||||
</Style>
|
||||
<Style id="redLineBluePoly">
|
||||
<LineStyle>
|
||||
<color>ff0000ff</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>ffff0000</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="blueLineRedPoly">
|
||||
<LineStyle>
|
||||
<color>ffff0000</color>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>ff0000ff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transRedPoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7d0000ff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transBluePoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7dff0000</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transGreenPoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7d00ff00</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="transYellowPoly">
|
||||
<LineStyle>
|
||||
<width>1.5</width>
|
||||
</LineStyle>
|
||||
<PolyStyle>
|
||||
<color>7d00ffff</color>
|
||||
</PolyStyle>
|
||||
</Style>
|
||||
<Style id="noDrivingDirections">
|
||||
<BalloonStyle>
|
||||
<text><![CDATA[
|
||||
<b>$[name]</b>
|
||||
<br /><br />
|
||||
$[description]
|
||||
]]></text>
|
||||
</BalloonStyle>
|
||||
</Style>
|
||||
<Folder>
|
||||
<name>Paths</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Examples of paths. Note that the tessellate tag is by default
|
||||
set to 0. If you want to create tessellated lines, they must be authored
|
||||
(or edited) directly in KML.</description>
|
||||
<Placemark>
|
||||
<name>Tessellated</name>
|
||||
<visibility>0</visibility>
|
||||
<description><![CDATA[If the <tessellate> tag has a value of 1, the line will contour to the underlying terrain]]></description>
|
||||
<LookAt>
|
||||
<longitude>-112.0822680013139</longitude>
|
||||
<latitude>36.09825589333556</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2889.145007690472</range>
|
||||
<tilt>62.04855796276328</tilt>
|
||||
<heading>103.8120432044965</heading>
|
||||
</LookAt>
|
||||
<LineString>
|
||||
<tessellate>1</tessellate>
|
||||
<coordinates> -112.0814237830345,36.10677870477137,0
|
||||
-112.0870267752693,36.0905099328766,0 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Untessellated</name>
|
||||
<visibility>0</visibility>
|
||||
<description><![CDATA[If the <tessellate> tag has a value of 0, the line follow a simple straight-line path from point to point]]></description>
|
||||
<LookAt>
|
||||
<longitude>-112.0822680013139</longitude>
|
||||
<latitude>36.09825589333556</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2889.145007690472</range>
|
||||
<tilt>62.04855796276328</tilt>
|
||||
<heading>103.8120432044965</heading>
|
||||
</LookAt>
|
||||
<LineString>
|
||||
<tessellate>0</tessellate>
|
||||
<coordinates> -112.080622229595,36.10673460007995,0
|
||||
-112.085242575315,36.09049598612422,0 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Absolute</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Transparent purple line</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2719329043177</longitude>
|
||||
<latitude>36.08890633450894</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2569.386744398339</range>
|
||||
<tilt>44.60763714063257</tilt>
|
||||
<heading>-106.8161545998597</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#transPurpleLineGreenPoly</styleUrl>
|
||||
<LineString>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>absolute</altitudeMode>
|
||||
<coordinates> -112.265654928602,36.09447672602546,2357
|
||||
-112.2660384528238,36.09342608838671,2357
|
||||
-112.2668139013453,36.09251058776881,2357
|
||||
-112.2677826834445,36.09189827357996,2357
|
||||
-112.2688557510952,36.0913137941187,2357
|
||||
-112.2694810717219,36.0903677207521,2357
|
||||
-112.2695268555611,36.08932171487285,2357
|
||||
-112.2690144567276,36.08850916060472,2357
|
||||
-112.2681528815339,36.08753813597956,2357
|
||||
-112.2670588176031,36.08682685262568,2357
|
||||
-112.2657374587321,36.08646312301303,2357 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Absolute Extruded</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Transparent green wall with yellow outlines</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2643334742529</longitude>
|
||||
<latitude>36.08563154742419</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>4451.842204068102</range>
|
||||
<tilt>44.61038665812578</tilt>
|
||||
<heading>-125.7518698668815</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#yellowLineGreenPoly</styleUrl>
|
||||
<LineString>
|
||||
<extrude>1</extrude>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>absolute</altitudeMode>
|
||||
<coordinates> -112.2550785337791,36.07954952145647,2357
|
||||
-112.2549277039738,36.08117083492122,2357
|
||||
-112.2552505069063,36.08260761307279,2357
|
||||
-112.2564540158376,36.08395660588506,2357
|
||||
-112.2580238976449,36.08511401044813,2357
|
||||
-112.2595218489022,36.08584355239394,2357
|
||||
-112.2608216347552,36.08612634548589,2357
|
||||
-112.262073428656,36.08626019085147,2357
|
||||
-112.2633204928495,36.08621519860091,2357
|
||||
-112.2644963846444,36.08627897945274,2357
|
||||
-112.2656969554589,36.08649599090644,2357 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Relative</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Black line (10 pixels wide), height tracks terrain</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2580438551384</longitude>
|
||||
<latitude>36.1072674824385</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2927.61105910266</range>
|
||||
<tilt>44.61324882043339</tilt>
|
||||
<heading>4.947421249553717</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#thickBlackLine</styleUrl>
|
||||
<LineString>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>relativeToGround</altitudeMode>
|
||||
<coordinates> -112.2532845153347,36.09886943729116,645
|
||||
-112.2540466121145,36.09919570465255,645
|
||||
-112.254734666947,36.09984998366178,645
|
||||
-112.255493345654,36.10051310621746,645
|
||||
-112.2563157098468,36.10108441943419,645
|
||||
-112.2568033076439,36.10159722088088,645
|
||||
-112.257494011321,36.10204323542867,645
|
||||
-112.2584106072308,36.10229131995655,645
|
||||
-112.2596588987972,36.10240001286358,645
|
||||
-112.2610581199487,36.10213176873407,645
|
||||
-112.2626285262793,36.10157011437219,645 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Relative Extruded</name>
|
||||
<visibility>0</visibility>
|
||||
<description>Opaque blue walls with red outline, height tracks terrain</description>
|
||||
<LookAt>
|
||||
<longitude>-112.2683594333433</longitude>
|
||||
<latitude>36.09884362144909</latitude>
|
||||
<altitude>0</altitude>
|
||||
<range>2184.193522571467</range>
|
||||
<tilt>44.60855445139561</tilt>
|
||||
<heading>-72.24271551768405</heading>
|
||||
</LookAt>
|
||||
<styleUrl>#redLineBluePoly</styleUrl>
|
||||
<LineString>
|
||||
<extrude>1</extrude>
|
||||
<tessellate>1</tessellate>
|
||||
<altitudeMode>relativeToGround</altitudeMode>
|
||||
<coordinates> -112.2656634181359,36.09445214722695,630
|
||||
-112.2652238941097,36.09520916122063,630
|
||||
-112.2645079986395,36.09580763864907,630
|
||||
-112.2638827428817,36.09628572284063,630
|
||||
-112.2635746835406,36.09679275951239,630
|
||||
-112.2635711822407,36.09740038871899,630
|
||||
-112.2640296531825,36.09804913435539,630
|
||||
-112.264327720538,36.09880337400301,630
|
||||
-112.2642436562271,36.09963644790288,630
|
||||
-112.2639148687042,36.10055381117246,630
|
||||
-112.2626894973474,36.10149062823369,630 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
</Folder>
|
||||
</Document>
|
||||
</kml>
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
p {
|
||||
width: 512px;
|
||||
}
|
||||
#map {
|
||||
width: 640px;
|
||||
height: 480px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map;
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map',
|
||||
{maxExtent: new OpenLayers.Bounds(0, 0, 640, 480)});
|
||||
|
||||
var options = {maxResolution: 'auto', numZoomLevels: 3};
|
||||
|
||||
var webcam = new OpenLayers.Layer.Image(
|
||||
'OL Webcam',
|
||||
'http://crschmidt.net/~crschmidt/openlayers.jpg',
|
||||
new OpenLayers.Bounds(0, 0, 640, 480),
|
||||
new OpenLayers.Size(640, 480),
|
||||
options);
|
||||
|
||||
map.addLayers([webcam]);
|
||||
map.zoomToMaxExtent();
|
||||
window.setInterval(refresh, 10000, webcam);
|
||||
}
|
||||
function refresh(layer) {
|
||||
layer.moveTo(layer.map.getExtent(), true);
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Webcam</h1>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
p {
|
||||
width: 512px;
|
||||
}
|
||||
#map {
|
||||
width: 640px;
|
||||
height: 480px;
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var map;
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map',
|
||||
{maxExtent: new OpenLayers.Bounds(0, 0, 640, 480)});
|
||||
|
||||
var options = {maxResolution: 'auto', numZoomLevels: 3};
|
||||
|
||||
var webcam = new OpenLayers.Layer.Image(
|
||||
'OL Webcam',
|
||||
'http://crschmidt.net/~crschmidt/openlayers.jpg',
|
||||
new OpenLayers.Bounds(0, 0, 640, 480),
|
||||
new OpenLayers.Size(640, 480),
|
||||
options);
|
||||
|
||||
map.addLayers([webcam]);
|
||||
map.zoomToMaxExtent();
|
||||
window.setInterval(refresh, 10000, webcam);
|
||||
}
|
||||
function refresh(layer) {
|
||||
layer.moveTo(layer.map.getExtent(), true);
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>OpenLayers Webcam</h1>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,269 +1,269 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* This is another virtual class in that it should never be instantiated by
|
||||
* itself as a Renderer. It exists because there is *tons* of shared
|
||||
* functionality between different vector libraries which use nodes/elements
|
||||
* as a base for rendering vectors.
|
||||
*
|
||||
* The highlevel bits of code that are implemented here are the adding and
|
||||
* removing of geometries, which is essentially the same for any
|
||||
* element-based renderer. The details of creating each node and drawing the
|
||||
* paths are of course different, but the machinery is the same.
|
||||
*
|
||||
* @requires OpenLayers/Renderer.js
|
||||
*/
|
||||
OpenLayers.Renderer.Elements = OpenLayers.Class.create();
|
||||
OpenLayers.Renderer.Elements.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Renderer, {
|
||||
|
||||
/** @type DOMElement */
|
||||
rendererRoot: null,
|
||||
|
||||
/** @type DOMElement */
|
||||
root: null,
|
||||
|
||||
/** @type String */
|
||||
xmlns: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} containerID
|
||||
*/
|
||||
initialize: function(containerID) {
|
||||
OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
|
||||
|
||||
this.rendererRoot = this.createRenderRoot();
|
||||
this.root = this.createRoot();
|
||||
|
||||
this.rendererRoot.appendChild(this.root);
|
||||
this.container.appendChild(this.rendererRoot);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
destroy: function() {
|
||||
|
||||
this.clear();
|
||||
|
||||
this.rendererRoot = null;
|
||||
this.root = null;
|
||||
this.xmlns = null;
|
||||
|
||||
OpenLayers.Renderer.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove all the elements from the root
|
||||
*
|
||||
*/
|
||||
clear: function() {
|
||||
if (this.root) {
|
||||
while (this.root.childNodes.length > 0) {
|
||||
this.root.removeChild(this.root.firstChild);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cycle through the rendered nodes and reproject them (this should be
|
||||
* called when the extent or size has changed);
|
||||
*
|
||||
* @param {OpenLayers.Bounds} extent
|
||||
*/
|
||||
reproject: function(extent) {
|
||||
|
||||
for (var i = 0; i < this.root.childNodes.length; i++) {
|
||||
var node = this.root.childNodes[i];
|
||||
//reproject node
|
||||
// for the moment, this only really happens so as to reset
|
||||
// the heaviness of the line relative to the resolution and
|
||||
// the size of the circle for the Point object
|
||||
this.reprojectNode(node);
|
||||
}
|
||||
},
|
||||
|
||||
/** This function is in charge of asking the specific renderer which type
|
||||
* of node to create for the given geometry. All geometries in an
|
||||
* Elements-based renderer consist of one node and some attributes. We
|
||||
* have the nodeFactory() function which creates a node for us, but it
|
||||
* takes a 'type' as input, and that is precisely what this function
|
||||
* tells us.
|
||||
*
|
||||
* @param geometry {OpenLayers.Geometry}
|
||||
*
|
||||
* @returns The corresponding node type for the specified geometry
|
||||
* @type String
|
||||
*/
|
||||
getNodeType: function(geometry) { },
|
||||
|
||||
/**
|
||||
* Draw the geometry on the specified layer, creating new nodes,
|
||||
* setting paths, setting style.
|
||||
*
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
* @param {Object} style
|
||||
*/
|
||||
drawGeometry: function(geometry, style) {
|
||||
|
||||
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon")) {
|
||||
for (var i = 0; i < geometry.components.length; i++) {
|
||||
this.drawGeometry(geometry.components[i], style);
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
//first we create the basic node and add it to the root
|
||||
var nodeType = this.getNodeType(geometry);
|
||||
var node = this.nodeFactory(geometry.id, nodeType, geometry);
|
||||
node.geometry = geometry;
|
||||
node.olStyle = style;
|
||||
this.root.appendChild(node);
|
||||
|
||||
//now actually draw the node, and style it
|
||||
this.drawGeometryNode(node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Given a node, draw a geometry on the specified layer.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
* @param {Object} style
|
||||
*/
|
||||
drawGeometryNode: function(node, geometry, style) {
|
||||
geometry = geometry || node.geometry;
|
||||
style = style || node.olStyle;
|
||||
|
||||
var options = {
|
||||
'isFilled': true,
|
||||
'isStroked': true
|
||||
};
|
||||
switch (geometry.CLASS_NAME) {
|
||||
case "OpenLayers.Geometry.Point":
|
||||
this.drawPoint(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Curve":
|
||||
options.isFilled = false;
|
||||
this.drawCurve(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.LineString":
|
||||
options.isFilled = false;
|
||||
this.drawLineString(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.LinearRing":
|
||||
this.drawLinearRing(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Polygon":
|
||||
this.drawPolygon(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Surface":
|
||||
this.drawSurface(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Rectangle":
|
||||
this.drawRectangle(node, geometry);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
node.olStyle = style;
|
||||
node.olOptions = options;
|
||||
|
||||
//set style
|
||||
this.setStyle(node);
|
||||
},
|
||||
|
||||
/**
|
||||
* virtual functions for drawing different Geometries.
|
||||
* These should all be implemented by subclasses.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
*/
|
||||
drawPoint: function(node, geometry) {},
|
||||
drawLineString: function(node, geometry) {},
|
||||
drawLinearRing: function(node, geometry) {},
|
||||
drawPolygon: function(node, geometry) {},
|
||||
drawRectangle: function(node, geometry) {},
|
||||
drawCircle: function(node, geometry) {},
|
||||
drawCurve: function(node, geometry) {},
|
||||
drawSurface: function(node, geometry) {},
|
||||
|
||||
/**
|
||||
* @param evt {Object} an OpenLayers.Event object
|
||||
*
|
||||
* @returns A geometry from an event that happened on a layer
|
||||
* @type OpenLayers.Geometry
|
||||
*/
|
||||
getGeometryFromEvent: function(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
var geometry = node.geometry ? node.geometry : null
|
||||
return geometry;
|
||||
},
|
||||
|
||||
/** Erase a geometry from the renderer. In the case of a multi-geometry,
|
||||
* we cycle through and recurse on ourselves. Otherwise, we look for a
|
||||
* node with the geometry.id, destroy its geometry, and remove it from
|
||||
* the DOM.
|
||||
*
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
*/
|
||||
eraseGeometry: function(geometry) {
|
||||
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon")) {
|
||||
for (var i = 0; i < geometry.components.length; i++) {
|
||||
this.eraseGeometry(geometry.components[i]);
|
||||
}
|
||||
} else {
|
||||
var element = $(geometry.id);
|
||||
if (element && element.parentNode) {
|
||||
if (element.geometry) {
|
||||
element.geometry.destroy();
|
||||
element.geometry = null;
|
||||
}
|
||||
element.parentNode.removeChild(element);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Create new node of the specified type, with the (optional) specified id.
|
||||
*
|
||||
* If node already exists with same ID and type, we remove it and then
|
||||
* call ourselves again to recreate it.
|
||||
*
|
||||
* @param {String} id
|
||||
* @param {String} type Kind of node to draw
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
*
|
||||
* @returns A new node of the given type and id
|
||||
* @type DOMElement
|
||||
*/
|
||||
nodeFactory: function(id, type, geometry) {
|
||||
var node = $(id);
|
||||
if (node) {
|
||||
if (!this.nodeTypeCompare(node, type)) {
|
||||
node.parentNode.removeChild(node);
|
||||
node = this.nodeFactory(id, type, geometry);
|
||||
}
|
||||
} else {
|
||||
node = this.createNode(type, id);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Renderer.Elements"
|
||||
});
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* This is another virtual class in that it should never be instantiated by
|
||||
* itself as a Renderer. It exists because there is *tons* of shared
|
||||
* functionality between different vector libraries which use nodes/elements
|
||||
* as a base for rendering vectors.
|
||||
*
|
||||
* The highlevel bits of code that are implemented here are the adding and
|
||||
* removing of geometries, which is essentially the same for any
|
||||
* element-based renderer. The details of creating each node and drawing the
|
||||
* paths are of course different, but the machinery is the same.
|
||||
*
|
||||
* @requires OpenLayers/Renderer.js
|
||||
*/
|
||||
OpenLayers.Renderer.Elements = OpenLayers.Class.create();
|
||||
OpenLayers.Renderer.Elements.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Renderer, {
|
||||
|
||||
/** @type DOMElement */
|
||||
rendererRoot: null,
|
||||
|
||||
/** @type DOMElement */
|
||||
root: null,
|
||||
|
||||
/** @type String */
|
||||
xmlns: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} containerID
|
||||
*/
|
||||
initialize: function(containerID) {
|
||||
OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
|
||||
|
||||
this.rendererRoot = this.createRenderRoot();
|
||||
this.root = this.createRoot();
|
||||
|
||||
this.rendererRoot.appendChild(this.root);
|
||||
this.container.appendChild(this.rendererRoot);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
destroy: function() {
|
||||
|
||||
this.clear();
|
||||
|
||||
this.rendererRoot = null;
|
||||
this.root = null;
|
||||
this.xmlns = null;
|
||||
|
||||
OpenLayers.Renderer.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove all the elements from the root
|
||||
*
|
||||
*/
|
||||
clear: function() {
|
||||
if (this.root) {
|
||||
while (this.root.childNodes.length > 0) {
|
||||
this.root.removeChild(this.root.firstChild);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cycle through the rendered nodes and reproject them (this should be
|
||||
* called when the extent or size has changed);
|
||||
*
|
||||
* @param {OpenLayers.Bounds} extent
|
||||
*/
|
||||
reproject: function(extent) {
|
||||
|
||||
for (var i = 0; i < this.root.childNodes.length; i++) {
|
||||
var node = this.root.childNodes[i];
|
||||
//reproject node
|
||||
// for the moment, this only really happens so as to reset
|
||||
// the heaviness of the line relative to the resolution and
|
||||
// the size of the circle for the Point object
|
||||
this.reprojectNode(node);
|
||||
}
|
||||
},
|
||||
|
||||
/** This function is in charge of asking the specific renderer which type
|
||||
* of node to create for the given geometry. All geometries in an
|
||||
* Elements-based renderer consist of one node and some attributes. We
|
||||
* have the nodeFactory() function which creates a node for us, but it
|
||||
* takes a 'type' as input, and that is precisely what this function
|
||||
* tells us.
|
||||
*
|
||||
* @param geometry {OpenLayers.Geometry}
|
||||
*
|
||||
* @returns The corresponding node type for the specified geometry
|
||||
* @type String
|
||||
*/
|
||||
getNodeType: function(geometry) { },
|
||||
|
||||
/**
|
||||
* Draw the geometry on the specified layer, creating new nodes,
|
||||
* setting paths, setting style.
|
||||
*
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
* @param {Object} style
|
||||
*/
|
||||
drawGeometry: function(geometry, style) {
|
||||
|
||||
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon")) {
|
||||
for (var i = 0; i < geometry.components.length; i++) {
|
||||
this.drawGeometry(geometry.components[i], style);
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
//first we create the basic node and add it to the root
|
||||
var nodeType = this.getNodeType(geometry);
|
||||
var node = this.nodeFactory(geometry.id, nodeType, geometry);
|
||||
node.geometry = geometry;
|
||||
node.olStyle = style;
|
||||
this.root.appendChild(node);
|
||||
|
||||
//now actually draw the node, and style it
|
||||
this.drawGeometryNode(node);
|
||||
},
|
||||
|
||||
/**
|
||||
* Given a node, draw a geometry on the specified layer.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
* @param {Object} style
|
||||
*/
|
||||
drawGeometryNode: function(node, geometry, style) {
|
||||
geometry = geometry || node.geometry;
|
||||
style = style || node.olStyle;
|
||||
|
||||
var options = {
|
||||
'isFilled': true,
|
||||
'isStroked': true
|
||||
};
|
||||
switch (geometry.CLASS_NAME) {
|
||||
case "OpenLayers.Geometry.Point":
|
||||
this.drawPoint(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Curve":
|
||||
options.isFilled = false;
|
||||
this.drawCurve(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.LineString":
|
||||
options.isFilled = false;
|
||||
this.drawLineString(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.LinearRing":
|
||||
this.drawLinearRing(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Polygon":
|
||||
this.drawPolygon(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Surface":
|
||||
this.drawSurface(node, geometry);
|
||||
break;
|
||||
case "OpenLayers.Geometry.Rectangle":
|
||||
this.drawRectangle(node, geometry);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
node.olStyle = style;
|
||||
node.olOptions = options;
|
||||
|
||||
//set style
|
||||
this.setStyle(node);
|
||||
},
|
||||
|
||||
/**
|
||||
* virtual functions for drawing different Geometries.
|
||||
* These should all be implemented by subclasses.
|
||||
*
|
||||
* @param {DOMElement} node
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
*/
|
||||
drawPoint: function(node, geometry) {},
|
||||
drawLineString: function(node, geometry) {},
|
||||
drawLinearRing: function(node, geometry) {},
|
||||
drawPolygon: function(node, geometry) {},
|
||||
drawRectangle: function(node, geometry) {},
|
||||
drawCircle: function(node, geometry) {},
|
||||
drawCurve: function(node, geometry) {},
|
||||
drawSurface: function(node, geometry) {},
|
||||
|
||||
/**
|
||||
* @param evt {Object} an OpenLayers.Event object
|
||||
*
|
||||
* @returns A geometry from an event that happened on a layer
|
||||
* @type OpenLayers.Geometry
|
||||
*/
|
||||
getGeometryFromEvent: function(evt) {
|
||||
var node = evt.target || evt.srcElement;
|
||||
var geometry = node.geometry ? node.geometry : null
|
||||
return geometry;
|
||||
},
|
||||
|
||||
/** Erase a geometry from the renderer. In the case of a multi-geometry,
|
||||
* we cycle through and recurse on ourselves. Otherwise, we look for a
|
||||
* node with the geometry.id, destroy its geometry, and remove it from
|
||||
* the DOM.
|
||||
*
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
*/
|
||||
eraseGeometry: function(geometry) {
|
||||
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
|
||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon")) {
|
||||
for (var i = 0; i < geometry.components.length; i++) {
|
||||
this.eraseGeometry(geometry.components[i]);
|
||||
}
|
||||
} else {
|
||||
var element = $(geometry.id);
|
||||
if (element && element.parentNode) {
|
||||
if (element.geometry) {
|
||||
element.geometry.destroy();
|
||||
element.geometry = null;
|
||||
}
|
||||
element.parentNode.removeChild(element);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Create new node of the specified type, with the (optional) specified id.
|
||||
*
|
||||
* If node already exists with same ID and type, we remove it and then
|
||||
* call ourselves again to recreate it.
|
||||
*
|
||||
* @param {String} id
|
||||
* @param {String} type Kind of node to draw
|
||||
* @param {OpenLayers.Geometry} geometry
|
||||
*
|
||||
* @returns A new node of the given type and id
|
||||
* @type DOMElement
|
||||
*/
|
||||
nodeFactory: function(id, type, geometry) {
|
||||
var node = $(id);
|
||||
if (node) {
|
||||
if (!this.nodeTypeCompare(node, type)) {
|
||||
node.parentNode.removeChild(node);
|
||||
node = this.nodeFactory(id, type, geometry);
|
||||
}
|
||||
} else {
|
||||
node = this.createNode(type, id);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Renderer.Elements"
|
||||
});
|
||||
|
||||
@@ -1,234 +1,249 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>Z
|
||||
|
||||
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var layer;
|
||||
|
||||
var name = 'Test Layer';
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var params = { map: '/mapdata/vmap_wms.map',
|
||||
layers: 'basic'};
|
||||
|
||||
function test_01_Layer_MapServer_constructor (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
t.ok( layer instanceof OpenLayers.Layer.MapServer, "new OpenLayers.Layer.MapServer returns object" );
|
||||
t.eq( layer.url, "http://labs.metacarta.com/cgi-bin/mapserv", "layer.url is correct (HTTPRequest inited)" );
|
||||
|
||||
t.eq( layer.params.mode, "map", "default mode param correctly copied");
|
||||
t.eq( layer.params.map_imagetype, "png", "default imagetype correctly copied");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_02_Layer_MapServer_addtile (t) {
|
||||
t.plan( 6 );
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.addLayer(layer);
|
||||
var pixel = new OpenLayers.Pixel(5,6);
|
||||
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||
tile.draw();
|
||||
|
||||
var img = tile.imgDiv;
|
||||
var tParams = OpenLayers.Util.extend({},params);
|
||||
tParams = OpenLayers.Util.extend(tParams, {
|
||||
layers: 'basic',
|
||||
mode: 'map',
|
||||
map_imagetype: 'png',
|
||||
mapext:[1,2,3,4],
|
||||
imgext:[1,2,3,4],
|
||||
map_size:[256, 256],
|
||||
imgx:128,
|
||||
imgy:128,
|
||||
imgxy:[256,256]
|
||||
});
|
||||
t.eq( img.src,
|
||||
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
|
||||
"image src is created correctly via addtile" );
|
||||
t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" );
|
||||
t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" );
|
||||
|
||||
var firstChild = layer.div.firstChild;
|
||||
if (!isMozilla)
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
else
|
||||
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
|
||||
t.eq( firstChild.src,
|
||||
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
|
||||
"div first child is correct image object" );
|
||||
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
|
||||
}
|
||||
|
||||
function test_03_Layer_MapServer_inittiles (t) {
|
||||
t.plan( 2 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0),5);
|
||||
t.eq( layer.grid.length, 7, "Grid rows is correct." );
|
||||
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function test_04_Layer_MapServer_clone (t) {
|
||||
t.plan(4);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var options = {tileSize: new OpenLayers.Size(500,50)};
|
||||
var map = new OpenLayers.Map('map', options);
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
layer.grid = [ [6, 7],
|
||||
[8, 9]];
|
||||
|
||||
var clone = layer.clone();
|
||||
|
||||
t.ok( clone.grid != layer.grid, "clone does not copy grid");
|
||||
|
||||
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
|
||||
|
||||
layer.tileSize.w += 40;
|
||||
|
||||
t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
|
||||
|
||||
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
||||
|
||||
layer.grid = null;
|
||||
}
|
||||
|
||||
function test_05_Layer_MapServer_isBaseLayer(t) {
|
||||
t.plan(3);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
t.ok( layer.isBaseLayer, "baselayer is true by default");
|
||||
|
||||
var newParams = OpenLayers.Util.extend(new Object(), params);
|
||||
newParams.transparent = "true";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, newParams);
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
|
||||
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false});
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
|
||||
}
|
||||
|
||||
function test_06_Layer_MapServer_mergeNewParams (t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
|
||||
var newParams = { layers: 'sooper',
|
||||
chickpeas: 'image/png'};
|
||||
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
t.ok( !layer.grid[0][0].url.match("chickpeas"), "chickpeas is not in URL of first tile in grid" );
|
||||
|
||||
layer.mergeNewParams(newParams);
|
||||
|
||||
t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
|
||||
t.ok( layer.grid[0][0].url.match("chickpeas"), "chickpeas is in URL of first tile in grid" );
|
||||
|
||||
newParams.chickpeas = 151;
|
||||
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hashtable");
|
||||
}
|
||||
|
||||
function test_07_Layer_MapServer_getFullRequestString (t) {
|
||||
|
||||
|
||||
t.plan( 1 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'png'};
|
||||
var tLayer = new OpenLayers.Layer.MapServer(name, tUrl, tParams);
|
||||
map.addLayer(tLayer);
|
||||
str = tLayer.getFullRequestString();
|
||||
var tParams = {
|
||||
layers: 'basic',
|
||||
format: 'png',
|
||||
mode: 'map',
|
||||
map_imagetype: 'png'
|
||||
};
|
||||
|
||||
var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams);
|
||||
sStr = sStr.replace(/,/g, "+");
|
||||
|
||||
t.eq(str, sStr , "getFullRequestString() works");
|
||||
|
||||
}
|
||||
|
||||
function test_08_Layer_MapServer_setOpacity (t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.projection = "xx";
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'image/png'};
|
||||
tOptions = { 'opacity': '0.5' };
|
||||
var tLayer = new OpenLayers.Layer.MapServer(name, tUrl, tParams, tOptions);
|
||||
map.addLayer(tLayer);
|
||||
map.zoomToMaxExtent();
|
||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
tLayer.setOpacity("0.6");
|
||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
var pixel = new OpenLayers.Pixel(5,6);
|
||||
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||
tile.draw();
|
||||
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
||||
|
||||
}
|
||||
|
||||
function test_20_Layer_MapServer_Reproject (t) {
|
||||
t.plan(5);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.Google("Google");
|
||||
map.addLayer(layer);
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
|
||||
layer.isBaseLayer=false;
|
||||
map.addLayer(layer);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
var tile = layer.grid[0][0];
|
||||
t.eq( tile.bounds.left, -22.5, "left side matches" );
|
||||
t.eq( tile.bounds.right, -11.25, "top side matches" );
|
||||
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
|
||||
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
var tile = layer.grid[0][0];
|
||||
t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay");
|
||||
}
|
||||
|
||||
function test_99_Layer_MapServer_destroy (t) {
|
||||
|
||||
t.plan( 1 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
|
||||
//grab a reference to one of the tiles
|
||||
var tile = layer.grid[0][0];
|
||||
<html>
|
||||
<head>
|
||||
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>Z
|
||||
|
||||
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var layer;
|
||||
|
||||
var name = 'Test Layer';
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var params = { map: '/mapdata/vmap_wms.map',
|
||||
layers: 'basic'};
|
||||
|
||||
function test_01_Layer_MapServer_constructor (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
t.ok( layer instanceof OpenLayers.Layer.MapServer, "new OpenLayers.Layer.MapServer returns object" );
|
||||
t.eq( layer.url, "http://labs.metacarta.com/cgi-bin/mapserv", "layer.url is correct (HTTPRequest inited)" );
|
||||
|
||||
t.eq( layer.params.mode, "map", "default mode param correctly copied");
|
||||
t.eq( layer.params.map_imagetype, "png", "default imagetype correctly copied");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_02_Layer_MapServer_addtile (t) {
|
||||
t.plan( 6 );
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.addLayer(layer);
|
||||
var pixel = new OpenLayers.Pixel(5,6);
|
||||
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||
tile.draw();
|
||||
|
||||
var img = tile.imgDiv;
|
||||
var tParams = OpenLayers.Util.extend({},params);
|
||||
tParams = OpenLayers.Util.extend(tParams, {
|
||||
layers: 'basic',
|
||||
mode: 'map',
|
||||
map_imagetype: 'png',
|
||||
mapext:[1,2,3,4],
|
||||
imgext:[1,2,3,4],
|
||||
map_size:[256, 256],
|
||||
imgx:128,
|
||||
imgy:128,
|
||||
imgxy:[256,256]
|
||||
});
|
||||
t.eq( img.src,
|
||||
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
|
||||
"image src is created correctly via addtile" );
|
||||
t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" );
|
||||
t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" );
|
||||
|
||||
var firstChild = layer.div.firstChild;
|
||||
if (!isMozilla)
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
else
|
||||
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
|
||||
t.eq( firstChild.src,
|
||||
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
|
||||
"div first child is correct image object" );
|
||||
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
|
||||
}
|
||||
|
||||
function test_03_Layer_MapServer_inittiles (t) {
|
||||
t.plan( 2 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0),5);
|
||||
t.eq( layer.grid.length, 7, "Grid rows is correct." );
|
||||
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function test_04_Layer_MapServer_clone (t) {
|
||||
t.plan(4);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var options = {tileSize: new OpenLayers.Size(500,50)};
|
||||
var map = new OpenLayers.Map('map', options);
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
layer.grid = [ [6, 7],
|
||||
[8, 9]];
|
||||
|
||||
var clone = layer.clone();
|
||||
|
||||
t.ok( clone.grid != layer.grid, "clone does not copy grid");
|
||||
|
||||
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
|
||||
|
||||
layer.tileSize.w += 40;
|
||||
|
||||
t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
|
||||
|
||||
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
||||
|
||||
layer.grid = null;
|
||||
}
|
||||
|
||||
function test_05_Layer_MapServer_isBaseLayer(t) {
|
||||
t.plan(3);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
t.ok( layer.isBaseLayer, "baselayer is true by default");
|
||||
|
||||
var newParams = OpenLayers.Util.extend(new Object(), params);
|
||||
newParams.transparent = "true";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, newParams);
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
|
||||
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false});
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
|
||||
}
|
||||
|
||||
function test_06_Layer_MapServer_mergeNewParams (t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
|
||||
var newParams = { layers: 'sooper',
|
||||
chickpeas: 'image/png'};
|
||||
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
t.ok( !layer.grid[0][0].url.match("chickpeas"), "chickpeas is not in URL of first tile in grid" );
|
||||
|
||||
layer.mergeNewParams(newParams);
|
||||
|
||||
t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
|
||||
t.ok( layer.grid[0][0].url.match("chickpeas"), "chickpeas is in URL of first tile in grid" );
|
||||
|
||||
newParams.chickpeas = 151;
|
||||
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hashtable");
|
||||
}
|
||||
|
||||
function test_07_Layer_MapServer_getFullRequestString (t) {
|
||||
|
||||
|
||||
t.plan( 1 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'png'};
|
||||
var tLayer = new OpenLayers.Layer.MapServer(name, tUrl, tParams);
|
||||
map.addLayer(tLayer);
|
||||
str = tLayer.getFullRequestString();
|
||||
var tParams = {
|
||||
layers: 'basic',
|
||||
format: 'png',
|
||||
mode: 'map',
|
||||
map_imagetype: 'png'
|
||||
};
|
||||
|
||||
var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams);
|
||||
sStr = sStr.replace(/,/g, "+");
|
||||
|
||||
t.eq(str, sStr , "getFullRequestString() works");
|
||||
|
||||
}
|
||||
|
||||
function test_08_Layer_MapServer_setOpacity (t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.projection = "xx";
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'image/png'};
|
||||
tOptions = { 'opacity': '0.5' };
|
||||
var tLayer = new OpenLayers.Layer.MapServer(name, tUrl, tParams, tOptions);
|
||||
map.addLayer(tLayer);
|
||||
map.zoomToMaxExtent();
|
||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
tLayer.setOpacity("0.6");
|
||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
var pixel = new OpenLayers.Pixel(5,6);
|
||||
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||
tile.draw();
|
||||
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
||||
|
||||
}
|
||||
|
||||
function test_20_Layer_MapServer_Reproject (t) {
|
||||
t.plan(5);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.Google("Google");
|
||||
map.addLayer(layer);
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params, {isBaseLayer: false, reproject: true});
|
||||
layer.isBaseLayer=false;
|
||||
map.addLayer(layer);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
var tile = layer.grid[0][0];
|
||||
t.eq( tile.bounds.left, -22.5, "left side matches" );
|
||||
t.eq( tile.bounds.right, -11.25, "top side matches" );
|
||||
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
|
||||
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
var tile = layer.grid[0][0];
|
||||
t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay");
|
||||
}
|
||||
|
||||
function test_99_Layer_MapServer_destroy (t) {
|
||||
|
||||
t.plan( 1 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
|
||||
//grab a reference to one of the tiles
|
||||
var tile = layer.grid[0][0];
|
||||
|
||||
layer.destroy();
|
||||
|
||||
// checks to make sure superclass (grid) destroy() was called
|
||||
|
||||
t.ok( layer.grid == null, "grid set to null");
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,163 +1,163 @@
|
||||
<html>
|
||||
<head>A
|
||||
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var layer;
|
||||
|
||||
var name = 'Test Layer';
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var params = { map: '/mapdata/vmap_wms.map',
|
||||
Alayers: 'basic'};
|
||||
|
||||
function test_01_Layer_MapServer_Untiled_constructor (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
t.ok( layer instanceof OpenLayers.Layer.MapServer.Untiled, "new OpenLayers.Layer.MapServer returns object" );
|
||||
t.eq( layer.url, "http://labs.metacarta.com/cgi-bin/mapserv", "layer.url is correct (HTTPRequest inited)" );
|
||||
|
||||
t.eq( layer.params.mode, "map", "default mode param correctly copied");
|
||||
t.eq( layer.params.map_imagetype, "png", "default imagetype correctly copied");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_04_Layer_MapServer_Untiled_clone (t) {
|
||||
t.plan(3);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var map = new OpenLayers.Map('map', {});
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
var clone = layer.clone();
|
||||
layer.tile = [[1,2],[3,4]];
|
||||
|
||||
t.ok( clone.tile != layer.tile, "clone does not copy tile");
|
||||
|
||||
layer.ratio += 1;
|
||||
|
||||
t.eq( clone.ratio, 1, "changing layer.ratio does not change clone.ratio -- a fresh copy was made, not just copied reference");
|
||||
|
||||
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
||||
|
||||
layer.tile = null;
|
||||
}
|
||||
|
||||
function test_05_Layer_MapServer_Untiled_isBaseLayer(t) {
|
||||
t.plan(3);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
t.ok( layer.isBaseLayer, "baselayer is true by default");
|
||||
|
||||
var newParams = OpenLayers.Util.extend(new Object(), params);
|
||||
newParams.transparent = "true";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, newParams);
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
|
||||
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params, {isBaseLayer: false});
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
|
||||
}
|
||||
|
||||
function test_06_Layer_MapServer_Untiled_mergeNewParams (t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
|
||||
var newParams = { layers: 'sooper',
|
||||
chickpeas: 'image/png'};
|
||||
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
t.ok( !layer.tile.url.match("chickpeas"), "chickpeas is not in URL of first tile in grid" );
|
||||
|
||||
layer.mergeNewParams(newParams);
|
||||
|
||||
t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
|
||||
t.ok( layer.tile.url.match("chickpeas"), "chickpeas is in URL of first tile in grid" );
|
||||
|
||||
newParams.chickpeas = 151;
|
||||
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hashtable");
|
||||
}
|
||||
|
||||
function test_07_Layer_MapServer_Untiled_getFullRequestString (t) {
|
||||
|
||||
|
||||
t.plan( 1 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'png'};
|
||||
var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams);
|
||||
map.addLayer(tLayer);
|
||||
str = tLayer.getFullRequestString();
|
||||
var tParams = {
|
||||
layers: 'basic',
|
||||
format: 'png',
|
||||
mode: 'map',
|
||||
map_imagetype: 'png',
|
||||
srs: 'EPSG:4326'
|
||||
};
|
||||
|
||||
var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams);
|
||||
sStr = sStr.replace(/,/g, "+");
|
||||
|
||||
t.eq(str, sStr , "getFullRequestString() works");
|
||||
|
||||
}
|
||||
|
||||
function test_08_Layer_MapServer_Untiled_setOpacity (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.projection = "xx";
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'image/png'};
|
||||
tOptions = { 'opacity': '0.5' };
|
||||
var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams, tOptions);
|
||||
map.addLayer(tLayer);
|
||||
map.zoomToMaxExtent();
|
||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
tLayer.setOpacity("0.6");
|
||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
|
||||
}
|
||||
|
||||
function test_99_Layer_MapServer_Untiled_destroy (t) {
|
||||
|
||||
t.plan( 1 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
|
||||
//grab a reference to one of the tiles
|
||||
var tile = layer.tile;
|
||||
|
||||
layer.destroy();
|
||||
|
||||
// checks to make sure superclass (grid) destroy() was called
|
||||
|
||||
t.ok( layer.tile == null, "tile set to null");
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:256px;height:256px"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<head>A
|
||||
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var layer;
|
||||
|
||||
var name = 'Test Layer';
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var params = { map: '/mapdata/vmap_wms.map',
|
||||
Alayers: 'basic'};
|
||||
|
||||
function test_01_Layer_MapServer_Untiled_constructor (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
t.ok( layer instanceof OpenLayers.Layer.MapServer.Untiled, "new OpenLayers.Layer.MapServer returns object" );
|
||||
t.eq( layer.url, "http://labs.metacarta.com/cgi-bin/mapserv", "layer.url is correct (HTTPRequest inited)" );
|
||||
|
||||
t.eq( layer.params.mode, "map", "default mode param correctly copied");
|
||||
t.eq( layer.params.map_imagetype, "png", "default imagetype correctly copied");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_04_Layer_MapServer_Untiled_clone (t) {
|
||||
t.plan(3);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
var map = new OpenLayers.Map('map', {});
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
var clone = layer.clone();
|
||||
layer.tile = [[1,2],[3,4]];
|
||||
|
||||
t.ok( clone.tile != layer.tile, "clone does not copy tile");
|
||||
|
||||
layer.ratio += 1;
|
||||
|
||||
t.eq( clone.ratio, 1, "changing layer.ratio does not change clone.ratio -- a fresh copy was made, not just copied reference");
|
||||
|
||||
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
||||
|
||||
layer.tile = null;
|
||||
}
|
||||
|
||||
function test_05_Layer_MapServer_Untiled_isBaseLayer(t) {
|
||||
t.plan(3);
|
||||
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
t.ok( layer.isBaseLayer, "baselayer is true by default");
|
||||
|
||||
var newParams = OpenLayers.Util.extend(new Object(), params);
|
||||
newParams.transparent = "true";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, newParams);
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
|
||||
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params, {isBaseLayer: false});
|
||||
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
|
||||
}
|
||||
|
||||
function test_06_Layer_MapServer_Untiled_mergeNewParams (t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
|
||||
var newParams = { layers: 'sooper',
|
||||
chickpeas: 'image/png'};
|
||||
|
||||
map.addLayer(layer);
|
||||
map.zoomToMaxExtent();
|
||||
t.ok( !layer.tile.url.match("chickpeas"), "chickpeas is not in URL of first tile in grid" );
|
||||
|
||||
layer.mergeNewParams(newParams);
|
||||
|
||||
t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
|
||||
t.ok( layer.tile.url.match("chickpeas"), "chickpeas is in URL of first tile in grid" );
|
||||
|
||||
newParams.chickpeas = 151;
|
||||
|
||||
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hashtable");
|
||||
}
|
||||
|
||||
function test_07_Layer_MapServer_Untiled_getFullRequestString (t) {
|
||||
|
||||
|
||||
t.plan( 1 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'png'};
|
||||
var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams);
|
||||
map.addLayer(tLayer);
|
||||
str = tLayer.getFullRequestString();
|
||||
var tParams = {
|
||||
layers: 'basic',
|
||||
format: 'png',
|
||||
mode: 'map',
|
||||
map_imagetype: 'png',
|
||||
srs: 'EPSG:4326'
|
||||
};
|
||||
|
||||
var sStr = tUrl + "?" + OpenLayers.Util.getParameterString(tParams);
|
||||
sStr = sStr.replace(/,/g, "+");
|
||||
|
||||
t.eq(str, sStr , "getFullRequestString() works");
|
||||
|
||||
}
|
||||
|
||||
function test_08_Layer_MapServer_Untiled_setOpacity (t) {
|
||||
t.plan( 4 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.projection = "xx";
|
||||
tUrl = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'image/png'};
|
||||
tOptions = { 'opacity': '0.5' };
|
||||
var tLayer = new OpenLayers.Layer.MapServer.Untiled(name, tUrl, tParams, tOptions);
|
||||
map.addLayer(tLayer);
|
||||
map.zoomToMaxExtent();
|
||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
tLayer.setOpacity("0.6");
|
||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
|
||||
}
|
||||
|
||||
function test_99_Layer_MapServer_Untiled_destroy (t) {
|
||||
|
||||
t.plan( 1 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.MapServer.Untiled(name, url, params);
|
||||
map.addLayer(layer);
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
|
||||
//grab a reference to one of the tiles
|
||||
var tile = layer.tile;
|
||||
|
||||
layer.destroy();
|
||||
|
||||
// checks to make sure superclass (grid) destroy() was called
|
||||
|
||||
t.ok( layer.tile == null, "tile set to null");
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:256px;height:256px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
var name = "Vector Layer";
|
||||
|
||||
function test_01_Layer_Vector_constructor(t) {
|
||||
t.plan(3);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(name);
|
||||
t.ok(layer instanceof OpenLayers.Layer.Vector, "new OpenLayers.Layer.Vector returns correct object" );
|
||||
t.eq(layer.name, name, "layer name is correctly set");
|
||||
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||
|
||||
}
|
||||
|
||||
function test_02_Layer_Vector_addFeatures(t) {
|
||||
t.plan(2);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(name);
|
||||
|
||||
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||
var pointFeature = new OpenLayers.Feature.Vector(layer, point);
|
||||
|
||||
layer.addFeatures([pointFeature]);
|
||||
|
||||
t.eq(layer.features.length, 1, "OpenLayers.Layer.Vector.addFeatures adds something to the array");
|
||||
t.ok(layer.features[0] == pointFeature, "OpenLayers.Layer.Vector.addFeatures returns an array of features");
|
||||
}
|
||||
|
||||
function test_03_Layer_Vector_removeFeatures(t) {
|
||||
t.plan(1);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(name);
|
||||
|
||||
var point1 = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||
var pointFeature1 = new OpenLayers.Feature.Vector(layer, point1);
|
||||
var point2 = new OpenLayers.Geometry.Point(-111.14, 45.78);
|
||||
var pointFeature2 = new OpenLayers.Feature.Vector(layer, point2);
|
||||
|
||||
layer.addFeatures([pointFeature1, pointFeature2]);
|
||||
var features = layer.removeFeatures([pointFeature1]);
|
||||
|
||||
t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
|
||||
}
|
||||
|
||||
function test_Layer_Vector_addsStyle (t) {
|
||||
t.plan(2);
|
||||
layer = new OpenLayers.Layer.Vector(name);
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.addLayer(layer);
|
||||
f = new OpenLayers.Feature.Vector();
|
||||
t.eq( f.style, null, "Feature style is null by default.");
|
||||
layer.addFeatures(f);
|
||||
t.ok( f.style != null, "Feature style is set by layer.");
|
||||
}
|
||||
|
||||
function test_99_Layer_Vector_destroy (t) {
|
||||
t.plan(1);
|
||||
layer = new OpenLayers.Layer.Vector(name);
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.addLayer(layer);
|
||||
layer.destroy();
|
||||
t.eq(layer.map, null, "layer.map is null after destroy");
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
var name = "Vector Layer";
|
||||
|
||||
function test_01_Layer_Vector_constructor(t) {
|
||||
t.plan(3);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(name);
|
||||
t.ok(layer instanceof OpenLayers.Layer.Vector, "new OpenLayers.Layer.Vector returns correct object" );
|
||||
t.eq(layer.name, name, "layer name is correctly set");
|
||||
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||
|
||||
}
|
||||
|
||||
function test_02_Layer_Vector_addFeatures(t) {
|
||||
t.plan(2);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(name);
|
||||
|
||||
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||
var pointFeature = new OpenLayers.Feature.Vector(layer, point);
|
||||
|
||||
layer.addFeatures([pointFeature]);
|
||||
|
||||
t.eq(layer.features.length, 1, "OpenLayers.Layer.Vector.addFeatures adds something to the array");
|
||||
t.ok(layer.features[0] == pointFeature, "OpenLayers.Layer.Vector.addFeatures returns an array of features");
|
||||
}
|
||||
|
||||
function test_03_Layer_Vector_removeFeatures(t) {
|
||||
t.plan(1);
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(name);
|
||||
|
||||
var point1 = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||
var pointFeature1 = new OpenLayers.Feature.Vector(layer, point1);
|
||||
var point2 = new OpenLayers.Geometry.Point(-111.14, 45.78);
|
||||
var pointFeature2 = new OpenLayers.Feature.Vector(layer, point2);
|
||||
|
||||
layer.addFeatures([pointFeature1, pointFeature2]);
|
||||
var features = layer.removeFeatures([pointFeature1]);
|
||||
|
||||
t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
|
||||
}
|
||||
|
||||
function test_Layer_Vector_addsStyle (t) {
|
||||
t.plan(2);
|
||||
layer = new OpenLayers.Layer.Vector(name);
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.addLayer(layer);
|
||||
f = new OpenLayers.Feature.Vector();
|
||||
t.eq( f.style, null, "Feature style is null by default.");
|
||||
layer.addFeatures(f);
|
||||
t.ok( f.style != null, "Feature style is set by layer.");
|
||||
}
|
||||
|
||||
function test_99_Layer_Vector_destroy (t) {
|
||||
t.plan(1);
|
||||
layer = new OpenLayers.Layer.Vector(name);
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.addLayer(layer);
|
||||
layer.destroy();
|
||||
t.eq(layer.map, null, "layer.map is null after destroy");
|
||||
}
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
function test_01_Format_constructor(t) {
|
||||
t.plan(4);
|
||||
|
||||
var options = {'foo': 'bar'};
|
||||
var format = new OpenLayers.Format(options);
|
||||
t.ok(format instanceof OpenLayers.Format,
|
||||
"new OpenLayers.Format returns object" );
|
||||
t.eq(format.foo, "bar", "constructor sets options correctly");
|
||||
t.eq(typeof format.read, "function", "format has a read function");
|
||||
t.eq(typeof format.write, "function", "format has a write function");
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
function test_01_Format_constructor(t) {
|
||||
t.plan(4);
|
||||
|
||||
var options = {'foo': 'bar'};
|
||||
var format = new OpenLayers.Format(options);
|
||||
t.ok(format instanceof OpenLayers.Format,
|
||||
"new OpenLayers.Format returns object" );
|
||||
t.eq(format.foo, "bar", "constructor sets options correctly");
|
||||
t.eq(typeof format.read, "function", "format has a read function");
|
||||
t.eq(typeof format.write, "function", "format has a write function");
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,212 +1,212 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var map;
|
||||
|
||||
function test_01_Geometry_constructor (t) {
|
||||
t.plan( 2 );
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
t.eq(g.CLASS_NAME, "OpenLayers.Geometry", "correct CLASS_NAME")
|
||||
t.ok(g.id.startsWith("OpenLayers.Geometry_"), "id correctly set");
|
||||
}
|
||||
|
||||
|
||||
function test_02_Geometry_setBounds(t) {
|
||||
t.plan( 2 );
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
//null object
|
||||
g.setBounds(null);
|
||||
t.ok(g.bounds == null, "setbounds with null value does not crash or set bounds");
|
||||
|
||||
//no classname object
|
||||
g_clone = {};
|
||||
var object = {
|
||||
'clone': function() { return g_clone; }
|
||||
};
|
||||
g.setBounds(object);
|
||||
t.ok(g.bounds == g_clone, "setbounds with valid object sets bounds, calls clone");
|
||||
}
|
||||
|
||||
function test_03_Geometry_extendBounds(t) {
|
||||
t.plan(9);
|
||||
|
||||
OpenLayers.Bounds.prototype._extend =
|
||||
OpenLayers.Bounds.prototype.extend;
|
||||
OpenLayers.Bounds.prototype.extend = function(b) {
|
||||
g_extendBounds = b;
|
||||
};
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
//this.bounds null (calculateBounds(), setBounds() called)
|
||||
g.setBounds = function(b) { g_setBounds = b; };
|
||||
g.calculateBounds = function() { g_calculateBounds = {}; };
|
||||
var object = {};
|
||||
g_setBounds = null;
|
||||
g_calculateBounds = null;
|
||||
g_extendBounds = null;
|
||||
g.extendBounds(object);
|
||||
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
|
||||
t.ok(g_setBounds == object, "setBounds() called when this.bounds is null and calculateBounds() is null too");
|
||||
t.ok(g_extendBounds != object, "this.bounds.extend() not called when this.bounds is null and calculateBounds() is null too");
|
||||
|
||||
//this.bounds null (calculateBounds() sets this.bounds:
|
||||
// - setBounds() not called
|
||||
// - this.bounds.extend() called
|
||||
g_calcBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
g.calculateBounds = function() {
|
||||
g_calculateBounds = {};
|
||||
this.bounds = g_calcBounds;
|
||||
};
|
||||
var object = {};
|
||||
|
||||
g_setBounds = null;
|
||||
g_calculateBounds = null;
|
||||
g_extendBounds = null;
|
||||
g.extendBounds(object);
|
||||
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
|
||||
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is null and calculateBounds() sets this.bounds");
|
||||
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is null and calculateBounds() sets this.bounds");
|
||||
|
||||
|
||||
//this.bounds non-null thus extend()
|
||||
// - setBounds() not called
|
||||
// - this.bounds.extend() called
|
||||
g_setBounds = null;
|
||||
g_calculateBounds = null;
|
||||
g_extendBounds = null;
|
||||
g.extendBounds(object);
|
||||
t.ok(g_calculateBounds == null, "calculateBounds() not called when this.bounds is non null");
|
||||
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is nonnull");
|
||||
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is non-null");
|
||||
|
||||
OpenLayers.Bounds.prototype.extend =
|
||||
OpenLayers.Bounds.prototype._extend;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_04_Geometry_getBounds(t) {
|
||||
t.plan(1);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
var testBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
g.bounds = testBounds.clone();
|
||||
|
||||
t.ok(g.getBounds().equals(testBounds), "getBounds works");
|
||||
}
|
||||
|
||||
function test_05_Geometry_atPoint(t) {
|
||||
t.plan(6);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
var lonlat = null;
|
||||
var lon = 5;
|
||||
var lat = 10;
|
||||
|
||||
//null lonlat
|
||||
g.bounds = new OpenLayers.Bounds();
|
||||
|
||||
var atPoint = g.atPoint(lonlat, lon, lat);
|
||||
t.ok(!atPoint, "null lonlat")
|
||||
|
||||
//null this.bounds
|
||||
g.bounds = null;
|
||||
lonlat = new OpenLayers.LonLat(1,2);
|
||||
|
||||
atPoint = g.atPoint(lonlat, lon, lat);
|
||||
t.ok(!atPoint, "null this.bounds")
|
||||
|
||||
//toleranceLon/toleranceLat
|
||||
|
||||
//default toleranceLon/toleranceLat
|
||||
OpenLayers.Bounds.prototype._containsLonLat = OpenLayers.Bounds.prototype.containsLonLat;
|
||||
g_Return = {};
|
||||
OpenLayers.Bounds.prototype.containsLonLat = function(ll) {
|
||||
g_bounds = this;
|
||||
return g_Return;
|
||||
}
|
||||
|
||||
var testBounds = new OpenLayers.Bounds(10,20,30,40);
|
||||
g.bounds = testBounds.clone();
|
||||
lonlat = new OpenLayers.LonLat(20,30);
|
||||
|
||||
g_bounds = null;
|
||||
atPoint = g.atPoint(lonlat);
|
||||
t.ok(g_bounds.equals(testBounds), "default toleranceLon/Lat are 0");
|
||||
t.ok(atPoint == g_Return, "default toleranceLon/Lat returns correctly");
|
||||
|
||||
//real toleranceLon/toleranceLat
|
||||
var testBounds = new OpenLayers.Bounds(10,20,30,40);
|
||||
g.bounds = testBounds.clone();
|
||||
lonlat = new OpenLayers.LonLat(20,30);
|
||||
|
||||
g_bounds = null;
|
||||
atPoint = g.atPoint(lonlat, lon, lat);
|
||||
testBounds.left -= lon;
|
||||
testBounds.bottom -= lat;
|
||||
testBounds.right += lon;
|
||||
testBounds.top += lat;
|
||||
t.ok(g_bounds.equals(testBounds), "real toleranceLon/Lat are 0");
|
||||
t.ok(atPoint == g_Return, "real toleranceLon/Lat returns correctly");
|
||||
|
||||
OpenLayers.Bounds.prototype.containsLonLat = OpenLayers.Bounds.prototype._containsLonLat;
|
||||
|
||||
}
|
||||
|
||||
function test_06_Geometry_getLength(t) {
|
||||
t.plan(1);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
t.eq(g.getLength(), 0, "getLength is 0");
|
||||
}
|
||||
|
||||
function test_07_Geometry_getArea(t) {
|
||||
t.plan(1);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
t.eq(g.getArea(), 0, "getArea is 0");
|
||||
}
|
||||
|
||||
function test_99_Geometry_destroy(t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
g.bounds = new OpenLayers.Bounds();
|
||||
g.feature = new Object();
|
||||
g.events = {
|
||||
'destroy': function() {
|
||||
g_events_destroy = {};
|
||||
}
|
||||
};
|
||||
|
||||
g_style_destroy = null;
|
||||
g_events_destroy = {};
|
||||
g.destroy();
|
||||
|
||||
t.eq(g.id, null, "id nullified");
|
||||
|
||||
t.eq(g.bounds, null, "bounds nullified");
|
||||
t.eq(g.feature, null, "feature reference nullified");
|
||||
|
||||
t.ok(g_events_destroy != null, "events.destroy() called on non-null events");
|
||||
t.eq(g.events, null, "events nullified");
|
||||
}
|
||||
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width: 1024px; height: 512px;"/>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var map;
|
||||
|
||||
function test_01_Geometry_constructor (t) {
|
||||
t.plan( 2 );
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
t.eq(g.CLASS_NAME, "OpenLayers.Geometry", "correct CLASS_NAME")
|
||||
t.ok(g.id.startsWith("OpenLayers.Geometry_"), "id correctly set");
|
||||
}
|
||||
|
||||
|
||||
function test_02_Geometry_setBounds(t) {
|
||||
t.plan( 2 );
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
//null object
|
||||
g.setBounds(null);
|
||||
t.ok(g.bounds == null, "setbounds with null value does not crash or set bounds");
|
||||
|
||||
//no classname object
|
||||
g_clone = {};
|
||||
var object = {
|
||||
'clone': function() { return g_clone; }
|
||||
};
|
||||
g.setBounds(object);
|
||||
t.ok(g.bounds == g_clone, "setbounds with valid object sets bounds, calls clone");
|
||||
}
|
||||
|
||||
function test_03_Geometry_extendBounds(t) {
|
||||
t.plan(9);
|
||||
|
||||
OpenLayers.Bounds.prototype._extend =
|
||||
OpenLayers.Bounds.prototype.extend;
|
||||
OpenLayers.Bounds.prototype.extend = function(b) {
|
||||
g_extendBounds = b;
|
||||
};
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
//this.bounds null (calculateBounds(), setBounds() called)
|
||||
g.setBounds = function(b) { g_setBounds = b; };
|
||||
g.calculateBounds = function() { g_calculateBounds = {}; };
|
||||
var object = {};
|
||||
g_setBounds = null;
|
||||
g_calculateBounds = null;
|
||||
g_extendBounds = null;
|
||||
g.extendBounds(object);
|
||||
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
|
||||
t.ok(g_setBounds == object, "setBounds() called when this.bounds is null and calculateBounds() is null too");
|
||||
t.ok(g_extendBounds != object, "this.bounds.extend() not called when this.bounds is null and calculateBounds() is null too");
|
||||
|
||||
//this.bounds null (calculateBounds() sets this.bounds:
|
||||
// - setBounds() not called
|
||||
// - this.bounds.extend() called
|
||||
g_calcBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
g.calculateBounds = function() {
|
||||
g_calculateBounds = {};
|
||||
this.bounds = g_calcBounds;
|
||||
};
|
||||
var object = {};
|
||||
|
||||
g_setBounds = null;
|
||||
g_calculateBounds = null;
|
||||
g_extendBounds = null;
|
||||
g.extendBounds(object);
|
||||
t.ok(g_calculateBounds != null, "calculateBounds() called when this.bounds is null");
|
||||
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is null and calculateBounds() sets this.bounds");
|
||||
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is null and calculateBounds() sets this.bounds");
|
||||
|
||||
|
||||
//this.bounds non-null thus extend()
|
||||
// - setBounds() not called
|
||||
// - this.bounds.extend() called
|
||||
g_setBounds = null;
|
||||
g_calculateBounds = null;
|
||||
g_extendBounds = null;
|
||||
g.extendBounds(object);
|
||||
t.ok(g_calculateBounds == null, "calculateBounds() not called when this.bounds is non null");
|
||||
t.ok(g_setBounds == null, "setBounds() not called when this.bounds is nonnull");
|
||||
t.ok(g_extendBounds == object, "this.bounds.extend() called when this.bounds is non-null");
|
||||
|
||||
OpenLayers.Bounds.prototype.extend =
|
||||
OpenLayers.Bounds.prototype._extend;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_04_Geometry_getBounds(t) {
|
||||
t.plan(1);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
var testBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
g.bounds = testBounds.clone();
|
||||
|
||||
t.ok(g.getBounds().equals(testBounds), "getBounds works");
|
||||
}
|
||||
|
||||
function test_05_Geometry_atPoint(t) {
|
||||
t.plan(6);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
var lonlat = null;
|
||||
var lon = 5;
|
||||
var lat = 10;
|
||||
|
||||
//null lonlat
|
||||
g.bounds = new OpenLayers.Bounds();
|
||||
|
||||
var atPoint = g.atPoint(lonlat, lon, lat);
|
||||
t.ok(!atPoint, "null lonlat")
|
||||
|
||||
//null this.bounds
|
||||
g.bounds = null;
|
||||
lonlat = new OpenLayers.LonLat(1,2);
|
||||
|
||||
atPoint = g.atPoint(lonlat, lon, lat);
|
||||
t.ok(!atPoint, "null this.bounds")
|
||||
|
||||
//toleranceLon/toleranceLat
|
||||
|
||||
//default toleranceLon/toleranceLat
|
||||
OpenLayers.Bounds.prototype._containsLonLat = OpenLayers.Bounds.prototype.containsLonLat;
|
||||
g_Return = {};
|
||||
OpenLayers.Bounds.prototype.containsLonLat = function(ll) {
|
||||
g_bounds = this;
|
||||
return g_Return;
|
||||
}
|
||||
|
||||
var testBounds = new OpenLayers.Bounds(10,20,30,40);
|
||||
g.bounds = testBounds.clone();
|
||||
lonlat = new OpenLayers.LonLat(20,30);
|
||||
|
||||
g_bounds = null;
|
||||
atPoint = g.atPoint(lonlat);
|
||||
t.ok(g_bounds.equals(testBounds), "default toleranceLon/Lat are 0");
|
||||
t.ok(atPoint == g_Return, "default toleranceLon/Lat returns correctly");
|
||||
|
||||
//real toleranceLon/toleranceLat
|
||||
var testBounds = new OpenLayers.Bounds(10,20,30,40);
|
||||
g.bounds = testBounds.clone();
|
||||
lonlat = new OpenLayers.LonLat(20,30);
|
||||
|
||||
g_bounds = null;
|
||||
atPoint = g.atPoint(lonlat, lon, lat);
|
||||
testBounds.left -= lon;
|
||||
testBounds.bottom -= lat;
|
||||
testBounds.right += lon;
|
||||
testBounds.top += lat;
|
||||
t.ok(g_bounds.equals(testBounds), "real toleranceLon/Lat are 0");
|
||||
t.ok(atPoint == g_Return, "real toleranceLon/Lat returns correctly");
|
||||
|
||||
OpenLayers.Bounds.prototype.containsLonLat = OpenLayers.Bounds.prototype._containsLonLat;
|
||||
|
||||
}
|
||||
|
||||
function test_06_Geometry_getLength(t) {
|
||||
t.plan(1);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
t.eq(g.getLength(), 0, "getLength is 0");
|
||||
}
|
||||
|
||||
function test_07_Geometry_getArea(t) {
|
||||
t.plan(1);
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
|
||||
t.eq(g.getArea(), 0, "getArea is 0");
|
||||
}
|
||||
|
||||
function test_99_Geometry_destroy(t) {
|
||||
t.plan( 5 );
|
||||
|
||||
var g = new OpenLayers.Geometry();
|
||||
g.bounds = new OpenLayers.Bounds();
|
||||
g.feature = new Object();
|
||||
g.events = {
|
||||
'destroy': function() {
|
||||
g_events_destroy = {};
|
||||
}
|
||||
};
|
||||
|
||||
g_style_destroy = null;
|
||||
g_events_destroy = {};
|
||||
g.destroy();
|
||||
|
||||
t.eq(g.id, null, "id nullified");
|
||||
|
||||
t.eq(g.bounds, null, "bounds nullified");
|
||||
t.eq(g.feature, null, "feature reference nullified");
|
||||
|
||||
t.ok(g_events_destroy != null, "events.destroy() called on non-null events");
|
||||
t.eq(g.events, null, "events nullified");
|
||||
}
|
||||
|
||||
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width: 1024px; height: 512px;"/>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,166 +1,166 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
var layer;
|
||||
|
||||
|
||||
function test_01_Renderer_drawGeometry(t) {
|
||||
t.plan(1);
|
||||
var r = new OpenLayers.Renderer();
|
||||
t.ok( r instanceof OpenLayers.Renderer, "new OpenLayers.Renderer returns REnderer object" );
|
||||
}
|
||||
/*
|
||||
function test_01_Renderer_drawGeometry(t) {
|
||||
t.plan(12);
|
||||
|
||||
var r = new OpenLayers.Renderer();
|
||||
r.root = document.body;
|
||||
r.setStyle = function() {};
|
||||
|
||||
var geometry = null;
|
||||
var style = null;
|
||||
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(true, "didnt do anything on null style");
|
||||
|
||||
// point
|
||||
var properDraw = false;
|
||||
r.drawPoint = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Point'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPoint when passed a point");
|
||||
|
||||
// curve
|
||||
var properDraw = false;
|
||||
r.drawCurve = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Curve'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawCurve when passed a curve");
|
||||
|
||||
// line segment
|
||||
var properDraw = false;
|
||||
r.drawLineString = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineSegment'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLineString when passed a line segment");
|
||||
|
||||
// line string
|
||||
var properDraw = false;
|
||||
r.drawLineString = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineString'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLineString when passed a line string");
|
||||
|
||||
// linear ring
|
||||
var properDraw = false;
|
||||
r.drawLinearRing = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LinearRing'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLinearRing when passed a linear ring");
|
||||
|
||||
// polygon
|
||||
var properDraw = false;
|
||||
r.drawPolygon = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Polygon'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPolygon when passed a polygon");
|
||||
|
||||
// surface
|
||||
var properDraw = false;
|
||||
r.drawSurface = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Surface'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawSurface when passed a surface");
|
||||
|
||||
// rectangle
|
||||
var properDraw = false;
|
||||
r.drawRectangle = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Rectangle'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawRectangle when passed a rectangle");
|
||||
|
||||
// multi-point
|
||||
var properDraw = false;
|
||||
r.drawPoint = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {
|
||||
CLASS_NAME: 'OpenLayers.Geometry.MultiPoint',
|
||||
components: [{CLASS_NAME: 'OpenLayers.Geometry.Point'}]
|
||||
};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPoint when passed a multi-point");
|
||||
|
||||
// multi-linestring
|
||||
var properDraw = false;
|
||||
r.drawLineString = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {
|
||||
CLASS_NAME: 'OpenLayers.Geometry.MultiLineString',
|
||||
components: [{CLASS_NAME: 'OpenLayers.Geometry.LineString'}]
|
||||
};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLineString when passed a multi-linestring");
|
||||
|
||||
// multi-polygon
|
||||
var properDraw = false;
|
||||
r.drawPolygon = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {
|
||||
CLASS_NAME: 'OpenLayers.Geometry.MultiPolygon',
|
||||
components: [{CLASS_NAME: 'OpenLayers.Geometry.Polygon'}]
|
||||
};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPolygon when passed a multi-polygon");
|
||||
|
||||
}
|
||||
*/
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
var layer;
|
||||
|
||||
|
||||
function test_01_Renderer_drawGeometry(t) {
|
||||
t.plan(1);
|
||||
var r = new OpenLayers.Renderer();
|
||||
t.ok( r instanceof OpenLayers.Renderer, "new OpenLayers.Renderer returns REnderer object" );
|
||||
}
|
||||
/*
|
||||
function test_01_Renderer_drawGeometry(t) {
|
||||
t.plan(12);
|
||||
|
||||
var r = new OpenLayers.Renderer();
|
||||
r.root = document.body;
|
||||
r.setStyle = function() {};
|
||||
|
||||
var geometry = null;
|
||||
var style = null;
|
||||
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(true, "didnt do anything on null style");
|
||||
|
||||
// point
|
||||
var properDraw = false;
|
||||
r.drawPoint = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Point'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPoint when passed a point");
|
||||
|
||||
// curve
|
||||
var properDraw = false;
|
||||
r.drawCurve = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Curve'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawCurve when passed a curve");
|
||||
|
||||
// line segment
|
||||
var properDraw = false;
|
||||
r.drawLineString = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineSegment'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLineString when passed a line segment");
|
||||
|
||||
// line string
|
||||
var properDraw = false;
|
||||
r.drawLineString = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LineString'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLineString when passed a line string");
|
||||
|
||||
// linear ring
|
||||
var properDraw = false;
|
||||
r.drawLinearRing = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.LinearRing'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLinearRing when passed a linear ring");
|
||||
|
||||
// polygon
|
||||
var properDraw = false;
|
||||
r.drawPolygon = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Polygon'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPolygon when passed a polygon");
|
||||
|
||||
// surface
|
||||
var properDraw = false;
|
||||
r.drawSurface = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Surface'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawSurface when passed a surface");
|
||||
|
||||
// rectangle
|
||||
var properDraw = false;
|
||||
r.drawRectangle = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {CLASS_NAME: 'OpenLayers.Geometry.Rectangle'};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawRectangle when passed a rectangle");
|
||||
|
||||
// multi-point
|
||||
var properDraw = false;
|
||||
r.drawPoint = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {
|
||||
CLASS_NAME: 'OpenLayers.Geometry.MultiPoint',
|
||||
components: [{CLASS_NAME: 'OpenLayers.Geometry.Point'}]
|
||||
};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPoint when passed a multi-point");
|
||||
|
||||
// multi-linestring
|
||||
var properDraw = false;
|
||||
r.drawLineString = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {
|
||||
CLASS_NAME: 'OpenLayers.Geometry.MultiLineString',
|
||||
components: [{CLASS_NAME: 'OpenLayers.Geometry.LineString'}]
|
||||
};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawLineString when passed a multi-linestring");
|
||||
|
||||
// multi-polygon
|
||||
var properDraw = false;
|
||||
r.drawPolygon = function(g) {
|
||||
properDraw = true;
|
||||
return {};
|
||||
}
|
||||
geometry = {
|
||||
CLASS_NAME: 'OpenLayers.Geometry.MultiPolygon',
|
||||
components: [{CLASS_NAME: 'OpenLayers.Geometry.Polygon'}]
|
||||
};
|
||||
style = true;
|
||||
r.drawGeometry(geometry, style);
|
||||
t.ok(properDraw, "drawGeometry called drawPolygon when passed a multi-polygon");
|
||||
|
||||
}
|
||||
*/
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user