本文整理了Java中org.deegree.geometry.GeometryFactory.createPoint()
方法的一些代码示例,展示了GeometryFactory.createPoint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.createPoint()
方法的具体详情如下:
包路径:org.deegree.geometry.GeometryFactory
类名称:GeometryFactory
方法名:createPoint
暂无
代码示例来源: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
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
private Point readPoint( ByteBuffer buffer ) {
return fac.createPoint( null, buffer.getDouble(), buffer.getDouble(), crs );
}
代码示例来源: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 Point readPointZ( ByteBuffer buffer ) {
return fac.createPoint( null,
new double[] { buffer.getDouble(), buffer.getDouble(), buffer.getDouble(),
buffer.getDouble() }, crs );
}
代码示例来源:origin: deegree/deegree3
private Points parseControlPoints( XMLStreamReaderWrapper xmlStream, ICRS crs )
throws XMLStreamException {
List<Point> controlPoints = null;
if ( xmlStream.getEventType() == XMLStreamConstants.START_ELEMENT ) {
String name = xmlStream.getLocalName();
if ( "coordinates".equals( name ) ) {
controlPoints = parseCoordinates( xmlStream, crs );
xmlStream.nextTag();
} else {
controlPoints = new LinkedList<Point>();
do {
name = xmlStream.getLocalName();
if ( "coord".equals( name ) ) {
double[] coords = parseCoordType( xmlStream );
// anonymous point (no registering necessary)
controlPoints.add( geomFac.createPoint( null, coords, crs ) );
} else {
break;
}
} while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT );
}
}
return geomFac.createPoints( controlPoints );
}
代码示例来源:origin: deegree/deegree3
private Point readPointM( ByteBuffer buffer ) {
return fac.createPoint( null, buffer.getDouble(), buffer.getDouble(), buffer.getDouble(), crs );
}
代码示例来源: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
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 MultiPoint readMultipointM( ByteBuffer buffer, int length ) {
int num = buffer.getInt();
int len = 40 + num * 16;
if ( length == len ) {
LinkedList<Point> list = new LinkedList<Point>();
for ( int i = 0; i < num; ++i ) {
list.add( fac.createPoint( null, new double[] { buffer.getDouble(), buffer.getDouble(), 0, 0 }, crs ) );
}
return fac.createMultiPoint( null, crs, list );
}
LinkedList<double[]> xy = new LinkedList<double[]>();
for ( int i = 0; i < num; ++i ) {
xy.add( new double[] { buffer.getDouble(), buffer.getDouble(), 0, 0 } );
}
LinkedList<Point> list = new LinkedList<Point>();
skipBytes( buffer, 16 ); // skip measure bounds
for ( int i = 0; i < num; ++i ) {
double[] p = xy.poll();
p[3] = buffer.getDouble();
list.add( fac.createPoint( null, p, crs ) );
}
return fac.createMultiPoint( null, crs, list );
}
代码示例来源:origin: deegree/deegree3
protected Point parseDirectPositionType( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
throws XMLParsingException, XMLStreamException {
ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
String s = xmlStream.getElementText();
// don't use String.split(regex) here (speed)
StringTokenizer st = new StringTokenizer( s );
List<String> tokens = new ArrayList<String>();
while ( st.hasMoreTokens() ) {
tokens.add( st.nextToken() );
}
double[] doubles = new double[tokens.size()];
for ( int i = 0; i < doubles.length; i++ ) {
try {
doubles[i] = Double.parseDouble( tokens.get( i ) );
} catch ( NumberFormatException e ) {
String msg = "Value '" + tokens.get( i ) + "' cannot be parsed as a double.";
throw new XMLParsingException( xmlStream, msg );
}
}
return geomFac.createPoint( null, doubles, crs );
}
代码示例来源:origin: deegree/deegree3
public static void paintLegendText( int origin, LegendOptions opts, String text, TextRenderer textRenderer ) {
TextStyling textStyling = new TextStyling();
textStyling.font = new org.deegree.style.styling.components.Font();
textStyling.font.fontFamily.add( 0, "Arial" );
textStyling.font.fontSize = opts.textSize;
textStyling.anchorPointX = 0;
textStyling.anchorPointY = 0.5;
textStyling.uom = Metre;
if ( text != null && text.length() > 0 ) {
textRenderer.render( textStyling, text, geofac.createPoint( null, opts.baseWidth + opts.spacing * 2,
origin - opts.baseHeight / 2 - opts.spacing,
CRSManager.getCRSRef( "CRS:1" ) ) );
}
}
代码示例来源:origin: deegree/deegree3
private static Points move( Points points, double offx, double offy ) {
List<Point> movedPoints = new ArrayList<Point>( points.size() );
GeometryFactory fac = new GeometryFactory();
for ( Point point : points ) {
double[] movedCoordinates = new double[] { point.get0() + offx, point.get1() + offy };
movedPoints.add( fac.createPoint( point.getId(), movedCoordinates, point.getCoordinateSystem() ) );
}
return new PointsList( movedPoints );
}
代码示例来源: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
/**
* 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;
}
代码示例来源:origin: deegree/deegree3
/**
* transforms the list of points
*
* @throws TransformationException
*/
private Points transform( Points points, Transformation trans )
throws TransformationException {
List<Point> result = new ArrayList<Point>( points.size() );
for ( Point point : points ) {
Point3d coord = new Point3d( point.get0(), point.get1(), point.get2() );
Point3d tmp = new Point3d( coord );
tmp = trans.doTransform( coord );
if ( Double.isNaN( point.get2() ) ) {
result.add( geomFactory.createPoint( point.getId(), new double[] { tmp.x, tmp.y }, getTargetCRS() ) );
} else {
// pass the 3rd coordinate if exist and dimension of source and target CRS is 2
if ( trans.getSourceCRS().getDimension() == 2 && trans.getTargetCRS().getDimension() == 2 ) {
tmp.z = point.get2();
}
result.add( geomFactory.createPoint( point.getId(), new double[] { tmp.x, tmp.y, tmp.z },
getTargetCRS() ) );
}
}
return new PointsList( result );
}
代码示例来源: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
/**
* transforms the submitted point to the target coordinate reference system
*
* @throws TransformationException
*/
private Point transform( Point geo, Transformation trans )
throws TransformationException {
Point3d coord = new Point3d( geo.get0(), geo.get1(), geo.get2() );
Point3d result = new Point3d( coord );
result = trans.doTransform( coord );
if ( Double.isNaN( geo.get2() ) ) {
return geomFactory.createPoint( geo.getId(), new double[] { result.x, result.y }, getTargetCRS() );
} else if ( trans.getSourceCRS().getDimension() == 2 && trans.getTargetCRS().getDimension() == 2 ) {
// pass the 3rd coordinate if exist and dimension of source and target CRS is 2
result.z = geo.get2();
}
return geomFactory.createPoint( geo.getId(), new double[] { result.x, result.y, result.z }, getTargetCRS() );
}
内容来源于网络,如有侵权,请联系作者删除!