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

Function loadFeature

mapfile.c:841–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

839}
840
841static int loadFeature(layerObj *player, int type)
842{
843 int status=MS_SUCCESS;
844 featureListNodeObjPtr *list = &(player->features);
845 featureListNodeObjPtr node;
846 multipointObj points={0,NULL};
847 shapeObj *shape=NULL;
848
849 shape = (shapeObj *) malloc(sizeof(shapeObj));
850 MS_CHECK_ALLOC(shape, sizeof(shapeObj), MS_FAILURE);
851
852 msInitShape(shape);
853 shape->type = type;
854
855 for(;;) {
856 switch(msyylex()) {
857 case(EOF):
858 msSetError(MS_EOFERR, NULL, "loadFeature()");
859 return(MS_FAILURE);
860 case(END):
861 if(player->features != NULL && player->features->tailifhead != NULL)
862 shape->index = player->features->tailifhead->shape.index + 1;
863 else
864 shape->index = 0;
865 if((node = insertFeatureList(list, shape)) == NULL)
866 status = MS_FAILURE;
867
868 msFreeShape(shape); /* clean up */
869 msFree(shape);
870
871 return(status);
872 case(FEATURE):
873 break; /* for string loads */
874 case(POINTS):
875 if(loadFeaturePoints(&points) == MS_FAILURE) return(MS_FAILURE); /* no clean up necessary, just return */
876 status = msAddLine(shape, &points);
877
878 msFree(points.point); /* clean up */
879 points.numpoints = 0;
880
881 if(status == MS_FAILURE) return(MS_FAILURE);
882 break;
883 case(ITEMS):
884 {
885 char *string=NULL;
886 if(getString(&string) == MS_FAILURE) return(MS_FAILURE);
887 if (string)
888 {
889 if(shape->values) msFreeCharArray(shape->values, shape->numvalues);
890 shape->values = msStringSplit(string, ';', &shape->numvalues);
891 msFree(string); /* clean up */
892 }
893 break;
894 }
895 case(TEXT):
896 if(getString(&shape->text) == MS_FAILURE) return(MS_FAILURE);
897 break;
898 case(WKT):

Callers 1

loadLayerFunction · 0.85

Calls 11

msInitShapeFunction · 0.85
msSetErrorFunction · 0.85
insertFeatureListFunction · 0.85
msFreeShapeFunction · 0.85
msFreeFunction · 0.85
loadFeaturePointsFunction · 0.85
msAddLineFunction · 0.85
getStringFunction · 0.85
msFreeCharArrayFunction · 0.85
msStringSplitFunction · 0.85
msShapeFromWKTFunction · 0.85

Tested by

no test coverage detected