mil.nga.geopackage.core.srs.SpatialReferenceSystemSfSql Java Examples

The following examples show how to use mil.nga.geopackage.core.srs.SpatialReferenceSystemSfSql. 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: GeoPackageDaoManager.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * Unregister all GeoPackage DAO with the connection source
 * 
 * @param connectionSource
 *            connection source
 */
public static void unregisterDaos(ConnectionSource connectionSource) {
	// TODO when ormlite-core version > 5.1 is released, replace with:
	// "DaoManager.unregisterDaos(connectionSource);"
	// See https://github.com/j256/ormlite-core/pull/149
	unregisterDao(connectionSource, Contents.class,
			SpatialReferenceSystem.class,
			SpatialReferenceSystemSfSql.class,
			SpatialReferenceSystemSqlMm.class, Extensions.class,
			GriddedCoverage.class, GriddedTile.class, GeometryIndex.class,
			TableIndex.class, FeatureTileLink.class,
			ExtendedRelation.class, TileScaling.class,
			GeometryColumns.class, GeometryColumnsSfSql.class,
			GeometryColumnsSqlMm.class, Metadata.class,
			MetadataReference.class, DataColumns.class,
			DataColumnConstraints.class, TileMatrix.class,
			TileMatrixSet.class, ContentsId.class);
}
 
Example #2
Source File: GeoPackageCoreImpl.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public SpatialReferenceSystemSfSqlDao getSpatialReferenceSystemSfSqlDao() {

	SpatialReferenceSystemSfSqlDao dao = createDao(
			SpatialReferenceSystemSfSql.class);
	verifyTableExists(dao);

	return dao;
}
 
Example #3
Source File: SpatialReferenceSystemUtils.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Test SF/SQL read
 * 
 * @param geoPackage
 * @param expectedResults
 * @throws SQLException
 */
public static void testSfSqlRead(GeoPackage geoPackage, Integer expectedResults)
		throws SQLException {

	SpatialReferenceSystemSfSqlDao dao = geoPackage
			.getSpatialReferenceSystemSfSqlDao();
	List<SpatialReferenceSystemSfSql> results = dao.queryForAll();
	if (expectedResults != null) {
		TestCase.assertEquals(
				"Unexpected number of spatial reference system rows",
				expectedResults.intValue(), results.size());
	}

	if (!results.isEmpty()) {

		// Verify non nulls
		for (SpatialReferenceSystemSfSql result : results) {
			TestCase.assertNotNull(result.getSrid());
			TestCase.assertNotNull(result.getAuthName());
			TestCase.assertNotNull(result.getAuthSrid());
		}

		// Choose random srs
		int random = (int) (Math.random() * results.size());
		SpatialReferenceSystemSfSql srs = results.get(random);

		// Query by id
		SpatialReferenceSystemSfSql querySrs = dao
				.queryForId(srs.getSrid());
		TestCase.assertNotNull(querySrs);
		TestCase.assertEquals(srs.getSrid(), querySrs.getSrid());

		// Query for equal
		List<SpatialReferenceSystemSfSql> querySrsList = dao.queryForEq(
				SpatialReferenceSystemSfSql.COLUMN_AUTH_NAME,
				srs.getAuthName());
		TestCase.assertNotNull(querySrsList);
		TestCase.assertTrue(querySrsList.size() >= 1);
		boolean found = false;
		for (SpatialReferenceSystemSfSql querySrsValue : querySrsList) {
			TestCase.assertEquals(srs.getAuthName(),
					querySrsValue.getAuthName());
			if (!found) {
				found = srs.getSrid() == querySrsValue.getSrid();
			}
		}
		TestCase.assertTrue(found);

	}
}
 
Example #4
Source File: SpatialReferenceSystemUtils.java    From geopackage-java with MIT License 4 votes vote down vote up
/**
 * Test SF/SQL read
 * 
 * @param geoPackage
 * @param expectedResults
 * @throws SQLException
 */
public static void testSfSqlRead(GeoPackage geoPackage,
		Integer expectedResults) throws SQLException {

	SpatialReferenceSystemSfSqlDao dao = geoPackage
			.getSpatialReferenceSystemSfSqlDao();
	List<SpatialReferenceSystemSfSql> results = dao.queryForAll();
	if (expectedResults != null) {
		TestCase.assertEquals(
				"Unexpected number of spatial reference system rows",
				expectedResults.intValue(), results.size());
	}

	if (!results.isEmpty()) {

		// Verify non nulls
		for (SpatialReferenceSystemSfSql result : results) {
			TestCase.assertNotNull(result.getSrid());
			TestCase.assertNotNull(result.getAuthName());
			TestCase.assertNotNull(result.getAuthSrid());
		}

		// Choose random srs
		int random = (int) (Math.random() * results.size());
		SpatialReferenceSystemSfSql srs = results.get(random);

		// Query by id
		SpatialReferenceSystemSfSql querySrs = dao
				.queryForId(srs.getSrid());
		TestCase.assertNotNull(querySrs);
		TestCase.assertEquals(srs.getSrid(), querySrs.getSrid());

		// Query for equal
		List<SpatialReferenceSystemSfSql> querySrsList = dao.queryForEq(
				SpatialReferenceSystemSfSql.COLUMN_AUTH_NAME,
				srs.getAuthName());
		TestCase.assertNotNull(querySrsList);
		TestCase.assertTrue(querySrsList.size() >= 1);
		boolean found = false;
		for (SpatialReferenceSystemSfSql querySrsValue : querySrsList) {
			TestCase.assertEquals(srs.getAuthName(),
					querySrsValue.getAuthName());
			if (!found) {
				found = srs.getSrid() == querySrsValue.getSrid();
			}
		}
		TestCase.assertTrue(found);

	}
}