Java Code Examples for mil.nga.geopackage.BoundingBox#union()

The following examples show how to use mil.nga.geopackage.BoundingBox#union() . 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: GeoPackageCoreImpl.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public BoundingBox getBoundingBox(Projection projection, boolean manual) {

	BoundingBox boundingBox = getContentsBoundingBox(projection);

	List<String> tables = getTables();
	for (String table : tables) {
		BoundingBox tableBoundingBox = getBoundingBox(projection, table,
				manual);
		if (tableBoundingBox != null) {
			if (boundingBox != null) {
				boundingBox = boundingBox.union(tableBoundingBox);
			} else {
				boundingBox = tableBoundingBox;
			}
		}
	}

	return boundingBox;
}
 
Example 2
Source File: ContentsDao.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * Get the bounding box for all tables in the provided projection
 * 
 * @param projection
 *            desired bounding box projection
 * 
 * @return bounding box
 * @since 3.1.0
 */
public BoundingBox getBoundingBox(Projection projection) {

	BoundingBox boundingBox = null;

	List<String> tables = null;
	try {
		tables = getTables();
	} catch (SQLException e) {
		throw new GeoPackageException(
				"Failed to query for contents tables", e);
	}

	for (String table : tables) {
		BoundingBox tableBoundingBox = getBoundingBox(projection, table);
		if (tableBoundingBox != null) {
			if (boundingBox != null) {
				boundingBox = boundingBox.union(tableBoundingBox);
			} else {
				boundingBox = tableBoundingBox;
			}
		}
	}

	return boundingBox;
}
 
Example 3
Source File: GeoPackageCoreImpl.java    From geopackage-core-java with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public BoundingBox getBoundingBox(Projection projection, String table,
		boolean manual) {

	BoundingBox boundingBox = getContentsBoundingBox(projection, table);

	BoundingBox tableBoundingBox = null;
	String tableType = getTableType(table);
	ContentsDataType dataType = ContentsDataType.fromName(tableType);
	if (dataType != null) {
		switch (dataType) {
		case FEATURES:
			tableBoundingBox = getFeatureBoundingBox(projection, table,
					manual);
			break;
		case TILES:
		case GRIDDED_COVERAGE:
			try {
				TileMatrixSet tileMatrixSet = getTileMatrixSetDao()
						.queryForId(table);
				tableBoundingBox = tileMatrixSet.getBoundingBox(projection);
			} catch (SQLException e) {
				throw new GeoPackageException(
						"Failed to retrieve tile matrix set for table: "
								+ table,
						e);
			}
			break;
		default:

		}
	}

	if (tableBoundingBox != null) {
		if (boundingBox == null) {
			boundingBox = tableBoundingBox;
		} else {
			boundingBox = boundingBox.union(tableBoundingBox);
		}
	}

	return boundingBox;
}
 
Example 4
Source File: TileBoundingBoxUtils.java    From geopackage-core-java with MIT License 2 votes vote down vote up
/**
 * Get the union bounding box combining the two bounding boxes
 *
 * @param boundingBox
 *            bounding box 1
 * @param boundingBox2
 *            bounding box 2
 * @return bounding box
 */
public static BoundingBox union(BoundingBox boundingBox,
		BoundingBox boundingBox2) {
	return boundingBox.union(boundingBox2);
}