当前位置: 首页>>代码示例>>Java>>正文


Java GeometryEnvelope类代码示例

本文整理汇总了Java中mil.nga.wkb.geom.GeometryEnvelope的典型用法代码示例。如果您正苦于以下问题:Java GeometryEnvelope类的具体用法?Java GeometryEnvelope怎么用?Java GeometryEnvelope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GeometryEnvelope类属于mil.nga.wkb.geom包,在下文中一共展示了GeometryEnvelope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: query

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Query for feature index results within the Geometry Envelope
 *
 * @param envelope geometry envelope
 * @return feature index results, close when done
 */
public FeatureIndexResults query(GeometryEnvelope envelope) {
    FeatureIndexResults results = null;
    switch (getIndexedType()) {
        case GEOPACKAGE:
            long count = featureTableIndex.count(envelope);
            CloseableIterator<GeometryIndex> geometryIndices = featureTableIndex.query(envelope);
            results = new FeatureIndexGeoPackageResults(featureTableIndex, count, geometryIndices);
            break;
        case METADATA:
            Cursor geometryMetadata = featureIndexer.query(envelope);
            results = new FeatureIndexMetadataResults(featureIndexer, geometryMetadata);
            break;
    }
    return results;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:22,代码来源:FeatureIndexManager.java

示例2: populate

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Populate a new geometry metadata from an envelope
 *
 * @param geoPackageId
 * @param tableName
 * @param geomId
 * @param envelope
 * @return
 */
public GeometryMetadata populate(long geoPackageId, String tableName, long geomId, GeometryEnvelope envelope) {

    GeometryMetadata metadata = new GeometryMetadata();
    metadata.setGeoPackageId(geoPackageId);
    metadata.setTableName(tableName);
    metadata.setId(geomId);
    metadata.setMinX(envelope.getMinX());
    metadata.setMaxX(envelope.getMaxX());
    metadata.setMinY(envelope.getMinY());
    metadata.setMaxY(envelope.getMaxY());
    if (envelope.hasZ()) {
        metadata.setMinZ(envelope.getMinZ());
        metadata.setMaxZ(envelope.getMaxZ());
    }
    if (envelope.hasM()) {
        metadata.setMinM(envelope.getMinM());
        metadata.setMaxM(envelope.getMaxM());
    }
    return metadata;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:GeometryMetadataDataSource.java

示例3: compareEnvelopes

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Compare two geometry envelopes and verify they are equal
 * 
 * @param expected
 * @param actual
 */
private static void compareEnvelopes(GeometryEnvelope expected,
		GeometryEnvelope actual) {

	if (expected == null) {
		TestCase.assertNull(actual);
	} else {
		TestCase.assertNotNull(actual);

		TestCase.assertEquals(GeoPackageGeometryData.getIndicator(expected),
                   GeoPackageGeometryData.getIndicator(actual));
		TestCase.assertEquals(expected.getMinX(), actual.getMinX());
		TestCase.assertEquals(expected.getMaxX(), actual.getMaxX());
		TestCase.assertEquals(expected.getMinY(), actual.getMinY());
		TestCase.assertEquals(expected.getMaxY(), actual.getMaxY());
		TestCase.assertEquals(expected.hasZ(), actual.hasZ());
		TestCase.assertEquals(expected.getMinZ(), actual.getMinZ());
		TestCase.assertEquals(expected.getMaxZ(), actual.getMaxZ());
		TestCase.assertEquals(expected.hasM(), actual.hasM());
		TestCase.assertEquals(expected.getMinM(), actual.getMinM());
		TestCase.assertEquals(expected.getMaxM(), actual.getMaxM());
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:GeoPackageGeometryDataUtils.java

示例4: populate

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Populate a new geometry index from an envelope
 *
 * @param tableIndex
 *            table index
 * @param geomId
 *            geometry id
 * @param envelope
 *            geometry envelope
 * @return geometry index
 */
public GeometryIndex populate(TableIndex tableIndex, long geomId,
		GeometryEnvelope envelope) {

	GeometryIndex geometryIndex = new GeometryIndex();
	geometryIndex.setTableIndex(tableIndex);
	geometryIndex.setGeomId(geomId);
	geometryIndex.setMinX(envelope.getMinX());
	geometryIndex.setMaxX(envelope.getMaxX());
	geometryIndex.setMinY(envelope.getMinY());
	geometryIndex.setMaxY(envelope.getMaxY());
	if (envelope.hasZ()) {
		geometryIndex.setMinZ(envelope.getMinZ());
		geometryIndex.setMaxZ(envelope.getMaxZ());
	}
	if (envelope.hasM()) {
		geometryIndex.setMinM(envelope.getMinM());
		geometryIndex.setMaxM(envelope.getMaxM());
	}
	return geometryIndex;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:32,代码来源:GeometryIndexDao.java

示例5: query

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Query for Geometry Index objects within the Geometry Envelope
 * 
 * @param envelope
 * @return geometry indices iterator
 */
public CloseableIterator<GeometryIndex> query(GeometryEnvelope envelope) {

	CloseableIterator<GeometryIndex> geometryIndices = null;

	QueryBuilder<GeometryIndex, GeometryIndexKey> qb = queryBuilder(envelope);
	try {
		geometryIndices = qb.iterator();
	} catch (SQLException e) {
		throw new GeoPackageException(
				"Failed to query for Geometry Indices. GeoPackage: "
						+ geoPackage.getName() + ", Table Name: "
						+ tableName + ", Column Name: " + columnName, e);
	}

	return geometryIndices;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:23,代码来源:FeatureTableCoreIndex.java

示例6: compareEnvelopes

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Compare two geometry envelopes and verify they are equal
 * 
 * @param expected
 * @param actual
 */
private static void compareEnvelopes(GeometryEnvelope expected,
		GeometryEnvelope actual) {

	if (expected == null) {
		TestCase.assertNull(actual);
	} else {
		TestCase.assertNotNull(actual);

		TestCase.assertEquals(
				GeoPackageGeometryData.getIndicator(expected),
				GeoPackageGeometryData.getIndicator(actual));
		TestCase.assertEquals(expected.getMinX(), actual.getMinX());
		TestCase.assertEquals(expected.getMaxX(), actual.getMaxX());
		TestCase.assertEquals(expected.getMinY(), actual.getMinY());
		TestCase.assertEquals(expected.getMaxY(), actual.getMaxY());
		TestCase.assertEquals(expected.hasZ(), actual.hasZ());
		TestCase.assertEquals(expected.getMinZ(), actual.getMinZ());
		TestCase.assertEquals(expected.getMaxZ(), actual.getMaxZ());
		TestCase.assertEquals(expected.hasM(), actual.hasM());
		TestCase.assertEquals(expected.getMinM(), actual.getMinM());
		TestCase.assertEquals(expected.getMaxM(), actual.getMaxM());
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:GeoPackageGeometryDataUtils.java

示例7: geometryCentroidTester

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Test the geometry centroid
 * 
 * @param geometry
 * @throws IOException
 */
private Point geometryCentroidTester(Geometry geometry) throws IOException {

	Point point = GeometryUtils.getCentroid(geometry);

	GeometryEnvelope envelope = GeometryEnvelopeBuilder
			.buildEnvelope(geometry);

	if (geometry.getGeometryType() == GeometryType.POINT) {
		TestCase.assertEquals(envelope.getMinX(), point.getX());
		TestCase.assertEquals(envelope.getMaxX(), point.getX());
		TestCase.assertEquals(envelope.getMinY(), point.getY());
		TestCase.assertEquals(envelope.getMaxY(), point.getY());
	}

	TestCase.assertTrue(point.getX() >= envelope.getMinX());
	TestCase.assertTrue(point.getX() <= envelope.getMaxX());
	TestCase.assertTrue(point.getY() >= envelope.getMinY());
	TestCase.assertTrue(point.getY() <= envelope.getMaxY());

	return point;
}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:28,代码来源:GeometryUtilsTest.java

示例8: compareEnvelopes

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Compare two geometry envelopes and verify they are equal
 * 
 * @param expected
 * @param actual
 */
public static void compareEnvelopes(GeometryEnvelope expected,
		GeometryEnvelope actual) {

	if (expected == null) {
		TestCase.assertNull(actual);
	} else {
		TestCase.assertNotNull(actual);

		TestCase.assertEquals(expected.getMinX(), actual.getMinX());
		TestCase.assertEquals(expected.getMaxX(), actual.getMaxX());
		TestCase.assertEquals(expected.getMinY(), actual.getMinY());
		TestCase.assertEquals(expected.getMaxY(), actual.getMaxY());
		TestCase.assertEquals(expected.hasZ(), actual.hasZ());
		TestCase.assertEquals(expected.getMinZ(), actual.getMinZ());
		TestCase.assertEquals(expected.getMaxZ(), actual.getMaxZ());
		TestCase.assertEquals(expected.hasM(), actual.hasM());
		TestCase.assertEquals(expected.getMinM(), actual.getMinM());
		TestCase.assertEquals(expected.getMaxM(), actual.getMaxM());
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-wkb-java,代码行数:28,代码来源:WKBTestUtils.java

示例9: index

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Index the feature row
 *
 * @param geoPackageId
 * @param row
 * @param possibleUpdate
 * @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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:41,代码来源:FeatureIndexer.java

示例10: query

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Query for all table geometry metadata matching the bounding box in the same projection
 *
 * @param geoPackageId
 * @param tableName
 * @param boundingBox
 * @return cursor that must be closed
 */
public Cursor query(long geoPackageId, String tableName, BoundingBox boundingBox) {
    GeometryEnvelope envelope = new GeometryEnvelope();
    envelope.setMinX(boundingBox.getMinLongitude());
    envelope.setMaxX(boundingBox.getMaxLongitude());
    envelope.setMinY(boundingBox.getMinLatitude());
    envelope.setMaxY(boundingBox.getMaxLatitude());
    return query(geoPackageId, tableName, envelope);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:17,代码来源:GeometryMetadataDataSource.java

示例11: validateGeometryIndex

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * 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());
    GeoPackageGeometryData geometryData = featureRow.getGeometry();
    GeometryEnvelope envelope = geometryData.getEnvelope();
    if (envelope == null) {
        Geometry geometry = geometryData.getGeometry();
        if (geometry != null) {
            envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
        }
    }

    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());
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:44,代码来源:FeatureTableIndexUtils.java

示例12: getCameraUpdate

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Get the camera update for zooming to the geometry
 *
 * @param view              view
 * @param pointZoom         point zoom
 * @param paddingPercentage padding percentage
 * @return camera update
 */
public CameraUpdate getCameraUpdate(View view, int pointZoom, float paddingPercentage) {

    CameraUpdate update = null;

    if (geometry.getGeometryType() == GeometryType.POINT) {

        update = CameraUpdateFactory.newLatLngZoom(getFirstLatLng(), pointZoom);

    } else {

        GeometryEnvelope envelope = getGeometryEnvelope();

        final LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
        boundsBuilder.include(new LatLng(envelope.getMinY(), envelope.getMinX()));
        boundsBuilder.include(new LatLng(envelope.getMinY(), envelope.getMaxX()));
        boundsBuilder.include(new LatLng(envelope.getMaxY(), envelope.getMinX()));
        boundsBuilder.include(new LatLng(envelope.getMaxY(), envelope.getMaxX()));

        int padding = 0;
        if (view != null) {
            int minViewLength = Math.min(view.getWidth(), view.getHeight());
            padding = (int) Math.floor(minViewLength
                    * paddingPercentage);
        }

        update = CameraUpdateFactory.newLatLngBounds(
                boundsBuilder.build(), padding);

    }

    return update;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:41,代码来源:ObservationLocation.java

示例13: index

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Index the geometry id and geometry data
 * 
 * @param tableIndex
 * @param geomId
 * @param geomData
 * 
 * @return true if indexed
 */
protected boolean index(TableIndex tableIndex, long geomId,
		GeoPackageGeometryData geomData) {

	boolean indexed = false;

	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) {
			GeometryIndex geometryIndex = geometryIndexDao.populate(
					tableIndex, geomId, envelope);
			try {
				geometryIndexDao.createOrUpdate(geometryIndex);
				indexed = true;
			} catch (SQLException e) {
				throw new GeoPackageException(
						"Failed to create or update Geometry Index. GeoPackage: "
								+ geoPackage.getName() + ", Table Name: "
								+ tableName + ", Geom Id: " + geomId, e);
			}
		}
	}

	return indexed;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:46,代码来源:FeatureTableCoreIndex.java

示例14: queryBuilder

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Build a query builder to query for Geometry Index objects within the
 * Geometry Envelope
 * 
 * @param envelope
 * @return query builder
 */
public QueryBuilder<GeometryIndex, GeometryIndexKey> queryBuilder(
		GeometryEnvelope envelope) {

	QueryBuilder<GeometryIndex, GeometryIndexKey> qb = geometryIndexDao
			.queryBuilder();
	try {

		Where<GeometryIndex, GeometryIndexKey> where = qb.where();
		where.eq(GeometryIndex.COLUMN_TABLE_NAME, tableName).and()
				.le(GeometryIndex.COLUMN_MIN_X, envelope.getMaxX()).and()
				.ge(GeometryIndex.COLUMN_MAX_X, envelope.getMinX()).and()
				.le(GeometryIndex.COLUMN_MIN_Y, envelope.getMaxY()).and()
				.ge(GeometryIndex.COLUMN_MAX_Y, envelope.getMinY());

		if (envelope.hasZ()) {
			where.and().le(GeometryIndex.COLUMN_MIN_Z, envelope.getMaxZ())
					.and()
					.ge(GeometryIndex.COLUMN_MAX_Z, envelope.getMinZ());
		}

		if (envelope.hasM()) {
			where.and().le(GeometryIndex.COLUMN_MIN_M, envelope.getMaxM())
					.and()
					.ge(GeometryIndex.COLUMN_MAX_M, envelope.getMinM());
		}

	} catch (SQLException e) {
		throw new GeoPackageException(
				"Failed to build query for Geometry Indices. GeoPackage: "
						+ geoPackage.getName() + ", Table Name: "
						+ tableName + ", Column Name: " + columnName, e);
	}

	return qb;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:43,代码来源:FeatureTableCoreIndex.java

示例15: buildEnvelope

import mil.nga.wkb.geom.GeometryEnvelope; //导入依赖的package包/类
/**
 * Build a Geometry Envelope from the bounding box
 * 
 * @return geometry envelope
 * @since 1.1.0
 */
public GeometryEnvelope buildEnvelope() {
	GeometryEnvelope envelope = new GeometryEnvelope();
	envelope.setMinX(minLongitude);
	envelope.setMaxX(maxLongitude);
	envelope.setMinY(minLatitude);
	envelope.setMaxY(maxLatitude);
	return envelope;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:15,代码来源:BoundingBox.java


注:本文中的mil.nga.wkb.geom.GeometryEnvelope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。