Hello Akos,

Mmm... not sure what the problem is there. I just tested the Divide
expression (which is confusingly not a filter function)
programmatically with double-valued literals and it worked as expected
(see test below). Next I tried it from a SLD file (also below) and got
points labelled "42.0".

Michael

public class DivTest {

    @Test
    public void divWithDouble() throws Exception {
        FilterFactory2 ff2 = CommonFactoryFinder.getFilterFactory2();
        Expression div = ff2.divide(ff2.literal(84.0), ff2.literal(2));
        Object answer = div.evaluate(null);

        assertEquals("The answer should be 42",
                42.0, ((Number) answer).doubleValue(), 1e-8);
    }
}


<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
                       xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
                       xmlns="http://www.opengis.net/sld";
                       xmlns:ogc="http://www.opengis.net/ogc";
                       xmlns:xlink="http://www.w3.org/1999/xlink";
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

    <NamedLayer>
        <Name>Divide test</Name>
        <UserStyle>
            <FeatureTypeStyle>
                <Rule>
                    <PointSymbolizer>
                        <Graphic>
                            <Mark>
                                <WellKnownName>circle</WellKnownName>
                                <Fill>
                                    <CssParameter
name="fill">#FF0000</CssParameter>
                                </Fill>
                            </Mark>
                            <Size>6</Size>
                        </Graphic>
                    </PointSymbolizer>
                    <TextSymbolizer>
                        <Label>
                            <ogc:Div>
                                <ogc:Literal>84.0</ogc:Literal>
                                <ogc:Literal>2</ogc:Literal>
                            </ogc:Div>
                        </Label>
                        <Font>
                            <CssParameter
name="font-family">Arial</CssParameter>
                            <CssParameter name="font-size">12</CssParameter>
                            <CssParameter
name="font-style">normal</CssParameter>
                            <CssParameter name="font-weight">bold</CssParameter>
                        </Font>
                        <LabelPlacement>
                            <PointPlacement>
                                <AnchorPoint>
                                    <AnchorPointX>0.5</AnchorPointX>
                                    <AnchorPointY>0.0</AnchorPointY>
                                </AnchorPoint>
                                <Displacement>
                                    <DisplacementX>0</DisplacementX>
                                    <DisplacementY>5</DisplacementY>
                                </Displacement>
                            </PointPlacement>
                        </LabelPlacement>
                        <Fill>
                            <CssParameter name="fill">#000000</CssParameter>
                        </Fill>
                    </TextSymbolizer>
                </Rule>
            </FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to