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

Function msLoadMapContextGeneral

mapcontext.c:720–878  ·  view source on GitHub ↗

** msLoadMapContextGeneral ** ** Load the General block of the mapcontext document */

Source from the content-addressed store, hash-verified

718** Load the General block of the mapcontext document
719*/
720int msLoadMapContextGeneral(mapObj *map, CPLXMLNode *psGeneral,
721 CPLXMLNode *psMapContext, int nVersion,
722 char *filename)
723{
724
725 char *pszProj=NULL;
726 char *pszValue, *pszValue1, *pszValue2;
727
728 /* Projection */
729 pszValue = (char*)CPLGetXMLValue(psGeneral,
730 "BoundingBox.SRS", NULL);
731 if(pszValue != NULL)
732 {
733 if(strncasecmp(pszValue, "AUTO:", 5) == 0)
734 {
735 pszProj = msStrdup(pszValue);
736 }
737 else
738 {
739 pszProj = (char*) malloc(sizeof(char)*(strlen(pszValue)+10));
740 sprintf(pszProj, "init=epsg:%s", pszValue+5);
741 }
742
743 msInitProjection(&map->projection);
744 map->projection.args[map->projection.numargs] = msStrdup(pszProj);
745 map->projection.numargs++;
746 msProcessProjection(&map->projection);
747
748 if( (map->units = GetMapserverUnitUsingProj(&(map->projection))) == -1)
749 {
750 free(pszProj);
751 msSetError( MS_MAPCONTEXTERR,
752 "Unable to set units for projection '%s'",
753 "msLoadMapContext()", pszProj );
754 return MS_FAILURE;
755 }
756 free(pszProj);
757 }
758 else
759 {
760 msDebug("Mandatory data General.BoundingBox.SRS missing in %s.",
761 filename);
762 }
763
764 /* Extent */
765 if( msGetMapContextXMLFloatValue(psGeneral, "BoundingBox.minx",
766 &(map->extent.minx)) == MS_FAILURE)
767 {
768 msDebug("Mandatory data General.BoundingBox.minx missing in %s.",
769 filename);
770 }
771 if( msGetMapContextXMLFloatValue(psGeneral, "BoundingBox.miny",
772 &(map->extent.miny)) == MS_FAILURE)
773 {
774 msDebug("Mandatory data General.BoundingBox.miny missing in %s.",
775 filename);
776 }
777 if( msGetMapContextXMLFloatValue(psGeneral, "BoundingBox.maxx",

Callers 1

msLoadMapContextFunction · 0.85

Calls 14

strncasecmpFunction · 0.85
msStrdupFunction · 0.85
msInitProjectionFunction · 0.85
msProcessProjectionFunction · 0.85
msSetErrorFunction · 0.85
msDebugFunction · 0.85

Tested by

no test coverage detected