OpenLayers OpenLayers

Ticket #1089 (closed feature: fixed)

Opened 1 year ago

Last modified 10 months ago

New control ScaleLine

Reported by: ianmayo Assigned to:
Priority: minor Milestone: 2.6 Release
Component: Control Version: 2.5
Keywords: Cc:
State: Complete

Description

This new control plots a line indicating the current scale, similar to that displayed by Google Maps.

Two sets of units are supported (typically representing metric & imperial), at two resolutions (such as meters and kilometres).

The attached patch records the following: - a modification to the list-tests.html file to include the scaleLine test file - a modification to the default css stylesheet, to provide default formatting for the new control's DIV - a modification to the default css stylesheet to move the overview map down a little - to make space for the new control - a modification to the controls.html demo html page that enlarges the plot, demonstrating the new control a little more clearly - a modification to the controls.html demo html page to include both the scale and scaleLine controls

Also included are the file for the new control and it's test-file.

Attachments

ScaleLine.js (5.3 kB) - added by ianmayo on 10/15/07 14:38:48.
to go into /openlayers/lib/OpenLayers/Control/
test_ScaleLine.html (6.8 kB) - added by ianmayo on 10/15/07 14:39:35.
to go into openlayers/tests/Control
scaleLine.patch (2.2 kB) - added by ianmayo on 10/15/07 14:40:03.
patch file
scaleline.patch (8.6 kB) - added by crschmidt on 02/08/08 17:30:19.
scaleline.2.patch (15.7 kB) - added by tschaub on 02/09/08 14:09:10.
ScaleLine control

Change History

10/15/07 14:38:48 changed by ianmayo

  • attachment ScaleLine.js added.

to go into /openlayers/lib/OpenLayers/Control/

10/15/07 14:39:35 changed by ianmayo

  • attachment test_ScaleLine.html added.

to go into openlayers/tests/Control

10/15/07 14:40:03 changed by ianmayo

  • attachment scaleLine.patch added.

patch file

10/15/07 14:41:41 changed by ianmayo

  • keywords set to Review.

10/17/07 15:33:19 changed by ianmayo

Bugger.

Still not a competent "svn diff" user - somehow it missed the change in OpenLayers.js.

Instruct OpenLayers to include our new file:

"OpenLayers/Control/Scale.js",

++ "OpenLayers/Control/ScaleLine.js",

"OpenLayers/Control/LayerSwitcher.js",

This extra line will need to be included.

10/27/07 18:58:26 changed by crschmidt

  • keywords deleted.
  • milestone changed from Future to 2.6 Release.

Safari and FF3 both display lines over the top of the top scale container, (causing the imperial units to be in an enclosed box).

We should make sure that any styles possible are moved out of the code and into the .css file.

In general though, it's quite nice. I'm using it on http://hypercube.telascience.org/fire/

I'd like to see the overline fixed before it goes in.

10/30/07 15:30:53 changed by ianmayo

thanks for your support Chris.

For the formatting, it's a balance between user formatting freedom & making the control bullet-proof. The only styling that's in the code is the part that hides the top of the top box & the bottom of the bottom box - these must be hidden for the control to work: the user has complete freedom to control the rest of the formatting. If these elements were moved out of the code it would be all too easy for the user to be unaware that these lines had to be hidden - and struggle with getting the control to work.

So, that's why they're in the code.

I've just managed to open the demo (& your fire viewer) in Safari. The ScaleLine control has the full boxes top & bottom, and the scale is appearing at the top-left of the chart. I don't currently have easy access to a Safari development/testing environment. I hope to in the next couple of weeks and will then try to resolve the Safari issues.

I haven't been able to reproduce your FF3 problem, though I'm not convinced I was actually running FF3 & not FF2. Will persevere.

10/30/07 16:01:20 changed by ianmayo

Now reproduced in FF3. To be fixed, once I've got my head around the formatting.

11/24/07 09:27:00 changed by ianmayo

this ticket may also fix #24 - opened back in May 06 - that's an old ticket...

12/15/07 13:51:37 changed by crschmidt

  • state set to Needs More Work.

02/08/08 17:30:19 changed by crschmidt

  • attachment scaleline.patch added.

02/08/08 17:30:26 changed by crschmidt

  • state changed from Needs More Work to Review.

02/09/08 14:00:36 changed by tschaub

This is cool. I like how simple it is. I made a number of minor tweaks. Some to match coding/doc conventions and some to correct little bits (style.width is a string with an integer pixel value, other style properties don't take the semicolon). Tests added to the patch. All pass in FF/Safari. Will be good to check IE.

Thanks for the contribution ianmayo, it will be cool to have this in the trunk.

02/09/08 14:02:46 changed by tschaub

Also put the border top/bottom display none stuff in css and set maxWidth as an instance property.

02/09/08 14:09:10 changed by tschaub

  • attachment scaleline.2.patch added.

ScaleLine control

02/09/08 14:09:36 changed by tschaub

IE is consistent with FF in the most recent patch.

02/09/08 14:25:56 changed by crschmidt

  • state changed from Review to Commit.

Please feel free to commit when you're happy with it.

02/09/08 14:39:12 changed by tschaub

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

(In [6177]) Thanks Ian Mayo for this nice ScaleLine control. Give your maps a dualie scale line control customizable with CSS. r=crschmidt (closes #1089)