Opened 18 years ago

Closed 16 years ago

#1523 closed enhancement (fixed)

Legend graphics for layer of type annotation

Reported by: szekerest Owned by: tamas
Priority: high Milestone: 5.4 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: minor Keywords:
Cc:

Description (last modified by sdlime)

It would be desirable to reflect some of the attributes of the annotation 
layers like font and text color in the map legend. The legend image could be 
drawn as a sample text with the corresponding font and color. The following 
code snippet can do the work like this:

maplegend.c line 128

switch(type) {
    case MS_LAYER_ANNOTATION:
	  if (class->label.size != -1)
	  {
		  rectObj label_rect;
		  labelObj label = class->label;
		  label.angle = 0;
		  if (label.type == MS_TRUETYPE) label.size = height;
		  marker.x = dstX + MS_NINT(width / 2.0);
		  marker.y = dstY + MS_NINT(height / 2.0);
		  if(msGetLabelSize("Abc", &label, &label_rect, &map->fontset, 
1.0) != -1)
		  {
			  pointObj label_point = get_metrics(&marker, MS_CC, 
label_rect, 0, 0, label.angle, 0, NULL);
			  msDrawTextGD(img, label_point, "Abc", &label, &map-
>fontset, 1.0);
		  }
	  }

The sample text might also be placed in the map file.


Tamas Szekeres

Change History (8)

comment:1 by sdlime, 18 years ago

Status: newassigned
Version: 4.64.8

comment:2 by sdlime, 18 years ago

Version: 4.84.10
A neat idea, but too big an addition to 4.8. Marking for 4.10...

Steve

comment:3 by sdlime, 18 years ago

Milestone: 5.0 release

comment:4 by sdlime, 17 years ago

Description: modified (diff)
Milestone: 5.0 release5.2 release

Too late (or too lazy) for 5.0 (unless you want to take it Tamas). Moving to 5.2.

Steve

comment:5 by sdlime, 16 years ago

Milestone: 5.2 release5.4 release

Moving to 5.4 to address properly...

Steve

comment:6 by tamas, 16 years ago

Owner: changed from sdlime to tamas
Status: assignednew

I'll take over this bug and see how can it be done with the current version.

comment:7 by tamas, 16 years ago

Status: newassigned

comment:8 by tamas, 16 years ago

Resolution: fixed
Status: assignedclosed
Version: 4.10svn-trunk (development)

Added in trunk r7859

Note: See TracTickets for help on using tickets.