Opened 19 years ago

Last modified 16 years ago

#1523 closed enhancement

Legend graphics for layer of type annotation — at Version 4

Reported by: szekerest Owned by: sdlime
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 (4)

comment:1 by sdlime, 19 years ago

Status: newassigned
Version: 4.64.8

comment:2 by sdlime, 19 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

Note: See TracTickets for help on using tickets.