Changeset 2172


Ignore:
Timestamp:
Jun 18, 2003, 6:39:52 AM (21 years ago)
Author:
sdlime
Message:

Tweaked code in legend builder to handle polygon layers slightly different. Now if a polygon layer contains only outlines and no fills (i.e. a polyline) then it is drawn using the zigzag legend shape rather than the box. I'll add legend outlines back in shortly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mapserver/maplegend.c

    r2165 r2172  
    1010int msDrawLegendIcon(mapObj *map, layerObj *lp, classObj *class, int width, int height, gdImagePtr img, int dstX, int dstY)
    1111{
    12   int i;
     12  int i, type;
    1313  shapeObj box, zigzag;
    1414  pointObj marker;
     
    6464  box.line[0].numpoints = 5;
    6565 
     66  type = lp->type;
     67
     68  // some polygon layers may be better drawn using zigzag if there is no fill
     69  if(type == MS_LAYER_POLYGON) {
     70    type = MS_LAYER_LINE;
     71    for(i=0; i<class->numstyles; i++) {
     72      if(MS_VALID_COLOR(class->styles[i].color)) { // there is a fill
     73        type = MS_LAYER_POLYGON;
     74        break;
     75      }
     76    }
     77  }
     78
    6679  /*
    6780  ** now draw the appropriate color/symbol/size combination
    6881  */     
    69   switch(lp->type) {
     82  switch(type) {
    7083  case MS_LAYER_ANNOTATION:
    7184  case MS_LAYER_POINT:
     
    8194  case MS_LAYER_POLYGON:
    8295    for(i=0; i<class->numstyles; i++) { // TO DO: it may not be this easy
    83       if(MS_VALID_COLOR(class->styles[0].color))
     96      if(MS_VALID_COLOR(class->styles[i].color))
    8497        msDrawShadeSymbolGD(&map->symbolset, img, &box, &(class->styles[i]), 1.0);
    8598      else
Note: See TracChangeset for help on using the changeset viewer.