Opened 19 years ago

Last modified 16 years ago

#1523 closed enhancement

Legend graphics for layer of type annotation — at Initial Version

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

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 (0)

Note: See TracTickets for help on using tickets.