OpenLayers OpenLayers

Ticket #1583 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

Bookmark Control

Reported by: hpbrantley Assigned to:
Priority: minor Milestone: Addins
Component: Control Version: 2.6
Keywords: bookmark control Cc:
State:

Description

A control to store an array of bounds, as strings, referenced by a name. Clicking the name zooms to the associated bounds in the map window. The layout is control by css only. The control can be inside the map pane, outside the map pane or have no DIV at all.

The control can be told not to allow Rico to round the corners of the div.

Example: http://www.brantleys.com/maps/bookmark.html

Attachments

bookmark.html (3.8 kB) - added by hpbrantley on 08/23/08 23:27:41.
bookmark-custom.html (5.7 kB) - added by hpbrantley on 08/23/08 23:27:49.
bookmark.css (1.6 kB) - added by hpbrantley on 08/23/08 23:27:55.
Bookmark.js (15.6 kB) - added by hpbrantley on 08/23/08 23:28:12.

Change History

06/20/08 09:51:05 changed by hpbrantley

  • milestone set to 2.7 Release.

Removed calls to Rico out of the control.

You now apply Rico to the div in the following manner.

bookmarks = new OpenLayers.Control.Bookmark({ 'div':OpenLayers.Util.getElement('myBookmarks'), 'title': 'Bookmarks outside the map' });
map.addControl(bookmarks);
bookmarks.add("WASHINGTON DC","-77.338126,38.639689,-76.788809,39.189005");

OpenLayers.Rico.Corner.round( bookmarks.div , {corners: "tl bl tr br", bgColor: "transparent", color: "darkblue", blend: false});
OpenLayers.Rico.Corner.changeOpacity(bookmarks.contentDiv, 0.75);

07/04/08 13:42:42 changed by euzuro

  • milestone changed from 2.7 Release to Addins.

this looks like a good patch, but I think it is more material for Addins directory

See http://trac.openlayers.org/wiki/Addins

08/21/08 21:35:02 changed by euzuro

Some comments:

  • APIProperties: At first glance, it seems like you might consider making the 'limit', 'stack', 'activateOnDraw', and 'clearOnDeactivate' properties APIProperties as perhaps users will want to have access to them.
  • APIMethods: same as above, but for 'maximizeControl', 'minimizeControl'
  • destroy(): generally we put this method directly below the initialize() function in the code... unless there is a clone() in which case the order is initialize(), clone(), destroy()

  • string for bbox: is there a reason why you have chosen to use strings as the bounds, both in the interface and in the storage? I think most OL users are used to using the OpenLayers.Bounds object. The way you have built the examples here (input text box) I can see maybe why you would have chosen this. However, I would imagine most people who would use this control would have some sort of point and click interface to it... in which case converting bbox's to strings only to be converted back again seems like double-work. At the very least, you should provide the user with an option to specify the bounds as an OpenLayers.Bounds object.
  • addView(): this function seems superfluous to me, especially given the above note.

08/21/08 21:48:03 changed by euzuro

One more thing that occurred to me is that it might be helpful (though not necessary) to have some tests for the control.

...I think we'll have to think a bit on what's the best way to get that infrastructure set up. test.Anotherway in each addin directory? maybe.

08/22/08 02:25:23 changed by elemoine

In addition to Erik's comments:

  • activate() should call the parent's method
  • activate() should return true or false (see other controls)
  • ND comments above showControls() mention LayerSwitcher

08/22/08 11:02:26 changed by hpbrantley

I have applied the suggestions from Erik, except for the tests. I'll have to figure out how to write one. This is my first Javascript class.

I used some existing controls as a base for some code fragments may still remain.

I removed the activate() method. Couldn't see where it was needed.

Also, should I replace the code here or let it stay in my sandbox?

08/22/08 11:56:44 changed by euzuro

yes, if you could please update this ticket with the new, final patch... that would be helpful for those of us reviewing.

08/23/08 23:27:41 changed by hpbrantley

  • attachment bookmark.html added.

08/23/08 23:27:49 changed by hpbrantley

  • attachment bookmark-custom.html added.

08/23/08 23:27:55 changed by hpbrantley

  • attachment bookmark.css added.

08/23/08 23:28:12 changed by hpbrantley

  • attachment Bookmark.js added.

08/25/08 12:36:02 changed by hpbrantley

Updated control code in this ticket.

Re: Bounds as string: The original intent changed but the string remained. I have recoded the control to allow a string or bounds object to be passed.

08/27/08 00:09:38 changed by euzuro

08/29/08 19:30:07 changed by euzuro

  • status changed from new to closed.
  • state deleted.
  • resolution set to fixed.

graduated. see source:/addins/bookmark