Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.Expression


            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


            FilterFactory2 factory = FilterSchema.filterFactory(hints);

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

                Expression geometry1 = (Expression) value[0].getValue();
                Expression geometry2 = (Expression) value[1].getValue();

                // GeometryFilter filter = factory.createGeometryFilter( type );
                switch (type) {
                case FilterType.GEOMETRY_EQUALS:
                    return factory.equal(geometry1, geometry2);
View Full Code Here

            if (value == null || value.length != 2) {
                throw new SAXException("ogc:propertyName or gml:box required for bbox filter");
            }
            FilterFactory2 factory = FilterSchema.filterFactory(hints);
            try {
                Expression geometry1 = (Expression) value[0].getValue();
                Expression geometry2 = (Expression) value[1].getValue();
                if( geometry2 instanceof Literal ){
                    Object literal = ((Literal) geometry2).getValue();
                    if( literal instanceof Geometry){
                        Geometry geometry = (Geometry) literal;
                        Envelope env = geometry.getEnvelopeInternal();
View Full Code Here

        public Object getValue(Element element, ElementValue[] value,
            Attributes attrs, Map hints) throws SAXException {
                   
          FilterFactory2 factory = FilterSchema.filterFactory( hints );
          try {
            Expression geometry1 =  (Expression) value[0].getValue();
            Expression geometry2 = (Expression) value[1].getValue();
            Literal literal = (Literal) value[2];
            double distance = ((Number)literal.getValue()).doubleValue();           
            return factory.beyond(geometry1, geometry2, distance, null)
          }
          catch( ClassCastException wrong){
View Full Code Here

        public Object getValue(Element element, ElementValue[] value,
            Attributes attrs, Map hints) throws SAXException {
         
          FilterFactory2 factory = FilterSchema.filterFactory( hints );
          try {
              Expression geometry1 =  (Expression) value[0].getValue();
                    Expression geometry2 = (Expression) value[1].getValue();
                    Literal literal = (Literal) value[2];
                    double distance = ((Number)literal.getValue()).doubleValue();
                    return factory.dwithin(geometry1, geometry2, distance, null );
          }
          catch( ClassCastException wrong){
View Full Code Here

       
        if (other == null) {
           throw new IllegalArgumentException("Temporal filter did not specify two operands");
        }
       
        Expression expr = null;
        if (other instanceof Expression) {
            expr = (Expression) other;
        }
        else {
            expr = factory.literal(other);
View Full Code Here

    public static List/* <AttributeMapping> */createMappingsColumnsAndValues(
            AttributeDescriptor targetFeature) throws Exception {

        List mappings = new LinkedList();
        AttributeMapping attMapping;
        Expression source;
        String target;

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        source = ff.literal("ph");
View Full Code Here

        FeatureTypeFactory tf = new UniqueNameFeatureTypeFactoryImpl();
        AttributeDescriptor targetFeature = tf.createAttributeDescriptor(targetType, targetType
                .getName(), 0, Integer.MAX_VALUE, true, null);

        List mappings = new LinkedList();
        Expression id;
        Expression source;
        String target;

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        id = ff.property("station_no");
View Full Code Here

        PropertyName ae = ff.property("/wq_plus/measurement/result");
        List unrolled = (List) ae.accept(visitor, null);
        assertNotNull(unrolled);
        assertEquals(1, unrolled.size());

        Expression unmappedExpr = (Expression) unrolled.get(0);
        assertTrue(unmappedExpr instanceof PropertyName);
        PropertyName attExp = (PropertyName) unmappedExpr;
        assertEquals("results_value", attExp.getPropertyName());

        // now try with an AttributeExpression that is not directly mapped to an
        // attribute
        // expresion on the surrogate FeatureType, but to a composite one.
        // For example, create a mapping from the test case simple source to
        // a complex type with an "areaOfInfluence" attribute, which is a buffer
        // over the simple "location" attribute
        // and another which is the concatenation of the attributes "anzlic_no"
        // and "project_no"
        FeatureTypeMapping mapping = createSampleDerivedAttributeMappings();
        targetDescriptor = mapping.getTargetFeature();

        visitor = new UnmappingFilterVisitor(mapping);
        attExp = ff.property("areaOfInfluence");
        List unrolledExpressions = (List) attExp.accept(visitor, null);

        assertNotNull(unrolledExpressions);
        assertEquals(1, unrolledExpressions.size());

        unmappedExpr = (Expression) unrolledExpressions.get(0);
        assertTrue(unmappedExpr instanceof Function);
        Function fe = (Function) unmappedExpr;
        assertEquals("buffer", fe.getName());

        Expression arg0 = (Expression) fe.getParameters().get(0);
        assertTrue(arg0 instanceof PropertyName);
        assertEquals("location", ((PropertyName) arg0).getPropertyName());
    }
View Full Code Here

        PropertyIsBetween bf = ff.between(ff.property("measurement/result"), ff.literal(1), ff
                .literal(2), MatchAction.ALL);

        PropertyIsBetween unrolled = (PropertyIsBetween) bf.accept(visitor, null);
        assertEquals(MatchAction.ALL, ((PropertyIsBetween) unrolled).getMatchAction());
        Expression att = unrolled.getExpression();
        assertTrue(att instanceof PropertyName);
        String propertyName = ((PropertyName) att).getPropertyName();
        assertEquals("results_value", propertyName);
    }      
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.