本文整理了Java中org.deegree.geometry.GeometryFactory.createLinearRing()
方法的一些代码示例,展示了GeometryFactory.createLinearRing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.createLinearRing()
方法的具体详情如下:
包路径:org.deegree.geometry.GeometryFactory
类名称:GeometryFactory
方法名:createLinearRing
[英]Creates a simple LinearRing from a list of passed Points.
[中]从传递的点列表创建简单的线性化。
代码示例来源:origin: deegree/deegree3
private LinearRing fromRing( double[][] points ) {
LinkedList<Point> ps = new LinkedList<Point>();
for ( double[] p : points ) {
ps.add( fac.createPoint( null, p, crs ) );
}
// may be expensive
if ( ps.getFirst() != ps.getLast() ) {
LOG.debug( "Ring was not closed as required by the shape file spec!" );
LOG.debug( "Trying to recover anyway." );
ps.add( ps.getFirst() );
}
return fac.createLinearRing( null, crs, new PointsList( ps ) );
}
代码示例来源: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 LinearRing transform( Ring ring, Transformation trans )
throws TransformationException {
if ( ring != null ) {
// TODO DefaultRing.getAsLineString currently returns an UnsupportedOpertionException
// interior.getAsLineString().getControlPoints(),
Points cP = ring.getControlPoints();
Points tcP = transform( cP, trans );
return geomFactory.createLinearRing( ring.getId(), getTargetCRS(), tcP );
}
return null;
}
代码示例来源:origin: deegree/deegree3
outer = fac.createLinearRing( null, crs, p );
} else {
LinearRing ring = fac.createLinearRing( null, crs, p );
Polygon outerP = fac.createPolygon( null, crs, outer, null );
Polygon innerP = fac.createPolygon( null, crs, ring, null );
代码示例来源:origin: deegree/deegree3
LinearRing linearRing = geomFac.createLinearRing( gid, crs, points );
linearRing.setType( type );
代码示例来源:origin: deegree/deegree3
LinearRing movedExteriorRing = null;
if ( exterior != null ) {
movedExteriorRing = fac.createLinearRing( exterior.getId(),
exterior.getCoordinateSystem(),
move( exterior.getAsLineString().getControlPoints(),
List<Ring> movedInteriorRings = new ArrayList<Ring>( interiorRings.size() );
for ( Ring interior : interiorRings ) {
movedInteriorRings.add( fac.createLinearRing( interior.getId(),
interior.getCoordinateSystem(),
move( interior.getAsLineString().getControlPoints(),
代码示例来源:origin: deegree/deegree3
/**
* @param xmlStream
* @param defaultCRS
* @return
* @throws XMLStreamException
*/
public Ring parseLinearRing( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
throws XMLStreamException {
String gid = parseGeometryId( xmlStream );
ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
xmlStream.nextTag();
Points points = parseControlPoints( xmlStream, crs );
if ( points.size() < 4 ) {
String msg = "Error in 'gml:LinearRing' element. Must specify at least four points.";
throw new XMLParsingException( xmlStream, msg );
}
xmlStream.require( END_ELEMENT, GML21NS, "LinearRing" );
LinearRing linearRing = geomFac.createLinearRing( gid, crs, points );
idContext.addObject( linearRing );
return linearRing;
}
代码示例来源: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
/**
* 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;
}
内容来源于网络,如有侵权,请联系作者删除!