use of org.opengis.filter.capability.FunctionName in project sldeditor by robward-scisys.
the class FunctionManager method initialise.
/**
* Initialise.
*/
private void initialise() {
functionNameList = functionFactory.getFunctionNames();
List<Class<?>> classList = new ArrayList<Class<?>>();
Logger logger = Logger.getLogger(getClass());
for (FunctionName function : functionNameList) {
logger.debug(function.getName());
functionNameMap.put(function.getName(), function);
for (int index = 0; index < function.getArgumentCount(); index++) {
if (!classList.contains(function.getArguments().get(index).getType())) {
classList.add(function.getArguments().get(index).getType());
}
logger.debug("\t" + function.getArgumentNames().get(index) + "\t" + function.getArguments().get(index).getType().getName() + "\t" + function.getArguments().get(index).getMinOccurs() + "\t" + function.getArguments().get(index).getMaxOccurs());
}
if (!classList.contains(function.getReturn().getType())) {
classList.add(function.getReturn().getType());
}
logger.debug("\tRet : " + function.getReturn().getType().getName());
}
logger.debug("\nClasses");
for (Class<?> className : classList) {
logger.debug(className.getName());
}
// CHECKSTYLE:OFF
Class<?>[] allowedNumberTypes = { Number.class, Double.class, Float.class, Integer.class, Long.class, Object.class };
Class<?>[] allowedDoubleTypes = { Number.class, Double.class, Float.class, Integer.class, Long.class, Object.class };
Class<?>[] allowedFloatTypes = { Number.class, Double.class, Float.class, Integer.class, Long.class, Object.class };
Class<?>[] allowedIntegerTypes = { Number.class, Double.class, Float.class, Integer.class, Long.class, Object.class };
Class<?>[] allowedLongTypes = { Number.class, Double.class, Float.class, Integer.class, Long.class, Object.class };
Class<?>[] allowedBooleanTypes = { Boolean.class, Object.class };
Class<?>[] allowedStringTypes = { String.class, Object.class };
Class<?>[] allowedGeometryTypes = { Geometry.class, LineString.class, Point.class, MultiPoint.class, LinearRing.class, Object.class };
Class<?>[] allowedDateTypes = { Date.class, Object.class };
Class<?>[] allowedClassifierTypes = { RangedClassifier.class, Classifier.class, Object.class };
Class<?>[] allowedBBoxTypes = { ReferencedEnvelope.class, Geometry.class };
Class<?>[] allowedObjectTypes = { Number.class, Double.class, Float.class, Integer.class, Long.class, Boolean.class, String.class, Date.class, Geometry.class, LineString.class, Point.class, MultiPoint.class, LinearRing.class, RangedClassifier.class, Classifier.class, ReferencedEnvelope.class, Object.class };
// CHECKSTYLE:ON
populateAllowedTypes(Number.class, allowedNumberTypes);
populateAllowedTypes(Double.class, allowedDoubleTypes);
populateAllowedTypes(Float.class, allowedFloatTypes);
populateAllowedTypes(Integer.class, allowedIntegerTypes);
populateAllowedTypes(Long.class, allowedLongTypes);
populateAllowedTypes(Boolean.class, allowedBooleanTypes);
populateAllowedTypes(String.class, allowedStringTypes);
populateAllowedTypes(Geometry.class, allowedGeometryTypes);
populateAllowedTypes(Date.class, allowedDateTypes);
populateAllowedTypes(Classifier.class, allowedClassifierTypes);
populateAllowedTypes(ReferencedEnvelope.class, allowedBBoxTypes);
populateAllowedTypes(Object.class, allowedObjectTypes);
}
use of org.opengis.filter.capability.FunctionName in project sldeditor by robward-scisys.
the class RenderTransformationDialogTest method testRenderTransformationDialog.
/**
* Test method for
* {@link com.sldeditor.rendertransformation.RenderTransformationDialog#RenderTransformationDialog(com.sldeditor.common.connection.GeoServerConnectionManagerInterface)}.
*/
@Test
public void testRenderTransformationDialog() {
TestRenderTransformationDialog testObj = new TestRenderTransformationDialog(null);
testObj.test_internal_showDialog(null);
ProcessFunction actualResult = testObj.getTransformationProcessFunction();
assertNull(actualResult);
ProcessFunctionFactory factory = new ProcessFunctionFactory();
FunctionName functionName = factory.getFunctionNames().get(0);
testObj.testDisplayFunction(functionName.getName());
actualResult = testObj.getTransformationProcessFunction();
assertNotNull(actualResult);
testObj.test_internal_showDialog(actualResult);
}
use of org.opengis.filter.capability.FunctionName in project sldeditor by robward-scisys.
the class SelectedProcessFunctionTest method testSetBuiltInProcessFunction.
/**
* Test method for
* {@link com.sldeditor.rendertransformation.SelectedProcessFunction#setBuiltInProcessFunction(org.opengis.filter.capability.FunctionName, org.geotools.process.function.ProcessFunction)}.
*/
@Test
public void testSetBuiltInProcessFunction() {
SelectedProcessFunction obj = new SelectedProcessFunction();
assertTrue(obj.isBuiltInSelected());
assertTrue(obj.extractParameters().isEmpty());
assertNull(obj.getFunctionName());
assertEquals(0, obj.getRowCount());
ProcessFunctionFactory processFunctionFactory = new ProcessFunctionFactory();
List<FunctionName> functionNameList = processFunctionFactory.getFunctionNames();
FunctionName functionName = functionNameList.get(0);
obj.setBuiltInProcessFunction(functionName, null);
assertTrue(obj.isBuiltInSelected());
assertTrue(obj.getFunctionName().getLocalPart().compareTo(functionName.getName()) == 0);
assertEquals(obj.getRowCount(), obj.extractParameters().size());
assertFalse(obj.extractParameters().isEmpty());
}
use of org.opengis.filter.capability.FunctionName in project sldeditor by robward-scisys.
the class FunctionManagerTest method testGetFunctionType.
/**
* Test method for
* {@link com.sldeditor.filter.v2.function.FunctionManager#getFunctionType(java.lang.String)}.
*/
@Test
public void testGetFunctionType() {
Class<?> returnType = FunctionManager.getInstance().getFunctionType(null);
assertNull(returnType);
List<FunctionNameFilterInterface> functionNameFilterList = new ArrayList<FunctionNameFilterInterface>();
FunctionNameFilterAll allFilter = new FunctionNameFilterAll();
allFilter.accept(null);
functionNameFilterList.add(allFilter);
List<FunctionName> functionNameList = FunctionManager.getInstance().getFunctionNameList(null, null);
for (FunctionName functionName : functionNameList) {
returnType = FunctionManager.getInstance().getFunctionType(functionName.getName());
assertEquals(functionName.getName(), functionName.getReturn().getType(), returnType);
}
}
use of org.opengis.filter.capability.FunctionName 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();
}
Aggregations