Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.Expression


        return this.styleBuilder.createPointPlacement(anchorPoint, displacement, rotation);
    }

    private AnchorPoint createAnchorPoint(final PJsonObject styleJson) {
        Expression anchorX = parseExpression(null, styleJson, JSON_LABEL_ANCHOR_POINT_X, new Function<String, Double>() {
            @Nullable
            @Override
            public Double apply(final String input) {
                return Double.parseDouble(input);
            }
        });
        Expression anchorY = parseExpression(null, styleJson, JSON_LABEL_ANCHOR_POINT_Y, new Function<String, Double>() {
            @Nullable
            @Override
            public Double apply(final String input) {
                return Double.parseDouble(input);
            }
View Full Code Here


        return this.styleBuilder.createAnchorPoint(anchorX, anchorY);
    }

    private Halo createHalo(final PJsonObject styleJson) {
        if (styleJson.has(JSON_HALO_RADIUS)) {
            Expression radius = parseExpression(1.0, styleJson, JSON_HALO_RADIUS, new Function<String, Double>() {
                @Nullable
                @Override
                public Double apply(final String input) {
                    return Double.parseDouble(input);
                }
View Full Code Here

        final String fillColor = styleJson.optString(JSON_FILL_COLOR, "black");
        return addFill(fillColor, styleJson.optString(JSON_FILL_OPACITY, "1.0"));
    }

    private Fill addFill(final String fillColor, final String fillOpacity) {
        final Expression finalFillColor = parseProperty(fillColor, new Function<String, Object>() {
            @Nullable
            @Override
            public Object apply(final String fillColor) {
                return toColorExpression(fillColor);
            }
        });
        final Expression opacity = parseProperty(fillOpacity, new Function<String, Object>() {
            @Nullable
            @Override
            public Object apply(final String fillOpacity) {
                return Double.parseDouble(fillOpacity);
            }
View Full Code Here

        final int quintupleWidth = 5;

        if (this.allowNullSymbolizer && allowNull && !styleJson.has(JSON_STROKE_COLOR)) {
            return null;
        }
        Expression strokeColor = parseExpression(Color.black, styleJson, JSON_STROKE_COLOR, new Function<String, Object>() {
            @Nullable
            @Override
            public Object apply(final String input) {
                return toColorExpression(input);
            }
        });
        Expression strokeOpacity = parseExpression(1.0, styleJson, JSON_STROKE_OPACITY, new Function<String, Object>() {
            @Nullable
            @Override
            public Object apply(final String input) {
                return Double.parseDouble(styleJson.getString(JSON_STROKE_OPACITY));
            }
        });
        Expression widthExpression = parseExpression(1, styleJson, JSON_STROKE_WIDTH, new Function<String, Object>() {
            @Nullable
            @Override
            public Object apply(final String input) {
                return Double.parseDouble(styleJson.getString(JSON_STROKE_WIDTH));
            }
        });

        float[] dashArray = null;
        if (styleJson.has(JSON_STROKE_DASHSTYLE) && !STROKE_DASHSTYLE_SOLID.equals(styleJson.getString(JSON_STROKE_DASHSTYLE))) {
            Double width = 1.0;
            if (widthExpression instanceof Literal) {
                Literal expression = (Literal) widthExpression;
                width = ((Number) expression.getValue()).doubleValue();
            }
            String dashStyle = styleJson.getString(JSON_STROKE_DASHSTYLE);
            if (dashStyle.equalsIgnoreCase(STROKE_DASHSTYLE_DOT)) {
                dashArray = new float[]{defaultDashSpacing, (float) (doubleWidth * width)};
            } else if (dashStyle.equalsIgnoreCase(STROKE_DASHSTYLE_DASH)) {
                dashArray = new float[]{(float) (doubleWidth * width), (float) (doubleWidth * width)};
            } else if (dashStyle.equalsIgnoreCase(STROKE_DASHSTYLE_DASHDOT)) {
                dashArray = new float[]{
                        (float) (tripleWidth * width),
                        (float) (doubleWidth * width),
                        defaultDashSpacing,
                        (float) (doubleWidth * width)};
            } else if (dashStyle.equalsIgnoreCase(STROKE_DASHSTYLE_LONGDASH)) {
                dashArray = new float[]{
                        (float) (quadrupleWidth * width),
                        (float) (doubleWidth * width)};
            } else if (dashStyle.equalsIgnoreCase(STROKE_DASHSTYLE_LONGDASHDOT)) {
                dashArray = new float[]{
                        (float) (quintupleWidth * width),
                        (float) (doubleWidth * width),
                        defaultDashSpacing,
                        (float) (doubleWidth * width)};
            } else if (dashStyle.contains(" ")) {
                //check for pattern if empty array, throw.
                try {
                    String[] x = dashStyle.split(" ");
                    if (x.length > 1) {
                        dashArray = new float[x.length];
                        for (int i = 0; i < x.length; i++) {
                            dashArray[i] = Float.parseFloat(x[i]);
                        }
                    }
                } catch (NumberFormatException e) {
                    //assume solid!
                }
            } else {
                throw new IllegalArgumentException("strokeDashstyle does not have a legal value: " + dashStyle);
            }
        }

        Expression lineCap = parseExpression(null, styleJson, JSON_STROKE_LINECAP, Functions.<String>identity());

        final Stroke stroke = this.styleBuilder.createStroke(strokeColor, widthExpression);
        stroke.setLineCap(lineCap);
        stroke.setOpacity(strokeOpacity);
        stroke.setDashArray(dashArray);
View Full Code Here

            FilterFactory2 factory = FilterSchema.filterFactory(hints);

            try {
                short type = ComparisonOpsType.findFilterType(element.getName());

                Expression expr1 = (Expression) value[0].getValue();
                Expression expr2 = (Expression) value[1].getValue();

                switch (type) {
                case FilterType.COMPARE_EQUALS:
                    return factory.equals(expr1, expr2);
View Full Code Here

            //            <xsd:attribute name="singleChar" type="xsd:string" use="required"/>
            //            <xsd:attribute name="escape" type="xsd:string" use="required"/>
            //          </xsd:extension>         
          try {
           
            Expression expr = (Expression) value[0].getValue();
            String wildCard = attrs.getValue( "wildCard" );
            String singleChar = attrs.getValue( "singleChar" );
            String escape = attrs.getValue( "escape" );
            Literal pattern = (Literal) value[1].getValue();
           
View Full Code Here

         */
        public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
                throws SAXException {
            FilterFactory2 factory = FilterSchema.filterFactory(hints);
            try {
                Expression expr = (Expression) value[0].getValue();

                return factory.isNull(expr);
            } catch (ClassCastException expressionRequired) {
                throw new SAXException("Illegal filter for " + element, expressionRequired);
            } catch (IllegalFilterException e) {
View Full Code Here

         */
        public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
                throws SAXException {
            FilterFactory2 factory = FilterSchema.filterFactory(hints);
            try {
                Expression left = (Expression) value[1].getValue();
                Expression middle = (Expression) value[0].getValue();
                Expression right = (Expression) value[2].getValue();

                return factory.between(middle, left, right);

            } catch (ClassCastException expressionRequired) {
                throw new SAXException("Illegal filter for " + element, expressionRequired);
View Full Code Here

        public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
                throws SAXException {
            FilterFactory2 factory = FilterSchema.filterFactory(hints);

            try {
                Expression expr1 = (Expression) value[0].getValue();
                Expression expr2 = (Expression) value[1].getValue();

                short type = findFilterType(element.getName());
                switch (type) {
                case FilterType.COMPARE_EQUALS:
                    return factory.equals(expr1, expr2);
View Full Code Here

            Map hints) throws IOException, OperationNotSupportedException {
            if (!canEncode(element, value, hints)) {
                return;
            }

            Expression lf = (Expression) value;

            output.startElement(element.getNamespace(), element.getName(), null);
            encodeExpr(lf,output,hints);
            output.endElement(element.getNamespace(), element.getName());
        }
View Full Code Here

TOP

Related Classes of org.opengis.filter.expression.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.