OpenLayers OpenLayers

Ticket #751 (new feature)

Opened 1 year ago

Last modified 4 months ago

Marker.Label

Reported by: openlayers Assigned to:
Priority: minor Milestone: Future
Component: Marker Version: 2.5
Keywords: marker label Cc:
State: Needs More Work

Description

Using Marker you can add an icon, but not a text/caption/label. This component allows you to add support to it, defining the label and the style to be used. It's recomended to user a negative top to show it on top of the icon (be careful the IE6 does not correctly support it)

Attachments

Label.js (1.7 kB) - added by openlayers on 06/09/07 11:59:02.
Label.2.js (5.7 kB) - added by jachym on 11/01/07 15:08:03.
New version of the file
Label.3.js (6.6 kB) - added by jachym on 11/07/07 07:35:39.
New methods
test_Label.html (4.5 kB) - added by jachym on 11/07/07 07:36:21.
Tests for OpenLayers.Marker.Label

Change History

06/09/07 11:59:02 changed by openlayers

  • attachment Label.js added.

11/01/07 15:07:20 changed by jachym

  • version set to 2.5.
  • milestone set to 2.6 Release.

I have updated the code to OpenLayers 2.5, run it through jslint. File added. The labels do appear, when mouse over on the icon (can be turned off).

In styles.css, new entry should be added:

.olMarkerLabel {
    font-size: small;
    color: white;
    background-color: darkblue;
    width: auto;
    padding: 1px;
    border: 1px white solid;
    opacity: 0.7;
    z-index: 1000;
}

11/01/07 15:08:03 changed by jachym

  • attachment Label.2.js added.

New version of the file

11/01/07 15:17:30 changed by jachym

Other proposed changes:

OpenLayers/Layer/Text.js:


data['overflow'] = overflow || "auto";

+ data.label  = title;

OpenLayers/Feature.js:


- this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);

+ if (this.data.label) {
+       this.marker = new OpenLayers.Marker.Label(this.lonlat, this.data.icon, this.data.label,{mouseOver:true});
+ }
+ else {
+      this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
+ }

11/07/07 07:35:39 changed by jachym

  • attachment Label.3.js added.

New methods

11/07/07 07:36:21 changed by jachym

  • attachment test_Label.html added.

Tests for OpenLayers.Marker.Label

11/07/07 07:37:30 changed by jachym

New file version, tests included.

12/19/07 23:01:57 changed by crschmidt

  • state set to Needs More Work.

The documentation strings here could definitely use some work: what is 'onlyOnMouseOver' supposed to mean? Also, this isn't right:

92 	     * icon - {<OpenLayers.Icon>}  the icon for this marker
93 	     * lonlat - {<OpenLayers.LonLat>} the position of this marker
94 	     * label - {String} the position of this marker
95 	     * options - {Object}

'label' is not the position of the marker.

An example file with a demonstration is a good idea for this one, and you haven't offered a patch that I can apply. I'm unlikely to review it until there is a patch that applies and adds the:

  • Marker/Label.js file
  • test file
  • Modifies run-tests
  • Modifies OpenLayers.js to include Marker/Label.js
  • an example via which I can see the output.

01/22/08 17:36:39 changed by crschmidt

  • milestone changed from 2.6 Release to 2.7 Release.

Mass ticket move to 2.7 post dev meeting. If you are actively working on this task, please update this ticket with information and change the milestone to 2.6. At the time of the next IRC meeting (most likely 1-31-08), this will mean the ticket can *not* be brought back into 2.6 unless there is further feedback.

04/27/08 00:57:00 changed by crschmidt

  • milestone changed from 2.7 Release to Future.

No current/ongoing development work. Moving to Future until someone expresses more interest.