Package org.geotools.filter.text.commons

Examples of org.geotools.filter.text.commons.Result


    public Or buildInPredicate(final int nodeExpression) throws CQLException {
        // retrieves the expressions from stack
        List<Expression> exprList = new LinkedList<Expression>();
        while (!getResultStack().empty()) {

            Result result = getResultStack().peek();

            int node = result.getNodeType();
            if (node != nodeExpression) {
                break;
            }
            getResultStack().popResult();
View Full Code Here


     * @throws CQLException if the pattern has not one of the following characters:T,F,*,0,1,2
     */
    public Literal buildPattern9IM() throws CQLException {
        // retrieves the pattern from stack
        Result resut = getResultStack().popResult();
        IToken token = resut.getToken();

        Literal built = (Literal)resut.getBuilt();
        final String pattern = (String)built.getValue();

        // validates the length
        if(pattern.length() != 9){
            throw new CQLException("the pattern DE-9IM must have nine (9) characters", token, getStatement() );
View Full Code Here

       
        try {
            Object built = build(n);

            IToken tokenAdapter = TokenAdapter.newAdapterFor(this.token);
            Result r = new Result(built, tokenAdapter, n.getType());
            this.builder.pushResult(r );
       
        } catch (CQLException e) {
                throw e;
             
View Full Code Here

    private org.opengis.filter.Filter buildBeforeOrDuring()
            throws CQLException {
        org.opengis.filter.Filter filter = null;

        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTPERIOD_BETWEEN_DATES_NODE:
        case JJTPERIOD_WITH_DATE_DURATION_NODE:
        case JJTPERIOD_WITH_DURATION_DATE_NODE:
            filter = this.builder.buildBeforeOrDuring();
            break;

        default:
            throw new CQLException(
                    "unexpeted date time expression in temporal predicate.",
                    node.getToken(), this.source);
        }

        return filter;
    }
View Full Code Here

    private Or buildDuringOrAfter()
            throws CQLException {
        Or filter = null;

        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTPERIOD_BETWEEN_DATES_NODE:
        case JJTPERIOD_WITH_DATE_DURATION_NODE:
        case JJTPERIOD_WITH_DURATION_DATE_NODE:
            filter = this.builder.buildDuringOrAfter();

            break;

        default:
            throw new CQLException(
                    "unexpeted date time expression in temporal predicate.",
                    node.getToken(), this.source);
        }

        return filter;
    }
View Full Code Here

    private Before buildBefore()
            throws CQLException {
        Before filter = null;

        // analyzes if the last build is period or date
        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTDATETIME_NODE:
            filter = this.builder.buildBeforeDate();
            break;

        case JJTPERIOD_BETWEEN_DATES_NODE:
        case JJTPERIOD_WITH_DATE_DURATION_NODE:
        case JJTPERIOD_WITH_DURATION_DATE_NODE:
            filter = this.builder.buildBeforePeriod();
            break;

        default:
            throw new CQLException(
                    "unexpeted date time expression in temporal predicate.",
                    node.getToken(), this.source);
        }

        return filter;
    }
View Full Code Here

     */
    private During buildDuring() throws CQLException {
        During filter = null;

        // determines if the node is period or date
        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTPERIOD_BETWEEN_DATES_NODE:
        case JJTPERIOD_WITH_DATE_DURATION_NODE:
        case JJTPERIOD_WITH_DURATION_DATE_NODE:
            filter = this.builder.buildDuringPeriod();
            break;

        default:
            throw new CQLException(
                    "unexpeted period expression in temporal predicate.", node
                            .getToken(), this.source);
        }

        return filter;
    }
View Full Code Here

    private After buildAfterPredicate()
            throws CQLException {
        After filter = null;

        // determines if the node is period or date
        Result node = this.builder.peekResult();

        switch (node.getNodeType()) {
        case JJTDATETIME_NODE:
          filter = this.builder.buildAfterDate();
            break;

        case JJTPERIOD_BETWEEN_DATES_NODE:
        case JJTPERIOD_WITH_DURATION_DATE_NODE:
        case JJTPERIOD_WITH_DATE_DURATION_NODE:
            filter = this.builder.buildAfterPeriod();
            break;

        default:
            throw new CQLException(
                    "unexpeted date time expression in temporal predicate.",
                    node.getToken(), this.source);
        }

        return filter;
    }
View Full Code Here

     * @param linestringNode LineString identifier defined in the grammar file
     */
    @Override
    public Geometry build(final int linestringNode) throws CQLException {

        Result result = getResultStack().peek();
        try{
            // Retrieve the liner ring for shell and holes
            final List<Geometry> geometryList= popGeometry(linestringNode);
           
            assert geometryList.size() >= 1;
           
            // retrieves the shell
            LineString line = (LineString)geometryList.get(0);
            final LinearRing shell = getGeometryFactory().createLinearRing(line.getCoordinates());

            // if it has holes, creates a ring for each linestring
            LinearRing[] holes = new LinearRing[0];
            if(geometryList.size() > 1){
               
                List<LinearRing> holeList = new LinkedList<LinearRing>();
                for( int i = 1;i < geometryList.size(); i++) {
                   
                    LineString holeLines = (LineString) geometryList.get(i);
                    LinearRing ring = getGeometryFactory().createLinearRing(holeLines.getCoordinates());
                    holeList.add(ring);
                }
                int holesSize = holeList.size();
                holes = holeList.toArray(new LinearRing[holesSize]) ;
            }
            // creates the polygon
            Polygon polygon= getGeometryFactory().createPolygon(shell, holes);
           
            return polygon;
           
        }catch(Exception e){

            throw new CQLException(e.getMessage(),  result.getToken(), getStatemet());
        }
   
   
    }
View Full Code Here

    /**
     * Builds a Point geometry
     */
    public Geometry build() throws CQLException {
        Result result = getResultStack().popResult();
        org.geotools.filter.text.commons.IToken token = result.getToken();
        try {
            Coordinate coordinate = (Coordinate) result.getBuilt();

            Point point = getGeometryFactory().createPoint(coordinate);

            return point;
           
View Full Code Here

TOP

Related Classes of org.geotools.filter.text.commons.Result

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.