Handler.Point doesn't render points if no default resolution props in map object. Thanks fredj for the review. (closes #1205)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5396 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -87,7 +87,14 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
|
|||||||
}
|
}
|
||||||
// create temporary vector layer for rendering geometry sketch
|
// create temporary vector layer for rendering geometry sketch
|
||||||
// TBD: this could be moved to initialize/destroy - setting visibility here
|
// TBD: this could be moved to initialize/destroy - setting visibility here
|
||||||
var options = {displayInLayerSwitcher: false};
|
var options = {
|
||||||
|
displayInLayerSwitcher: false,
|
||||||
|
// indicate that the temp vector layer will never be out of range
|
||||||
|
// without this, resolution properties must be specified at the
|
||||||
|
// map-level for this temporary layer to init its resolutions
|
||||||
|
// correctly
|
||||||
|
calculateInRange: function() { return true; }
|
||||||
|
};
|
||||||
this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
|
this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
|
||||||
this.map.addLayer(this.layer);
|
this.map.addLayer(this.layer);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>Draw Feature Acceptance Test</title>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map {
|
||||||
|
margin: 1em;
|
||||||
|
float: left;
|
||||||
|
width: 256px;
|
||||||
|
height: 256px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var map1, map2;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
var wms, vector, ctrl;
|
||||||
|
var goodMaxRes = OpenLayers.Map.prototype.maxResolution;
|
||||||
|
var badMaxRes = 0.00000001;
|
||||||
|
|
||||||
|
map1 = new OpenLayers.Map('map1');
|
||||||
|
wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
|
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
||||||
|
vector = new OpenLayers.Layer.Vector("vector1");
|
||||||
|
map1.addLayers([wms, vector]);
|
||||||
|
ctrl = new OpenLayers.Control.DrawFeature(vector,
|
||||||
|
OpenLayers.Handler.Path);
|
||||||
|
map1.addControl(ctrl);
|
||||||
|
ctrl.activate();
|
||||||
|
|
||||||
|
map2 = new OpenLayers.Map('map2',
|
||||||
|
{maxResolution: badMaxRes});
|
||||||
|
wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
|
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'},
|
||||||
|
{maxResolution: goodMaxRes});
|
||||||
|
vector = new OpenLayers.Layer.Vector("vector2",
|
||||||
|
{maxResolution: goodMaxRes});
|
||||||
|
map2.addLayers([wms, vector]);
|
||||||
|
ctrl = new OpenLayers.Control.DrawFeature(vector,
|
||||||
|
OpenLayers.Handler.Path);
|
||||||
|
map2.addControl(ctrl);
|
||||||
|
ctrl.activate();
|
||||||
|
|
||||||
|
map1.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||||
|
map2.setCenter(new OpenLayers.LonLat(0, 0), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<div id="map1" class="map"></div>
|
||||||
|
<p><b>Resolution properties set at the map level.</b></p>
|
||||||
|
<p>Points should draw as you draw lines. Click to start
|
||||||
|
drawing and double-click to draw the last point.</p>
|
||||||
|
<br style="clear: both;" />
|
||||||
|
|
||||||
|
<div id="map2" class="map"></div>
|
||||||
|
<p><b>Resolution properties set at the layer level.</b></p>
|
||||||
|
<p>Points should draw as you draw lines. Click to start
|
||||||
|
drawing and double-click to draw the last point.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user