本文整理汇总了Java中org.opengis.filter.FilterFactory2.literal方法的典型用法代码示例。如果您正苦于以下问题:Java FilterFactory2.literal方法的具体用法?Java FilterFactory2.literal怎么用?Java FilterFactory2.literal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.filter.FilterFactory2
的用法示例。
在下文中一共展示了FilterFactory2.literal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
@Override
public void visit(DWithinCriterion criterion, Object context) {
FilterContext fc = (FilterContext) context;
String name = criterion.getAttributeName();
if (name == null) {
name = fc.getDefaultGeometryName();
}
Geometry geometry;
try {
geometry = converterService.toInternal(criterion.getValue());
geometry = check(geometry);
FilterFactory2 ff = (FilterFactory2) filterService.getFilterFactory();
Expression nameExpression = ff.property(name);
Literal geomLiteral = ff.literal(geometry);
Filter filter = ff.dwithin(nameExpression, geomLiteral, criterion.getDistance(), criterion.getUnits());
fc.setFilter(filter);
} catch (GeomajasException e) {
throw new IllegalArgumentException("Unparseable geometry in filter");
}
}
示例2: styleFactoryExample
import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
/**
* This example is limited to just the gt-opengis style interfaces which are immutable once created.
*
* @throws Exception
*/
private void styleFactoryExample() throws Exception {
// styleFactoryExample start
//
org.opengis.style.StyleFactory sf = CommonFactoryFinder.getStyleFactory();
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
//
// create the graphical mark used to represent a city
Stroke stroke = sf.stroke(ff.literal("#000000"), null, null, null, null, null, null);
Fill fill = sf.fill(null, ff.literal(Color.BLUE), ff.literal(1.0));
// OnLineResource implemented by gt-metadata - so no factory!
OnLineResourceImpl svg = new OnLineResourceImpl(new URI("file:city.svg"));
svg.freeze(); // freeze to prevent modification at runtime
OnLineResourceImpl png = new OnLineResourceImpl(new URI("file:city.png"));
png.freeze(); // freeze to prevent modification at runtime
//
// List of symbols is considered in order with the rendering engine choosing
// the first one it can handle. Allowing for svg, png, mark order
List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
symbols.add(sf.externalGraphic(svg, "svg", null)); // svg preferred
symbols.add(sf.externalGraphic(png, "png", null)); // png preferred
symbols.add(sf.mark(ff.literal("circle"), fill, stroke)); // simple circle backup plan
Expression opacity = null; // use default
Expression size = ff.literal(10);
Expression rotation = null; // use default
AnchorPoint anchor = null; // use default
Displacement displacement = null; // use default
// define a point symbolizer of a small circle
Graphic circle = sf.graphic(symbols, opacity, size, rotation, anchor, displacement);
PointSymbolizer pointSymbolizer = sf.pointSymbolizer("point", ff.property("the_geom"), null,
null, circle);
// styleFactoryExample end
}
示例3: 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
}