本文整理了Java中org.deegree.geometry.Geometry
类的一些代码示例,展示了Geometry
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry
类的具体详情如下:
包路径:org.deegree.geometry.Geometry
类名称:Geometry
[英]Base interface for all vector geometry types.
Root of deegree's ISO 19107/GML 3.1.1/GML 3.2.1 compliant geometry type hierarchy. All geometries inherit methods for the common topological predicates (e.g. #intersects(Geometry) and #touches(Geometry) as well as the usual geometry creation methods (e.g #getIntersection(Geometry) and #getBuffer(Measure)).
These are the methods for evaluating the common topological predicates:
Methods for deriving geometries that aid spatial analysis tasks:
#getBuffer(Measure)
#getCentroid()
#getConvexHull()
#getDifference(Geometry)
#getEnvelope()
#getIntersection(Geometry)
#getUnion(Geometry)
Distance calculation:
#getDistance(Geometry,Unit)
TODO: check with specification
As the expressiveness of the ISO 19107 model is much more powerful than the Simple Feature Specification (SFS), a deegree Geometryis not automatically a compliant SFS geometry. #isSFSCompliant() can be used to check if this is the case, it returns true
for the following subtypes / configurations:
GML geometries allow for non-geometric properties, such as the ones from the gml:StandardObjectProperties
attribute group. Additionally, extensions of core GML geometry elements (e.g. aixm:ElevatedPoint
from the AIXM 5.1 application schema) may define even more properties which don't actually add to the geometric semantics of the element. The properties of GML geometry can hence be divided like this:
gml:name
)gml:pos/code>)
true
:gml:StandardObjectProperties
属性组中的特性。此外,核心GML几何元素的扩展(例如来自AIXM 5.1应用程序模式的[2$])可能会定义更多实际上不会添加到元素几何语义的属性。因此,GML几何体的属性可以如下划分:gml:name
gml:pos/code>)
代码示例来源:origin: deegree/deegree3
@Override
public ICRS getCoordinateSystem() {
return getReferencedObject().getCoordinateSystem();
}
代码示例来源:origin: deegree/deegree3
@Override
public Envelope getEnvelope() {
return getReferencedObject().getEnvelope();
}
代码示例来源:origin: deegree/deegree3
private void startGeometry( String localName, Geometry geometry )
throws XMLStreamException {
writeStartElementWithNS( GML21NS, localName );
if ( geometry.getId() != null ) {
referenceExportStrategy.addExportedId( geometry.getId() );
writer.writeAttribute( "gid", geometry.getId() );
}
if ( outputCRS != null ) {
writer.writeAttribute( "srsName", outputCRS.getAlias() );
} else if ( geometry.getCoordinateSystem() != null ) {
ICRS coordinateSystem = geometry.getCoordinateSystem();
writer.writeAttribute( "srsName", coordinateSystem.getAlias() );
}
}
代码示例来源:origin: deegree/deegree3
@Override
public boolean visitGeometry( Geometry geom ) {
if ( geom.getCoordinateSystem() != null && geom.getCoordinateDimension() != 1 ) {
try {
geom.getCoordinateSystem();
} catch ( Exception e ) {
throw new IllegalArgumentException( e.getMessage() );
}
}
return true;
}
代码示例来源:origin: deegree/deegree3
/**
* Sets the {@link CRS} for all geometries contained in the given {@link Filter} that do not have crs information.
*
* @param filter
* filter to process, must not be <code>null</code>
* @param crs
* crs to set, must not be <code>null</code>
*/
public static void setDefaultCRS( Filter filter, ICRS crs ) {
for ( Geometry geom : getGeometries( filter ) ) {
if ( geom.getCoordinateSystem() == null ) {
// TODO propagate to deeper levels / change behavior of setCoordinateSystem()
geom.setCoordinateSystem( crs );
}
}
}
代码示例来源:origin: deegree/deegree3
private Geometry transformGeometry( Geometry value, GeometryTransformer transformer )
throws IllegalArgumentException, TransformationException {
Geometry transformed = value;
if ( transformed.getCoordinateSystem() == null ) {
transformed.setCoordinateSystem( transformer.getTargetCRS() );
} else {
transformed = linearizer.linearize( value, crit );
if ( !( transformed instanceof Point && transformed.getCoordinateDimension() == 1 ) ) {
transformed = transformer.transform( transformed, transformed.getCoordinateSystem() );
}
}
return transformed;
}
代码示例来源:origin: deegree/deegree3
List<SurfacePatch> patches = new ArrayList<SurfacePatch>();
patches.add( geomFac.createPolygonPatch( p.getExteriorRing(), p.getInteriorRings() ) );
geom = geomFac.createSurface( geom.getId(), patches, geom.getCoordinateSystem() );
} else if ( hierarchy.getCurveSubstitutions().contains( particle.getName() ) && geom instanceof LineString ) {
CurveSegment[] segments = new CurveSegment[1];
segments[0] = geomFac.createLineStringSegment( p.getControlPoints() );
geom = geomFac.createCurve( geom.getId(), geom.getCoordinateSystem(), segments );
geom.setType( fs.getSchema().getGeometryType( particle.getName() ) );
geom.setProperties( props );
代码示例来源:origin: deegree/deegree3
Geometry clipGeometry( final Geometry geom, Geometry clippingArea ) {
if ( clippingArea != null && !clippingArea.contains( geom ) ) {
try {
Geometry clippedGeometry = clippingArea.getIntersection( geom );
if ( clippedGeometry == null ) {
return null;
}
com.vividsolutions.jts.geom.Geometry jtsOrig = ( (AbstractDefaultGeometry) geom ).getJTSGeometry();
com.vividsolutions.jts.geom.Geometry jtsClipped = ( (AbstractDefaultGeometry) clippedGeometry ).getJTSGeometry();
if ( jtsOrig == jtsClipped ) {
return geom;
}
if ( isInvertedOrientation( jtsOrig ) ) {
return clippedGeometry;
}
return fixOrientation( clippedGeometry, clippedGeometry.getCoordinateSystem() );
} catch ( UnsupportedOperationException e ) {
// use original geometry if intersection not supported by JTS
return geom;
}
}
return geom;
}
代码示例来源:origin: deegree/deegree3
if ( !insideValidDomain( domainOfValidity, geo ) ) {
throw new OutsideCRSDomainException( "Geometry (gml:id="
+ ( isSet( geo.getId() ) ? geo.getId() : "not set" )
+ ")is outside the area of validity of the source CRS." );
GeometryType geometryType = geo.getGeometryType();
try {
switch ( geometryType ) {
geo.getCoordinateSystem().getAlias(),
getTargetCRS().getCodes(), ge.getMessage() ), ge );
代码示例来源:origin: deegree/deegree3
private void startGeometry( String localName, Geometry geometry )
throws XMLStreamException, UnknownCRSException, TransformationException {
GMLObjectType gmlType = geometry.getType();
if ( gmlType == null ) {
writeStartElementWithNS( gmlNs, localName );
} else {
QName elName = gmlType.getName();
writeStartElementWithNS( elName.getNamespaceURI(), elName.getLocalPart() );
}
if ( geometry.getId() != null ) {
referenceExportStrategy.addExportedId( geometry.getId() );
writeAttributeWithNS( gmlNs, "id", geometry.getId() );
} else if ( version == GML_32 && geometry.getId() == null ) {
// in GML 3.2, a gml:id is required for every geometry
writeAttributeWithNS( gmlNs, "id", "GEOMETRY_" + generateNewId() );
}
if ( outputCRS != null ) {
writer.writeAttribute( "srsName", outputCRS.getAlias() );
} else if ( geometry.getCoordinateSystem() != null ) {
writer.writeAttribute( "srsName", geometry.getCoordinateSystem().getAlias() );
}
exportStandardProps( geometry );
}
代码示例来源:origin: deegree/deegree3
@Override
public boolean visitGeometry( Geometry geom ) {
idToObject.put( geom.getId(), geom );
return true;
}
代码示例来源:origin: deegree/deegree3
private Geometry simplify( Geometry geometry ) {
if ( simplifier == null ) {
return geometry;
}
GeometryType type = geometry.getGeometryType();
if ( type == ENVELOPE || type == COMPOSITE_GEOMETRY ) {
return geometry;
}
return simplifier.simplify( geometry );
}
代码示例来源:origin: deegree/deegree3
@Override
public Geometry process( Geometry inputGeometry, Map<String, Object> params ) {
return inputGeometry.getCentroid();
}
代码示例来源:origin: deegree/deegree3
String oldGid = geometry.getId();
if ( oldGid != null ) {
gids.remove( oldGid );
geometry.setId( newGid );
if ( geometry.getId() == null ) {
String newGid = "GEOMETRY_" + generateNewId();
geometry.setId( newGid );
gids.add( newGid );
代码示例来源:origin: deegree/deegree3
@Override
public boolean contains( Geometry geometry ) {
return getReferencedObject().contains( geometry );
}
代码示例来源:origin: deegree/deegree3
@Override
public int getCoordinateDimension() {
return members.get( 0 ).getCoordinateDimension();
}
代码示例来源:origin: deegree/deegree3
@Override
public void setCoordinateSystem( ICRS crs ) {
getReferencedObject().setCoordinateSystem( crs );
}
代码示例来源:origin: deegree/deegree3
@Override
public boolean equals( Geometry geometry ) {
return getReferencedObject().equals( geometry );
}
代码示例来源:origin: deegree/deegree3
@Override
public boolean crosses( Geometry geometry ) {
return getReferencedObject().crosses( geometry );
}
代码示例来源:origin: deegree/deegree3
private <T extends Geometry> T transformLinearized( T g ) {
if ( g instanceof Surface ) {
@SuppressWarnings("unchecked")
T g2 = (T) transform( linearizer.linearize( (Surface) g, new NumPointsCriterion( 100 ) ) );
g2.setCoordinateSystem( g.getCoordinateSystem() );
return g2;
}
if ( g instanceof Curve ) {
@SuppressWarnings("unchecked")
T g2 = (T) transform( linearizer.linearize( (Curve) g, new NumPointsCriterion( 100 ) ) );
g2.setCoordinateSystem( g.getCoordinateSystem() );
return g2;
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!