Package org.opengis.filter

Examples of org.opengis.filter.PropertyIsNull


     */
    public void testNull() throws IllegalFilterException {
        // Test for false positive.
        PropertyName testAttribute = new AttributeExpressionImpl(testSchema, "testString");

        PropertyIsNull filter = fac.isNull(org.opengis.filter.expression.Expression.NIL);
        assertTrue(filter.evaluate(testFeature));
       
        filter = fac.isNull(testAttribute);
        assertFalse(filter.evaluate(testFeature));
    }
View Full Code Here


        public void testCompareShortCircuit() throws IllegalFilterException {
           // Test all integer permutations
            PropertyName testAttribute = new AttributeExpressionImpl(testSchema,
                   "testInteger");
   
            PropertyIsNull nullFilter = fac.isNull(testAttribute);
          
            org.opengis.filter.Filter notNullFilter  = fac.not(nullFilter);
           
            PropertyIsEqualTo compareFilter = fac.equals( testAttribute, fac.literal(10));
           
           
            testFeature.setAttribute("testInteger", null);
            assertEquals( false, compareFilter.evaluate( testFeature ) );
           
            assertTrue(nullFilter.evaluate(testFeature));
            assertFalse(notNullFilter.evaluate(testFeature));
           
            //test AND
            org.opengis.filter.Filter finalFilter = fac.and(notNullFilter, compareFilter);
            try{
View Full Code Here

        PropertyName id = factory.property("id");
        PropertyName name = factory.property("name");
        PropertyName geom = factory.property("geom");

        // check nullFilter
        PropertyIsNull nullFilter = factory.isNull(id);
        names = DataUtilities.attributeNames(nullFilter);
        assertEquals(1, names.length);
        assertEquals("id", names[0]);

        PropertyIsEqualTo equal = factory.equals(name, id);
        names = DataUtilities.attributeNames(equal);
        assertEquals(2, names.length);
        List list = Arrays.asList(names);
        assertTrue(list.contains("name"));
        assertTrue(list.contains("id"));

        Function fnCall = factory.function("Max", new Expression[] { id, name });

        PropertyIsLike fn = factory.like(fnCall, "does-not-matter");
        names = DataUtilities.attributeNames(fn);
        list = Arrays.asList(names);
        assertTrue(list.contains("name"));
        assertTrue(list.contains("id"));

        PropertyIsBetween between = factory.between(name, id, geom);
        names = DataUtilities.attributeNames(between);
        assertEquals(3, names.length);
        list = Arrays.asList(names);
        assertTrue(list.contains("name"));
        assertTrue(list.contains("id"));
        assertTrue(list.contains("geom"));

        // check logic filter
        PropertyIsNull geomNull = factory.isNull(geom);
        names = DataUtilities.attributeNames(factory.and(geomNull, equal));
        assertEquals(3, names.length);
        list = Arrays.asList(names);
        assertTrue(list.contains("name"));
        assertTrue(list.contains("id"));
View Full Code Here

        this.uom = defaultUnit;
        if (unscaled instanceof Literal) {
            processLiteralExpression((Literal) unscaled, defaultUnit);
        } else {
            // see if we can still optimize
            PropertyIsNull test = ff.isNull(unscaled);
            Filter simplified = (Filter) test.accept(new SimplifyingFilterVisitor(), null);
            if (simplified == Filter.INCLUDE) {
                // special case, the expression was nil to start with
                this.expression = NilExpression.NIL;
                this.uom = defaultUnit;
            } else if (simplified instanceof PropertyIsNull) {
                PropertyIsNull pin = (PropertyIsNull) simplified;
                Expression se = pin.getExpression();
                if (se instanceof Literal) {
                    processLiteralExpression((Literal) se, defaultUnit);
                } else {
                    this.expression = se;
                    this.uom = defaultUnit;
View Full Code Here

        }
    }
   
    @Override
    public Object visit(PropertyIsNull filter, Object extraData) {
        PropertyIsNull clone = (PropertyIsNull) super.visit(filter, extraData);
        if(isConstant(clone.getExpression())) {
            return staticFilterEvaluate(clone);
        } else {
            return clone;
        }
    }
View Full Code Here

        FilterFactory2 factory = CommonFactoryFinder.getFilterFactory2(null);
        String fid1 = "FID.1";
       
        Filter fidFilter = factory.not( factory.id( Collections.singleton( factory.featureId(fid1) ) ) );
       
         PropertyIsNull nullFilter = factory.isNull( factory.property("name"));

        Filter filter = factory.and(nullFilter,fidFilter);

        FilterEncodingPreProcessor visitor = new FilterEncodingPreProcessor(XMLHandlerHints.VALUE_FILTER_COMPLIANCE_LOW);
        filter.accept(visitor,null);
View Full Code Here

TOP

Related Classes of org.opengis.filter.PropertyIsNull

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.