Changes between Version 6 and Version 7 of Addins/Bookmark
- Timestamp:
- 08/15/08 08:56:02 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Addins/Bookmark
v6 v7 3 3 4 4 == Description == 5 The Bookmark control provides a simple means to "bookmark" a location.5 The Bookmark control provides a simple means to "bookmark" or "remember" a location. 6 6 7 7 == Examples == 8 * [http://www.brantleys.com/maps/examples/bookmark.html bookmark.html] - A basic example of the Bookmark in action. (until sandbox is created) 9 * [http://www.brantleys.com/maps/examples/bookmark-custom.html bookmark-custom.html] - An example demonstrating advanced configurations of the Bookmark control. (until sandbox is created) 10 11 * [http://dev.openlayers.org/addins/bookmark/trunk/examples/bookmark.html bookmark.html] - A basic example of the !Bookmark in action. 12 * [http://dev.openlayers.org/addins/bookmark/trunk/examples/bookmakr-custom.html bookmark-custom.html] - An example demonstrating advanced configurations of the Bookmark control. 8 * [http://dev.openlayers.org/sandbox/hpbrantley/openlayers/examples/bookmark.html bookmark.html] - A basic example of the Bookmark in action. 9 * [http://dev.openlayers.org/sandbox/hpbrantley/openlayers/examples/bookmark-custom.html bookmark-custom.html] - An example demonstrating advanced configurations of the Bookmark control. 13 10 14 11 == Installation and Use == 15 12 1. Use subversion to check out the [http://svn.openlayers.org/addins/bookmark/trunk/ Bookmark] addin. 16 1. Place the [ source:addins/bookmark/trunk/lib/OpenLayers/Control/Bookmark.js Bookmark.js] file in your [source:trunk/openlayers/lib/OpenLayers/Control/ Control] directory (or alternatively, place it elsewhere and add a {{{<script>}}} tag to your page that points to it).13 1. Place the [http://dev.openlayers.org/sandbox/hpbrantley/openlayers/lib/OpenLayers/Control/Bookmark.js Bookmark.js] file in your [source:http://dev.openlayers.org/sandbox/hpbrantley/openlayers/lib/OpenLayers/Control/ Control] directory (or alternatively, place it elsewhere and add a {{{<script>}}} tag to your page that points to it). 17 14 1. Use the [wiki:Profiles build tools] to create a single file build (or link to your !OpenLayers.js file to run in development mode). 18 1. Add a stylesheet to your page to style the Bookmark (see examples).15 1. Add a stylesheet to your page to style the Bookmark, [http://dev.openlayers.org/sandbox/hpbrantley/openlayers/examples/bookmark.css bookmark.css]. 19 16 1. Construct a map and add a Bookmark to it with the following syntax: 20 17 … … 31 28 32 29 == Advanced Usage == 33 Passing a user defined function and value. This function will be called when bookmark.zoomTo() method is called. This can 34 be triggered by the user clicking the bookmark in the DIV or, if no DIV is defined, using something similar 35 to 30 === Bookmarks with no DIV === 31 The developer can allow interaction with the Bookmark control without adding it as a map control. Simply pass the map reference to the constructor. Using this method, the CSS declarations are not needed. 32 {{{ 33 34 var map = new OpenLayers.Map("map"); 35 var bookmark = new OpenLayers.Control.Bookmark({ 'map': map }); 36 bookmark.add("BOSTON","-71.401901,41.989908,-70.698776,42.693033"); 37 }}} 38 39 === Bookmarks Outside the Map === 40 {{{ 41 <style> 42 #myBookmarks { height: 200px; width: 15em; float: right; } 43 #myBookmarks #olBookmarkElement { cursor : pointer; } 44 </style> 45 }}} 36 46 37 47 {{{ 48 var map = new OpenLayers.Map("map"); 49 bookmark = new OpenLayers.Control.Bookmark({ 'div':OpenLayers.Util.getElement('myBookmarks'), 'title': 'Bookmarks outside the map' }); 50 map.addControl(bookmark); 51 }}} 52 {{{ 53 <body> 54 <!-- Div to contain the bookmarks --> 55 <div id="myBookmarks"></div> 56 <div id="map"></div> 57 </body> 58 }}} 59 60 === Passing Developer Defined Function === 61 Passing a developer defined function and value. This function will be called when bookmark.zoomTo() method is called. This can 62 be triggered by the user clicking the bookmark in the DIV or, if no DIV is defined, using something similar 63 to: 64 65 {{{ 66 var map = new OpenLayers.Map("map"); 67 var bookmark = new OpenLayers.Control.Bookmark(); 68 38 69 /* add a bookmark with user defined function and value */ 39 70 bookmark.add("BOSTON","-71.401901,41.989908,-70.698776,42.693033",Msg,"Welcome to Boston"); 40 71 41 bookmark.zoomTo(bookmark.find("boston") );.72 bookmark.zoomTo(bookmark.find("boston")[0]);. 42 73 43 74 function Msg(val) { alert(val); } 44 75 }}} 45 76 46 == Styl e==47 The look of the Bookmark contol is styled using css elements. If the bookmark is used without a defining DIV, no css48 elements are required. 77 == Styling == 78 The look of the Bookmark contol is styled using CSS elements. If the Bookmark is used without a defining DIV, no CSS 79 elements are required. See CSS examples [http://dev.openlayers.org/sandbox/hpbrantley/openlayers/examples/bookmark.css bookmark.css]. 49 80 50 81 {{{ … … 59 90 60 91 /* bookmark data elements */ 92 61 93 .olControlBookmarkElements {} 62 94 … … 77 109 }}} 78 110 111 == Properties & Methods == 112 See [http://dev.openlayers.org/sandbox/hpbrantley/openlayers/lib/OpenLayers/Control/Bookmark.js Bookmark.js] for descriptions and explanations.
