** Utility method to process the legend template. */
| 4713 | ** Utility method to process the legend template. |
| 4714 | */ |
| 4715 | char *msProcessLegendTemplate(mapObj *map, char **names, char **values, int numentries) |
| 4716 | { |
| 4717 | char *pszOutBuf = NULL; |
| 4718 | |
| 4719 | if(map && map->legend.template) { |
| 4720 | |
| 4721 | /* Initialize object and set appropriate defaults. */ |
| 4722 | mapservObj *mapserv = NULL; |
| 4723 | mapserv = msAllocMapServObj(); |
| 4724 | |
| 4725 | mapserv->map = map; |
| 4726 | mapserv->Mode = BROWSE; |
| 4727 | |
| 4728 | if(names && values && numentries > 0) { |
| 4729 | msFreeCharArray(mapserv->request->ParamNames, mapserv->request->NumParams); |
| 4730 | msFreeCharArray(mapserv->request->ParamValues, mapserv->request->NumParams); |
| 4731 | mapserv->request->ParamNames = names; |
| 4732 | mapserv->request->ParamValues = values; |
| 4733 | mapserv->request->NumParams = numentries; |
| 4734 | } |
| 4735 | |
| 4736 | pszOutBuf = generateLegendTemplate(mapserv); |
| 4737 | |
| 4738 | /* Don't free the map and names and values arrays since they were passed by reference. */ |
| 4739 | mapserv->map = NULL; |
| 4740 | mapserv->request->ParamNames = mapserv->request->ParamValues = NULL; |
| 4741 | mapserv->request->NumParams = 0; |
| 4742 | msFreeMapServObj(mapserv); |
| 4743 | } |
| 4744 | |
| 4745 | return pszOutBuf; |
| 4746 | } |
| 4747 | |
| 4748 | /* |
| 4749 | ** Utility function that process a template file(s) used in the |
no test coverage detected