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

Function generateLayerTemplate

maptemplate.c:2673–2803  ·  view source on GitHub ↗

! * Replace all tags from layer 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

2671 * buffer must be freed by caller.
2672*/
2673int generateLayerTemplate(char *pszLayerTemplate, mapObj *map, int nIdxLayer, hashTableObj *oLayerArgs, char **pszTemp, char* pszPrefix)
2674{
2675 hashTableObj *myHashTable;
2676 char szStatus[10];
2677 char szType[10];
2678
2679 int nOptFlag=0;
2680 char *pszOptFlag = NULL;
2681 char *pszClassImg;
2682
2683 char szTmpstr[128]; /* easily big enough for the couple of instances we need */
2684
2685 *pszTemp = NULL;
2686
2687 if(!pszLayerTemplate ||
2688 !map ||
2689 nIdxLayer > map->numlayers ||
2690 nIdxLayer < 0 ) {
2691 msSetError(MS_WEBERR, "Invalid pointer.", "generateLayerTemplate()");
2692 return MS_FAILURE;
2693 }
2694
2695 if(oLayerArgs)
2696 pszOptFlag = msLookupHashTable(oLayerArgs, "opt_flag");
2697
2698 if(pszOptFlag)
2699 nOptFlag = atoi(pszOptFlag);
2700
2701 /* don't display deleted layers */
2702 if(GET_LAYER(map, nIdxLayer)->status == MS_DELETE)
2703 return MS_SUCCESS;
2704
2705 /* dont display layer is off. */
2706 /* check this if Opt flag is not set */
2707 if((nOptFlag & 2) == 0 && GET_LAYER(map, nIdxLayer)->status == MS_OFF)
2708 return MS_SUCCESS;
2709
2710 /* dont display layer is query. */
2711 /* check this if Opt flag is not set */
2712 if((nOptFlag & 4) == 0 && GET_LAYER(map, nIdxLayer)->type == MS_LAYER_QUERY)
2713 return MS_SUCCESS;
2714
2715 /* dont display layer is annotation. */
2716 /* check this if Opt flag is not set */
2717 if((nOptFlag & 8) == 0 && GET_LAYER(map, nIdxLayer)->type == MS_LAYER_ANNOTATION)
2718 return MS_SUCCESS;
2719
2720 /* dont display layer if out of scale. */
2721 /* check this if Opt flag is not set */
2722 if((nOptFlag & 1) == 0) {
2723 if(map->scaledenom > 0) {
2724 if((GET_LAYER(map, nIdxLayer)->maxscaledenom > 0) && (map->scaledenom > GET_LAYER(map, nIdxLayer)->maxscaledenom))
2725 return MS_SUCCESS;
2726 if((GET_LAYER(map, nIdxLayer)->minscaledenom > 0) && (map->scaledenom <= GET_LAYER(map, nIdxLayer)->minscaledenom))
2727 return MS_SUCCESS;
2728 }
2729 }
2730

Callers 1

generateLegendTemplateFunction · 0.85

Calls 12

msSetErrorFunction · 0.85
msLookupHashTableFunction · 0.85
msStrdupFunction · 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