本文整理汇总了Java中org.opengis.feature.GeometryAttribute类的典型用法代码示例。如果您正苦于以下问题:Java GeometryAttribute类的具体用法?Java GeometryAttribute怎么用?Java GeometryAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeometryAttribute类属于org.opengis.feature包,在下文中一共展示了GeometryAttribute类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public static LinkedList<PreparedPolygon> load() throws IOException {
URL krajeShp = Kraje.class
.getResource("kraje/hranice_krajov_simpl.shp");
FileDataStore store = FileDataStoreFinder.getDataStore(krajeShp);
FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = store
.getFeatureSource();
FeatureCollection<SimpleFeatureType, SimpleFeature> fC = featureSource
.getFeatures();
FeatureIterator<SimpleFeature> iter = fC.features();
LinkedList<PreparedPolygon> list = new LinkedList<PreparedPolygon>();
try {
while (iter.hasNext()) {
Feature f = iter.next();
GeometryAttribute geomAttr = f.getDefaultGeometryProperty();
list.add(new PreparedPolygon((Polygonal) geomAttr.getValue()));
}
} finally {
iter.close();
}
return list;
}
示例2: makeProtoRoute
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public ProtoRoute makeProtoRoute(ExtendedFeature exft, Double speed) throws Exception {
GeometryAttribute geomAttr = exft.feat.getDefaultGeometryProperty();
MultiLineString geom = (MultiLineString) geomAttr.getValue();
if (FAIL_ON_MULTILINESTRING && geom.getNumGeometries() > 1) {
throw new Exception("Features may only contain a single linestring.");
}
double spacing = Config.getSpacing(exft, this.data);
LineString ls = (LineString) geom.getGeometryN(0);
ProtoRoute ret = this.makeProtoRouteStopsFromLinestring(ls, spacing);
ret.speed = speed;
return ret;
}
示例3: makeProtoRoute
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
@Override
public ProtoRoute makeProtoRoute(ExtendedFeature exft, Double speed) throws Exception {
GeometryAttribute geomAttr = exft.feat.getDefaultGeometryProperty();
MultiLineString geom = (MultiLineString) geomAttr.getValue();
if (FAIL_ON_MULTILINESTRING && geom.getNumGeometries() > 1) {
throw new Exception("Features may only contain a single linestring.");
}
LineString ls = (LineString) geom.getGeometryN(0);
ProtoRoute ret = this.makeProtoRouteStopsFromLinestring(ls);
ret.speed = speed;
return ret;
}
示例4: transformFeature
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
private Map<String, Object> transformFeature(SimpleFeature feature) {
Map<String, Object> attributes = new HashMap<String, Object>();
for (Property prop : feature.getProperties()) {
attributes.put(prop.getName().getLocalPart(), prop.getValue());
}
GeometryAttribute geometryProperty = feature
.getDefaultGeometryProperty();
if (geometryProperty != null) {
String wktGeometry = "";
try {
if (feature.getDefaultGeometry() != null) {
Geometry geometry = (Geometry) feature
.getDefaultGeometry();
if (simplifyGeometry > 0) {
DouglasPeuckerSimplifier simplifier = new DouglasPeuckerSimplifier(
geometry);
simplifier.setDistanceTolerance(simplifyGeometry);
geometry = simplifier.getResultGeometry();
}
if (transform != null) {
geometry = JTS.transform(geometry, transform);
}
wktGeometry = geometry.toString();
}
} catch (Exception e) {
LOGGER.warn("Could not convert Geometry to WKT String. Geometry will not be indexed!");
}
attributes.put(geometryProperty.getName().getLocalPart(),
wktGeometry);
attributes.put(FID_KEY, feature.getID());
}
return attributes;
}
示例5: getDefaultGeometryProperty
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public GeometryAttribute getDefaultGeometryProperty() {
return simpleFeature.getDefaultGeometryProperty();
}
示例6: setDefaultGeometryProperty
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public void setDefaultGeometryProperty(
GeometryAttribute geometryAttribute ) {
simpleFeature.setDefaultGeometryProperty(geometryAttribute);
}
示例7: main
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
public static void main (String[] args) throws Exception {
Map<String,Object> params = new HashMap<String,Object>();
params.put( "dbtype", "monetdb");
params.put( "host", "localhost");
params.put( "database", "test");
params.put( "user", "monetdb");
params.put( "passwd", "monetdb");
DataStore dataStore = (new MonetDBDataStoreFactory()).createDataStore( params );
if (dataStore == null) {
throw new Exception("Unable to create datastore!");
}
System.out.println("DataStore created!");
FeatureSource fsBuildings = dataStore.getFeatureSource("nyc_buildings");
//System.out.println("bc count: " + fsBC.getCount(Query.ALL));
System.out.println(fsBuildings.getSchema().getGeometryDescriptor());
Query query = Query.ALL;
query.setMaxFeatures(10);
FeatureCollection collection = fsBuildings.getFeatures(query);
System.out.println(collection.getBounds());
FeatureIterator iter = collection.features();
int counter = 0;
while(iter.hasNext()) {
Feature feature = iter.next();
//System.out.println(feature);
GeometryAttribute geom = feature.getDefaultGeometryProperty();
counter++;
if (counter >= 10) break;
}
dataStore.dispose();
}
示例8: getDefaultGeometryProperty
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
/** Not Implemented. Use Attributes */
public GeometryAttribute getDefaultGeometryProperty() {return null;}
示例9: setDefaultGeometryProperty
import org.opengis.feature.GeometryAttribute; //导入依赖的package包/类
/** Not Implemented. Use Attributes */
public void setDefaultGeometryProperty(GeometryAttribute arg0) {}