本文整理汇总了Java中mil.nga.geopackage.geom.GeoPackageGeometryData类的典型用法代码示例。如果您正苦于以下问题:Java GeoPackageGeometryData类的具体用法?Java GeoPackageGeometryData怎么用?Java GeoPackageGeometryData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoPackageGeometryData类属于mil.nga.geopackage.geom包,在下文中一共展示了GeoPackageGeometryData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: jsonCompatible
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Build a JSON compatible object
*
* @param includePoints true to include point geometries, ignored if includeGeometries is true
* @param includeGeometries true to include all geometry types
* @return JSON compatiable object
*/
public Object jsonCompatible(boolean includePoints, boolean includeGeometries) {
Map<String, Object> jsonValues = new HashMap<>();
for (String key : values.keySet()) {
Object jsonValue = null;
Object value = values.get(key);
if (key.equals(geometryColumn)) {
GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
if (geometryData.getGeometry() != null) {
if (includeGeometries || (includePoints && geometryData.getGeometry().getGeometryType() == GeometryType.POINT)) {
jsonValue = GeometryJSONCompatible.getJSONCompatibleGeometry(geometryData.getGeometry());
}
} else {
jsonValue = value;
}
if (jsonValue != null) {
jsonValues.put(key, jsonValue);
}
}
}
return jsonValues;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:32,代码来源:FeatureRowData.java
示例2: compareGeometryData
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Compare two geometry datas and verify they are equal
*
* @param expected
* @param actual
*/
public static void compareGeometryData(GeoPackageGeometryData expected,
GeoPackageGeometryData actual) {
// Compare geometry data attributes
TestCase.assertEquals(expected.isExtended(), actual.isExtended());
TestCase.assertEquals(expected.isEmpty(), actual.isEmpty());
TestCase.assertEquals(expected.getByteOrder(), actual.getByteOrder());
TestCase.assertEquals(expected.getSrsId(), actual.getSrsId());
compareEnvelopes(expected.getEnvelope(), actual.getEnvelope());
TestCase.assertEquals(expected.getWkbGeometryIndex(),
actual.getWkbGeometryIndex());
// Compare header bytes
compareByteArrays(expected.getHeaderBytes(), actual.getHeaderBytes());
// Compare geometries
compareGeometries(expected.getGeometry(), actual.getGeometry());
// Compare well-known binary geometries
compareByteArrays(expected.getWkbBytes(), actual.getWkbBytes());
// Compare all bytes
compareByteArrays(expected.getBytes(), actual.getBytes());
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:32,代码来源:GeoPackageGeometryDataUtils.java
示例3: compareEnvelopes
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的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: infoFeatureClick
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Info feature click
*
* @param marker
* @param markerFeature
*/
private void infoFeatureClick(final Marker marker, MarkerFeature markerFeature) {
final GeoPackage geoPackage = manager.open(markerFeature.database);
final FeatureDao featureDao = geoPackage
.getFeatureDao(markerFeature.tableName);
final FeatureRow featureRow = featureDao.queryForIdRow(markerFeature.featureId);
if (featureRow != null) {
final GeoPackageGeometryData geomData = featureRow.getGeometry();
final GeometryType geometryType = geomData.getGeometry()
.getGeometryType();
String title = getTitle(geometryType, marker);
infoExistingFeatureOption(geoPackage, featureRow, title, geomData);
} else {
geoPackage.close();
}
}
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:25,代码来源:GeoPackageMapFragment.java
示例5: drawFeature
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Draw the feature
*
* @param zoom
* zoom level
* @param boundingBox
* @param transform
* @param graphics
* @param row
*/
private void drawFeature(int zoom, BoundingBox boundingBox,
ProjectionTransform transform, Graphics2D graphics, FeatureRow row) {
try {
GeoPackageGeometryData geomData = row.getGeometry();
if (geomData != null) {
Geometry geometry = geomData.getGeometry();
double simplifyTolerance = TileBoundingBoxUtils
.toleranceDistance(zoom, tileWidth, tileHeight);
drawGeometry(simplifyTolerance, boundingBox, transform,
graphics, geometry);
}
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to draw feature in tile. Table: "
+ featureDao.getTableName(), e);
}
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:27,代码来源:DefaultFeatureTiles.java
示例6: compareEnvelopes
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的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: projectGeometry
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Project the geometry into the provided projection
*
* @param geometryData geometry data
* @param projection projection
*/
public void projectGeometry(GeoPackageGeometryData geometryData, Projection projection) {
if (geometryData.getGeometry() != null) {
try {
SpatialReferenceSystemDao srsDao = DaoManager.createDao(featureDao.getDb().getConnectionSource(), SpatialReferenceSystem.class);
int srsId = geometryData.getSrsId();
SpatialReferenceSystem srs = srsDao.queryForId((long) srsId);
if (!projection.equals(srs.getOrganization(), srs.getOrganizationCoordsysId())) {
Projection geomProjection = ProjectionFactory.getProjection(srs);
ProjectionTransform transform = geomProjection.getTransformation(projection);
Geometry projectedGeometry = transform.transform(geometryData.getGeometry());
geometryData.setGeometry(projectedGeometry);
SpatialReferenceSystem projectionSrs = srsDao.getOrCreateCode(projection.getAuthority(), Long.parseLong(projection.getCode()));
geometryData.setSrsId((int) projectionSrs.getSrsId());
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to project geometry to projection with Authority: "
+ projection.getAuthority() + ", Code: " + projection.getCode(), e);
}
}
}
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:33,代码来源:FeatureInfoBuilder.java
示例8: columnToContentValue
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* {@inheritDoc}
* Handles geometry columns
*/
@Override
protected void columnToContentValue(ContentValues contentValues,
FeatureColumn column, Object value) {
if (column.isGeometry()) {
String columnName = column.getName();
if (value instanceof GeoPackageGeometryData) {
GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
try {
contentValues.put(columnName, geometryData.toBytes());
} catch (IOException e) {
throw new GeoPackageException(
"Failed to write Geometry Data bytes. column: "
+ columnName, e);
}
} else if (value instanceof byte[]) {
contentValues.put(columnName, (byte[]) value);
} else {
throw new GeoPackageException(
"Unsupported update geometry column value type. column: "
+ columnName + ", value type: "
+ value.getClass().getName());
}
} else {
super.columnToContentValue(contentValues, column, value);
}
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:35,代码来源:FeatureRow.java
示例9: index
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的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: drawFeature
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Draw the feature on the canvas
*
* @param zoom zoom level
* @param boundingBox
* @param transform
* @param canvas
* @param row
*/
private void drawFeature(int zoom, BoundingBox boundingBox, ProjectionTransform transform, Canvas canvas, FeatureRow row) {
try {
GeoPackageGeometryData geomData = row.getGeometry();
if (geomData != null) {
Geometry geometry = geomData.getGeometry();
double simplifyTolerance = TileBoundingBoxUtils.toleranceDistance(zoom, tileWidth, tileHeight);
drawShape(simplifyTolerance, boundingBox, transform, canvas, geometry);
}
} catch (Exception e) {
Log.e(DefaultFeatureTiles.class.getSimpleName(), "Failed to draw feature in tile. Table: "
+ featureDao.getTableName(), e);
}
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:23,代码来源:DefaultFeatureTiles.java
示例11: validateGeometryIndex
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的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: setPoint
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
public static void setPoint(FeatureRow featureRow, double x, double y) {
GeoPackageGeometryData geomData = new GeoPackageGeometryData(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
Point point = new Point(false, false, x, y);
geomData.setGeometry(point);
featureRow.setGeometry(geomData);
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:8,代码来源:FeatureTileUtils.java
示例13: insertLine
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
public static long insertLine(FeatureDao featureDao, double[][] points) {
FeatureRow featureRow = featureDao.newRow();
GeoPackageGeometryData geomData = new GeoPackageGeometryData(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
LineString lineString = getLineString(points);
geomData.setGeometry(lineString);
featureRow.setGeometry(geomData);
return featureDao.insert(featureRow);
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:10,代码来源:FeatureTileUtils.java
示例14: insertPolygon
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
public static long insertPolygon(FeatureDao featureDao, double[][]... points) {
FeatureRow featureRow = featureDao.newRow();
GeoPackageGeometryData geomData = new GeoPackageGeometryData(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
Polygon polygon = new Polygon(false, false);
for (double[][] ring : points) {
LineString lineString = getLineString(ring);
polygon.addRing(lineString);
}
geomData.setGeometry(polygon);
featureRow.setGeometry(geomData);
return featureDao.insert(featureRow);
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:14,代码来源:FeatureTileUtils.java
示例15: index
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的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
示例16: addEditableShapeBack
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* Add editable shape back after editing is complete
*/
private void addEditableShapeBack() {
Long featureId = editFeatureIds.get(editFeatureMarker.getId());
final GeoPackage geoPackage = manager.open(editFeaturesDatabase);
try {
final FeatureDao featureDao = geoPackage
.getFeatureDao(editFeaturesTable);
final FeatureRow featureRow = featureDao.queryForIdRow(featureId);
GeoPackageGeometryData geomData = featureRow.getGeometry();
if (geomData != null) {
Geometry geometry = geomData.getGeometry();
if (geometry != null) {
GoogleMapShapeConverter converter = new GoogleMapShapeConverter(
featureDao.getProjection());
GoogleMapShape shape = converter.toShape(geometry);
prepareShapeOptions(shape, true, true);
GoogleMapShape mapShape = GoogleMapShapeConverter
.addShapeToMap(map, shape);
addEditableShape(featureId, mapShape);
}
}
} finally {
if (geoPackage != null) {
geoPackage.close();
}
}
}
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:31,代码来源:GeoPackageMapFragment.java
示例17: columnToContentValue
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* Handles geometry columns
*/
@Override
protected void columnToContentValue(ContentValues contentValues,
FeatureColumn column, Object value) {
if (column.isGeometry()) {
String columnName = column.getName();
if (value instanceof GeoPackageGeometryData) {
GeoPackageGeometryData geometryData = (GeoPackageGeometryData) value;
try {
contentValues.put(columnName, geometryData.toBytes());
} catch (IOException e) {
throw new GeoPackageException(
"Failed to write Geometry Data bytes. column: "
+ columnName, e);
}
} else if (value instanceof byte[]) {
contentValues.put(columnName, (byte[]) value);
} else {
throw new GeoPackageException(
"Unsupported update geometry column value type. column: "
+ columnName + ", value type: "
+ value.getClass().getName());
}
} else {
super.columnToContentValue(contentValues, column, value);
}
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:36,代码来源:FeatureRow.java
示例18: validateGeometryIndex
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的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-java,代码行数:44,代码来源:FeatureTableIndexUtils.java
示例19: setPoint
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
public static void setPoint(FeatureRow featureRow, double x, double y) {
GeoPackageGeometryData geomData = new GeoPackageGeometryData(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
Point point = new Point(false, false, x, y);
geomData.setGeometry(point);
featureRow.setGeometry(geomData);
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:8,代码来源:FeatureTileUtils.java
示例20: insertLine
import mil.nga.geopackage.geom.GeoPackageGeometryData; //导入依赖的package包/类
public static long insertLine(FeatureDao featureDao, double[][] points) {
FeatureRow featureRow = featureDao.newRow();
GeoPackageGeometryData geomData = new GeoPackageGeometryData(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
LineString lineString = getLineString(points);
geomData.setGeometry(lineString);
featureRow.setGeometry(geomData);
return featureDao.insert(featureRow);
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:10,代码来源:FeatureTileUtils.java
注:本文中的mil.nga.geopackage.geom.GeoPackageGeometryData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论