• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Literal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visitLiteralGeometry

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
protected void visitLiteralGeometry(Literal expression) throws IOException {
    // evaluate the literal and store it for later
    currentGeometry  = (Geometry) evaluateLiteral(expression, Geometry.class);

    if ( currentGeometry instanceof LinearRing ) {
        // convert LinearRing to LineString
        final GeometryFactory factory = currentGeometry.getFactory();
        final LinearRing linearRing = (LinearRing) currentGeometry;
        final CoordinateSequence coordinates;
        coordinates = linearRing.getCoordinateSequence();
        currentGeometry = factory.createLineString(coordinates);
    }

    final String geoJson = new GeometryJSON().toString(currentGeometry);
    currentShapeBuilder = mapReader.readValue(geoJson);
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:17,代码来源:FilterToElastic.java


示例2: getGraphicSize

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
/**
 * Gets a numeric value for the given graphic
 * 
 * @param feature sample to be used for evals
 * @param pointSymbolizer symbolizer
 * @param defaultSize size to use is none can be taken from the graphic
 */
private double getGraphicSize(Feature feature, Graphic graphic, int defaultSize) {
    if (graphic != null) {
        Expression sizeExp = graphic.getSize();
        if (sizeExp instanceof Literal) {
            Object size = sizeExp.evaluate(feature);
            if (size != null) {
                if (size instanceof Double) {
                    return (Double) size;
                }
                try {
                    return Double.parseDouble(size.toString());
                } catch (NumberFormatException e) {
                    return defaultSize;
                }

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


示例3: getWidthSize

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
/**
 * Gets a numeric value for the given graphic
 * 
 * @param feature sample to be used for evals
 * @param pointSymbolizer symbolizer
 * @param defaultSize size to use is none can be taken from the graphic
 */
private double getWidthSize(Feature feature, Expression widthExp, int defaultSize) {
    if (widthExp != null) {
        if (widthExp instanceof Literal) {
            Object size = widthExp.evaluate(feature);
            if (size != null) {
                if (size instanceof Double) {
                    return (Double) size;
                }
                try {
                    return Double.parseDouble(size.toString());
                } catch (NumberFormatException e) {
                    return defaultSize;
                }
            }
        }
    }
    return defaultSize;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:SLDEditorBufferedImageLegendGraphicBuilder.java


示例4: createExpression

import org.opengis.filter.expression.Literal; //导入依赖的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


示例5: visitDistanceSpatialOperator

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
protected void visitDistanceSpatialOperator(DistanceBufferOperator filter,
        PropertyName property, Literal geometry, boolean swapped,
        Object extraData) {

    property.accept(delegate, extraData);
    key = (String) delegate.field;
    geometry.accept(delegate, extraData);
    final Geometry geo = delegate.currentGeometry;
    lat = geo.getCentroid().getY();
    lon = geo.getCentroid().getX();
    final double inputDistance = filter.getDistance();
    final String inputUnits = filter.getDistanceUnits();
    distance = Double.valueOf(toMeters(inputDistance, inputUnits));

    delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
            "filter", ImmutableMap.of("geo_distance", 
                    ImmutableMap.of("distance", distance+SI.METER.toString(), key, ImmutableList.of(lon,lat)))));

    if ((filter instanceof DWithin && swapped)
            || (filter instanceof Beyond && !swapped)) {
        delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", delegate.queryBuilder));
    }
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:24,代码来源:FilterToElasticHelper.java


示例6: clipToWorld

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
protected Literal clipToWorld(Literal geometry) {
    if(geometry != null) {
        Geometry g = geometry.evaluate(null, Geometry.class);
        if(g != null) {
            g.apply(new GeometryComponentFilter() {
                @Override
                public void filter(Geometry geom) {
                    geom.apply(new CoordinateFilter() {
                        @Override
                        public void filter(Coordinate coord) {
                            coord.setCoordinate(new Coordinate(clipLon(coord.x),clipLat(coord.y)));
                        }
                    });
                }
            });
            geometry = CommonFactoryFinder.getFilterFactory(null).literal(g);

        }
    }

    return geometry;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:23,代码来源:FilterToElasticHelper.java


示例7: getLiteral

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
private static Literal getLiteral(Object o, AttributeType type) {
	Class<?> c = type.getBinding();
	Literal l = null;
	String s = o.toString();
	if (c == java.lang.Double.class)
		l = FF.literal(Double.parseDouble(s));
	else if (c == java.lang.Integer.class)
		l = FF.literal(Integer.parseInt(s));
	else if (c == java.lang.Long.class)
		l = FF.literal(Long.parseLong(s));
	else if (c == java.lang.Character.class)
		l = FF.literal(s.charAt(0));
	else if (c == java.lang.Boolean.class)
		l = FF.literal(Boolean.parseBoolean(s));
	else if (c == java.lang.Short.class)
		l = FF.literal(Short.parseShort(s));
	else if (c == java.lang.String.class)
		l = FF.literal(s);
	else
		l = FF.literal(o);
	return l;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:23,代码来源:GTUtils.java


示例8: utcTimeZone

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
private static void utcTimeZone() throws Exception{
	
	// utcTimeZone start
    Filter filter = ECQL.toFilter("2006-11-30T01:00:00+03:00 DURING 2006-11-30T00:30:00+03:00/2006-11-30T01:30:00+03:00 ");
	// utcTimeZone end
    Utility.prittyPrintFilter(filter);
    
    Boolean result = filter.evaluate(null);
    System.out.println("Result of filter evaluation: " + result);

    During during = (During) filter;
    Literal literal = (Literal)during.getExpression1();
    Date date = (Date)literal.getValue();
    
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
    TimeZone tz = TimeZone.getTimeZone("GMT+0300");
    sdf.setTimeZone(tz);
    System.out.println("Expression 1 as Date: " +sdf.format(date));
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:20,代码来源:ECQLExamples.java


示例9: visit

import org.opengis.filter.expression.Literal; //导入依赖的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


示例10: visitLiteralGeometry

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
@Override
protected void visitLiteralGeometry(Literal expression) throws IOException {
    // evaluate the literal and store it for later
    Geometry geom  = (Geometry) evaluateLiteral(expression, Geometry.class);
    
    if ( geom instanceof LinearRing ) {
        //postgis does not handle linear rings, convert to just a line string
        geom = geom.getFactory().createLineString(((LinearRing) geom).getCoordinateSequence());
    }
            
    out.write("GeomFromText('");
    out.write(geom.toText());
    if(currentSRID == null && currentGeometry  != null) {
        // if we don't know at all, use the srid of the geometry we're comparing against
        // (much slower since that has to be extracted record by record as opposed to 
        // being a constant)
        out.write("', SRID(\"" + currentGeometry.getLocalName() + "\"))");
    } else {
        out.write("', " + currentSRID + ")");
    }
    
}
 
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:23,代码来源:MonetDBFilterToSQL.java


示例11: visitBinarySpatialOperator

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
        PropertyName property, Literal geometry, boolean swapped,
        Object extraData) {
    try {
        if (filter instanceof DistanceBufferOperator) {
            visitDistanceSpatialOperator((DistanceBufferOperator) filter,
                    property, geometry, swapped, extraData);
        } else {
            visitComparisonSpatialOperator(filter, property, geometry,
                    swapped, extraData);
        }
    } catch (IOException e) {
        throw new RuntimeException(IO_ERROR, e);
    }
    return extraData;
}
 
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:17,代码来源:FilterToSqlHelper.java


示例12: visitDistanceSpatialOperator

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
void visitDistanceSpatialOperator(DistanceBufferOperator filter,
        PropertyName property, Literal geometry, boolean swapped,
        Object extraData) throws IOException {
    if ((filter instanceof DWithin && !swapped)
            || (filter instanceof Beyond && swapped)) {
        out.write("ST_DWithin(");
        property.accept(delegate, extraData);
        out.write(",");
        geometry.accept(delegate, extraData);
        out.write(",");
        out.write(toMeters(filter.getDistance(), filter.getDistanceUnits()));
        out.write(")");
    }
    if ((filter instanceof DWithin && swapped)
            || (filter instanceof Beyond && !swapped)) {
        out.write("Distance(");
        property.accept(delegate, extraData);
        out.write(",");
        geometry.accept(delegate, extraData);
        out.write(") > ");
        out.write(Double.toString(filter.getDistance()));
    }
}
 
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:24,代码来源:FilterToSqlHelper.java


示例13: createRGBImageSymbol

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
/**
 * Creates the rgb image symbol.
 *
 * @param sym the sym
 * @param cov the cov
 * @param raster the raster
 */
private void createRGBImageSymbol(RasterSymbolizer sym, GridCoverage2D cov,
        WritableRaster raster) {
    double dest;
    List<Double> valueList = new ArrayList<Double>();

    GridEnvelope2D gridRange2D = cov.getGridGeometry().getGridRange2D();
    for (int x = 0; x < gridRange2D.getWidth(); x++) {
        for (int y = 0; y < gridRange2D.getHeight(); y++) {
            try {
                dest = raster.getSampleDouble(x, y, 0);

                if (!valueList.contains(dest)) {
                    valueList.add(dest);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    ColorMapImpl colourMap = new ColorMapImpl();

    // Sort the unique sample values in ascending order
    Collections.sort(valueList);

    // Create colour amp entries in the colour map for all the sample values
    for (Double value : valueList) {
        ColorMapEntry entry = new ColorMapEntryImpl();
        Literal colourExpression = ff
                .literal(ColourUtils.fromColour(ColourUtils.createRandomColour()));
        entry.setColor(colourExpression);
        entry.setQuantity(ff.literal(value.doubleValue()));

        colourMap.addColorMapEntry(entry);
    }

    colourMap.setType(ColorMap.TYPE_VALUES);
    sym.setColorMap(colourMap);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:47,代码来源:RasterReader.java


示例14: setSolidFill

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
/**
 * Sets the solid fill.
 *
 * @param fieldConfigManager the field config manager
 * @param expFillColour the exp fill colour
 * @param expFillColourOpacity the exp fill colour opacity
 */
public void setSolidFill(GraphicPanelFieldManager fieldConfigManager, Expression expFillColour,
        Expression expFillColourOpacity) {
    if (symbolTypeField != null) {
        FieldConfigBase field = fieldConfigManager.get(this.selectionComboBox);
        Literal expression = ff.literal(SOLID_FILL_VALUE);
        field.populate(expression);

        markerField.setSolidFill(fieldConfigManager, expFillColour, expFillColourOpacity);
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:18,代码来源:SymbolTypeFactory.java


示例15: createExpression

import org.opengis.filter.expression.Literal; //导入依赖的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


示例16: function

import org.opengis.filter.expression.Literal; //导入依赖的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


示例17: SnapFunction

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
public SnapFunction(List<Expression> parameters, Literal fallback) {
	Logger.getLogger("org.geoserver.wms").severe("COSTRUTTORE!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
	
	this.parameters = parameters;
	this.fallback = fallback;
	
	Logger.getLogger("org.geoserver.wms").severe(parameters.get(0).toString());
}
 
开发者ID:melvinm99,项目名称:fluxomajic3,代码行数:9,代码来源:SnapFunction.java


示例18: visitBinarySpatialOperator

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
        PropertyName property, Literal geometry, boolean swapped,
        Object extraData) {

    if (filter instanceof DistanceBufferOperator) {
        visitDistanceSpatialOperator((DistanceBufferOperator) filter,
                property, geometry, swapped, extraData);
    } else {
        visitComparisonSpatialOperator(filter, property, geometry,
                swapped, extraData);
    }
    return extraData;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:14,代码来源:FilterToElasticHelper.java


示例19: visitComparisonSpatialOperator

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
void visitComparisonSpatialOperator(BinarySpatialOperator filter,
        PropertyName property, Literal geometry, boolean swapped, Object extraData) {

    // if geography case, sanitize geometry first
    this.geometry = geometry;
    if(isCurrentGeography()) {
        this.geometry = clipToWorld(geometry);
    }

    visitBinarySpatialOperator(filter, (Expression)property, (Expression)this.geometry, swapped, extraData);

    // if geography case, sanitize geometry first
    if(isCurrentGeography()) {
        if(isWorld(this.geometry)) {
            // nothing to filter in this case
            delegate.queryBuilder = MATCH_ALL;
            return;
        } else if(isEmpty(this.geometry)) {
            if(!(filter instanceof Disjoint)) {
                delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", MATCH_ALL));
            } else {
                delegate.queryBuilder = MATCH_ALL;
            }
            return;
        }
    }

    visitBinarySpatialOperator(filter, (Expression)property, (Expression)this.geometry, swapped, extraData);
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:30,代码来源:FilterToElasticHelper.java


示例20: isWorld

import org.opengis.filter.expression.Literal; //导入依赖的package包/类
/**
 * Returns true if the geometry covers the entire world
 * @param geometry
 * @return
 */
protected boolean isWorld(Literal geometry) {
    boolean result = false;
    if(geometry != null) {
        Geometry g = geometry.evaluate(null, Geometry.class);
        if(g != null) {
            result = JTS.toGeometry(WORLD).equalsTopo(g.union());
        }
    }
    return result;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:16,代码来源:FilterToElasticHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValueSource类代码示例发布时间:2022-05-21
下一篇:
Java CannotWriteException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap