本文整理了Java中org.deegree.geometry.GeometryFactory.<init>()
方法的一些代码示例,展示了GeometryFactory.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.<init>()
方法的具体详情如下:
包路径:org.deegree.geometry.GeometryFactory
类名称:GeometryFactory
方法名:<init>
暂无
代码示例来源:origin: deegree/deegree3
private Envelope getDefaultBBox() {
return new GeometryFactory().createEnvelope( new double[] { -sphereSize, -sphereSize, -sphereSize },
new double[] { sphereSize, sphereSize, sphereSize }, 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
/**
* Creates a new {@link GMLStreamReader} instance.
*
* @param version
* GML version of the input, must not be <code>null</code>
* @param xmlStream
* XML stream used to read the input, must not be <code>null</code>
*/
GMLStreamReader( GMLVersion version, XMLStreamReaderWrapper xmlStream ) {
this.version = version;
this.xmlStream = xmlStream;
this.idContext = new GmlDocumentIdContext( version );
this.geomFac = new GeometryFactory();
}
代码示例来源:origin: deegree/deegree3
@SuppressWarnings("boxing")
protected static Envelope createEnvelope( String bboxStr, ICRS srs ) {
String[] coordList = bboxStr.split( "," );
int n = coordList.length / 2;
List<Double> lowerCorner = new ArrayList<Double>();
for ( int i = 0; i < n; i++ ) {
lowerCorner.add( Double.parseDouble( coordList[i] ) );
}
List<Double> upperCorner = new ArrayList<Double>();
for ( int i = n; i < 2 * n; i++ ) {
upperCorner.add( Double.parseDouble( coordList[i] ) );
}
GeometryFactory gf = new GeometryFactory();
return gf.createEnvelope( lowerCorner, upperCorner, srs );
}
代码示例来源:origin: deegree/deegree3
private Envelope readEnvelope( ByteBuffer bb ) {
Envelope result = null;
if ( ( bb.position() + ( 6 * ( AllocatedHeapMemory.DOUBLE_SIZE ) ) ) < bb.capacity() ) {
double[] min = new double[] { bb.getDouble(), bb.getDouble(), bb.getDouble() };
double[] max = new double[] { bb.getDouble(), bb.getDouble(), bb.getDouble() };
String crs = ObjectSerializer.readString( bb );
result = new GeometryFactory().createEnvelope( min, max, CRSManager.getCRSRef( crs ) );
}
return result;
}
代码示例来源:origin: deegree/deegree3
/**
* Creates a new {@link GeometryLinearizer} instance.
*/
public GeometryLinearizer() {
this.geomFac = new GeometryFactory();
this.curveLinearizer = new CurveLinearizer( geomFac );
this.sfLinearizer = new SurfaceLinearizer( geomFac );
}
代码示例来源:origin: deegree/deegree3
@Override
protected com.vividsolutions.jts.geom.LinearRing buildJTSGeometry() {
CurveLinearizer linearizer = new CurveLinearizer( new GeometryFactory() );
// TODO how to determine a feasible linearization criterion?
LinearizationCriterion crit = new NumPointsCriterion( 100 );
List<Coordinate> coords = new LinkedList<Coordinate>();
for ( final CurveSegment segment : getCurveSegments() ) {
LineStringSegment lsSegment = linearizer.linearize( segment, crit );
coords.addAll( getCoordinates( lsSegment ) );
}
return jtsFactory.createLinearRing( coords.toArray( new Coordinate[coords.size()] ) );
}
代码示例来源:origin: deegree/deegree3
private void getAndSetSubImage( BufferedImage targetImage, List<LayerRef> layers, int xMin, int width,
int yMin, int height, RasterGeoReference rasterEnv, ICRS crs, String format,
boolean transparent, boolean errorsInImage )
throws IOException {
double[] min = rasterEnv.getWorldCoordinate( xMin, yMin + height );
double[] max = rasterEnv.getWorldCoordinate( xMin + width, yMin );
Envelope env = new GeometryFactory().createEnvelope( min, max, crs );
Pair<BufferedImage, String> response = getMap( layers, styles, width, height, env, crs, format,
transparent, errorsInImage, false, null );
if ( response.second != null ) {
throw new IOException( response.second );
}
targetImage.getGraphics().drawImage( response.first, xMin, yMin, null );
}
}
代码示例来源:origin: deegree/deegree3
private Envelope calculateMainBBox( List<BoundingBox> bbox ) {
if ( bbox == null || bbox.isEmpty() )
return null;
double west = bbox.get( 0 ).getWestBoundLongitude();
double east = bbox.get( 0 ).getEastBoundLongitude();
double south = bbox.get( 0 ).getSouthBoundLatitude();
double north = bbox.get( 0 ).getNorthBoundLatitude();
for ( BoundingBox b : bbox ) {
west = Math.min( west, b.getWestBoundLongitude() );
east = Math.max( east, b.getEastBoundLongitude() );
south = Math.min( south, b.getSouthBoundLatitude() );
north = Math.max( north, b.getNorthBoundLatitude() );
}
GeometryFactory gf = new GeometryFactory();
return gf.createEnvelope( west, south, east, north, CRSUtils.EPSG_4326 );
}
代码示例来源:origin: deegree/deegree3
private TypedObjectNode[] getResultBBox( List<BoundingBox> bbox ) {
if ( bbox == null || bbox.isEmpty() )
return new TypedObjectNode[0];
double west = bbox.get( 0 ).getWestBoundLongitude();
double east = bbox.get( 0 ).getEastBoundLongitude();
double south = bbox.get( 0 ).getSouthBoundLatitude();
double north = bbox.get( 0 ).getNorthBoundLatitude();
for ( BoundingBox b : bbox ) {
west = Math.min( west, b.getWestBoundLongitude() );
east = Math.max( east, b.getEastBoundLongitude() );
south = Math.min( south, b.getSouthBoundLatitude() );
north = Math.max( north, b.getNorthBoundLatitude() );
}
GeometryFactory gf = new GeometryFactory();
return new TypedObjectNode[] { gf.createEnvelope( west, south, east, north, CRSUtils.EPSG_4326 ) };
}
代码示例来源:origin: deegree/deegree3
@Override
protected Envelope parseLatLonBoundingBox( OMElement elem ) {
double[] min = new double[2];
double[] max = new double[2];
while ( elem.getLocalName().equals( "Layer" ) ) {
OMElement bbox = getElement( elem, new XPath( "LatLonBoundingBox", null ) );
if ( bbox != null ) {
try {
min[0] = Double.parseDouble( bbox.getAttributeValue( new QName( "minx" ) ) );
min[1] = Double.parseDouble( bbox.getAttributeValue( new QName( "miny" ) ) );
max[0] = Double.parseDouble( bbox.getAttributeValue( new QName( "maxx" ) ) );
max[1] = Double.parseDouble( bbox.getAttributeValue( new QName( "maxy" ) ) );
return new GeometryFactory().createEnvelope( min, max, CRSManager.getCRSRef( WGS84 ) );
} catch ( NumberFormatException nfe ) {
LOG.warn( get( "WMSCLIENT.SERVER_INVALID_NUMERIC_VALUE", nfe.getLocalizedMessage() ) );
}
} else {
elem = (OMElement) elem.getParent();
}
}
return null;
}
代码示例来源: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
private static RenderablePrototype createBoxPrototype() {
RenderableQualityModel rqm = new RenderableQualityModel();
RenderableGeometry rg = new BOXGeometry();
rqm.addQualityModelPart( rg );
Envelope env = new GeometryFactory().createEnvelope( 0, 0, 1, 1, null );
return new RenderablePrototype( "box", "yeah", env, rqm );
}
代码示例来源:origin: deegree/deegree3
private static Envelope parseEnvelope( String bbox, ICRS crs )
throws OWSException {
double[] coords = parseEnvelopeCoords( bbox );
GeometryFactory geomFactory = new GeometryFactory();
if ( coords.length == 4 ) {
return geomFactory.createEnvelope( new double[] { coords[0], coords[1] }, new double[] { coords[2],
coords[3] }, crs );
}
if ( coords.length == 6 ) {
// rb: the minz,maxz values are at position 4,5 of the bbox (WTF).
return geomFactory.createEnvelope( new double[] { coords[0], coords[1], coords[4] },
new double[] { coords[2], coords[3], coords[5] }, crs );
}
throw new OWSException(
"Invalid bbox, the given bbox may only have 4 (minx,miny,maxx,maxy) or 6 (minx,miny,maxx,maxy,minz,maxz) parameters.",
OWSException.INVALID_PARAMETER_VALUE, "bbox" );
}
代码示例来源:origin: deegree/deegree3
private Envelope parseEnvelope()
throws OWSException {
// get the values from a spatial subset
OMElement envelope = parseEnvelopeElement();
String srsName = parseSRSName( envelope, "EPSG:4326" );
List<OMElement> posElems = getElements( envelope, new XPath( "gml:pos", wcsNSContext ) );
if ( posElems.size() != 2 ) {
throw new OWSException( "invalid envelope, need two gml:pos", OWSException.INVALID_PARAMETER_VALUE,
"spatialSubset" );
}
double[] min = parseNums( "gml:pos", posElems.get( 0 ) );
double[] max = parseNums( "gml:pos", posElems.get( 1 ) );
ICRS crs = CRSManager.getCRSRef( srsName );
GeometryFactory geomFactory = new GeometryFactory();
return geomFactory.createEnvelope( min, max, crs );
}
代码示例来源:origin: deegree/deegree3
public Envelope calcClickBox( int radius ) {
radius = parameters.get( "RADIUS" ) == null ? radius : parseInt( parameters.get( "RADIUS" ) );
GeometryFactory fac = new GeometryFactory();
double dw = envelope.getSpan0() / width;
double dh = envelope.getSpan1() / height;
int r2 = radius / 2;
r2 = r2 <= 0 ? 1 : r2;
return fac.createEnvelope( new double[] { envelope.getMin().get0() + ( x - r2 ) * dw,
envelope.getMax().get1() - ( y + r2 ) * dh },
new double[] { envelope.getMin().get0() + ( x + r2 ) * dw,
envelope.getMax().get1() - ( y - r2 ) * dh },
envelope.getCoordinateSystem() );
}
}
代码示例来源:origin: deegree/deegree3
@Override
protected Envelope parseLatLonBoundingBox( OMElement elem ) {
double[] min = new double[2];
double[] max = new double[2];
while ( elem.getLocalName().equals( "Layer" ) ) {
OMElement bbox = getElement( elem, new XPath( "wms:EX_GeographicBoundingBox", nsContext ) );
if ( bbox != null ) {
try {
min[0] = getRequiredNodeAsDouble( bbox, new XPath( "wms:westBoundLongitude", nsContext ) );
min[1] = getRequiredNodeAsDouble( bbox, new XPath( "wms:southBoundLatitude", nsContext ) );
max[0] = getRequiredNodeAsDouble( bbox, new XPath( "wms:eastBoundLongitude", nsContext ) );
max[1] = getRequiredNodeAsDouble( bbox, new XPath( "wms:northBoundLatitude", nsContext ) );
return new GeometryFactory().createEnvelope( min, max, CRSManager.getCRSRef( WGS84 ) );
} catch ( NumberFormatException nfe ) {
LOG.warn( get( "WMSCLIENT.SERVER_INVALID_NUMERIC_VALUE", nfe.getLocalizedMessage() ) );
}
} else {
elem = (OMElement) elem.getParent();
}
}
return null;
}
代码示例来源:origin: deegree/deegree3
/**
* @param building
* @return the DataObjectInfo which holds values of the given building.
*/
private DataObjectInfo<RenderablePrototype> createDataObjectInfo( WorldRenderableObject building ) {
RenderableQualityModel rqm = building.getQualityLevel( 0 );
if ( rqm == null ) {
LOG.info( "Could not extract the quality level of the RenderablePrototype with id:" + building.getId() );
return null;
}
rqm = createScaledQualityModel( rqm );
Envelope env = new GeometryFactory().createEnvelope( new double[] { 0, 0, 0 }, new double[] { 1, 1, 1 }, null );
building.setBbox( env );
RenderablePrototype rp = new RenderablePrototype( building.getId(), building.getTime(), building.getBbox(), rqm );
return new DataObjectInfo<RenderablePrototype>( building.getId(), Type.PROTOTYPE.getModelTypeName(),
building.getName(), building.getExternalReference(),
building.getBbox(), rp );
}
代码示例来源: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 );
}
内容来源于网络,如有侵权,请联系作者删除!