Changeset 3728
- Timestamp:
- 07/13/07 07:14:46 (1 year ago)
- Files:
-
- trunk/openlayers/doc/authors.txt (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Control.js (modified) (8 diffs)
- trunk/openlayers/lib/OpenLayers/Icon.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Marker.js (modified) (7 diffs)
- trunk/openlayers/lib/OpenLayers/Popup.js (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/doc/authors.txt
r3545 r3728 16 16 Cameron Shorter 17 17 Paul Spencer 18 Glen Stampoultzis 18 19 James Stembridge 19 20 Erik Uzureau trunk/openlayers/lib/OpenLayers/Control.js
r3672 r3728 4 4 5 5 /** 6 * Class: OpenLayers.Control 7 * Controls affect the display or behavior of the map. They allow everything 8 * from panning and zooming to displaying a scale indicator. 9 */ 6 * Class: OpenLayers.Control 7 * Controls affect the display or behavior of the map. They allow everything 8 * from panning and zooming to displaying a scale indicator. Controls by 9 * default are added to the map they are contained within however it is 10 * possible to add a control to an external div by passing the div in the 11 * options parameter. 12 * 13 * Example: 14 * The following example shows how to add many of the common controls 15 * to a map. 16 * 17 * > var map = new OpenLayers.Map('map', { controls: [] }); 18 * > 19 * > map.addControl(new OpenLayers.Control.PanZoomBar()); 20 * > map.addControl(new OpenLayers.Control.MouseToolbar()); 21 * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false})); 22 * > map.addControl(new OpenLayers.Control.Permalink()); 23 * > map.addControl(new OpenLayers.Control.Permalink('permalink')); 24 * > map.addControl(new OpenLayers.Control.MousePosition()); 25 * > map.addControl(new OpenLayers.Control.OverviewMap()); 26 * > map.addControl(new OpenLayers.Control.KeyboardDefaults()); 27 * 28 * The next code fragment is a quick example of how to intercept 29 * shift-mouse click to display the extent of the bounding box 30 * dragged out by the user. Usually controls are not created 31 * in exactly this manner. See the source for a more complete 32 * example: 33 * 34 * > var control = new OpenLayers.Control(); 35 * > OpenLayers.Util.extend(control, { 36 * > draw: function () { 37 * > // this Handler.Box will intercept the shift-mousedown 38 * > // before Control.MouseDefault gets to see it 39 * > this.box = new OpenLayers.Handler.Box( control, 40 * > {"done": this.notice}, 41 * > {keyMask: OpenLayers.Handler.MOD_SHIFT}); 42 * > this.box.activate(); 43 * > }, 44 * > 45 * > notice: function (bounds) { 46 * > alert(bounds); 47 * > } 48 * > }); 49 * > map.addControl(control); 50 * 51 */ 10 52 OpenLayers.Control = OpenLayers.Class.create(); 11 53 … … 64 106 /** 65 107 * Constructor: OpenLayers.Control 66 * Create an OpenLayers Control. 108 * Create an OpenLayers Control. The options passed as a parameter 109 * directly extend the control. For example passing the following: 110 * 111 * > var control = new OpenLayers.Control({div: myDiv}); 112 * 113 * Overrides the default div attribute value of null. 67 114 * 68 115 * Parameters: … … 82 129 /** 83 130 * Method: destroy 131 * The destroy method is used to perform any clean up before the control 132 * is dereferenced. Typically this is where event listeners are removed 133 * to prevent memory leaks. 84 134 */ 85 135 destroy: function () { … … 94 144 * Method: setMap 95 145 * Set the map property for the control. This is done through an accessor 96 * so that subclasses can override this and take special action once97 * they have their map variable set.146 * so that subclasses can override this and take special action once 147 * they have their map variable set. 98 148 * 99 149 * Parameters: … … 108 158 109 159 /** 110 * Method: draw 111 * 112 * Parameters: 113 * px - {<OpenLayers.Pixel>} 160 * Method: draw 161 * The draw method is called when the control is ready to be displayed 162 * on the page. If a div has not been created one is created. Controls 163 * with a visual component will almost always want to override this method 164 * to customize the look of control. 165 * 166 * Parameters: 167 * px - {<OpenLayers.Pixel>} The top-left pixel position of the control 168 * or null. 114 169 * 115 170 * Return: … … 131 186 /** 132 187 * Method: moveTo 188 * Sets the left and top style attributes to the passed in pixel 189 * coordinates. 133 190 * 134 191 * Parameters: … … 144 201 /** 145 202 * Method: activate 203 * Explicitly activates a control and it's associated 204 * handler if one has been set. Controls can be 205 * deactivated by calling the deactivate() method. 146 206 * 147 207 * Return: 148 * {Boolean} 208 * {Boolean} True if the control was successfully activated or 209 * false if the control was already active. 149 210 */ 150 211 activate: function () { … … 161 222 /** 162 223 * Method: deactivate 224 * Deactivates a control and it's associated handler if any. The exact 225 * effect of this depends on the control itself. 163 226 * 164 227 * Return: 165 * {Boolean} 228 * {Boolean} True if the control was effectively deactivated or false 229 * if the control was already inactive. 166 230 */ 167 231 deactivate: function () { trunk/openlayers/lib/OpenLayers/Icon.js
r3686 r3728 6 6 /** 7 7 * Class: OpenLayers.Icon 8 * 9 * The icon represents a graphical icon on the screen. Typically used in 10 * conjunction with a <OpenLayers.Marker> to represent markers on a screen. 11 * 12 * An icon has a url, size and position. It also contains an offset which 13 * allows the center point to be represented correctly. This can be 14 * provided either as a fixed offset or a function provided to calculate 15 * the desired offset. 16 * 8 17 */ 9 18 OpenLayers.Icon = OpenLayers.Class.create(); … … 66 75 /** 67 76 * Method: destroy 68 * nullify references to prevent circular references and memory leaks 77 * Nullify references and remove event listeners to prevent circular 78 * references and memory leaks 69 79 */ 70 80 destroy: function() { trunk/openlayers/lib/OpenLayers/Map.js
r3706 r3728 11 11 * Instances of OpenLayers.Map are interactive maps embedded in a web page. 12 12 * Create a new map with the <OpenLayers.Map> constructor. 13 * 14 * On their own maps do not provide much functionality. To extend a map 15 * it's necessary to add controls (<OpenLayers.Control>) and 16 * layers (<OpenLayers.Layer>) to the map. 13 17 */ 14 18 OpenLayers.Map = OpenLayers.Class.create(); trunk/openlayers/lib/OpenLayers/Marker.js
r3686 r3728 10 10 * Class: OpenLayers.Marker 11 11 * Instances of OpenLayers.Marker are a combination of a 12 * <OpenLayers.LonLat> and an <OpenLayers.Icon>. 12 * <OpenLayers.LonLat> and an <OpenLayers.Icon>. 13 * 14 * Markers are generally added to a special layer called 15 * <OpenLayers.Layer.Makers>. 16 * 17 * Example: 18 * (code) 19 * var markers = new OpenLayers.Layer.Markers( "Markers" ); 20 * map.addLayer(markers); 21 * 22 * var size = new OpenLayers.Size(10,17); 23 * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); 24 * var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset); 25 * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon)); 26 * 27 * (end) 13 28 */ 14 29 OpenLayers.Marker = OpenLayers.Class.create(); … … 17 32 /** 18 33 * Property: icon 19 * {<OpenLayers.Icon>} 34 * {<OpenLayers.Icon>} The icon used by this marker. 20 35 */ 21 36 icon: null, … … 29 44 /** 30 45 * Property: events 31 * {<OpenLayers.Events>} 46 * {<OpenLayers.Events>} the event handler. 32 47 */ 33 48 events: null, … … 35 50 /** 36 51 * Property: map 37 * {<OpenLayers.Map>} 52 * {<OpenLayers.Map>} the map this marker is attached to 38 53 */ 39 54 map: null, … … 42 57 * Constructor: OpenLayers.Marker 43 58 * Paraemeters: 44 * icon - {<OpenLayers.Icon>} 45 * lonlat - {<OpenLayers.LonLat>} 59 * icon - {<OpenLayers.Icon>} the icon for this marker 60 * lonlat - {<OpenLayers.LonLat>} the position of this marker 46 61 */ 47 62 initialize: function(lonlat, icon) { … … 92 107 * 93 108 * Parameters: 94 * px - {<OpenLayers.Pixel>} 109 * px - {<OpenLayers.Pixel>} the pixel position to move to 95 110 */ 96 111 moveTo: function (px) { … … 119 134 /** 120 135 * Method: inflate 136 * Englarges the markers icon by the specified ratio. 121 137 * 122 138 * Parameters: 123 * inflate - {float} 139 * inflate - {float} the ratio to enlarge the marker by (passing 2 140 * will double the size). 124 141 */ 125 142 inflate: function(inflate) { trunk/openlayers/lib/OpenLayers/Popup.js
r3686 r3728 6 6 /** 7 7 * Class: OpenLayers.Popup 8 * 9 * A popup is a small div that can opened and closed on the map. 10 * Typically opened in response to clicking on a marker. 11 * See <OpenLayers.Marker>. Popup's don't require their own 12 * layer and are added the the map using the <OpenLayers.Map.addPopup> 13 * method. 14 * 15 * Example: 16 * (code) 17 * popup = new OpenLayers.Popup("chicken", 18 * new OpenLayers.LonLat(5,40), 19 * new OpenLayers.Size(200,200), 20 * "example popup", 21 * true); 22 * 23 * map.addPopup(popup); 24 * (end) 8 25 */ 9 26 OpenLayers.Popup = OpenLayers.Class.create(); … … 18 35 19 36 /** 20 * Property: events 21 * {<OpenLayers.Events>} 37 * Property: events 38 * {<OpenLayers.Events>} custom event manager 22 39 */ 23 40 events: null, 24 41 25 42 /** Property: id 26 * {String} 43 * {String} the unique identifier assigned to this popup. 27 44 */ 28 45 id: "", … … 30 47 /** 31 48 * Property: lonlat 32 * {<OpenLayers.LonLat>} 49 * {<OpenLayers.LonLat>} the position of this popup on the map 33 50 */ 34 51 lonlat: null, … … 36 53 /** 37 54 * Property: div 38 * {DOMElement} 55 * {DOMElement} the div that contains this popup. 39 56 */ 40 57 div: null, … … 42 59 /** 43 60 * Property: size 44 * {<OpenLayers.Size>} 61 * {<OpenLayers.Size>} the width and height of the popup. 45 62 */ 46 63 size: null, … … 48 65 /** 49 66 * Property: contentHTML 50 * {String} 67 * {String} The HTML that this popup displays. 51 68 */ 52 69 contentHTML: "", … … 54 71 /** 55 72 * Property: backgroundColor 56 * {String} 73 * {String} the background color used by the popup. 57 74 */ 58 75 backgroundColor: "", … … 60 77 /** 61 78 * Property: opacity 62 * {float} 79 * {float} the opacity of this popup (between 0.0 and 1.0) 63 80 */ 64 81 opacity: "", … … 66 83 /** 67 84 * Property: border 68 * {String} 85 * {String} the border size of the popup. (eg 2px) 69 86 */ 70 87 border: "", … … 72 89 /** 73 90 * Property: contentDiv 74 * {DOMElement} 91 * {DOMElement} a reference to the element that holds the content of 92 * the div. 75 93 */ 76 94 contentDiv: null, … … 78 96 /** 79 97 * Property: groupDiv 80 * {DOMElement} 98 * {DOMElement} the parent of <OpenLayers.Popup.contentDiv> 81 99 */ 82 100 groupDiv: null, … … 84 102 /** 85 103 * Property: padding 86 * {int} 104 * {int} the internal padding of the content div. 87 105 */ 88 106 padding: 5, … … 100 118 * 101 119 * Parameters: 102 * id - {String} 103 * lonlat - {<OpenLayers.LonLat>} 104 * size - {<OpenLayers.Size>} 105 * contentHTML - {String} 106 * closeBox - {Boolean} 120 * id - {String} a unqiue identifier for this popup. If null is passed 121 * an identifier will be automatically generated. 122 * lonlat - {<OpenLayers.LonLat>} The position on the map the popup will 123 * be shown. 124 * size - {<OpenLayers.Size>} The size of the popup. 125 * contentHTML - {String} The HTML content to display inside the 126 * popup. 127 * closeBox - {Boolean} Whether to display a close box inside 128 * the popup. 107 129 */ 108 130 initialize:function(id, lonlat, size, contentHTML, closeBox) { … … 179 201 180 202 /** 181 * method: draw 182 * 203 * Method: draw 204 * Constructs the elements that make up the popup. 205 * 183 206 * Parameters: 184 * px - {<OpenLayers.Pixel>} 207 * px - {<OpenLayers.Pixel>} the position the popup in pixels. 185 208 * 186 209 * Return: … … 217 240 218 241 /** 219 * Method: moveTo220 *221 * Parameters:222 * px - {<OpenLayers.Pixel>}223 */242 * Method: moveTo 243 * 244 * Parameters: 245 * px - {<OpenLayers.Pixel>} the top and left position of the popup div. 246 */ 224 247 moveTo: function(px) { 225 248 if ((px != null) && (this.div != null)) { … … 230 253 231 254 /** 232 * method: visible255 * Method: visible 233 256 * 234 257 * Returns: … … 241 264 /** 242 265 * Method: toggle 266 * Toggles visibility of the popup. 243 267 */ 244 268 toggle: function() { … … 248 272 /** 249 273 * Method: show 274 * Makes the popup visible. 250 275 */ 251 276 show: function() { … … 255 280 /** 256 281 * Method: hide 282 * Makes the popup invisible. 257 283 */ 258 284 hide: function() { … … 261 287 262 288 /** 263 * Method: setSize 264 * 265 * Parameters: 266 * size - {<OpenLayers.Size>} 267 */ 289 * Method: setSize 290 * Used to adjust the size of the popup. 291 * 292 * Parameters: 293 * size - {<OpenLayers.Size>} the new size of the popup in pixels. 294 */ 268 295 setSize:function(size) { 269 296 if (size != undefined) { … … 283 310 /** 284 311 * Method: setBackgroundColor 285 * 312 * Sets the background color of the popup. 286 313 * Parameters: 287 * color - {String} 314 * color - {String} the background color. eg "#FFBBBB" 288 315 */ 289 316 setBackgroundColor:function(color) { … … 298 325 299 326 /** 300 * Method: setOpacity 301 * 302 * Parameters: 303 * opacity - {float} 304 */ 327 * Method: setOpacity 328 * Sets the opacity of the popup. 329 * 330 * Parameters: 331 * opacity - {float} A value between 0.0 (transparent) and 1.0 (solid). 332 */ 305 333 setOpacity:function(opacity) { 306 334 if (opacity != undefined) { … … 318 346 319 347 /** 320 * Method: setBorder 321 * 322 * Parameters: 323 * border - {int} 324 */ 348 * Method: setBorder 349 * Sets the border style of the popup. 350 * 351 * Parameters: 352 * border - {String} The border style value. eg 2px 353 */ 325 354 setBorder:function(border) { 326 355 if (border != undefined) { … … 335 364 /** 336 365 * Method: setContentHTML 366 * Allows the user to set the HTML content of the popup. 337 367 * 338 368 * Parameters: 339 * contentHTML - {String} 369 * contentHTML - {String} HTML for the div. 340 370 */ 341 371 setContentHTML:function(contentHTML) {
