| 115 | } |
| 116 | |
| 117 | static void bindStyle(layerObj *layer, shapeObj *shape, styleObj *style, int querymapMode) { |
| 118 | if(style->numbindings > 0) { |
| 119 | if(style->bindings[MS_STYLE_BINDING_SYMBOL].index != -1) { |
| 120 | style->symbol = msGetSymbolIndex(&(layer->map->symbolset), shape->values[style->bindings[MS_STYLE_BINDING_SYMBOL].index], MS_TRUE); |
| 121 | if(style->symbol == -1) style->symbol = 0; /* a reasonable default (perhaps should throw an error?) */ |
| 122 | } |
| 123 | if(style->bindings[MS_STYLE_BINDING_ANGLE].index != -1) { |
| 124 | style->angle = 360.0; |
| 125 | bindDoubleAttribute(&style->angle, shape->values[style->bindings[MS_STYLE_BINDING_ANGLE].index]); |
| 126 | } |
| 127 | if(style->bindings[MS_STYLE_BINDING_SIZE].index != -1) { |
| 128 | style->size = 1; |
| 129 | bindDoubleAttribute(&style->size, shape->values[style->bindings[MS_STYLE_BINDING_SIZE].index]); |
| 130 | } |
| 131 | if(style->bindings[MS_STYLE_BINDING_WIDTH].index != -1) { |
| 132 | style->width = 1; |
| 133 | bindDoubleAttribute(&style->width, shape->values[style->bindings[MS_STYLE_BINDING_WIDTH].index]); |
| 134 | } |
| 135 | if(style->bindings[MS_STYLE_BINDING_COLOR].index != -1 && (querymapMode != MS_TRUE)) { |
| 136 | MS_INIT_COLOR(style->color, -1,-1,-1,255); |
| 137 | bindColorAttribute(&style->color, shape->values[style->bindings[MS_STYLE_BINDING_COLOR].index]); |
| 138 | } |
| 139 | if(style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].index != -1 && (querymapMode != MS_TRUE)) { |
| 140 | MS_INIT_COLOR(style->outlinecolor, -1,-1,-1,255); |
| 141 | bindColorAttribute(&style->outlinecolor, shape->values[style->bindings[MS_STYLE_BINDING_OUTLINECOLOR].index]); |
| 142 | } |
| 143 | if(style->bindings[MS_STYLE_BINDING_OUTLINEWIDTH].index != -1) { |
| 144 | style->outlinewidth = 1; |
| 145 | bindDoubleAttribute(&style->outlinewidth, shape->values[style->bindings[MS_STYLE_BINDING_OUTLINEWIDTH].index]); |
| 146 | } |
| 147 | if(style->bindings[MS_STYLE_BINDING_OPACITY].index != -1) { |
| 148 | style->opacity = 100; |
| 149 | bindIntegerAttribute(&style->opacity, shape->values[style->bindings[MS_STYLE_BINDING_OPACITY].index]); |
| 150 | |
| 151 | if(style->opacity < 100) { |
| 152 | int alpha; |
| 153 | alpha = MS_NINT(style->opacity*2.55); |
| 154 | |
| 155 | style->color.alpha = alpha; |
| 156 | style->outlinecolor.alpha = alpha; |
| 157 | style->backgroundcolor.alpha = alpha; |
| 158 | |
| 159 | style->mincolor.alpha = alpha; |
| 160 | style->maxcolor.alpha = alpha; |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | /* |
| 167 | ** Function to bind various layer properties to shape attributes. |
no test coverage detected