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


Java FilterFactory2.literal方法代码示例

本文整理汇总了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");
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:21,代码来源:DefaultCriterionFilterConverter.java

示例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
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:44,代码来源:StyleExamples.java

示例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
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:11,代码来源:FilterExamples.java


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