本文整理了Java中org.deegree.geometry.GeometryFactory.createPolygon()
方法的一些代码示例,展示了GeometryFactory.createPolygon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.createPolygon()
方法的具体详情如下:
包路径:org.deegree.geometry.GeometryFactory
类名称:GeometryFactory
方法名:createPolygon
[英]Creates a PolygonPatch surface patch.
[中]创建多边形面片曲面面片。
代码示例来源:origin: deegree/deegree3
private LinkedList<Polygon> fromTriangleStrip( double[][] points ) {
LinkedList<Point> ps = new LinkedList<Point>();
for ( double[] p : points ) {
ps.add( fac.createPoint( null, p, crs ) );
}
LinkedList<Polygon> ss = new LinkedList<Polygon>();
while ( ps.size() > 2 ) {
LinkedList<Point> ring = new LinkedList<Point>();
ring.add( ps.get( 0 ) );
ring.add( ps.get( 1 ) );
ring.add( ps.get( 2 ) );
ring.add( ring.getFirst() );
ps.poll();
LinearRing r = fac.createLinearRing( null, crs, new PointsList( ring ) );
ss.add( fac.createPolygon( null, crs, r, null ) );
}
return ss;
}
代码示例来源:origin: deegree/deegree3
private LinkedList<Polygon> fromTriangleFan( double[][] points ) {
LinkedList<Point> ps = new LinkedList<Point>();
for ( double[] p : points ) {
ps.add( fac.createPoint( null, p, crs ) );
}
LinkedList<Polygon> ss = new LinkedList<Polygon>();
Point center = ps.poll();
while ( ps.size() > 1 ) {
LinkedList<Point> ringps = new LinkedList<Point>();
ringps.add( center );
ringps.add( ps.get( 0 ) );
ringps.add( ps.get( 1 ) );
ringps.add( center );
ps.poll();
LinearRing ring = fac.createLinearRing( null, crs, new PointsList( ringps ) );
ss.add( fac.createPolygon( null, crs, ring, null ) );
}
return ss;
}
代码示例来源:origin: deegree/deegree3
private Polygon getLegendRect( int xpos, int ypos, int xsize, int ysize ) {
Point p1 = geofac.createPoint( null, xpos, ypos, mapcs );
Point p2 = geofac.createPoint( null, xpos + xsize, ypos, mapcs );
Point p3 = geofac.createPoint( null, xpos + xsize, ypos - ysize, mapcs );
Point p4 = geofac.createPoint( null, xpos, ypos - ysize, mapcs );
List<Point> ps = new ArrayList<Point>( 5 );
ps.add( p1 );
ps.add( p2 );
ps.add( p3 );
ps.add( p4 );
ps.add( p1 );
return geofac.createPolygon( null, mapcs, geofac.createLinearRing( null, null, geofac.createPoints( ps ) ),
null );
}
代码示例来源:origin: deegree/deegree3
private Polygon transform( Polygon polygon, Transformation trans )
throws TransformationException {
Ring exterior = polygon.getExteriorRing();
LinearRing tExteriorRing = transform( exterior, trans );
List<Ring> interiorRings = polygon.getInteriorRings();
List<Ring> tInteriorRings = new ArrayList<Ring>( interiorRings == null ? 0 : interiorRings.size() );
if ( interiorRings != null && !interiorRings.isEmpty() ) {
for ( Ring interior : interiorRings ) {
if ( interior != null ) {
tInteriorRings.add( transform( interior, trans ) );
}
}
}
return geomFactory.createPolygon( polygon.getId(), getTargetCRS(), tExteriorRing, tInteriorRings );
}
代码示例来源:origin: deegree/deegree3
if ( outerRingMode ) {
LOG.trace( "Finishing with outer ring mode." );
ss.add( fac.createPolygon( null, crs, outerRing, innerRings ) );
innerRings.clear();
outerRing = null;
ring = fromRing( ps[i] );
if ( !unknownRingMode ) {
ss.add( fac.createPolygon( null, crs, ring, null ) );
} else {
if ( isCCW( ring ) ) {
if ( unknownOuterRing == null ) {
while ( unknownInnerRings.size() != 0 ) {
ss.add( fac.createPolygon( null, crs, unknownInnerRings.poll(), null ) );
ss.add( fac.createPolygon( null, crs, unknownOuterRing, unknownInnerRings ) );
代码示例来源:origin: deegree/deegree3
} else {
LinearRing ring = fac.createLinearRing( null, crs, p );
Polygon outerP = fac.createPolygon( null, crs, outer, null );
Polygon innerP = fac.createPolygon( null, crs, ring, null );
if ( outerP.contains( innerP ) ) {
inners.add( ring );
polys.add( fac.createPolygon( null, crs, outer, inners ) );
inners = new LinkedList<Ring>();
} else {
polys.add( fac.createPolygon( null, crs, outer, null ) );
polys.add( fac.createPolygon( null, crs, outer, inners ) );
代码示例来源:origin: deegree/deegree3
linearizedInteriorRings.add( (Ring) curveLinearizer.linearize( interiorRing, crit ) );
linearizedSurface = (T) geomFac.createPolygon( polygon.getId(), polygon.getCoordinateSystem(),
linearizedExteriorRing, linearizedInteriorRings );
break;
代码示例来源:origin: deegree/deegree3
Ring exteriorRing = patch.getExteriorRing();
List<Ring> interiorRings = patch.getInteriorRings();
simplified = geomFac.createPolygon( geometry.getId(), geometry.getCoordinateSystem(), exteriorRing,
interiorRings );
} else {
Ring exteriorRing = ( (PolygonPatch) patch ).getExteriorRing();
List<Ring> interiorRings = ( (PolygonPatch) patch ).getInteriorRings();
members.add( geomFac.createPolygon( null, geometry.getCoordinateSystem(), exteriorRing,
interiorRings ) );
代码示例来源:origin: deegree/deegree3
Polygon polygon = geomFac.createPolygon( gid, crs, exteriorRing, interiorRings );
idContext.addObject( polygon );
return polygon;
代码示例来源:origin: deegree/deegree3
Polygon polygon = geomFac.createPolygon( gid, crs, exteriorRing, interiorRings );
polygon.setType( type );
代码示例来源:origin: deegree/deegree3
/**
* @param env
* @return a polygon
*/
public static Polygon envelopeToPolygon( Envelope env ) {
GeometryFactory fac = new GeometryFactory();
Point a = env.getMin();
Point b = fac.createPoint( null, a.get0() + env.getSpan0(), a.get1(), env.getCoordinateSystem() );
Point c = env.getMax();
Point d = fac.createPoint( null, a.get0(), a.get1() + env.getSpan1(), env.getCoordinateSystem() );
LinearRing ring = fac.createLinearRing( null, env.getCoordinateSystem(), new PointsArray( a, b, c, d, a ) );
return fac.createPolygon( null, env.getCoordinateSystem(), ring, null );
}
代码示例来源:origin: deegree/deegree3
Curve ls = fac.createLineString( null, crs, new PackedPoints( null, points, 2 ) );
Ring exteriorRing = fac.createRing( null, crs, Collections.singletonList( ls ) );
return fac.createPolygon( null, crs, exteriorRing, null );
代码示例来源:origin: deegree/deegree3
/**
* Return the bounding geometry of a raster as a polygon (but is actually a rectangle).
*
* @param raster
* @return bounding polygon
*/
public static Polygon createPolygonGeometry( AbstractRaster raster ) {
ICRS crs = raster.getCoordinateSystem();
GeometryFactory fac = new GeometryFactory();
Envelope env = raster.getEnvelope();
env = raster.getRasterReference().relocateEnvelope( OriginLocation.OUTER, env );
Point pmin = env.getMin();
Point pmax = env.getMax();
Point p1 = fac.createPoint( null, pmin.get0(), pmin.get1(), crs );
Point p3 = fac.createPoint( null, pmax.get0(), pmax.get1(), crs );
Point p2 = fac.createPoint( null, p1.get0(), p3.get1(), crs );
Point p4 = fac.createPoint( null, p3.get0(), p1.get1(), crs );
Point p5 = fac.createPoint( null, p1.get0(), p1.get1(), crs );
Point[] points = { p1, p2, p3, p4, p5 };
// (asList(points));
LinearRing ring = fac.createLinearRing( null, crs, new PointsList( asList( points ) ) );
Polygon poly = fac.createPolygon( null, crs, ring, null );
return poly;
}
内容来源于网络,如有侵权,请联系作者删除!