MCPcopy Index your code
hub / github.com/MapServer/MapServer / generateClassTemplate

Function generateClassTemplate

maptemplate.c:2814–2952  ·  view source on GitHub ↗

! * Replace all tags from class template * with correct value. * * this function return a buffer containing * the template with correct values. * * buffer must be freed by caller. */

Source from the content-addressed store, hash-verified

2812 * buffer must be freed by caller.
2813*/
2814int generateClassTemplate(char* pszClassTemplate, mapObj *map, int nIdxLayer, int nIdxClass, hashTableObj *oClassArgs, char **pszTemp, char* pszPrefix)
2815{
2816 hashTableObj *myHashTable;
2817 char szStatus[10];
2818 char szType[10];
2819
2820 char *pszClassImg;
2821 int nOptFlag=0;
2822 char *pszOptFlag = NULL;
2823
2824 char szTmpstr[128]; /* easily big enough for the couple of instances we need */
2825
2826 *pszTemp = NULL;
2827
2828 if(!pszClassTemplate ||
2829 !map ||
2830 nIdxLayer > map->numlayers ||
2831 nIdxLayer < 0 ||
2832 nIdxClass > GET_LAYER(map, nIdxLayer)->numclasses ||
2833 nIdxClass < 0) {
2834
2835 msSetError(MS_WEBERR, "Invalid pointer.", "generateClassTemplate()");
2836 return MS_FAILURE;
2837 }
2838
2839 if(oClassArgs)
2840 pszOptFlag = msLookupHashTable(oClassArgs, "Opt_flag");
2841
2842 if(pszOptFlag)
2843 nOptFlag = atoi(pszOptFlag);
2844
2845 /* don't display deleted layers */
2846 if(GET_LAYER(map, nIdxLayer)->status == MS_DELETE)
2847 return MS_SUCCESS;
2848
2849 /* dont display class if layer is off. */
2850 /* check this if Opt flag is not set */
2851 if((nOptFlag & 2) == 0 && GET_LAYER(map, nIdxLayer)->status == MS_OFF)
2852 return MS_SUCCESS;
2853
2854 /* dont display class if layer is query. */
2855 /* check this if Opt flag is not set */
2856 if((nOptFlag & 4) == 0 && GET_LAYER(map, nIdxLayer)->type == MS_LAYER_QUERY)
2857 return MS_SUCCESS;
2858
2859 /* dont display class if layer is annotation. */
2860 /* check this if Opt flag is not set */
2861 if((nOptFlag & 8) == 0 && GET_LAYER(map, nIdxLayer)->type == MS_LAYER_ANNOTATION)
2862 return MS_SUCCESS;
2863
2864 /* dont display layer if out of scale. */
2865 /* check this if Opt flag is not set */
2866 if((nOptFlag & 1) == 0) {
2867 if(map->scaledenom > 0) {
2868 if((GET_LAYER(map, nIdxLayer)->maxscaledenom > 0) && (map->scaledenom > GET_LAYER(map, nIdxLayer)->maxscaledenom))
2869 return MS_SUCCESS;
2870 if((GET_LAYER(map, nIdxLayer)->minscaledenom > 0) && (map->scaledenom <= GET_LAYER(map, nIdxLayer)->minscaledenom))
2871 return MS_SUCCESS;

Callers 1

generateLegendTemplateFunction · 0.85

Calls 12

msSetErrorFunction · 0.85
msLookupHashTableFunction · 0.85
msSmallMallocFunction · 0.85
msReplaceSubstringFunction · 0.85
msCreateHashTableFunction · 0.85
msInsertHashTableFunction · 0.85
msLayerIsVisibleFunction · 0.85
msIsLayerQueryableFunction · 0.85
processIfTagFunction · 0.85
msFreeHashTableFunction · 0.85
processIconFunction · 0.85
processMetadataFunction · 0.85

Tested by

no test coverage detected