Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLD: Add support to arithmetic expressions #5831

Merged
merged 38 commits into from Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
17d1510
Setup msautotest/sld for testing SLD improvements
jbo-ads Jun 28, 2019
3933a45
Add shapefiles as converted from geojson files
jbo-ads Jul 1, 2019
70d0ed8
Setup SLD tests wrt. new features
jbo-ads Feb 8, 2019
b641abc
<SvgParameter name="stroke-width">: add <Literal> and <PropertyName> …
jbo-ads Feb 8, 2019
765710f
Add tests on opacity
jbo-ads Feb 8, 2019
7606ace
Add tests on opacity
jbo-ads Feb 12, 2019
6764ecf
<Opacity>: add <Literal> and <PropertyName> support
jbo-ads Feb 12, 2019
f959922
Update expected result wrt. latest evolutions
jbo-ads Jul 1, 2019
0c7c4a1
<SvgParameter name="stroke-opacity>: add <Literal> and <PropertyName>…
jbo-ads Feb 12, 2019
68b5d5e
Add expected PNG
jbo-ads Feb 12, 2019
5aa9abc
<SvgParameter name="stroke-width">: add <Literal> and <PropertyName> …
jbo-ads Feb 12, 2019
937f3cf
Add <Literal> and <PropertyName> support to Polygon "stroke" and "fill"
jbo-ads Feb 13, 2019
0a6e02b
Add expected PNG
jbo-ads Feb 14, 2019
9c52ef5
Add <Literal> and <PropertyName> support to various tags
jbo-ads Feb 14, 2019
7a8ac9f
Add <Literal> and <PropertyName> support to <Size>, <Rotation> and <D…
jbo-ads Feb 15, 2019
7c9699e
Prepare SLD evolutions on <TextSymbolizer>
jbo-ads Feb 15, 2019
36f510c
<TextSymbolizer>: <Literal>, <PropertyName> on "font-size"
jbo-ads Feb 22, 2019
c5181a3
cosmetics
jbo-ads Feb 22, 2019
e527686
Prep <LabelPlacement>
jbo-ads Feb 25, 2019
86f35cd
<TextSymbolizer>: <Literal>, <PropertyName> on <Rotation>, "fill"
jbo-ads Feb 26, 2019
8986ff0
Prep <Halo>
jbo-ads Feb 26, 2019
ef3d081
<TextSymbolizer>: <Literal>, <PropertyName> on <Halo> "fill"
jbo-ads Feb 26, 2019
616ec03
cosmetics
jbo-ads Mar 4, 2019
6a5a772
Prepare support to ogc:expression in SLD
jbo-ads Mar 4, 2019
4a50bec
Add ogc:expression support on style's <PropertyName>
jbo-ads Mar 5, 2019
889f903
Prepare support to ogc:expression in SLD's <TextSymbolizer>
jbo-ads Mar 6, 2019
227dc39
Add ogc:expression support on label's <PropertyName>
jbo-ads Mar 6, 2019
29488ed
Add <Add><Sub><Mul><Div> in <ogc:expression>, tested with geometry_li…
jbo-ads Mar 6, 2019
494dc85
Test <ogc:expression> with geometry_point.map
jbo-ads Mar 6, 2019
b5c9bbe
Test <ogc:expression> with geometry_polygon.map
jbo-ads Mar 6, 2019
355933a
Test <ogc:expression> with geometry_text.map
jbo-ads Mar 6, 2019
1f553fa
Remove debug traces
jbo-ads Mar 12, 2019
f2c8ee3
Rename SLD tests
jbo-ads May 15, 2019
2e45255
Minor renaming
jbo-ads May 15, 2019
91e8667
Report opacity value on color alpha when reading SLD
jbo-ads May 23, 2019
90b72f4
Dummy commit to trigger Appveyor
jbo-ads Jul 2, 2019
d05dddf
Add missing msFreeExpression() on allocated exprBindings[]
jbo-ads Jul 9, 2019
fc07dd9
Add expressions on LABEL SIZE
jbo-ads Jul 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions mapcopy.c
Expand Up @@ -317,8 +317,11 @@ int msCopyLabel(labelObj *dst, labelObj *src)
for(i=0; i<MS_LABEL_BINDING_LENGTH; i++) {
MS_COPYSTRING(dst->bindings[i].item, src->bindings[i].item);
dst->bindings[i].index = src->bindings[i].index; /* no way to use the macros */
MS_COPYSTRING(dst->exprBindings[i].string, src->exprBindings[i].string);
dst->exprBindings[i].type = src->exprBindings[i].type;
}
MS_COPYSTELEM(numbindings);
MS_COPYSTELEM(nexprbindings);

MS_COPYSTRING(dst->font, src->font);

Expand Down Expand Up @@ -471,8 +474,11 @@ int msCopyStyle(styleObj *dst, styleObj *src)
for(i=0; i<MS_STYLE_BINDING_LENGTH; i++) {
MS_COPYSTRING(dst->bindings[i].item, src->bindings[i].item);
dst->bindings[i].index = src->bindings[i].index; /* no way to use the macros */
MS_COPYSTRING(dst->exprBindings[i].string, src->exprBindings[i].string);
dst->exprBindings[i].type = src->exprBindings[i].type;
}
MS_COPYSTELEM(numbindings);
MS_COPYSTELEM(nexprbindings);

MS_COPYCOLOR(&(dst->color), &(src->color));
MS_COPYCOLOR(&(dst->outlinecolor),&(src->outlinecolor));
Expand Down
4 changes: 4 additions & 0 deletions mapfile.c
Expand Up @@ -1675,9 +1675,11 @@ void initLabel(labelObj *label)
label->styles = NULL;

label->numbindings = 0;
label->nexprbindings = 0;
for(i=0; i<MS_LABEL_BINDING_LENGTH; i++) {
label->bindings[i].item = NULL;
label->bindings[i].index = -1;
msInitExpression(&(label->exprBindings[i]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this freed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. I added msFreeExpression() in freeLabel() function.

}

msInitExpression(&(label->expression));
Expand Down Expand Up @@ -2599,9 +2601,11 @@ int initStyle(styleObj *style)
style->linejoinmaxsize = MS_CJC_DEFAULT_JOIN_MAXSIZE;

style->numbindings = 0;
style->nexprbindings = 0;
for(i=0; i<MS_STYLE_BINDING_LENGTH; i++) {
style->bindings[i].item = NULL;
style->bindings[i].index = -1;
msInitExpression(&(style->exprBindings[i]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this freed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again. I added msFreeExpression() in freeStyle() function.

}

return MS_SUCCESS;
Expand Down
26 changes: 25 additions & 1 deletion maplayer.c
Expand Up @@ -830,7 +830,7 @@ int msLayerWhichItems(layerObj *layer, int get_all, const char *metadata)

if(layer->_geomtransform.type == MS_GEOMTRANSFORM_EXPRESSION)
msTokenizeExpression(&layer->_geomtransform, layer->items, &(layer->numitems));

/* class level counts */
for(i=0; i<layer->numclasses; i++) {

Expand All @@ -839,6 +839,12 @@ int msLayerWhichItems(layerObj *layer, int get_all, const char *metadata)
nt += layer->class[i]->styles[j]->numbindings;
if(layer->class[i]->styles[j]->_geomtransform.type == MS_GEOMTRANSFORM_EXPRESSION)
nt += msCountChars(layer->class[i]->styles[j]->_geomtransform.string, '[');
for(k=0; k<MS_STYLE_BINDING_LENGTH; k++) {
if (layer->class[i]->styles[j]->exprBindings[k].type == MS_EXPRESSION)
{
nt += msCountChars(layer->class[i]->styles[j]->exprBindings[k].string, '[');
}
}
}

if(layer->class[i]->expression.type == MS_EXPRESSION)
Expand All @@ -852,6 +858,12 @@ int msLayerWhichItems(layerObj *layer, int get_all, const char *metadata)
if(layer->class[i]->labels[l]->styles[j]->_geomtransform.type == MS_GEOMTRANSFORM_EXPRESSION)
nt += msCountChars(layer->class[i]->labels[l]->styles[j]->_geomtransform.string, '[');
}
for(k=0; k<MS_LABEL_BINDING_LENGTH; k++) {
if (layer->class[i]->labels[l]->exprBindings[k].type == MS_EXPRESSION)
{
nt += msCountChars(layer->class[i]->labels[l]->exprBindings[k].string, '[');
}
}

if(layer->class[i]->labels[l]->expression.type == MS_EXPRESSION)
nt += msCountChars(layer->class[i]->labels[l]->expression.string, '[');
Expand Down Expand Up @@ -908,6 +920,12 @@ int msLayerWhichItems(layerObj *layer, int get_all, const char *metadata)
for(k=0; k<MS_STYLE_BINDING_LENGTH; k++) {
if(layer->class[i]->styles[j]->bindings[k].item)
layer->class[i]->styles[j]->bindings[k].index = string2list(layer->items, &(layer->numitems), layer->class[i]->styles[j]->bindings[k].item);
if (layer->class[i]->styles[j]->exprBindings[k].type == MS_EXPRESSION)
{
msTokenizeExpression(
&(layer->class[i]->styles[j]->exprBindings[k]),
layer->items, &(layer->numitems));
}
}
if(layer->class[i]->styles[j]->_geomtransform.type == MS_GEOMTRANSFORM_EXPRESSION)
msTokenizeExpression(&(layer->class[i]->styles[j]->_geomtransform), layer->items, &(layer->numitems));
Expand All @@ -928,6 +946,12 @@ int msLayerWhichItems(layerObj *layer, int get_all, const char *metadata)
for(k=0; k<MS_LABEL_BINDING_LENGTH; k++) {
if(layer->class[i]->labels[l]->bindings[k].item)
layer->class[i]->labels[l]->bindings[k].index = string2list(layer->items, &(layer->numitems), layer->class[i]->labels[l]->bindings[k].item);
if (layer->class[i]->labels[l]->exprBindings[k].type == MS_EXPRESSION)
{
msTokenizeExpression(
&(layer->class[i]->labels[l]->exprBindings[k]),
layer->items, &(layer->numitems));
}
}

/* label expression */
Expand Down