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

Function msWCSParseSubset20

mapwcs20.c:367–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365/************************************************************************/
366
367static int msWCSParseSubset20(wcs20SubsetObjPtr subset, const char *axis,
368 const char *crs, const char *min, const char *max)
369{
370 int ts1, ts2;
371 ts1 = ts2 = MS_WCS20_UNDEFINED_VALUE;
372
373 if (subset == NULL)
374 {
375 return MS_FAILURE;
376 }
377
378 if (axis == NULL || strlen(axis) == 0)
379 {
380 msSetError(MS_WCSERR, "Subset axis is not given.",
381 "msWCSParseSubset20()");
382 return MS_FAILURE;
383 }
384
385 subset->axis = msStrdup(axis);
386 if (crs != NULL)
387 {
388 subset->crs = msStrdup(crs);
389 }
390
391 /* Parse first (probably only) part of interval/point;
392 * check whether its a time value or a scalar value */
393 ts1 = msWCSParseTimeOrScalar20(&(subset->min), min);
394 if (ts1 == MS_WCS20_ERROR_VALUE)
395 {
396 return MS_FAILURE;
397 }
398
399 /* check if its an interval */
400 /* if there is a comma, then it is */
401 if (max != NULL && strlen(max) > 0)
402 {
403 subset->operation = MS_WCS20_TRIM;
404
405 /* Parse the second value of the interval */
406 ts2 = msWCSParseTimeOrScalar20(&(subset->max), max);
407 if (ts2 == MS_WCS20_ERROR_VALUE)
408 {
409 return MS_FAILURE;
410 }
411
412 /* if at least one boundary is defined, use that value */
413 if ((ts1 == MS_WCS20_UNDEFINED_VALUE) ^ (ts2
414 == MS_WCS20_UNDEFINED_VALUE))
415 {
416 if (ts1 == MS_WCS20_UNDEFINED_VALUE)
417 {
418 ts1 = ts2;
419 }
420 }
421 /* if time and scalar values do not fit, throw an error */
422 else if (ts1 != MS_WCS20_UNDEFINED_VALUE && ts2
423 != MS_WCS20_UNDEFINED_VALUE && ts1 != ts2)
424 {

Callers 2

Calls 3

msSetErrorFunction · 0.85
msStrdupFunction · 0.85
msWCSParseTimeOrScalar20Function · 0.85

Tested by

no test coverage detected