Opened 14 years ago

Closed 12 years ago

#3335 closed defect (fixed)

Label style support

Reported by: sdlime Owned by: sdlime
Priority: normal Milestone:
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc: dmorissette, aboudreault, havatv

Description

Ticket to track add styleObj's to label objects. This allows you to draw, for example, road symbology and road shields at the same time. (yeah!)

Steve

Change History (10)

comment:1 by dmorissette, 14 years ago

Cc: dmorissette added

comment:2 by sdlime, 14 years ago

Status: newassigned

Initial implementation committed in r9859. Two types of styles are supported and are differentiated by their GEOMTRANSFORM: labelpnt (default) and labelpoly.

To draw a marker under a label, simply do:

LABEL
  ...
  STYLE
    SYMBOL 'shield.png'
  END
END

To draw a background block and shadow do:

STYLE
  GEOMTRANSFORM 'labelpoly'
  COLOR 100 100 100
  OFFSET 2 2
END
STYLE
  GEOMTRANSFORM 'labelpoly'
  COLOR 222 222 222
  OUTLINECOLOR 0 0 0
END

Todo's:

  • deal with backwards compatibility (this obsoletes a number of label parameters and annotation layers)
  • make sure it works with non-cached labels
  • make sure label binding works with label styles
  • take point markers into account in label collision

Steve

comment:3 by tamas, 13 years ago

MapScript should also be updated to follow this addition

comment:4 by dmorissette, 13 years ago

Cc: aboudreault added

comment:5 by havatv, 13 years ago

Cc: havatv added

I have discovered that LABEL STYLE OFFSET, at least when used with GEOMTRANSFORM 'labelpoly' does not work as expected when SYMBOLSCALEDENOM is specified for the layer. If someone is interested in testing, use shp2img with the following map file (FONTSET will probably have to be changed). If SYMBOLSCALEDENOM is commented out, behaviour is as expected. When SYMBOLSCALEDENOM is in effect, the offset will be scaled. Documentation says that OFFSET is given in pixels.

MAP
  SIZE 200 200
  EXTENT 0 0 100 100
  UNITS meters
  IMAGETYPE png

  FONTSET /usr/share/fonts/truetype/font.list

  SYMBOL
    NAME "circle"
    TYPE ellipse
    FILLED true
    POINTS 1 1 END
  END

  LAYER
    NAME "feature"
    STATUS DEFAULT
    TYPE POINT
    SYMBOLSCALEDENOM 25000
    FEATURE
      TEXT "Label"
      POINTS
        50 50
      END
    END
    CLASS
      STYLE # black filled circle
        SYMBOL 'circle'
        MINSIZE 4
        SIZE 4
        MAXSIZE 4
        COLOR 0 0 0
      END
      LABEL
        STYLE # ------ Gray Box (shadow) ------
            GEOMTRANSFORM labelpoly
            COLOR 102 102 102
            OFFSET 2 2
        END
        STYLE # ------ Red Box ------
            GEOMTRANSFORM labelpoly
            COLOR 255 0 0
        END
        FONT "arial"
        TYPE TRUETYPE
        POSITION UR
        MINSIZE 12
        SIZE 12
        MAXSIZE 12
        COLOR 0 0 0
      END
    END
  END # point
END # Map file

I have tested with 6.0 and trunk.

Should this be filed as a separate ticket?

comment:6 by sdlime, 13 years ago

I'd like to track as a separate issue. It gets confusing otherwise. If the docs have been updated then let's close this ticket.

Steve

comment:7 by havatv, 13 years ago

I think documentation is OK for the mapfile section (added in r11453), but nothing seems to be documented for mapscript. Who will do the mapscript documentation?

comment:8 by amonteiro3, 13 years ago

Steve, please only close this ticket when the ticket's purpose has been accomplished:

"Ticket to track add styleObj's to label objects"

I would love it if you added "Layer" objects to that purpose as well.

As far as I can find out, this is not yet implemented, and hence has not been implemented in the C# wrapper of MapScript, which is what I'm waiting for.

comment:9 by amonteiro3, 13 years ago

Alan B has clarified a misleading statement in the migration guide for me. Please ignore my comment about adding to the Layer object.

comment:10 by sdlime, 12 years ago

Resolution: fixed
Status: assignedclosed

Closing... Steve

Note: See TracTickets for help on using tickets.