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

Function msUnionLayerOpen

mapunion.c:85–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85int msUnionLayerOpen(layerObj *layer)
86{
87 msUnionLayerInfo *layerinfo;
88 char **layerNames;
89 mapObj* map;
90 int i;
91 int layerCount;
92
93 if (layer->layerinfo != NULL)
94 {
95 return MS_SUCCESS; // Nothing to do... layer is already opened
96 }
97
98 if (!layer->connection)
99 {
100 msSetError(MS_MISCERR, "The CONNECTION option is not specified for layer: %s", layer->name);
101 return MS_FAILURE;
102 }
103
104 if (!layer->map)
105 {
106 msSetError(MS_MISCERR, "No map assigned to this layer: %s", layer->name);
107 return MS_FAILURE;
108 }
109
110 map = layer->map;
111
112 layerinfo =(msUnionLayerInfo*)malloc(sizeof(msUnionLayerInfo));
113 MS_CHECK_ALLOC(layerinfo, sizeof(msUnionLayerInfo), MS_FAILURE);
114
115 layer->layerinfo = layerinfo;
116 layerinfo->layerIndex = 0;
117
118 layerinfo->classgroup = NULL;
119 layerinfo->nclasses = 0;
120
121 layerinfo->layerCount = 0;
122
123 layerinfo->classText = NULL;
124
125 layerNames = msStringSplit(layer->connection, ',', &layerCount);
126
127 if (layerCount == 0)
128 {
129 msSetError(MS_MISCERR, "No source layers specified in layer: %s", layer->name);
130 if(layerNames)
131 msFreeCharArray(layerNames, layerinfo->layerCount);
132 msUnionLayerClose(layer);
133 return MS_FAILURE;
134 }
135
136 layerinfo->layers =(layerObj*)malloc(layerCount * sizeof(layerObj));
137 MS_CHECK_ALLOC(layerinfo->layers, layerCount * sizeof(layerObj), MS_FAILURE);
138
139 layerinfo->status =(int*)malloc(layerCount * sizeof(int));
140 MS_CHECK_ALLOC(layerinfo->status, layerCount * sizeof(int), MS_FAILURE);
141
142 for(i=0; i < layerCount; i++)

Callers

nothing calls this directly

Calls 9

msSetErrorFunction · 0.85
msStringSplitFunction · 0.85
msFreeCharArrayFunction · 0.85
msUnionLayerCloseFunction · 0.85
msGetLayerIndexFunction · 0.85
initLayerFunction · 0.85
msCopyLayerFunction · 0.85
msLayerSetProcessingKeyFunction · 0.85
msLayerOpenFunction · 0.85

Tested by

no test coverage detected