当前位置: 首页>>代码示例>>Java>>正文


Java Function类代码示例

本文整理汇总了Java中org.opengis.filter.expression.Function的典型用法代码示例。如果您正苦于以下问题:Java Function类的具体用法?Java Function怎么用?Java Function使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Function类属于org.opengis.filter.expression包,在下文中一共展示了Function类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createExpression

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Creates the expression.
 *
 * @param functionName the function name
 * @param argumentList the argument list
 * @return the expression
 */
/*
 * (non-Javadoc)
 * 
 * @see com.sldeditor.filter.v2.function.FunctionNameInterface#createExpression(org.opengis.filter.capability.FunctionName, java.util.List)
 */
@Override
public Expression createExpression(FunctionName functionName, List<Expression> argumentList) {
    if (functionName == null) {
        return null;
    }

    Literal fallback = null;
    Function function = functionFactory.function(functionName.getFunctionName(), argumentList,
            fallback);

    return function;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:FunctionManager.java

示例2: setOffset

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Sets the offset in a symbolizer.
 * 
 * @param symbolizer the symbolizer.
 * @param text the text representing the offsets in the CSV form.
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public static void setOffset( Symbolizer symbolizer, String text ) {
    if (text.indexOf(',') == -1) {
        return;
    }
    String[] split = text.split(",");
    if (split.length != 2) {
        return;
    }
    double xOffset = Double.parseDouble(split[0]);
    double yOffset = Double.parseDouble(split[1]);

    Expression geometry = symbolizer.getGeometry();
    if (geometry != null) {
        if (geometry instanceof FilterFunction_offset) {
            FilterFunction_offset offsetFunction = (FilterFunction_offset) geometry;
            List parameters = offsetFunction.getParameters();
            parameters.set(1, ff.literal(xOffset));
            parameters.set(2, ff.literal(yOffset));
        }
    } else {
        Function function = ff.function("offset", ff.property("the_geom"), ff.literal(xOffset), ff.literal(yOffset));
        symbolizer.setGeometry(function);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:32,代码来源:Utilities.java

示例3: classiferExample

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public void classiferExample() {
    SimpleFeatureCollection collection = null;
    SimpleFeature feature = null;
    // classiferExample start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Function classify = ff.function("Quantile", ff.property("name"), ff.literal(2));
    
    Classifier groups = (Classifier) classify.evaluate(collection);
    // classiferExample end
    // classiferExample2 start
    groups.setTitle(0, "Group A");
    groups.setTitle(1, "Group B");
    // classiferExample2 end
    
    // classiferExample3 start
    // groups is a classifier with "Group A" and "Group B"
    Function sort = ff.function("classify", ff.property("name"), ff.literal(groups));
    int slot = (Integer) sort.evaluate(feature);
    
    System.out.println(groups.getTitle(slot)); // ie. "Group A"
    // classiferExample3 end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:23,代码来源:BrewerExamples.java

示例4: visit

import org.opengis.filter.expression.Function; //导入依赖的package包/类
@Override
public Object visit(Function function, Object extraData) throws RuntimeException {
    helper.out = out;
    try {
        encodingFunction = true;
        boolean encoded = helper.visitFunction(function, extraData);
        encodingFunction = false;
        
        if(encoded) {
           return extraData; 
        } else {
            return super.visit(function, extraData);
        }
    } catch(IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:18,代码来源:MonetDBFilterToSQL.java

示例5: getFunctionName

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Maps a function to its native db equivalent
 * 
 * @param function
 * @return
 */
public String getFunctionName(Function function) {
    if(function instanceof FilterFunction_strLength) {
        return "char_length";
    } else if(function instanceof FilterFunction_strToLowerCase) {
        return "lower";
    } else if(function instanceof FilterFunction_strToUpperCase) {
        return "upper";
    } else if(function instanceof FilterFunction_abs ||
            function instanceof FilterFunction_abs_2 ||
            function instanceof FilterFunction_abs_3 ||
            function instanceof FilterFunction_abs_4) {
        return "abs";
    }
    return function.getName();
}
 
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:22,代码来源:FilterToSqlHelper.java

示例6: createExpression

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Creates the expression.
 *
 * @param envVar the env var
 * @return the expression
 */
@Override
public Expression createExpression(EnvVar envVar) {
    if (envVar == null) {
        return null;
    }

    Function function = ff.function("env", ff.literal(envVar.getName()));

    return function;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:17,代码来源:EnvironmentVariableManager.java

示例7: createExpression

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Creates the expression.
 *
 * @param functionName the function name
 * @return the expression
 */
@Override
public Expression createExpression(FunctionName functionName) {
    if (functionName == null) {
        return null;
    }

    List<Expression> parameters = null;
    Literal fallback = null;
    Function function = functionFactory.function(functionName.getFunctionName(), parameters,
            fallback);

    return function;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:FilterManager.java

示例8: getExpression

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Gets the expression.
 *
 * @param factory the factory
 * @return the expression
 */
public ProcessFunction getExpression(FunctionFactory factory) {
    List<Expression> overallParameterList = new ArrayList<Expression>();

    for (ProcessFunctionParameterValue value : valueList) {
        List<Expression> parameterList = new ArrayList<Expression>();
        parameterList.add(ff.literal(value.name));

        boolean setValue = true;
        if (value.optional) {
            setValue = value.included;
        }

        if (setValue) {
            if (value.objectValue != null) {
                Expression expression = value.objectValue.getExpression();
                if (expression != null) {
                    parameterList.add(expression);
                }
            }
        }

        if (setValue) {
            Function function = factory.function(PARAMETER, parameterList, null);

            overallParameterList.add(function);
        }
    }

    if (this.selectedFunction.getFunctionName() == null) {
        return null;
    }
    Function processFunction = factory.function(this.selectedFunction.getFunctionName(),
            overallParameterList, null);

    return (ProcessFunction) processFunction;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:43,代码来源:FunctionTableModel.java

示例9: ClassifiedStyleCreator

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public ClassifiedStyleCreator() {
Set<Function> funcs = CommonFactoryFinder.getFunctions(GeoTools
	.getDefaultHints());
ArrayList<String> fNames = new ArrayList<String>();
for (Function func : funcs) {
    if (func instanceof ClassificationFunction) {
	classifiers.add(func);
	fNames.add(func.getName());
    }
}
setPalette(DEFAULT_PALETTE);
setNumberOfClasses(DEFAULT_NUMBER_OF_CLASSES);
setClassifier(DEFAULT_CLASSIFIER);
   }
 
开发者ID:ianturton,项目名称:ShapefileViewer,代码行数:15,代码来源:ClassifiedStyleCreator.java

示例10: setClassifier

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public void setClassifier(String name) {
for (Function f : classifiers) {
    if (f.getName().equalsIgnoreCase(name)) {
	setClassifier(f);
	return;
    }
}
   }
 
开发者ID:ianturton,项目名称:ShapefileViewer,代码行数:9,代码来源:ClassifiedStyleCreator.java

示例11: getFunctionNames

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public List<String> getFunctionNames() {
ArrayList<String> ret = new ArrayList<String>();

for (Function f : classifiers) {
    ret.add(f.getName());

}
return ret;
   }
 
开发者ID:ianturton,项目名称:ShapefileViewer,代码行数:10,代码来源:ClassifiedStyleCreator.java

示例12: function

import org.opengis.filter.expression.Function; //导入依赖的package包/类
/**
 * Ritorna una function usando il nome
 */
@Override
public Function function(Name name, List<Expression> args, Literal fallback) {
	if( SnapFunction.NAME.getFunctionName().equals(name)){
           return new SnapFunction( args, fallback );
       }
	else if( Fluxomizer.NAME.getFunctionName().equals(name) ){
		return new Fluxomizer(args, fallback);
	}
       return null; // we do not implement that function
}
 
开发者ID:melvinm99,项目名称:fluxomajic3,代码行数:14,代码来源:FluxomajicFunctionFactory.java

示例13: function

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public Function function(Name name, List<Expression> args, Literal fallback) {
    if(new NameImpl("first").equals(name)){
        return new AbstractFunction( FIRST, args, fallback ){
            public Geometry evaluate(Object object) {
                Geometry geom = eval(object, 0, Geometry.class );
                Coordinate coordinate = geom.getCoordinate();
                return geom.getFactory().createPoint(coordinate);
            }
        };
    }
    return null; // we do not implement that function
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:13,代码来源:ExampleFunctionFactory2.java

示例14: classiferQuantile

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public void classiferQuantile() {
    SimpleFeatureCollection collection = null;
    SimpleFeature feature = null;
    // classiferQuantile start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Function classify = ff.function("Quantile", ff.property("zone"), ff.literal(2));
    
    // Zones assigned by a municipal board do not have an intrinsic numerical
    // meaning making them suitable for display using:
    // - qualitative palette where each zone would have the same visual impact
    Classifier groups = (Classifier) classify.evaluate(collection);
    // classiferQuantile end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:14,代码来源:BrewerExamples.java

示例15: classiferEqualInterval

import org.opengis.filter.expression.Function; //导入依赖的package包/类
public void classiferEqualInterval() {
    SimpleFeatureCollection collection = null;
    SimpleFeature feature = null;
    // classiferEqualInterval start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Function classify = ff.function("EqualInterval", ff.property("height"), ff.literal(5));
    
    // this will create a nice smooth series of intervals suitable for presentation
    // with:
    // - sequential color palette to make each height blend smoothly into the next
    // - diverging color palettes if you want to make higher and lower areas stand out more
    Classifier height = (Classifier) classify.evaluate(collection);
    // classiferEqualInterval end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:15,代码来源:BrewerExamples.java


注:本文中的org.opengis.filter.expression.Function类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。