本文整理汇总了Java中org.opengis.filter.FilterFactory2.function方法的典型用法代码示例。如果您正苦于以下问题:Java FilterFactory2.function方法的具体用法?Java FilterFactory2.function怎么用?Java FilterFactory2.function使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.filter.FilterFactory2
的用法示例。
在下文中一共展示了FilterFactory2.function方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: classiferExample
import org.opengis.filter.FilterFactory2; //导入方法依赖的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
}
示例2: expressionExamples
import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
private void expressionExamples() {
Geometry geometry = null;
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
// expressionExamples start
Expression propertyAccess = ff.property("THE_GEOM");
Expression literal = ff.literal(geometry);
Expression math = ff.add(ff.literal(1), ff.literal(2));
Expression function = ff.function("length", ff.property("CITY_NAME"));
// expressionExamples end
}
示例3: classiferQuantile
import org.opengis.filter.FilterFactory2; //导入方法依赖的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
}
示例4: classiferEqualInterval
import org.opengis.filter.FilterFactory2; //导入方法依赖的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
}
示例5: colorBrewerExample
import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
void colorBrewerExample(SimpleFeatureCollection featureCollection) {
// colorBrewerExample start
// STEP 0 Set up Color Brewer
ColorBrewer brewer = ColorBrewer.instance();
// STEP 1 - call a classifier function to summarise your content
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
PropertyName propteryExpression = ff.property("height");
// classify into five categories
Function classify = ff.function("Quantile", propteryExpression, ff.literal(5));
Classifier groups = (Classifier) classify.evaluate(featureCollection);
// STEP 2 - look up a predefined palette from color brewer
String paletteName = "GrBu";
Color[] colors = brewer.getPalette(paletteName).getColors(5);
// STEP 3 - ask StyleGenerator to make a set of rules for the Classifier
// assigning features the correct color based on height
FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
groups,
propteryExpression,
colors,
"Generated FeatureTypeStyle for GreeBlue",
featureCollection.getSchema().getGeometryDescriptor(),
StyleGenerator.ELSEMODE_IGNORE,
0.95,
null);
// colorBrewerExample end
}