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

The following examples show how to use mil.nga.geopackage.core.srs.SpatialReferenceSystemSfSqlDao. 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 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public SpatialReferenceSystemSfSqlDao getSpatialReferenceSystemSfSqlDao() {

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

	return dao;
}
 
Example #2
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 #3
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);

	}
}
 
Example #4
Source File: GeoPackageCore.java    From geopackage-core-java with MIT License 2 votes vote down vote up
/**
 * Get a SF/SQL Spatial Reference System DAO
 * 
 * @return SF/SQL Spatial Reference System DAO
 */
public SpatialReferenceSystemSfSqlDao getSpatialReferenceSystemSfSqlDao();