Java Code Examples for mil.nga.geopackage.features.user.FeatureRow#getGeometryEnvelope()

The following examples show how to use mil.nga.geopackage.features.user.FeatureRow#getGeometryEnvelope() . 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: FeatureTableIndexUtils.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Validate a Geometry Index result
 *
 * @param featureTableIndex
 * @param geometryIndex
 */
private static void validateGeometryIndex(
        FeatureTableIndex featureTableIndex, GeometryIndex geometryIndex) {
    FeatureRow featureRow = featureTableIndex.getFeatureRow(geometryIndex);
    TestCase.assertNotNull(featureRow);
    TestCase.assertEquals(featureTableIndex.getTableName(),
            geometryIndex.getTableName());
    TestCase.assertEquals(geometryIndex.getGeomId(), featureRow.getId());
    GeometryEnvelope envelope = featureRow.getGeometryEnvelope();

    TestCase.assertNotNull(envelope);

    TestCase.assertEquals(envelope.getMinX(), geometryIndex.getMinX());
    TestCase.assertEquals(envelope.getMaxX(), geometryIndex.getMaxX());
    TestCase.assertEquals(envelope.getMinY(), geometryIndex.getMinY());
    TestCase.assertEquals(envelope.getMaxY(), geometryIndex.getMaxY());
    if (envelope.isHasZ()) {
        TestCase.assertEquals(envelope.getMinZ(), geometryIndex.getMinZ());
        TestCase.assertEquals(envelope.getMaxZ(), geometryIndex.getMaxZ());
    } else {
        TestCase.assertNull(geometryIndex.getMinZ());
        TestCase.assertNull(geometryIndex.getMaxZ());
    }
    if (envelope.isHasM()) {
        TestCase.assertEquals(envelope.getMinM(), geometryIndex.getMinM());
        TestCase.assertEquals(envelope.getMaxM(), geometryIndex.getMaxM());
    } else {
        TestCase.assertNull(geometryIndex.getMinM());
        TestCase.assertNull(geometryIndex.getMaxM());
    }
}
 
Example 2
Source File: FeatureIndexManagerUtils.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Validate a Feature Row result
 *
 * @param featureIndexManager
 * @param featureRow
 * @param queryEnvelope
 */
private static void validateFeatureRow(
        FeatureIndexManager featureIndexManager, FeatureRow featureRow,
        GeometryEnvelope queryEnvelope, boolean includeEmpty) {
    TestCase.assertNotNull(featureRow);
    GeometryEnvelope envelope = featureRow.getGeometryEnvelope();

    if (!includeEmpty) {
        TestCase.assertNotNull(envelope);

        if (queryEnvelope != null) {
            TestCase.assertTrue(envelope.getMinX() <= queryEnvelope
                    .getMaxX());
            TestCase.assertTrue(envelope.getMaxX() >= queryEnvelope
                    .getMinX());
            TestCase.assertTrue(envelope.getMinY() <= queryEnvelope
                    .getMaxY());
            TestCase.assertTrue(envelope.getMaxY() >= queryEnvelope
                    .getMinY());
            if (envelope.isHasZ()) {
                if (queryEnvelope.hasZ()) {
                    TestCase.assertTrue(envelope.getMinZ() <= queryEnvelope
                            .getMaxZ());
                    TestCase.assertTrue(envelope.getMaxZ() >= queryEnvelope
                            .getMinZ());
                }
            }
            if (envelope.isHasM()) {
                if (queryEnvelope.hasM()) {
                    TestCase.assertTrue(envelope.getMinM() <= queryEnvelope
                            .getMaxM());
                    TestCase.assertTrue(envelope.getMaxM() >= queryEnvelope
                            .getMinM());
                }
            }
        }
    }
}
 
Example 3
Source File: FeatureTableIndexUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Validate a Geometry Index result
 * 
 * @param featureTableIndex
 * @param geometryIndex
 */
private static void validateGeometryIndex(
		FeatureTableIndex featureTableIndex, GeometryIndex geometryIndex) {
	FeatureRow featureRow = featureTableIndex.getFeatureRow(geometryIndex);
	TestCase.assertNotNull(featureRow);
	TestCase.assertEquals(featureTableIndex.getTableName(),
			geometryIndex.getTableName());
	TestCase.assertEquals(geometryIndex.getGeomId(), featureRow.getId());
	GeometryEnvelope envelope = featureRow.getGeometryEnvelope();

	TestCase.assertNotNull(envelope);

	TestCase.assertEquals(envelope.getMinX(), geometryIndex.getMinX());
	TestCase.assertEquals(envelope.getMaxX(), geometryIndex.getMaxX());
	TestCase.assertEquals(envelope.getMinY(), geometryIndex.getMinY());
	TestCase.assertEquals(envelope.getMaxY(), geometryIndex.getMaxY());
	if (envelope.isHasZ()) {
		TestCase.assertEquals(envelope.getMinZ(), geometryIndex.getMinZ());
		TestCase.assertEquals(envelope.getMaxZ(), geometryIndex.getMaxZ());
	} else {
		TestCase.assertNull(geometryIndex.getMinZ());
		TestCase.assertNull(geometryIndex.getMaxZ());
	}
	if (envelope.isHasM()) {
		TestCase.assertEquals(envelope.getMinM(), geometryIndex.getMinM());
		TestCase.assertEquals(envelope.getMaxM(), geometryIndex.getMaxM());
	} else {
		TestCase.assertNull(geometryIndex.getMinM());
		TestCase.assertNull(geometryIndex.getMaxM());
	}
}
 
Example 4
Source File: FeatureIndexManagerUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Validate a Feature Row result
 *
 * @param featureIndexManager
 * @param featureRow
 * @param queryEnvelope
 */
private static void validateFeatureRow(
		FeatureIndexManager featureIndexManager, FeatureRow featureRow,
		GeometryEnvelope queryEnvelope, boolean includeEmpty) {
	TestCase.assertNotNull(featureRow);
	GeometryEnvelope envelope = featureRow.getGeometryEnvelope();

	if (!includeEmpty) {
		TestCase.assertNotNull(envelope);

		if (queryEnvelope != null) {
			TestCase.assertTrue(
					envelope.getMinX() <= queryEnvelope.getMaxX());
			TestCase.assertTrue(
					envelope.getMaxX() >= queryEnvelope.getMinX());
			TestCase.assertTrue(
					envelope.getMinY() <= queryEnvelope.getMaxY());
			TestCase.assertTrue(
					envelope.getMaxY() >= queryEnvelope.getMinY());
			if (envelope.isHasZ()) {
				if (queryEnvelope.hasZ()) {
					TestCase.assertTrue(
							envelope.getMinZ() <= queryEnvelope.getMaxZ());
					TestCase.assertTrue(
							envelope.getMaxZ() >= queryEnvelope.getMinZ());
				}
			}
			if (envelope.isHasM()) {
				if (queryEnvelope.hasM()) {
					TestCase.assertTrue(
							envelope.getMinM() <= queryEnvelope.getMaxM());
					TestCase.assertTrue(
							envelope.getMaxM() >= queryEnvelope.getMinM());
				}
			}
		}
	}
}