本文整理了Java中org.deegree.geometry.GeometryFactory
类的一些代码示例,展示了GeometryFactory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory
类的具体详情如下:
包路径:org.deegree.geometry.GeometryFactory
类名称:GeometryFactory
[英]Augments the SimpleGeometryFactory with additional methods for building complex Geometry and geometry-related objects ( CurveSegments and SurfacePatches).
[中]使用用于构建复杂几何体和几何体相关对象(曲线分段和曲面匹配)的其他方法来扩充SimpleMethodFactory。
代码示例来源:origin: deegree/deegree3
private Envelope getDefaultBBox() {
return new GeometryFactory().createEnvelope( new double[] { -sphereSize, -sphereSize, -sphereSize },
new double[] { sphereSize, sphereSize, sphereSize }, null );
}
代码示例来源: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 LineString getLegendLine( int xpos, int ypos, int xsz, int ysz ) {
Point p1 = geofac.createPoint( null, xpos, ypos - ysz, mapcs );
Point p2 = geofac.createPoint( null, xpos + xsz / 3, ypos - ysz / 3, mapcs );
Point p3 = geofac.createPoint( null, xpos + xsz / 3 * 2, ypos - ysz / 3 * 2, mapcs );
Point p4 = geofac.createPoint( null, xpos + xsz, ypos, mapcs );
List<Point> ps = new ArrayList<Point>( 4 );
ps.add( p1 );
ps.add( p2 );
ps.add( p3 );
ps.add( p4 );
return geofac.createLineString( null, mapcs, geofac.createPoints( ps ) );
}
代码示例来源:origin: deegree/deegree3
/**
* @param ps
* @param b
* @param index
* @throws SQLException
*/
private Envelope getEnvelope( float[] location, float width, float height, float depth ) {
return geomFac.createEnvelope( new double[] { location[0], location[1], location[2] },
new double[] { location[0] + width, location[1] + depth, location[2] + height },
null );
}
代码示例来源:origin: deegree/deegree3
/**
* Creates a new {@link GeometryValidator} which performs callbacks on the given
* {@link GeometryValidationEventHandler} in case of errors.
*
* @param eventHandler
* callback handler for errors, must not be <code>null</code>
*/
public GeometryValidator( GeometryValidationEventHandler eventHandler ) {
linearizer = new CurveLinearizer( new org.deegree.geometry.GeometryFactory() );
crit = new NumPointsCriterion( 150 );
jtsFactory = new GeometryFactory();
this.eventHandler = eventHandler;
}
代码示例来源: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
GeometryFactory fac = new GeometryFactory();
if ( geom instanceof Point ) {
Point p = (Point) geom;
return fac.createPoint( geom.getId(), new double[] { p.get0() + offx, p.get1() + offy },
p.getCoordinateSystem() );
ps.add( (Point) move( p, offx, offy ) );
return fac.createLineString( geom.getId(), c.getCoordinateSystem(), new PointsList( ps ) );
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(),
offx, offy ) ) );
movedPatches.add( fac.createPolygonPatch( movedExteriorRing, movedInteriorRings ) );
} else {
throw new UnsupportedOperationException( "Cannot move non-planar surface patches." );
return fac.createSurface( geom.getId(), movedPatches, geom.getCoordinateSystem() );
代码示例来源:origin: deegree/deegree3
/**
* @return an interior point of this geometry
*/
public Point getInteriorPoint() {
Coordinate coord = new InteriorPointArea( getJTSGeometry() ).getInteriorPoint();
return new GeometryFactory().createPoint( null, coord.x, coord.y, crs );
}
代码示例来源:origin: deegree/deegree3
double[] coords = parseCoordType( xmlStream );
points.add( geomFac.createPoint( null, coords, crs ) );
} else {
String msg = "Error in 'gml:Envelope' element.";
Envelope envelope = geomFac.createEnvelope( points.get( 0 ).getAsArray(), points.get( 1 ).getAsArray(), crs );
idContext.addObject( envelope );
return envelope;
代码示例来源:origin: deegree/deegree3
/**
* Calculates the points inside the geometry and inside the view port. First the passed geometry is clipped
* by the view port. A multipolygon may result. For each of the polygon in this multipolygon one interior point
* is created
*
* @param geom to create labels for, must not be <code>null</code> and in the same CRS as the viewPort
* @return a MultiPoint with all calculated labels
*/
MultiPoint calculateInteriorPoints( final Geometry geom ) {
if ( geom == null )
return null;
Geometry clippedGeometry = clipGeometry( geom, viewPort );
List<Point> points = new ArrayList<Point>();
if ( clippedGeometry != null && clippedGeometry instanceof DefaultSurface ) {
points.add( ( (DefaultSurface) clippedGeometry ).getInteriorPoint() );
}
if ( clippedGeometry != null && clippedGeometry instanceof MultiPolygon ) {
for ( Polygon p : ( (MultiPolygon) clippedGeometry ) ) {
if ( p instanceof DefaultSurface ) {
points.add( ( (DefaultSurface) p ).getInteriorPoint() );
}
}
}
return new GeometryFactory().createMultiPoint( null, geom.getCoordinateSystem(), points );
}
代码示例来源: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 Point getPoint( Coordinate jtsCoord, ICRS crs ) {
if ( jtsCoord == null ) {
return null;
}
double[] coords = null;
if ( jtsCoord.z != Double.NaN ) {
coords = new double[] { jtsCoord.x, jtsCoord.y, jtsCoord.z };
} else if ( jtsCoord.y != Double.NaN ) {
coords = new double[] { jtsCoord.x, jtsCoord.y };
} else {
coords = new double[] { jtsCoord.x };
}
return geomFac.createPoint( null, coords, crs );
}
代码示例来源:origin: deegree/deegree3
ICRS crs = env.getCoordinateSystem();
if ( min.equals( max ) ) {
return fac.createPoint( null, min.getAsArray(), crs );
return fac.createLineString( null, crs, points );
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
private MultiPoint readMultipoint( ByteBuffer buffer ) {
int num = buffer.getInt();
LinkedList<Point> list = new LinkedList<Point>();
for ( int i = 0; i < num; ++i ) {
list.add( fac.createPoint( null, buffer.getDouble(), buffer.getDouble(), crs ) );
}
return fac.createMultiPoint( null, crs, list );
}
代码示例来源: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 );
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 ) );
return fac.createMultiPolygon( null, crs, polys );
代码示例来源: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
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 ) );
return null;
return fac.createMultiPolygon( null, crs, ss );
代码示例来源:origin: deegree/deegree3
linearizedInteriorRings.add( (Ring) curveLinearizer.linearize( interiorRing, crit ) );
linearizedSurface = (T) geomFac.createPolygon( polygon.getId(), polygon.getCoordinateSystem(),
linearizedExteriorRing, linearizedInteriorRings );
break;
linearizedSurface = (T) geomFac.createPolyhedralSurface( surface.getId(), surface.getCoordinateSystem(),
linearizedPatches );
break;
linearizedSurface = (T) geomFac.createSurface( surface.getId(), linearizedPatches,
surface.getCoordinateSystem() );
break;
代码示例来源:origin: deegree/deegree3
ICRS normalCRS = determineActiveCRS( xmlStream, defaultCRS );
double[] coords = parseDoubleList( xmlStream );
normals.add( geomFac.createPoint( null, coords, normalCRS ) );
xmlStream.nextTag();
return geomFac.createArcStringByBulge( points, bulges, geomFac.createPoints( normals ) );
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!