mil.nga.sf.util.GeometryEnvelopeBuilder Java Examples

The following examples show how to use mil.nga.sf.util.GeometryEnvelopeBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FeatureIndexer.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Index the feature row
 *
 * @param geoPackageId   GeoPackage id
 * @param row            feature row
 * @param possibleUpdate possible update flag
 * @return true if indexed
 */
private boolean index(long geoPackageId, FeatureRow row, boolean possibleUpdate) {

    boolean indexed = false;

    GeoPackageGeometryData geomData = row.getGeometry();
    if (geomData != null) {

        // Get the envelope
        GeometryEnvelope envelope = geomData.getEnvelope();

        // If no envelope, build one from the geometry
        if (envelope == null) {
            Geometry geometry = geomData.getGeometry();
            if (geometry != null) {
                envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
            }
        }

        // Create the new index row
        if (envelope != null) {
            GeometryMetadata metadata = geometryMetadataDataSource.populate(geoPackageId, featureDao.getTableName(), row.getId(), envelope);
            if (possibleUpdate) {
                geometryMetadataDataSource.createOrUpdate(metadata);
            } else {
                geometryMetadataDataSource.create(metadata);
            }
            indexed = true;
        }
    }

    return indexed;
}
 
Example #2
Source File: GeoPackageGeometryData.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * Get the envelope if it exists or build it from the geometry if not null
 * 
 * @return geometry envelope
 * @since 3.1.0
 */
public GeometryEnvelope getOrBuildEnvelope() {
	GeometryEnvelope envelope = getEnvelope();
	if (envelope == null) {
		Geometry geometry = getGeometry();
		if (geometry != null) {
			envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
		}
	}
	return envelope;
}
 
Example #3
Source File: ObservationLocation.java    From mage-android with Apache License 2.0 4 votes vote down vote up
/**
 * Get a geometry envelope that includes the entire geometry
 *
 * @return geometry envelope
 */
private GeometryEnvelope getGeometryEnvelope() {
    Geometry geometryCopy = geometry.copy();
    GeometryUtils.minimizeGeometry(geometryCopy, ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
    return GeometryEnvelopeBuilder.buildEnvelope(geometryCopy);
}