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


Java AttributeType.getBinding方法代码示例

本文整理汇总了Java中org.opengis.feature.type.AttributeType.getBinding方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeType.getBinding方法的具体用法?Java AttributeType.getBinding怎么用?Java AttributeType.getBinding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opengis.feature.type.AttributeType的用法示例。


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

示例1: getLiteral

import org.opengis.feature.type.AttributeType; //导入方法依赖的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

示例2: getGKBinding

import org.opengis.feature.type.AttributeType; //导入方法依赖的package包/类
public static int getGKBinding(AttributeType at) {
	Class<?> c = at.getBinding();
	int binding;
	if (c == java.lang.Integer.class || c == java.lang.Long.class)
		binding = ValueMetaInterface.TYPE_INTEGER;
	else if (c == java.lang.Double.class)
		binding = ValueMetaInterface.TYPE_NUMBER;
	else if (c == java.util.Date.class)
		binding = ValueMetaInterface.TYPE_DATE;
	else if (com.vividsolutions.jts.geom.Geometry.class.isAssignableFrom(c))
		binding = ValueMetaInterface.TYPE_GEOMETRY;
	else
		binding = ValueMetaInterface.TYPE_STRING;
	return binding;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:16,代码来源:GTUtils.java

示例3: createSpec

import org.opengis.feature.type.AttributeType; //导入方法依赖的package包/类
private DataTableSpec createSpec(SimpleFeatureType type) {
	List<DataColumnSpec> columns = new ArrayList<>();
	Set<String> columnNames = new LinkedHashSet<>();

	for (AttributeType t : type.getTypes()) {
		String name;

		if (t == type.getGeometryDescriptor().getType()) {
			name = type.getGeometryDescriptor().getName().toString();
		} else {
			name = t.getName().toString();
		}

		if (t == type.getGeometryDescriptor().getType()) {
			columns.add(new DataColumnSpecCreator(name, ShapeBlobCell.TYPE).createSpec());
		} else if (t.getBinding() == Integer.class) {
			columns.add(new DataColumnSpecCreator(name, IntCell.TYPE).createSpec());
		} else if (t.getBinding() == Double.class) {
			columns.add(new DataColumnSpecCreator(name, DoubleCell.TYPE).createSpec());
		} else if (t.getBinding() == Boolean.class) {
			columns.add(new DataColumnSpecCreator(name, BooleanCell.TYPE).createSpec());
		} else {
			columns.add(new DataColumnSpecCreator(name, StringCell.TYPE).createSpec());
		}

		columnNames.add(name);
	}

	latitudeColumn = KnimeUtils.createNewValue(LATITUDE_COLUMN, columnNames);
	longitudeColumn = KnimeUtils.createNewValue(LONGITUDE_COLUMN, columnNames);
	areaColumn = KnimeUtils.createNewValue(AREA_COLUMN, columnNames);

	columns.add(new DataColumnSpecCreator(latitudeColumn, DoubleCell.TYPE).createSpec());
	columns.add(new DataColumnSpecCreator(longitudeColumn, DoubleCell.TYPE).createSpec());
	columns.add(new DataColumnSpecCreator(areaColumn, DoubleCell.TYPE).createSpec());

	return new DataTableSpec(columns.toArray(new DataColumnSpec[0]));
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:39,代码来源:ShapefileReaderNodeModel.java

示例4: create

import org.opengis.feature.type.AttributeType; //导入方法依赖的package包/类
/**
 * Creates the sample data from the supplied schema.
 *
 * @param schema the schema
 * @param fieldList the field list
 */
public void create(FeatureType schema, List<DataSourceAttributeData> fieldList) {
    if (schema == null) {
        return;
    }

    // Put fields into map for speed
    Map<String, DataSourceAttributeData> fieldMap = 
            new HashMap<String, DataSourceAttributeData>();
    if (fieldList != null) {
        for (DataSourceAttributeData attributeData : fieldList) {
            fieldMap.put(attributeData.getName(), attributeData);
        }
    }

    SimpleFeatureType featureType = (SimpleFeatureType) schema;
    memory = new MemoryDataStore();
    try {
        memory.createSchema(featureType);
    } catch (IOException e) {
        ConsoleManager.getInstance().exception(this, e);
        memory = null;
        return;
    }
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);

    SimpleFeature feature = DataUtilities.template(featureType);

    builder.init((SimpleFeature) feature);
    int index = 0;
    for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) {
        AttributeType attributeType = descriptor.getType();
        Object value = null;
        Class<?> fieldType = attributeType.getBinding();
        if (attributeType instanceof GeometryTypeImpl) {
            geometryType = GeometryTypeMapping.getGeometryType(fieldType);

            switch (geometryType) {
            case POLYGON:
                ExamplePolygonInterface examplePolygon = DataSourceFactory
                        .createExamplePolygon(null);
                value = examplePolygon.getPolygon();
                break;
            case LINE:
                ExampleLineInterface exampleLine = DataSourceFactory.createExampleLine(null);
                value = exampleLine.getLine();
                break;
            case POINT:
            default:
                ExamplePointInterface examplePoint = DataSourceFactory.createExamplePoint(null);
                value = examplePoint.getPoint();
                break;
            }
        } else {
            if ((fieldList != null) && (index < fieldList.size())) {
                DataSourceAttributeData attrData = fieldMap.get(descriptor.getLocalName());

                if (attrData != null) {
                    value = attrData.getValue();
                }
            }

            value = getFieldTypeValue(index, attributeType.getName().getLocalPart(), fieldType,
                    value);
        }
        builder.add(value);
        index++;
    }

    SimpleFeature newFeature = builder.buildFeature("1234");
    memory.addFeature(newFeature);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:78,代码来源:CreateSampleData.java


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