Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Treat UI and non-UI controls differently #233

Open
wants to merge 11 commits into from

3 participants

@jorix

This proposal was developed by elemoine, this is just an update to current trunk.

See http://trac.osgeo.org/openlayers/ticket/3180.

Small adjustments in respect the initial proposal:

  • The MouseDefaults and MouseToolbar controls are not changed since currently are in deprecated.js
  • The control.outsideViewport = (control.div != null); of Map.addControlToMap has been moved into if(typeof control.draw === 'function') {
  • In Control.js: outsideViewport property has been documented, and expanded documentation on createDiv method.
  • In deprecated.js has been added the Control.draw method.

Tests of Map and all controls are working properly (deprecated/Control/MouseToolbar.html included)

@elemoine
Owner

I think that we should not break third-party controls that override draw and call Control.prototype.draw. And requesting users of such controls to load deprecated.js in their pages isn't a solution in my opinion. We've never discouraged people from calling Control.prototype.draw in custom controls, so moving this function to deprecated.js would be too severe.

So I think we should either find another solution or give up with this patch. Another solution might be to have non-UI controls to override draw to set it to Function.void. This isn't as elegant but this may meet our goal and preserve backward compatibility.

@jorix

@elemoine: Yes, of course it is better to lose a bit of elegance to preserve compatibility.

NOTE: The first committ is the same but without touching deprecated.js.

Tests of Map and all controls are working properly (Except for Graticule control that has not been able to test today, because http://proj4js.org is not responding)

@elemoine
Owner

@jorix I think you didn't fully understand my comments. Sorry. I think we should not deprecate the draw method, but rather have non-UI controls not call Control.prototype.draw and set draw to the void function. Don't you think it would work?

@jorix

If I understand, we seek operation as proposed but we must remove Control.createDiv and unify it with Control.draw (and don't touch Map) ...and remove all comments deprecated

And keep the following recommendation in docs of Control.draw: "In non-UI controls must be used void function as draw method"

Agrees this with your approach?

@elemoine
Owner

If I understand, we seek operation as proposed but we must remove Control.createDiv

Yes

and unify it with Control.draw (and don't touch Map)

Yes, I don't think Map.addControlToMap would need any change. If control.draw returns undefined no DOM element will be added to the viewport div.

...and remove all comments deprecated

No addition to deprecated.js. No deprecation at all.

And keep the following recommendation in docs of Control.draw: "In non-UI controls must be used void function as draw method"

Yes. Non-UI controls just have draw: OpenLayers.Function.Void in their prototypes.

Agrees this with your approach?

I sounds like so. Hope it makes sense to you, and it will work.

Sorry for going back and forth on this, and thanks a lot for your effort.

@jorix

@elemoine:

Yes, this makes sense (when I say not to touch the map, I say leave it as before and use that div is undefined, I think we agree)

Do not worry, I tried to keep the initial idea.

I have the temptation to use function(){} instead of OpenLayers.Function.Void in non-UI controls??

@elemoine
Owner

@jorix, yes using function() {} is more explicit and does not cause any issue here.

@jorix

@elemoine: Done!

I have no authority to change the milestone, can you put in 2.12 if you think proper.

Please review.

@jorix

Tests of Map and all controls are working properly (Except for Graticule.js because http://proj4js.org is not responding)

@elemoine: I changed test_createDiv to test draw method, It was not necessary for the current approach (Control.js has not been touched) but I thought it was interesting to keep your job in this test.

@elemoine elemoine commented on the diff
lib/OpenLayers/Control.js
@@ -84,6 +84,14 @@ OpenLayers.Control = OpenLayers.Class({
type: null,
/**
+ * Property: outsideViewport
@elemoine Owner
elemoine added a note

This should be an APIProperty.

@jorix
jorix added a note

@elemoine: Ok, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@elemoine
Owner

It looks good @jorix. Before merging I'd just like to

  • check that the examples are in conformance
  • add docs in Control explaining how to create controls (initialize/destroy, setMap, draw, activate/deactivate)
  • add release notes
@jorix

check that the examples are in conformance

Now I've seen that ZoomBox not draw the box but in the trunk either! see http://www.openlayers.org/dev/examples/controls.html So the problem is due to a commit, oops!

add docs in Control explaining how to create controls (initialize/destroy, setMap, draw, activate/deactivate)

Very interesting! "ahocevar" has a very old ticket proposed an adjustment to this topic:
deactivate on destroy trac #2210.

My English is poor :(, I guess is not thinking that I documented.

@elemoine
Owner

@jorix, can you please open an issue for the ZoomBox issue? Thanks.

lib/OpenLayers/Control.js
@@ -84,6 +84,13 @@ OpenLayers.Control = OpenLayers.Class({
type: null,
/**
+ * APIProperty: outsideViewport
@elemoine Owner
elemoine added a note

I don't think this should to be an API property, it's for internal use only.

@jorix
jorix added a note

Yes, in this moment I have no GIT, tomorrow take it out, so I'll leave it as Property.

@jorix
jorix added a note

Done!, we leave as property, I think is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@elemoine
Owner

Proposed changes in pull request sent to @jorix: jorix#1

@jorix jorix Merge pull request #1 from elemoine/controls
proposed changes for the UI non-UI control stuff
bd13e4a
@elemoine
Owner

I'd really like to have other core developers' opinions before merging this. To sum up, this pull request adds draw: function() {} in the prototype of non-UI controls, i.e. controls that don't need a div to be added to the map viewport. This is to avoid polluting the DOM.

@probins

permalink should not draw if anchor:true

@jorix

@probins:

permalink should not draw if anchor:true

Done! (Permalink and Scale)

NOTE: It was necessary to merge with the "master" branch so that fixes a bug in "Permalink.destroy".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 29, 2012
  1. @jorix

    3180: treat UI and non-UI controls differently, on non-UI controls `d…

    jorix authored
    …raw` method should be empty.
  2. @jorix
  3. @jorix
Commits on Mar 1, 2012
  1. @jorix
Commits on Mar 2, 2012
  1. @elemoine
  2. @elemoine

    Navigation and TouchNavigation controls - no need to call set map on …

    elemoine authored
    …the internal controls as the map object is set in their options
  3. @elemoine
  4. @jorix

    Merge pull request #1 from elemoine/controls

    jorix authored
    proposed changes for the UI non-UI control stuff
Commits on Mar 3, 2012
  1. @jorix
Commits on Mar 12, 2012
  1. @jorix
  2. @jorix
This page is out of date. Refresh to see the latest.
Showing with 583 additions and 144 deletions.
  1. +35 −22 examples/custom-control.html
  2. +42 −36 lib/OpenLayers/Control.js
  3. +6 −0 lib/OpenLayers/Control/ArgParser.js
  4. +8 −4 lib/OpenLayers/Control/Attribution.js
  5. +6 −0 lib/OpenLayers/Control/Button.js
  6. +6 −0 lib/OpenLayers/Control/DragFeature.js
  7. +13 −4 lib/OpenLayers/Control/DragPan.js
  8. +6 −0 lib/OpenLayers/Control/DrawFeature.js
  9. +1 −1  lib/OpenLayers/Control/EditingToolbar.js
  10. +6 −0 lib/OpenLayers/Control/Geolocate.js
  11. +6 −0 lib/OpenLayers/Control/GetFeature.js
  12. +20 −26 lib/OpenLayers/Control/Graticule.js
  13. +5 −6 lib/OpenLayers/Control/KeyboardDefaults.js
  14. +6 −1 lib/OpenLayers/Control/LayerSwitcher.js
  15. +6 −0 lib/OpenLayers/Control/Measure.js
  16. +6 −0 lib/OpenLayers/Control/ModifyFeature.js
  17. +9 −2 lib/OpenLayers/Control/MousePosition.js
  18. +1 −1  lib/OpenLayers/Control/NavToolbar.js
  19. +13 −4 lib/OpenLayers/Control/Navigation.js
  20. +2 −6 lib/OpenLayers/Control/NavigationHistory.js
  21. +9 −2 lib/OpenLayers/Control/OverviewMap.js
  22. +6 −0 lib/OpenLayers/Control/Pan.js
  23. +6 −4 lib/OpenLayers/Control/PanZoom.js
  24. +8 −1 lib/OpenLayers/Control/PanZoomBar.js
  25. +8 −3 lib/OpenLayers/Control/Panel.js
  26. +14 −5 lib/OpenLayers/Control/Permalink.js
  27. +6 −0 lib/OpenLayers/Control/PinchZoom.js
  28. +6 −0 lib/OpenLayers/Control/SLDSelect.js
  29. +15 −6 lib/OpenLayers/Control/Scale.js
  30. +8 −3 lib/OpenLayers/Control/ScaleLine.js
  31. +6 −0 lib/OpenLayers/Control/SelectFeature.js
  32. +6 −0 lib/OpenLayers/Control/Snapping.js
  33. +6 −0 lib/OpenLayers/Control/Split.js
  34. +12 −3 lib/OpenLayers/Control/TouchNavigation.js
  35. +6 −0 lib/OpenLayers/Control/TransformFeature.js
  36. +6 −0 lib/OpenLayers/Control/WMSGetFeatureInfo.js
  37. +6 −0 lib/OpenLayers/Control/WMTSGetFeatureInfo.js
  38. +14 −3 lib/OpenLayers/Control/ZoomBox.js
  39. +6 −0 lib/OpenLayers/Control/ZoomIn.js
  40. +6 −0 lib/OpenLayers/Control/ZoomOut.js
  41. +7 −1 lib/OpenLayers/Control/ZoomToMaxExtent.js
  42. +75 −0 tests/Control.html
  43. +2 −0  tests/Control/Navigation.html
  44. +56 −0 tests/Control/Permalink.html
  45. +39 −0 tests/Control/Scale.html
  46. +41 −0 tests/Map.html
View
57 examples/custom-control.html
@@ -12,33 +12,46 @@
var lon = 5;
var lat = 40;
var zoom = 5;
- var map, layer;
+ var map, layer, control;
+
+ // DisplayBounds is a custom control that allows to draw rectangles
+ // on the map, and, upon drawing a rectangle, displays its coords
+ // in a browser alert window.
+ var DisplayBounds = OpenLayers.Class(OpenLayers.Control, {
+
+ autoActivate: true, // make the map activate the control
+ // when the control is added to the
+ // map with map.addControl
+
+ initialize: function() {
+ OpenLayers.Control.prototype.initialize.apply(this,
+ arguments);
+ this.handler = new OpenLayers.Handler.Box(this,
+ {"done": this.notice},
+ {keyMask: OpenLayers.Handler.MOD_SHIFT});
+ },
+
+ notice: function (bounds) {
+ var ll = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom));
+ var ur = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right, bounds.top));
+ alert(ll.lon.toFixed(4) + ", " +
+ ll.lat.toFixed(4) + ", " +
+ ur.lon.toFixed(4) + ", " +
+ ur.lat.toFixed(4));
+ },
+
+ draw: function() {
+ // we override "draw" and set it to an empty
+ // func so no element is created and added to
+ // the DOM for this control
+ }
+ });
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
-
- var control = new OpenLayers.Control();
- OpenLayers.Util.extend(control, {
- draw: function () {
- // this Handler.Box will intercept the shift-mousedown
- // before Control.MouseDefault gets to see it
- this.box = new OpenLayers.Handler.Box( control,
- {"done": this.notice},
- {keyMask: OpenLayers.Handler.MOD_SHIFT});
- this.box.activate();
- },
-
- notice: function (bounds) {
- var ll = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom));
- var ur = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right, bounds.top));
- alert(ll.lon.toFixed(4) + ", " +
- ll.lat.toFixed(4) + ", " +
- ur.lon.toFixed(4) + ", " +
- ur.lat.toFixed(4));
- }
- });
+ control = new DisplayBounds();
map.addLayer(layer);
map.addControl(control);
View
78 lib/OpenLayers/Control.js
@@ -10,48 +10,45 @@
/**
* Class: OpenLayers.Control
* Controls affect the display or behavior of the map. They allow everything
- * from panning and zooming to displaying a scale indicator. Controls by
- * default are added to the map they are contained within however it is
- * possible to add a control to an external div by passing the div in the
- * options parameter.
- *
+ * from panning and zooming to displaying a scale indicator.
+ *
+ * <OpenLayers.Control> is the base control class. Any specific control should
+ * extend this class.
+ *
* Example:
* The following example shows how to add many of the common controls
* to a map.
*
- * > var map = new OpenLayers.Map('map', { controls: [] });
- * >
- * > map.addControl(new OpenLayers.Control.PanZoomBar());
- * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
- * > map.addControl(new OpenLayers.Control.Permalink());
- * > map.addControl(new OpenLayers.Control.Permalink('permalink'));
- * > map.addControl(new OpenLayers.Control.MousePosition());
- * > map.addControl(new OpenLayers.Control.OverviewMap());
- * > map.addControl(new OpenLayers.Control.KeyboardDefaults());
+ * (code)
+ * var map = new OpenLayers.Map('map', {controls: []});
+ * map.addControl(new OpenLayers.Control.PanZoomBar());
+ * map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
+ * map.addControl(new OpenLayers.Control.Permalink());
+ * map.addControl(new OpenLayers.Control.Permalink('permalink'));
+ * map.addControl(new OpenLayers.Control.MousePosition());
+ * map.addControl(new OpenLayers.Control.OverviewMap());
+ * map.addControl(new OpenLayers.Control.KeyboardDefaults());
+ * (end)
*
- * The next code fragment is a quick example of how to intercept
- * shift-mouse click to display the extent of the bounding box
- * dragged out by the user. Usually controls are not created
- * in exactly this manner. See the source for a more complete
- * example:
+ * Control developer information::
*
- * > var control = new OpenLayers.Control();
- * > OpenLayers.Util.extend(control, {
- * > draw: function () {
- * > // this Handler.Box will intercept the shift-mousedown
- * > // before Control.MouseDefault gets to see it
- * > this.box = new OpenLayers.Handler.Box( control,
- * > {"done": this.notice},
- * > {keyMask: OpenLayers.Handler.MOD_SHIFT});
- * > this.box.activate();
- * > },
- * >
- * > notice: function (bounds) {
- * > OpenLayers.Console.userError(bounds);
- * > }
- * > });
- * > map.addControl(control);
- *
+ * Just like any class created with {<OpenLayers.Class>} the "initialize"
+ * function is called when a control is created. If the control relies on
+ * an {<OpenLayers.Handler>} the initialize function is a good place to
+ * create the handler.
+ *
+ * When the control is added to the map its "setMap", "draw", and
+ * optionally "activate", functions are called. The "setMap"
+ * function is called first, with the map object passed as an argument.
+ * "setMap" is where initialization steps requiring the map object
+ * are done. After "setMap" the "draw" function is called. Unless
+ * a div is passed in the control options the parent <draw>
+ * function creates a div for the control, which the map adds to
+ * its viewport element. Controls that don't need a div to be
+ * created and added to the map viewport should overwite "draw"
+ * to set it to an empty function (draw: function() {}). Finally, if
+ * <autoActivate> is true the map calls
+ * the "activate" function to activate the control.
*/
OpenLayers.Control = OpenLayers.Class({
@@ -84,6 +81,13 @@ OpenLayers.Control = OpenLayers.Class({
type: null,
/**
+ * Property: outsideViewport
@elemoine Owner
elemoine added a note

This should be an APIProperty.

@jorix
jorix added a note

@elemoine: Ok, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ * {Boolean} This property is set to true when the control is added to the
+ * map if the control was created with a <div> property (read-only).
+ */
+ outsideViewport: false,
+
+ /**
* Property: allowSelection
* {Boolean} By default, controls do not allow selection, because
* it may interfere with map dragging. If this is true, OpenLayers
@@ -248,6 +252,8 @@ OpenLayers.Control = OpenLayers.Class({
* on the page. If a div has not been created one is created. Controls
* with a visual component will almost always want to override this method
* to customize the look of control.
+ * Controls without a visual HTML component should override this method
+ * with a empty function.
*
* Parameters:
* px - {<OpenLayers.Pixel>} The top-left pixel position of the control
View
6 lib/OpenLayers/Control/ArgParser.js
@@ -133,6 +133,12 @@ OpenLayers.Control.ArgParser = OpenLayers.Class(OpenLayers.Control, {
}
},
+ /**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
/**
* Method: setCenter
* As soon as a baseLayer has been loaded, we center and zoom
View
12 lib/OpenLayers/Control/Attribution.js
@@ -57,11 +57,15 @@ OpenLayers.Control.Attribution =
/**
* Method: draw
- * Initialize control.
- *
+ * Create the HTML markup for this control.
+ *
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
* Returns:
- * {DOMElement} A reference to the DIV DOMElement containing the control
- */
+ * {DOMElement} The container div.
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
View
6 lib/OpenLayers/Control/Button.js
@@ -35,6 +35,12 @@ OpenLayers.Control.Button = OpenLayers.Class(OpenLayers.Control, {
type: OpenLayers.Control.TYPE_BUTTON,
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: trigger
* Called by a control panel when the button is clicked.
*/
View
6 lib/OpenLayers/Control/DragFeature.js
@@ -234,6 +234,12 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: overFeature
* Called when the feature handler detects a mouse-over on a feature.
* This activates the drag handler.
View
17 lib/OpenLayers/Control/DragPan.js
@@ -72,11 +72,14 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
/**
- * Method: draw
- * Creates a Drag handler, using <panMap> and
- * <panMapDone> as callbacks.
+ * Constructor: OpenLayers.Control.DragPan
+ * Create a DragPan control.
+ *
+ * Parameters:
+ * options - {Object} The options object.
*/
- draw: function() {
+ initialize: function(options) {
+ OpenLayers.Control.prototype.initialize.call(this, options);
if(this.enableKinetic) {
var config = {interval: this.kineticInterval};
if(typeof this.enableKinetic === "object") {
@@ -96,6 +99,12 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: panMapStart
*/
panMapStart: function() {
View
6 lib/OpenLayers/Control/DrawFeature.js
@@ -111,6 +111,12 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: drawFeature
*/
drawFeature: function(geometry) {
View
2  lib/OpenLayers/Control/EditingToolbar.js
@@ -64,7 +64,7 @@ OpenLayers.Control.EditingToolbar = OpenLayers.Class(
/**
* Method: draw
- * calls the default draw, and then activates mouse defaults.
+ * calls the default panel draw, and then sets Navigation as default control.
*
* Returns:
* {DOMElement}
View
6 lib/OpenLayers/Control/Geolocate.js
@@ -83,6 +83,12 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: activate
* Activates the control.
*
View
6 lib/OpenLayers/Control/GetFeature.js
@@ -285,6 +285,12 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: selectClick
* Called on click
*
View
46 lib/OpenLayers/Control/Graticule.js
@@ -125,32 +125,9 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
this.labelSymbolizer.labelAlign = "${labelAlign}";
this.labelSymbolizer.labelXOffset = "${xOffset}";
this.labelSymbolizer.labelYOffset = "${yOffset}";
- },
- /**
- * APIMethod: destroy
- */
- destroy: function() {
- this.deactivate();
- OpenLayers.Control.prototype.destroy.apply(this, arguments);
- if (this.gratLayer) {
- this.gratLayer.destroy();
- this.gratLayer = null;
- }
- },
-
- /**
- * Method: draw
- *
- * initializes the graticule layer and does the initial update
- *
- * Returns:
- * {DOMElement}
- */
- draw: function() {
- OpenLayers.Control.prototype.draw.apply(this, arguments);
if (!this.gratLayer) {
- var gratStyle = new OpenLayers.Style({},{
+ var gratStyle = new OpenLayers.Style({}, {
rules: [new OpenLayers.Rule({'symbolizer':
{"Point":this.labelSymbolizer,
"Line":this.lineSymbolizer}
@@ -162,10 +139,27 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
displayInLayerSwitcher: this.displayInLayerSwitcher
});
}
- return this.div;
},
- /**
+ /**
+ * APIMethod: destroy
+ */
+ destroy: function() {
+ this.deactivate();
+ OpenLayers.Control.prototype.destroy.apply(this, arguments);
+ if (this.gratLayer) {
+ this.gratLayer.destroy();
+ this.gratLayer = null;
+ }
+ },
+
+ /**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: activate
*/
activate: function() {
View
11 lib/OpenLayers/Control/KeyboardDefaults.js
@@ -45,13 +45,12 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
/**
* Constructor: OpenLayers.Control.KeyboardDefaults
+ *
+ * Parameters:
+ * options - {Object} The options object.
*/
-
- /**
- * Method: draw
- * Create handler.
- */
- draw: function() {
+ initialize: function(options) {
+ OpenLayers.Control.prototype.initialize.call(this, options);
var observeElement = this.observeElement || document;
this.handler = new OpenLayers.Handler.Keyboard( this,
{"keydown": this.defaultKeyPress},
View
7 lib/OpenLayers/Control/LayerSwitcher.js
@@ -174,8 +174,13 @@ OpenLayers.Control.LayerSwitcher =
/**
* Method: draw
+ * Create the HTML markup for this control.
*
- * Returns:
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
* {DOMElement} A reference to the DIV DOMElement containing the
* switcher tabs.
*/
View
6 lib/OpenLayers/Control/Measure.js
@@ -135,6 +135,12 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: deactivate
*/
deactivate: function() {
View
6 lib/OpenLayers/Control/ModifyFeature.js
@@ -297,6 +297,12 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: activate
* Activate the control.
*
View
11 lib/OpenLayers/Control/MousePosition.js
@@ -126,8 +126,15 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
- * {DOMElement}
- */
+ * Create the HTML markup for this control.
+ *
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
View
2  lib/OpenLayers/Control/NavToolbar.js
@@ -43,7 +43,7 @@ OpenLayers.Control.NavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {
/**
* Method: draw
- * calls the default draw, and then activates mouse defaults.
+ * calls the default panel draw, and then sets Navigation as default control.
*/
draw: function() {
var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
View
17 lib/OpenLayers/Control/Navigation.js
@@ -178,9 +178,14 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
},
/**
- * Method: draw
+ * Method: setMap
+ *
+ * Parameters:
+ * map - {<OpenLayers.Map>} The map.
*/
- draw: function() {
+ setMap: function(map) {
+ OpenLayers.Control.prototype.setMap.call(this, map);
+
// disable right mouse context menu for support of right click events
if (this.handleRightClicks) {
this.map.viewPortDiv.oncontextmenu = OpenLayers.Function.False;
@@ -206,8 +211,6 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
);
this.zoomBox = new OpenLayers.Control.ZoomBox(
{map: this.map, keyMask: this.zoomBoxKeyMask});
- this.dragPan.draw();
- this.zoomBox.draw();
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
this, {"up" : this.wheelUp,
"down": this.wheelDown},
@@ -220,6 +223,12 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: defaultClick
*
* Parameters:
View
8 lib/OpenLayers/Control/NavigationHistory.js
@@ -213,13 +213,9 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
- * Called when the control is added to the map.
+ * This control does not have HTML component, so this method should be empty.
*/
- draw: function() {
- OpenLayers.Control.prototype.draw.apply(this, arguments);
- this.next.draw();
- this.previous.draw();
- },
+ draw: function() {},
/**
* Method: previousTrigger
View
11 lib/OpenLayers/Control/OverviewMap.js
@@ -198,8 +198,15 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
- * Render the control in the browser.
- */
+ * Create the HTML markup for this control.
+ *
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
if(!(this.layers.length > 0)) {
View
6 lib/OpenLayers/Control/Pan.js
@@ -67,6 +67,12 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: trigger
*/
trigger: function(){
View
10 lib/OpenLayers/Control/PanZoom.js
@@ -87,11 +87,13 @@ OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
+ * Create the HTML markup for this control.
*
- * Parameters:
- * px - {<OpenLayers.Pixel>}
- *
- * Returns:
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
* {DOMElement} A reference to the container div for the PanZoom control.
*/
draw: function(px) {
View
9 lib/OpenLayers/Control/PanZoomBar.js
@@ -121,7 +121,14 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
/**
* Method: redraw
- * clear the div and start over.
+ * Create the HTML markup for this control.
+ *
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
*/
redraw: function() {
if (this.div != null) {
View
11 lib/OpenLayers/Control/Panel.js
@@ -163,10 +163,15 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
+ * Create the HTML markup for this control.
*
- * Returns:
- * {DOMElement}
- */
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
if (this.outsideViewport) {
View
19 lib/OpenLayers/Control/Permalink.js
@@ -67,7 +67,7 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
* Constructor: OpenLayers.Control.Permalink
*
* Parameters:
- * element - {DOMElement}
+ * element - {String|DOMElement}
* base - {String}
* options - {Object} options to the control.
*
@@ -139,18 +139,25 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
+ * Create the HTML markup for this control.
*
- * Returns:
- * {DOMElement}
- */
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
+ var elementInViewport = false;
if (!this.element && !this.anchor) {
this.element = document.createElement("a");
this.element.innerHTML = OpenLayers.i18n("Permalink");
this.element.href="";
this.div.appendChild(this.element);
+ elementInViewport = true;
}
this.map.events.on({
'moveend': this.updateLink,
@@ -163,7 +170,9 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
// moved yet.
this.updateLink();
- return this.div;
+ if (elementInViewport) {
+ return this.div;
+ }
},
/**
View
6 lib/OpenLayers/Control/PinchZoom.js
@@ -65,6 +65,12 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: activate
* Activate this control. Must be called after the control is added to a
* map.
View
6 lib/OpenLayers/Control/SLDSelect.js
@@ -178,6 +178,12 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: coupleLayerVisiblity
* Couple the selection layer and the source layer with respect to
* layer visibility. So if the source layer is turned off, the
View
21 lib/OpenLayers/Control/Scale.js
@@ -38,7 +38,7 @@ OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, {
* Constructor: OpenLayers.Control.Scale
*
* Parameters:
- * element - {DOMElement}
+ * element - {String|DOMElement}
* options - {Object}
*/
initialize: function(element, options) {
@@ -48,19 +48,28 @@ OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
- *
- * Returns:
- * {DOMElement}
- */
+ * Create the HTML markup for this control.
+ *
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
+ var elementInViewport = false;
if (!this.element) {
this.element = document.createElement("div");
this.div.appendChild(this.element);
+ elementInViewport = true;
}
this.map.events.register( 'moveend', this, this.updateScale);
this.updateScale();
- return this.div;
+ if (elementInViewport) {
+ return this.div;
+ }
},
/**
View
11 lib/OpenLayers/Control/ScaleLine.js
@@ -83,9 +83,14 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: draw
- *
- * Returns:
- * {DOMElement}
+ * Create the HTML markup for this control.
+ *
+ * Parameters:
+ * px - {<OpenLayers.Pixel>} The top-left position of the
+ * container div.
+ *
+ * Returns:
+ * {DOMElement} The container div.
*/
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
View
6 lib/OpenLayers/Control/SelectFeature.js
@@ -247,6 +247,12 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: activate
* Activates the control.
*
View
6 lib/OpenLayers/Control/Snapping.js
@@ -192,6 +192,12 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: setLayer
* Set the editable layer. Call the setLayer method if the editable layer
* changes and the same control should be used on a new editable layer.
View
6 lib/OpenLayers/Control/Split.js
@@ -177,6 +177,12 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: setSource
* Set the source layer for edits layer.
*
View
15 lib/OpenLayers/Control/TouchNavigation.js
@@ -129,9 +129,13 @@ OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
},
/**
- * Method: draw
+ * Method: setMap
+ *
+ * Parameters:
+ * map - {<OpenLayers.Map>} The map.
*/
- draw: function() {
+ setMap: function(map) {
+ OpenLayers.Control.prototype.setMap.call(this, map);
var clickCallbacks = {
click: this.defaultClick,
dblclick: this.defaultDblClick
@@ -150,13 +154,18 @@ OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
documentDrag: this.documentDrag
}, this.dragPanOptions)
);
- this.dragPan.draw();
this.pinchZoom = new OpenLayers.Control.PinchZoom(
OpenLayers.Util.extend({map: this.map}, this.pinchZoomOptions)
);
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: defaultClick
*
* Parameters:
View
6 lib/OpenLayers/Control/TransformFeature.js
@@ -213,6 +213,12 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* APIMethod: activate
* Activates the control.
*/
View
6 lib/OpenLayers/Control/WMSGetFeatureInfo.js
@@ -220,6 +220,12 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: getInfoForClick
* Called on click
*
View
6 lib/OpenLayers/Control/WMTSGetFeatureInfo.js
@@ -213,6 +213,12 @@ OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: getInfoForClick
* Called on click
*
View
17 lib/OpenLayers/Control/ZoomBox.js
@@ -46,14 +46,25 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
alwaysZoom: false,
/**
- * Method: draw
+ * Constructor: OpenLayers.Control.ZoomBox
+ * Create a ZoomBox control.
+ *
+ * Parameters:
+ * options - {Object} The options object.
*/
- draw: function() {
- this.handler = new OpenLayers.Handler.Box( this,
+ initialize: function(options) {
+ OpenLayers.Control.prototype.initialize.call(this, options);
+ this.handler = new OpenLayers.Handler.Box(this,
{done: this.zoomBox}, {keyMask: this.keyMask} );
},
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: zoomBox
*
* Parameters:
View
6 lib/OpenLayers/Control/ZoomIn.js
@@ -25,6 +25,12 @@ OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, {
type: OpenLayers.Control.TYPE_BUTTON,
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: trigger
*/
trigger: function(){
View
6 lib/OpenLayers/Control/ZoomOut.js
@@ -25,6 +25,12 @@ OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, {
type: OpenLayers.Control.TYPE_BUTTON,
/**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
+
+ /**
* Method: trigger
*/
trigger: function(){
View
8 lib/OpenLayers/Control/ZoomToMaxExtent.js
@@ -25,8 +25,14 @@ OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, {
* handle our events.
*/
type: OpenLayers.Control.TYPE_BUTTON,
+
+ /**
+ * Method: draw
+ * This control does not have HTML component, so this method should be empty.
+ */
+ draw: function() {},
- /*
+ /**
* Method: trigger
* Do the zoom.
*/
View
75 tests/Control.html
@@ -99,6 +99,81 @@
}
+ function test_draw(t) {
+ t.plan(28);
+
+ var control, div;
+
+ // case [a]
+ control = new OpenLayers.Control();
+ control.div = null;
+ control.allowSelection = true;
+ control.title = '';
+ control.position = null;
+
+ div = control.draw();
+ t.ok(OpenLayers.Util.isElement(div), '[a0] draw returns a DOM element');
+ t.eq(div.className, 'olControl', '[a0] className as expected');
+ t.eq(div.getAttribute('unselectable'), undefined,
+ '[a0] unselectable attribute as expected');
+ t.eq(div.title, '', '[a0] title as expected');
+ t.eq(div.style.left, '', '[a0] style.left as expected');
+ t.eq(div.style.top, '', '[a0] style.top as expected');
+ t.eq(control.position, null, '[a0] control position as expected');
+
+ div = control.draw(new OpenLayers.Pixel(3, 6));
+ t.eq(div.style.left, '3px', '[a1] style.left as expected');
+ t.eq(div.style.top, '6px', '[a1] style.top as expected');
+ t.eq(control.position.x, 3 , '[a1] control position x as expected');
+ t.eq(control.position.y, 6 , '[a1] control position y as expected');
+
+ // case [b]
+ control = new OpenLayers.Control();
+ control.div = null;
+ control.allowSelection = true;
+ control.title = '';
+ control.position = new OpenLayers.Pixel(5, 8);
+
+ div = control.draw();
+ t.ok(OpenLayers.Util.isElement(div), '[b0] draw returns a DOM element');
+ t.eq(div.style.left, '5px', '[b0] style.left as expected');
+ t.eq(div.style.top, '8px', '[b0] style.top as expected');
+
+ div = control.draw(new OpenLayers.Pixel(3, 6));
+ t.eq(div.style.left, '3px', '[b1] style.left as expected');
+ t.eq(div.style.top, '6px', '[b1] style.top as expected');
+ t.eq(control.position.x, 3 , '[b1] control position x as expected');
+ t.eq(control.position.y, 6 , '[b1] control position y as expected');
+
+ // case [c]
+ control = new OpenLayers.Control();
+ control.div = null;
+ control.allowSelection = false;
+ control.title = 'title';
+ control.position = null;
+
+ div = control.draw();
+ t.ok(OpenLayers.Util.isElement(div), '[c0] draw returns a DOM element');
+ t.eq(div.className, 'olControl olControlNoSelect',
+ '[c0] className as expected');
+ t.eq(div.getAttribute('unselectable'), 'on',
+ '[c0] unselectable attribute as expected');
+ t.eq(div.title, 'title', '[c0] title as expected');
+
+ // case [d]
+ control = new OpenLayers.Control();
+ control.div = document.createElement('div');
+ control.position = null;
+
+ div = control.draw(new OpenLayers.Pixel(3, 6));
+ t.ok(OpenLayers.Util.isElement(div), '[d0] draw returns a DOM element');
+ t.ok(control.div === div, '[d0] returned div is div set in control');
+ t.eq(div.style.left, '3px', '[d0] style.left as expected');
+ t.eq(div.style.top, '6px', '[d0] style.top as expected');
+ t.eq(control.position.x, 3 , '[d0] control position x as expected');
+ t.eq(control.position.y, 6 , '[d0] control position y as expected');
+ }
+
</script>
</head>
<body>
View
2  tests/Control/Navigation.html
@@ -99,6 +99,7 @@
t.plan(2);
var nav = new OpenLayers.Control.Navigation();
var zb = new OpenLayers.Control.ZoomBox({});
+ zb.handler = null;
nav.zoomBox = zb;
zb.activate();
nav.disableZoomBox();
@@ -110,6 +111,7 @@
t.plan(2);
var nav = new OpenLayers.Control.Navigation();
var zb = new OpenLayers.Control.ZoomBox({});
+ zb.handler = null;
nav.zoomBox = zb;
nav.active = true;
nav.enableZoomBox();
View
56 tests/Control/Permalink.html
@@ -412,6 +412,62 @@
window.location.hash = previous;
}
+ function test_Permalink_AddControl(t) {
+ t.plan(5);
+
+ var map = new OpenLayers.Map('map', {controls: []});
+
+ function inViewPortDiv(div) {
+ for(var i=0; i < map.viewPortDiv.childNodes.length; i++) {
+ var childNode = map.viewPortDiv.childNodes[i];
+ if (childNode == control.div) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ var control, childNodesLength;
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add a HTML Permalink to the map
+ control = new OpenLayers.Control.Permalink({anchor: false});
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength + 1,
+ 'one child node added to viewport div');
+ t.ok(inViewPortDiv(control.div), 'Permalink div is in viewport div');
+ control.destroy();
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add to the map a Permalink using anchor.
+ control = new OpenLayers.Control.Permalink({anchor: true});
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength,
+ 'no child node added to viewport div');
+ control.destroy();
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add to the map a Permalink using HTML element outside viewport and anchor
+ control = new OpenLayers.Control.Permalink({element: "permalink", anchor: true});
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength,
+ 'no child node added to viewport div');
+ control.destroy();
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add to the map a Permalink using a HTML element outside viewport
+ control = new OpenLayers.Control.Permalink({element: "permalink", anchor: false});
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength,
+ 'no child node added to viewport div');
+ control.destroy();
+
+ map.destroy();
+ }
</script>
</head>
<body>
View
39 tests/Control/Scale.html
@@ -45,6 +45,45 @@
map.addControl(control);
t.eq(control.div.firstChild.innerHTML, "Scale = 1 : 443M", "Internal scale displayed properly.");
}
+
+ function test_Scale_AddControl(t) {
+ t.plan(3);
+
+ var map = new OpenLayers.Map('map', {controls: []});
+
+ function inViewPortDiv(div) {
+ for(var i=0; i < map.viewPortDiv.childNodes.length; i++) {
+ var childNode = map.viewPortDiv.childNodes[i];
+ if (childNode == control.div) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ var control, childNodesLength;
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add a Scale to the map
+ control = new OpenLayers.Control.Scale();
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength + 1,
+ 'one child node added to viewport div');
+ t.ok(inViewPortDiv(control.div), 'Scale div is in viewport div');
+ control.destroy();
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add to the map a Scale using a HTML element outside viewport
+ control = new OpenLayers.Control.Scale('scale');
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength,
+ 'no child node added to viewport div');
+ control.destroy();
+
+ map.destroy();
+ }
</script>
</head>
<body>
View
41 tests/Map.html
@@ -1066,6 +1066,47 @@
map.destroy();
}
+ function test_addControlToMap(t) {
+ t.plan(3);
+
+ var map = new OpenLayers.Map('map', {controls: []});
+
+ function inViewPortDiv(div) {
+ for(var i=0; i < map.viewPortDiv.childNodes.length; i++) {
+ var childNode = map.viewPortDiv.childNodes[i];
+ if (childNode == control.div) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ var control, childNodesLength;
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add a UI control to the map
+ control = new OpenLayers.Control();
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength + 1,
+ 'one child node added to viewport div');
+ t.ok(inViewPortDiv(control.div), 'control div is in viewport div');
+ control.destroy();
+
+ childNodesLength = map.viewPortDiv.childNodes.length;
+
+ // add a non-UI control to map using void function as draw
+ control = new OpenLayers.Control({
+ draw: function(){}
+ });
+ map.addControlToMap(control);
+ t.eq(map.viewPortDiv.childNodes.length, childNodesLength,
+ 'no child node added to viewport div using void function as draw');
+ control.destroy();
+
+ map.destroy();
+ }
+
function test_Map_addControls(t) {
t.plan(5);
var map = new OpenLayers.Map('map', {
Something went wrong with that request. Please try again.