Search in sources :

Example 11 with FilterName

use of com.sldeditor.filter.v2.function.FilterName in project sldeditor by robward-scisys.

the class IsNull method getFilterConfiguration.

/**
 * Gets the filter configuration.
 *
 * @return the filter configuration
 */
@Override
public FilterName getFilterConfiguration() {
    FilterName filterName = new FilterName("IsNull", Boolean.class);
    filterName.addParameter(new FilterNameParameter("expression", ExpressionTypeEnum.EXPRESSION, Object.class));
    return filterName;
}
Also used : FilterName(com.sldeditor.filter.v2.function.FilterName) FilterNameParameter(com.sldeditor.filter.v2.function.FilterNameParameter)

Example 12 with FilterName

use of com.sldeditor.filter.v2.function.FilterName in project sldeditor by robward-scisys.

the class FilterManagerTest method testGetFunctionType.

/**
 * Test method for
 * {@link com.sldeditor.filter.v2.function.FilterManager#getFunctionType(java.lang.String)}.
 * Test method for
 * {@link com.sldeditor.filter.v2.function.FilterManager#getFilterConfig(java.lang.String)}.
 */
@Test
public void testGetFunctionType() {
    List<FilterConfigInterface> filterConfigList = FilterManager.getInstance().getFilterConfigList();
    Class<?> returnType = FilterManager.getInstance().getFunctionType(null);
    assertNull(returnType);
    // Find a known function
    for (FilterConfigInterface filterConfig : filterConfigList) {
        FilterName filterName = filterConfig.getFilterConfiguration();
        returnType = FilterManager.getInstance().getFunctionType(filterName.getFilterName());
        assertEquals(filterName.getFilterName(), filterName.getReturnType(), returnType);
        FilterConfigInterface actualFilterConfig = FilterManager.getInstance().getFilterConfig(filterName.getFilterName());
        assertEquals(filterConfig.getClass(), actualFilterConfig.getClass());
    }
}
Also used : FilterConfigInterface(com.sldeditor.filter.v2.function.FilterConfigInterface) FilterName(com.sldeditor.filter.v2.function.FilterName) Test(org.junit.Test)

Example 13 with FilterName

use of com.sldeditor.filter.v2.function.FilterName in project sldeditor by robward-scisys.

the class FilterNode method setFilter.

/**
 * Sets the filter.
 *
 * @param filter the new expression
 * @param filterConfig the filter config
 */
public void setFilter(Filter filter, FilterConfigInterface filterConfig) {
    this.filter = filter;
    this.filterConfig = filterConfig;
    setDisplayString();
    this.removeAllChildren();
    TypeManager.getInstance().reset();
    if (filterConfig != null) {
        FilterName filterName = filterConfig.getFilterConfiguration();
        if (filter instanceof Not) {
            List<Filter> childFilterList = ((LogicFilterImpl) filter).getChildren();
            if (childFilterList.isEmpty()) {
                // No child filter so add a minimum 1 to work with.
                setFilterParameter(null, filterName.getParameter(0));
            } else {
                setFilterParameter(childFilterList.get(0), filterName.getParameter(0));
            }
        } else if (filter instanceof LogicFilterImpl) {
            List<Filter> childFilterList = ((LogicFilterImpl) filter).getChildren();
            if (childFilterList.isEmpty()) {
                // No child filter so add a minimum 2 to work with.
                setFilterParameter(null, filterName.getParameter(0));
                setFilterParameter(null, filterName.getParameter(0));
            } else {
                for (Filter childFilter : childFilterList) {
                    setFilterParameter(childFilter, filterName.getParameter(0));
                }
            }
        } else if (filter instanceof BinaryTemporalOperator) {
            setExpressionParameter(((BinaryTemporalOperator) filter).getExpression1(), filterName.getParameter(0));
            setExpressionParameter(((BinaryTemporalOperator) filter).getExpression2(), filterName.getParameter(1));
        } else if (filter instanceof PropertyIsNull) {
            setExpressionParameter(((PropertyIsNull) filter).getExpression(), filterName.getParameter(0));
        } else if (filter instanceof PropertyIsBetween) {
            setExpressionParameter(((PropertyIsBetween) filter).getLowerBoundary(), filterName.getParameter(0));
            setExpressionParameter(((PropertyIsBetween) filter).getExpression(), filterName.getParameter(1));
            setExpressionParameter(((PropertyIsBetween) filter).getUpperBoundary(), filterName.getParameter(2));
        } else if (filter instanceof PropertyIsLike) {
            setExpressionParameter(((PropertyIsLike) filter).getExpression(), filterName.getParameter(0));
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).getLiteral()), filterName.getParameter(1));
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).getWildCard()), filterName.getParameter(2));
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).getSingleChar()), filterName.getParameter(3));
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).getEscape()), filterName.getParameter(4));
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).isMatchingCase()), filterName.getParameter(5));
        } else if (filter instanceof BinarySpatialOperator) {
            setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression1(), filterName.getParameter(0));
            setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression2(), filterName.getParameter(1));
        } else if (filter instanceof BinaryComparisonAbstract) {
            setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression1(), filterName.getParameter(0));
            setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression2(), filterName.getParameter(1));
            // which has no matchCase parameter
            if (filterName.getParameterList().size() > 2) {
                setExpressionParameter(ff.literal(((BinaryComparisonAbstract) filter).isMatchingCase()), filterName.getParameter(2));
            }
        }
    }
}
Also used : Not(org.opengis.filter.Not) BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) PropertyIsLike(org.opengis.filter.PropertyIsLike) PropertyIsNull(org.opengis.filter.PropertyIsNull) Filter(org.opengis.filter.Filter) LogicFilterImpl(org.geotools.filter.LogicFilterImpl) List(java.util.List) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) FilterName(com.sldeditor.filter.v2.function.FilterName) BinaryComparisonAbstract(org.geotools.filter.BinaryComparisonAbstract) BinarySpatialOperator(org.opengis.filter.spatial.BinarySpatialOperator)

Example 14 with FilterName

use of com.sldeditor.filter.v2.function.FilterName in project sldeditor by robward-scisys.

the class BBox method getFilterConfiguration.

/**
 * Gets the filter configuration.
 *
 * @return the filter configuration
 */
@Override
public FilterName getFilterConfiguration() {
    FilterName filterName = new FilterName("BBOX", Boolean.class);
    filterName.addParameter(new FilterNameParameter("property", ExpressionTypeEnum.PROPERTY, BoundingBox.class));
    filterName.addParameter(new FilterNameParameter("boundingbox", ExpressionTypeEnum.LITERAL, BoundingBox.class));
    return filterName;
}
Also used : BoundingBox(org.opengis.geometry.BoundingBox) FilterName(com.sldeditor.filter.v2.function.FilterName) FilterNameParameter(com.sldeditor.filter.v2.function.FilterNameParameter)

Example 15 with FilterName

use of com.sldeditor.filter.v2.function.FilterName in project sldeditor by robward-scisys.

the class Contains method getFilterConfiguration.

/**
 * Gets the filter configuration.
 *
 * @return the filter configuration
 */
@Override
public FilterName getFilterConfiguration() {
    FilterName filterName = new FilterName("Contains", Boolean.class);
    filterName.addParameter(new FilterNameParameter("property", ExpressionTypeEnum.PROPERTY, Geometry.class));
    filterName.addParameter(new FilterNameParameter("expression", ExpressionTypeEnum.EXPRESSION, Geometry.class));
    return filterName;
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) FilterName(com.sldeditor.filter.v2.function.FilterName) FilterNameParameter(com.sldeditor.filter.v2.function.FilterNameParameter)

Aggregations

FilterName (com.sldeditor.filter.v2.function.FilterName)33 FilterNameParameter (com.sldeditor.filter.v2.function.FilterNameParameter)30 Geometry (com.vividsolutions.jts.geom.Geometry)9 Date (java.util.Date)6 Filter (org.opengis.filter.Filter)4 Test (org.junit.Test)3 ExpressionPanelv2 (com.sldeditor.filter.v2.expression.ExpressionPanelv2)1 FilterNode (com.sldeditor.filter.v2.expression.FilterNode)1 FilterConfigInterface (com.sldeditor.filter.v2.function.FilterConfigInterface)1 List (java.util.List)1 BinaryComparisonAbstract (org.geotools.filter.BinaryComparisonAbstract)1 LogicFilterImpl (org.geotools.filter.LogicFilterImpl)1 Not (org.opengis.filter.Not)1 PropertyIsBetween (org.opengis.filter.PropertyIsBetween)1 PropertyIsLike (org.opengis.filter.PropertyIsLike)1 PropertyIsNull (org.opengis.filter.PropertyIsNull)1 BinarySpatialOperator (org.opengis.filter.spatial.BinarySpatialOperator)1 BinaryTemporalOperator (org.opengis.filter.temporal.BinaryTemporalOperator)1 BoundingBox (org.opengis.geometry.BoundingBox)1