本文整理汇总了Java中org.geotools.feature.simple.SimpleFeatureImpl类的典型用法代码示例。如果您正苦于以下问题:Java SimpleFeatureImpl类的具体用法?Java SimpleFeatureImpl怎么用?Java SimpleFeatureImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleFeatureImpl类属于org.geotools.feature.simple包,在下文中一共展示了SimpleFeatureImpl类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
// Draw a "Z"
path = new Path2D.Double();
path.moveTo(0, 0);
path.lineTo(3, 0);
path.lineTo(0, 3);
path.lineTo(3, 3);
product = new Product("p", "t", 4, 4);
band = product.addBand("b", "4 * (Y-0.5) + (X-0.5) + 0.1");
dataSourceConfig = new ProfilePlotPanel.DataSourceConfig();
SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder();
ftb.setName("ft");
ftb.add("lat", Double.class);
ftb.add("lon", Double.class);
ftb.add("data", Double.class);
SimpleFeatureType ft = ftb.buildFeatureType();
DefaultFeatureCollection fc = new DefaultFeatureCollection("id", ft);
fc.add(new SimpleFeatureImpl(new Object[]{0, 0, 0.3}, ft, new FeatureIdImpl("id1"), false));
fc.add(new SimpleFeatureImpl(new Object[]{0, 0, 0.5}, ft, new FeatureIdImpl("id2"), false));
fc.add(new SimpleFeatureImpl(new Object[]{0, 0, 0.7}, ft, new FeatureIdImpl("id3"), false));
fc.add(new SimpleFeatureImpl(new Object[]{0, 0, 0.1}, ft, new FeatureIdImpl("id4"), false));
dataSourceConfig.pointDataSource = new VectorDataNode("vd", fc);
dataSourceConfig.dataField = ft.getDescriptor("data");
dataSourceConfig.boxSize = 1;
dataSourceConfig.computeInBetweenPoints = true;
}
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:30,代码来源:ProfileDataTableModelTest.java
示例2: deserialize
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Override
public SimpleFeatureImpl deserialize(
final SimpleFeatureImpl t )
throws IOException {
final FeatureWritable fw = new FeatureWritable();
fw.readFields(dataInput);
return (SimpleFeatureImpl) fw.getFeature();
}
开发者ID:locationtech,项目名称:geowave,代码行数:9,代码来源:SimpleFeatureImplSerialization.java
示例3: serialize
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Override
public void serialize(
final SimpleFeatureImpl t )
throws IOException {
final FeatureWritable fw = new FeatureWritable(
t.getFeatureType(),
t);
fw.write(dataOutput);
}
开发者ID:locationtech,项目名称:geowave,代码行数:11,代码来源:SimpleFeatureImplSerialization.java
示例4: endElement
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.indexOf(":") > 0) {
qName = qName.substring(qName.indexOf(":") + 1);
}
switch (qName) {
case "MaskFeature":
if (currentFeaturePoligons.size() > 0) {
result.add(new SimpleFeatureImpl(currentFeaturePoligons.toArray(), featureType, currentFeatureId, true));
}
break;
case "Polygon":
if (currentLinearRing != null) {
currentFeaturePoligons.add(geometryFactory.createPolygon(currentLinearRing));
currentFeaturePoligons.add(String.format("Polygon-%s", linRingCount));
currentLinearRing = null;
}
break;
case "exterior":
break;
case "LinearRing":
if (currentCoordinates != null) {
if (currentCoordinates.get(0).equals2D(currentCoordinates.get(currentCoordinates.size() - 1))) {
currentLinearRing = geometryFactory.createLinearRing(currentCoordinates.toArray(new Coordinate[currentCoordinates.size()]));
} else {
systemLogger.warning(String.format("The linear ring #%s is not a closed polygon!", linRingCount));
}
currentCoordinates = null;
}
break;
case "posList":
StringTokenizer tokenizer = new StringTokenizer(buffer.toString(), " ", true);
currentCoordinates = new ArrayList<>();
int idx = 0;
Coordinate current = new Coordinate();
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (" ".equals(token)) {
if (idx == dimensions) {
currentCoordinates.add(current);
current = new Coordinate();
idx = 0;
}
} else {
current.setOrdinate(idx++, Double.parseDouble(token));
}
}
if (idx == dimensions) {
currentCoordinates.add(current);
}
break;
}
buffer.setLength(0);
}
开发者ID:senbox-org,项目名称:s2tbx,代码行数:56,代码来源:GMLReader.java
示例5: test
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的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);
}
开发者ID:locationtech,项目名称:geowave,代码行数:49,代码来源:FeatureSerializationTest.java
示例6: accept
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Override
public boolean accept(
final Class<?> c ) {
return SimpleFeatureImpl.class.isAssignableFrom(c);
}
开发者ID:locationtech,项目名称:geowave,代码行数:6,代码来源:SimpleFeatureImplSerialization.java
示例7: getDeserializer
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Override
public Deserializer<SimpleFeatureImpl> getDeserializer(
final Class<SimpleFeatureImpl> arg0 ) {
return new SFDeserializer();
}
开发者ID:locationtech,项目名称:geowave,代码行数:6,代码来源:SimpleFeatureImplSerialization.java
示例8: getSerializer
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
@Override
public Serializer<SimpleFeatureImpl> getSerializer(
final Class<SimpleFeatureImpl> arg0 ) {
return new SFSerializer();
}
开发者ID:locationtech,项目名称:geowave,代码行数:6,代码来源:SimpleFeatureImplSerialization.java
示例9: handleNonGeometricAttributes
import org.geotools.feature.simple.SimpleFeatureImpl; //导入依赖的package包/类
/**
*
* Handling non-spatial attributes only
**/
public void handleNonGeometricAttributes(SimpleFeatureImpl feature) throws UnsupportedEncodingException, FileNotFoundException {
try
{
String featureAttribute = "featureWithoutID";
String featureName = "featureWithoutName";
String featureClass = "featureWithoutClass";
//Feature id
if (feature.getAttribute(configuration.attribute) != null) {
featureAttribute = feature.getAttribute(configuration.attribute).toString();
}
//Feature name
if (feature.getAttribute(configuration.featname) != null) {
featureName = feature.getAttribute(configuration.featname).toString();
}
//Feature classification
if (feature.getAttribute(configuration.featclass) != null) {
featureClass = feature.getAttribute(configuration.featclass).toString();
}
if (!featureAttribute.equals(configuration.ignore))
{
String encodingType =
URLEncoder.encode(configuration.type,
UtilsConstants.UTF_8).replace(STRING_TO_REPLACE,
REPLACEMENT);
String encodingResource =
URLEncoder.encode(featureAttribute,
UtilsConstants.UTF_8).replace(STRING_TO_REPLACE,
REPLACEMENT);
String aux = encodingType + SEPARATOR + encodingResource;
//Insert literal for name (name of feature)
if ((!featureName.equals(configuration.ignore)) && (!featureName.equals(""))) //NOT NULL values only
{
insertResourceNameLiteral(
configuration.nsUri + aux,
configuration.nsUri + Constants.NAME,
featureName,
configuration.defaultLang );
}
//Insert literal for class (type of feature)
if ((!featureClass.equals(configuration.ignore)) && (!featureClass.equals(""))) //NOT NULL values only
{
encodingResource =
URLEncoder.encode(featureClass,
UtilsConstants.UTF_8).replace(STRING_TO_REPLACE,
REPLACEMENT);
//Type according to application schema
insertResourceTypeResource(
configuration.nsUri + aux,
configuration.nsUri + encodingResource);
}
}
}
catch(Exception e) {}
}
开发者ID:GeoKnow,项目名称:TripleGeo,代码行数:67,代码来源:ShpConnector.java
注:本文中的org.geotools.feature.simple.SimpleFeatureImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论