本文整理汇总了Java中org.opengis.feature.type.AttributeDescriptor.getDefaultValue方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeDescriptor.getDefaultValue方法的具体用法?Java AttributeDescriptor.getDefaultValue怎么用?Java AttributeDescriptor.getDefaultValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.feature.type.AttributeDescriptor
的用法示例。
在下文中一共展示了AttributeDescriptor.getDefaultValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFeature
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
public static SimpleFeature buildFeature(
final SimpleFeatureType featureType,
final Pair<String, Object>[] entries ) {
final List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature newFeature = SimpleFeatureBuilder.build(
featureType,
defaults,
UUID.randomUUID().toString());
for (final Pair<String, Object> entry : entries) {
newFeature.setAttribute(
entry.getKey(),
entry.getValue());
}
return newFeature;
}
示例2: setup
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException {
type = DataUtilities.createType(
"geostuff",
"geom:Geometry:srid=4326,pop:java.lang.Long,pid:String");
final List<AttributeDescriptor> descriptors = type.getAttributeDescriptors();
defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
}
示例3: create
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
private SimpleFeature create(
final String pid ) {
final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature newFeature = SimpleFeatureBuilder.build(
schema,
defaults,
UUID.randomUUID().toString());
newFeature.setAttribute(
"pid",
pid);
return newFeature;
}
示例4: create
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
private SimpleFeature create(
final String pid,
final Set<String> set ) {
final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature newFeature = SimpleFeatureBuilder.build(
schema,
defaults,
UUID.randomUUID().toString());
newFeature.setAttribute(
"pid",
pid);
set.add(pid);
return newFeature;
}
示例5: NonSimpleFeatureConverter
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
public NonSimpleFeatureConverter(
final String[] extraDimensionNames,
final Class<? extends Geometry> shapeClass ) {
featureType = AnalyticFeature.createFeatureAdapter(
centroidDataTypeId,
extraDimensionNames,
BasicFeatureTypes.DEFAULT_NAMESPACE,
ClusteringUtils.CLUSTERING_CRS,
ClusterFeatureAttribute.values(),
shapeClass).getFeatureType();
this.shapeClass = shapeClass;
final List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors();
defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
}
示例6: setup
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException {
type = DataUtilities.createType(
"geostuff",
"geometry:Geometry:srid=4326,vis:java.lang.String,pop:java.lang.Long,pid:String");
descriptors = type.getAttributeDescriptors();
defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
newFeature = SimpleFeatureBuilder.build(
type,
defaults,
UUID.randomUUID().toString());
newFeature.setAttribute(
"pop",
Long.valueOf(100));
newFeature.setAttribute(
"pid",
UUID.randomUUID().toString());
newFeature.setAttribute(
"vis",
"{\"pid\":\"TS\", \"geo.*\":\"S\"}");
newFeature.setAttribute(
"geometry",
factory.createPoint(new Coordinate(
43.454,
128.232)));
}
示例7: create
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
private SimpleFeature create(
final Double val ) {
final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature newFeature = SimpleFeatureBuilder.build(
schema,
defaults,
UUID.randomUUID().toString());
newFeature.setAttribute(
"pop",
val);
newFeature.setAttribute(
"pid",
UUID.randomUUID().toString());
newFeature.setAttribute(
"when",
new Date());
newFeature.setAttribute(
"whennot",
new Date());
newFeature.setAttribute(
"geometry",
factory.createPoint(new Coordinate(
27.25,
41.25)));
return newFeature;
}
示例8: SimpleFeatureConverter
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
public SimpleFeatureConverter(
final FeatureDataAdapter adapter,
final Class<? extends Geometry> shapeClass ) {
type = createFeatureType(
adapter.getFeatureType(),
shapeClass);
int p = 0;
this.shapeClass = shapeClass;
final List<AttributeDescriptor> descriptors = adapter.getFeatureType().getAttributeDescriptors();
defaults = new Object[descriptors.size()];
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
}
示例9: test
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
@Test
public void test()
throws SchemaException {
SimpleFeatureType schema = DataUtilities.createType(
"testGeo",
"location:Point:srid=4326,name:String");
List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
SimpleFeature feature = SimpleFeatureBuilder.build(
schema,
defaults,
UUID.randomUUID().toString());
final GeometryFactory geoFactory = new GeometryFactory();
feature.setAttribute(
"location",
geoFactory.createPoint(new Coordinate(
-45,
45)));
Point point = extractor.getCentroid(feature);
assertEquals(
4326,
point.getSRID());
}
示例10: testInferredRange
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
@Test
public void testInferredRange()
throws SchemaException {
final SimpleFeatureType schema = DataUtilities.createType(
"sp.geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,start:Date,end:Date,pid:String");
final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature newFeature = SimpleFeatureBuilder.build(
schema,
defaults,
UUID.randomUUID().toString());
newFeature.setAttribute(
"pop",
Long.valueOf(100));
newFeature.setAttribute(
"pid",
UUID.randomUUID().toString());
newFeature.setAttribute(
"start",
time1);
newFeature.setAttribute(
"end",
time2);
newFeature.setAttribute(
"geometry",
factory.createPoint(new Coordinate(
27.25,
41.25)));
final AvroFeatureDataAdapter dataAdapter = new AvroFeatureDataAdapter(
schema,
new GlobalVisibilityHandler<SimpleFeature, Object>(
"default"));
final PrimaryIndex index = new SpatialIndexBuilder().createIndex();
dataAdapter.init(index);
final byte[] binary = dataAdapter.toBinary();
final AvroFeatureDataAdapter dataAdapterCopy = new AvroFeatureDataAdapter();
dataAdapterCopy.fromBinary(binary);
assertEquals(
dataAdapterCopy.getAdapterId(),
dataAdapter.getAdapterId());
assertEquals(
dataAdapterCopy.getFeatureType(),
dataAdapter.getFeatureType());
assertEquals(
Boolean.TRUE,
dataAdapterCopy.getFeatureType().getDescriptor(
"end").getUserData().get(
"end"));
assertEquals(
Boolean.TRUE,
dataAdapterCopy.getFeatureType().getDescriptor(
"start").getUserData().get(
"start"));
final List<IndexFieldHandler<SimpleFeature, ? extends CommonIndexValue, Object>> handlers = dataAdapterCopy
.getDefaultTypeMatchingHandlers(schema);
boolean found = false;
for (final IndexFieldHandler<SimpleFeature, ? extends CommonIndexValue, Object> handler : handlers) {
found |= ((handler instanceof FeatureTimeRangeHandler)
&& ((((FeatureTimeRangeHandler) handler).toIndexValue(
newFeature).toNumericData().getMin() - time1.getTime()) < 0.001) && ((((FeatureTimeRangeHandler) handler)
.toIndexValue(
newFeature)
.toNumericData()
.getMax() - time2.getTime()) < 0.001));
}
assertTrue(found);
}
示例11: createGeometryFeature
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
public static SimpleFeature createGeometryFeature(
final SimpleFeatureType featureType,
final String batchId,
final String dataId,
final String name,
final String groupID,
final double weight,
final Geometry geometry,
final String[] extraDimensionNames,
final double[] extraDimensions,
final int zoomLevel,
final int iteration,
final long count ) {
if (extraDimensionNames.length != extraDimensions.length) {
LOGGER.error("The number of extraDimension names does not equal the number of extraDimensions");
throw new IllegalArgumentException(
"The number of extraDimension names does not equal the number of extraDimensions");
}
final List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature newFeature = SimpleFeatureBuilder.build(
featureType,
defaults,
dataId);
newFeature.setAttribute(
ClusterFeatureAttribute.NAME.attrName(),
name);
newFeature.setAttribute(
ClusterFeatureAttribute.GROUP_ID.attrName(),
groupID);
newFeature.setAttribute(
ClusterFeatureAttribute.ITERATION.attrName(),
iteration);
newFeature.setAttribute(
ClusterFeatureAttribute.WEIGHT.attrName(),
weight);
newFeature.setAttribute(
ClusterFeatureAttribute.BATCH_ID.attrName(),
batchId);
newFeature.setAttribute(
ClusterFeatureAttribute.COUNT.attrName(),
count);
newFeature.setAttribute(
ClusterFeatureAttribute.GEOMETRY.attrName(),
geometry);
newFeature.setAttribute(
ClusterFeatureAttribute.ZOOM_LEVEL.attrName(),
zoomLevel);
int i = 0;
for (final String dimName : extraDimensionNames) {
newFeature.setAttribute(
dimName,
new Double(
extraDimensions[i++]));
}
return newFeature;
}
示例12: test
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
@Test
public void test()
throws SchemaException {
final Kryo kryo = new Kryo();
kryo.register(
SimpleFeatureImpl.class,
new FeatureSerializer());
final SimpleFeatureType schema = DataUtilities.createType(
"testGeo",
"location:Point:srid=4326,name:String");
final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
final Object[] defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
final SimpleFeature feature = SimpleFeatureBuilder.build(
schema,
defaults,
UUID.randomUUID().toString());
final GeometryFactory geoFactory = new GeometryFactory();
feature.setAttribute(
"location",
geoFactory.createPoint(new Coordinate(
-45,
45)));
final Output output = new OutputChunked();
kryo.getSerializer(
SimpleFeatureImpl.class).write(
kryo,
output,
feature);
final Input input = new InputChunked();
input.setBuffer(output.getBuffer());
final SimpleFeature f2 = (SimpleFeature) kryo.getSerializer(
SimpleFeatureImpl.class).read(
kryo,
input,
SimpleFeatureImpl.class);
assertEquals(
feature,
f2);
}