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

Function loadStyle

mapfile.c:2419–2654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2417}
2418
2419int loadStyle(styleObj *style) {
2420 int symbol;
2421
2422 for(;;) {
2423 switch(msyylex()) {
2424 /* New Color Range fields*/
2425 case (COLORRANGE):
2426 /*These are both in one line now*/
2427 if(loadColor(&(style->mincolor), NULL) != MS_SUCCESS) return(MS_FAILURE);
2428 if(loadColor(&(style->maxcolor), NULL) != MS_SUCCESS) return(MS_FAILURE);
2429 break;
2430 case(DATARANGE):
2431 /*These are both in one line now*/
2432 if(getDouble(&(style->minvalue)) == -1) return(-1);
2433 if(getDouble(&(style->maxvalue)) == -1) return(-1);
2434 break;
2435 case(RANGEITEM):
2436 if(getString(&style->rangeitem) == MS_FAILURE) return(-1);
2437 break;
2438 /* End Range fields*/
2439 case(ANGLE):
2440 if((symbol = getSymbol(3, MS_NUMBER,MS_BINDING,MS_AUTO)) == -1) return(MS_FAILURE);
2441
2442 if(symbol == MS_NUMBER)
2443 style->angle = (double) msyynumber;
2444 else if(symbol==MS_BINDING){
2445 if (style->bindings[MS_STYLE_BINDING_ANGLE].item != NULL)
2446 msFree(style->bindings[MS_STYLE_BINDING_ANGLE].item);
2447 style->bindings[MS_STYLE_BINDING_ANGLE].item = msStrdup(msyystring_buffer);
2448 style->numbindings++;
2449 } else {
2450 style->autoangle=MS_TRUE;
2451 }
2452 break;
2453 case(ANTIALIAS):
2454 if((style->antialias = getSymbol(2, MS_TRUE,MS_FALSE)) == -1)
2455 return(MS_FAILURE);
2456 break;
2457 case(BACKGROUNDCOLOR):
2458 if(loadColor(&(style->backgroundcolor), NULL) != MS_SUCCESS) return(MS_FAILURE);
2459 break;
2460 case(COLOR):
2461 if(loadColor(&(style->color), &(style->bindings[MS_STYLE_BINDING_COLOR])) != MS_SUCCESS) return(MS_FAILURE);
2462 if(style->bindings[MS_STYLE_BINDING_COLOR].item) style->numbindings++;
2463 break;
2464 case(EOF):
2465 msSetError(MS_EOFERR, NULL, "loadStyle()");
2466 return(MS_FAILURE); /* missing END (probably) */
2467 case(END):
2468 {
2469 int alpha;
2470
2471 /* apply opacity as the alpha channel color(s) */
2472 if(style->opacity < 100) {
2473 alpha = MS_NINT(style->opacity*2.55);
2474
2475 style->color.alpha = alpha;
2476 style->outlinecolor.alpha = alpha;

Callers 3

loadLabelFunction · 0.85
msUpdateStyleFromStringFunction · 0.85
loadClassFunction · 0.85

Calls 9

loadColorFunction · 0.85
getDoubleFunction · 0.85
getStringFunction · 0.85
getSymbolFunction · 0.85
msFreeFunction · 0.85
msStrdupFunction · 0.85
msSetErrorFunction · 0.85
MS_NINTFunction · 0.85
msStyleSetGeomTransformFunction · 0.85

Tested by

no test coverage detected