本文整理了Java中com.vividsolutions.jts.geom.Polygon.setUserData()
方法的一些代码示例,展示了Polygon.setUserData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.setUserData()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Polygon
类名称:Polygon
方法名:setUserData
暂无
代码示例来源:origin: opentripplanner/OpenTripPlanner
shell.setUserData(new ArrayList<LinearRing>());
代码示例来源:origin: opentripplanner/OpenTripPlanner
shell.setUserData(new ArrayList<LinearRing>());
代码示例来源:origin: org.geotools/gt-render
public void setUserData(Object userData) {
polygon.setUserData(userData);
}
代码示例来源:origin: com.vividsolutions/jts
cellPoly.setUserData(v.getCoordinate());
return cellPoly;
代码示例来源:origin: DataSystemsLab/GeoSpark
@Override
public Iterator<Polygon> call(Geometry spatialObject)
throws Exception
{
List<Polygon> result = new ArrayList<Polygon>();
if (spatialObject instanceof MultiPolygon) {
MultiPolygon multiObjects = (MultiPolygon) spatialObject;
for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
Polygon oneObject = (Polygon) multiObjects.getGeometryN(i);
oneObject.setUserData(multiObjects.getUserData());
result.add(oneObject);
}
}
else if (spatialObject instanceof Polygon) {
result.add((Polygon) spatialObject);
}
else {
throw new Exception("[ShapefileRDD][getPolygonRDD] the object type is not Polygon or MultiPolygon type. It is " + spatialObject.getGeometryType());
}
return result.iterator();
}
}));
代码示例来源:origin: org.geotools/gt2-cql
LinearRing shell = gf.createLinearRing(coords);
Polygon bbox = gf.createPolygon(shell, null);
bbox.setUserData(DefaultGeographicCRS.WGS84);
代码示例来源:origin: DataSystemsLab/GeoSpark
@Override
public Iterator<Polygon> call(Geometry spatialObject)
throws Exception
{
List<Polygon> result = new ArrayList<Polygon>();
if (spatialObject instanceof MultiPolygon) {
MultiPolygon multiObjects = (MultiPolygon) spatialObject;
for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
Polygon oneObject = (Polygon) multiObjects.getGeometryN(i);
oneObject.setUserData(multiObjects.getUserData());
result.add(oneObject);
}
}
else if (spatialObject instanceof Polygon) {
result.add((Polygon) spatialObject);
}
else {
throw new Exception("[ShapefileRDD][getPolygonRDD] the object type is not Polygon or MultiPolygon type. It is " + spatialObject.getGeometryType());
}
return result.iterator();
}
});
代码示例来源:origin: org.geotools/gt-cql
LinearRing shell = gf.createLinearRing(coords);
Polygon bbox = gf.createPolygon(shell, null);
bbox.setUserData(DefaultGeographicCRS.WGS84);
代码示例来源:origin: org.datasyslab/geospark
@Override
public Iterator<Polygon> call(Geometry spatialObject)
throws Exception
{
List<Polygon> result = new ArrayList<Polygon>();
if (spatialObject instanceof MultiPolygon) {
MultiPolygon multiObjects = (MultiPolygon) spatialObject;
for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
Polygon oneObject = (Polygon) multiObjects.getGeometryN(i);
oneObject.setUserData(multiObjects.getUserData());
result.add(oneObject);
}
}
else if (spatialObject instanceof Polygon) {
result.add((Polygon) spatialObject);
}
else {
throw new Exception("[ShapefileRDD][getPolygonRDD] the object type is not Polygon or MultiPolygon type. It is " + spatialObject.getGeometryType());
}
return result.iterator();
}
});
代码示例来源:origin: org.datasyslab/geospark
@Override
public Iterator<Polygon> call(Geometry spatialObject)
throws Exception
{
List<Polygon> result = new ArrayList<Polygon>();
if (spatialObject instanceof MultiPolygon) {
MultiPolygon multiObjects = (MultiPolygon) spatialObject;
for (int i = 0; i < multiObjects.getNumGeometries(); i++) {
Polygon oneObject = (Polygon) multiObjects.getGeometryN(i);
oneObject.setUserData(multiObjects.getUserData());
result.add(oneObject);
}
}
else if (spatialObject instanceof Polygon) {
result.add((Polygon) spatialObject);
}
else {
throw new Exception("[ShapefileRDD][getPolygonRDD] the object type is not Polygon or MultiPolygon type. It is " + spatialObject.getGeometryType());
}
return result.iterator();
}
}));
代码示例来源:origin: org.geotools/gt2-main
/**
* Returns the completed OGC Polygon.
*
* @param geometryFactory Geometry factory to be used in Polygon creation.
*
* @return Completed OGC Polygon.
*/
public Geometry create(GeometryFactory geometryFactory) {
for (int i = 0; i < innerBoundaries.size(); i++) {
LinearRing hole = (LinearRing) innerBoundaries.get(i);
if (hole.crosses(outerBoundary)) {
LOGGER.warning("Topology Error building polygon");
return null;
}
}
LinearRing[] rings =
(LinearRing[]) innerBoundaries.toArray(new LinearRing[innerBoundaries.size()]);
Polygon polygon = geometryFactory.createPolygon(outerBoundary,rings);
polygon.setUserData( getSRS() );
polygon.setSRID( getSRID() );
return polygon;
}
}
代码示例来源:origin: org.geotools/gt-main
/**
* Returns the completed OGC Polygon.
*
* @param geometryFactory Geometry factory to be used in Polygon creation.
*
* @return Completed OGC Polygon.
*/
public Geometry create(GeometryFactory geometryFactory) {
for (int i = 0; i < innerBoundaries.size(); i++) {
LinearRing hole = (LinearRing) innerBoundaries.get(i);
if (hole.crosses(outerBoundary)) {
LOGGER.warning("Topology Error building polygon");
return null;
}
}
LinearRing[] rings =
(LinearRing[]) innerBoundaries.toArray(new LinearRing[innerBoundaries.size()]);
Polygon polygon = geometryFactory.createPolygon(outerBoundary,rings);
polygon.setUserData( getSRS() );
polygon.setSRID( getSRID() );
return polygon;
}
}
代码示例来源:origin: org.geotools/gt-render
public Expression getExpression2() {
Coordinate[] coords = new Coordinate[5];
coords[0] = new Coordinate(envelope.getMinX(), envelope.getMinY());
coords[1] = new Coordinate(envelope.getMinX(), envelope.getMaxY());
coords[2] = new Coordinate(envelope.getMaxX(), envelope.getMaxY());
coords[3] = new Coordinate(envelope.getMaxX(), envelope.getMinY());
coords[4] = new Coordinate(envelope.getMinX(), envelope.getMinY());
LinearRing ring = null;
GeometryFactory gfac = new GeometryFactory();
try {
ring = gfac.createLinearRing(coords);
} catch (TopologyException tex) {
throw new IllegalFilterException(tex.toString());
}
Polygon polygon = gfac.createPolygon(ring, null);
if (envelope instanceof ReferencedEnvelope) {
ReferencedEnvelope refEnv = (ReferencedEnvelope) envelope;
polygon.setUserData(refEnv.getCoordinateReferenceSystem());
}
return factory.literal(polygon);
}
代码示例来源:origin: org.geotools/gt-main
polygon.setUserData( getSRS() );
polygon.setSRID( getSRID() );
代码示例来源:origin: org.geotools/gt2-main
polygon.setUserData( getSRS() );
polygon.setSRID( getSRID() );
代码示例来源:origin: org.geotools/gt-main
if (env instanceof ReferencedEnvelope) {
ReferencedEnvelope refEnv = (ReferencedEnvelope) env;
polygon.setUserData(refEnv.getCoordinateReferenceSystem());
代码示例来源:origin: com.vividsolutions/jts-core
cellPoly.setUserData(v.getCoordinate());
return cellPoly;
代码示例来源:origin: org.locationtech.geogig/geogig-datastore
@Test
public void testGetCount() throws Exception {
assertEquals(3, pointsSource.getCount(Query.ALL));
assertEquals(3, linesSource.getCount(Query.ALL));
Filter filter;
filter = ff.id(Collections.singleton(ff.featureId(RepositoryTestCase.idP2)));
assertEquals(1, pointsSource.getCount(new Query(pointsName, filter)));
ReferencedEnvelope queryBounds = boundsOf(points1, points2);
Polygon geometry = JTS.toGeometry(queryBounds);
filter = ff.intersects(ff.property(pointsType.getGeometryDescriptor().getLocalName()),
ff.literal(geometry));
assertEquals(2, pointsSource.getCount(new Query(pointsName, filter)));
ReferencedEnvelope transformedQueryBounds;
CoordinateReferenceSystem queryCrs = CRS.decode("EPSG:3857");
transformedQueryBounds = queryBounds.transform(queryCrs, true);
geometry = JTS.toGeometry(transformedQueryBounds);
geometry.setUserData(queryCrs);
filter = ff.intersects(ff.property(pointsType.getGeometryDescriptor().getLocalName()),
ff.literal(geometry));
assertEquals(2, pointsSource.getCount(new Query(pointsName, filter)));
filter = ECQL.toFilter("sp = 'StringProp2_3' OR ip = 2000");
assertEquals(2, linesSource.getCount(new Query(linesName, filter)));
}
代码示例来源:origin: org.locationtech.geogig/geogig-datastore
@Test
public void testGetBoundsQuery() throws Exception {
ReferencedEnvelope bounds;
Filter filter;
filter = ff.id(Collections.singleton(ff.featureId(RepositoryTestCase.idP2)));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points2), bounds);
ReferencedEnvelope queryBounds = boundsOf(points1, points2);
Polygon geometry = JTS.toGeometry(queryBounds);
filter = ff.intersects(ff.property(pointsType.getGeometryDescriptor().getLocalName()),
ff.literal(geometry));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points1, points2), bounds);
ReferencedEnvelope transformedQueryBounds;
CoordinateReferenceSystem queryCrs = CRS.decode("EPSG:3857");
transformedQueryBounds = queryBounds.transform(queryCrs, true);
geometry = JTS.toGeometry(transformedQueryBounds);
geometry.setUserData(queryCrs);
filter = ff.intersects(ff.property(pointsType.getGeometryDescriptor().getLocalName()),
ff.literal(geometry));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points1, points2), bounds);
filter = ECQL.toFilter("sp = 'StringProp2_3' OR ip = 2000");
bounds = linesSource.getBounds(new Query(linesName, filter));
assertEquals(boundsOf(lines3, lines2), bounds);
}
代码示例来源:origin: org.locationtech.geogig/geogig-datastore
@Test
public void testGetBoundsQueryWithSpatialIndex() throws Exception {
createQuadTree(pointsName);
ReferencedEnvelope bounds;
Filter filter;
filter = ff.id(Collections.singleton(ff.featureId(RepositoryTestCase.idP2)));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points2), bounds);
ReferencedEnvelope queryBounds = boundsOf(points1, points2);
Polygon geometry = JTS.toGeometry(queryBounds);
filter = ff.intersects(ff.property(pointsType.getGeometryDescriptor().getLocalName()),
ff.literal(geometry));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points1, points2), bounds);
ReferencedEnvelope transformedQueryBounds;
CoordinateReferenceSystem queryCrs = CRS.decode("EPSG:3857");
transformedQueryBounds = queryBounds.transform(queryCrs, true);
geometry = JTS.toGeometry(transformedQueryBounds);
geometry.setUserData(queryCrs);
filter = ff.intersects(ff.property(pointsType.getGeometryDescriptor().getLocalName()),
ff.literal(geometry));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points1, points2), bounds);
filter = ECQL.toFilter("sp = 'StringProp2_3' OR ip = 2000");
bounds = linesSource.getBounds(new Query(linesName, filter));
assertEquals(boundsOf(lines3, lines2), bounds);
}
内容来源于网络,如有侵权,请联系作者删除!