Search in sources :

Example 1 with FunctionNameFilterRaster

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

the class FunctionField method setDataType.

/**
 * Sets the field data types.
 *
 * @param fieldType the new data type
 * @param isRasterSymbol the is raster symbol
 */
public void setDataType(Class<?> fieldType, boolean isRasterSymbol) {
    functionNameMap.clear();
    List<FunctionNameFilterInterface> functionNameFilterList = new ArrayList<FunctionNameFilterInterface>();
    if (isRasterSymbol) {
        functionNameFilterList.add(new FunctionNameFilterRaster());
    } else {
        functionNameFilterList.add(new FunctionNameFilterAll());
    }
    List<FunctionName> functionNameList = functionNameMgr.getFunctionNameList(fieldType, functionNameFilterList);
    for (FunctionName functionName : functionNameList) {
        String functionNameString = functionName.getName();
        functionNameMap.put(functionNameString, functionName);
    }
    populateFunctionComboBox();
}
Also used : FunctionName(org.opengis.filter.capability.FunctionName) FunctionNameFilterAll(com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterAll) FunctionNameFilterInterface(com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterInterface) ArrayList(java.util.ArrayList) FunctionNameFilterRaster(com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterRaster)

Example 2 with FunctionNameFilterRaster

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

the class FunctionManagerTest method testGetFunctionNameList2.

/**
 * Test method for
 * {@link com.sldeditor.filter.v2.function.FunctionManager#getFunctionNameList(java.lang.Class)}.
 * Testing FunctionNameFilterRaster
 */
@Test
public void testGetFunctionNameList2() {
    Class<?> returnType = FunctionManager.getInstance().getFunctionType(null);
    assertNull(returnType);
    List<FunctionName> functionNameList = FunctionManager.getInstance().getFunctionNameList(Object.class, null);
    FunctionName propertyFunction = null;
    FunctionName idFunction = null;
    FunctionName areaFunction = null;
    FunctionName ceilFunction = null;
    for (FunctionName functionName : functionNameList) {
        if (functionName.getName().compareTo("property") == 0) {
            propertyFunction = functionName;
        } else if (functionName.getName().compareTo("id") == 0) {
            idFunction = functionName;
        } else if (functionName.getName().compareTo("Area") == 0) {
            areaFunction = functionName;
        } else if (functionName.getName().compareTo("ceil") == 0) {
            ceilFunction = functionName;
        }
    }
    assertNotNull(propertyFunction);
    assertNotNull(areaFunction);
    assertNotNull(ceilFunction);
    assertNotNull(idFunction);
    List<FunctionNameFilterInterface> functionNameFilterList = new ArrayList<FunctionNameFilterInterface>();
    FunctionNameFilterRaster rasterFilter = new FunctionNameFilterRaster();
    rasterFilter.accept(null);
    functionNameFilterList.add(rasterFilter);
    List<FunctionName> rasterFunctionNameList = FunctionManager.getInstance().getFunctionNameList(Object.class, functionNameFilterList);
    assertFalse(rasterFunctionNameList.contains(propertyFunction));
    assertFalse(rasterFunctionNameList.contains(areaFunction));
    assertFalse(rasterFunctionNameList.contains(idFunction));
    assertTrue(rasterFunctionNameList.contains(ceilFunction));
}
Also used : FunctionName(org.opengis.filter.capability.FunctionName) FunctionNameFilterInterface(com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterInterface) ArrayList(java.util.ArrayList) FunctionNameFilterRaster(com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterRaster) Test(org.junit.Test)

Aggregations

FunctionNameFilterInterface (com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterInterface)2 FunctionNameFilterRaster (com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterRaster)2 ArrayList (java.util.ArrayList)2 FunctionName (org.opengis.filter.capability.FunctionName)2 FunctionNameFilterAll (com.sldeditor.filter.v2.function.namefilter.FunctionNameFilterAll)1 Test (org.junit.Test)1