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


Java FeatureRow.getGeometry方法代码示例

本文整理汇总了Java中mil.nga.geopackage.features.user.FeatureRow.getGeometry方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureRow.getGeometry方法的具体用法?Java FeatureRow.getGeometry怎么用?Java FeatureRow.getGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mil.nga.geopackage.features.user.FeatureRow的用法示例。


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

示例1: infoFeatureClick

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例2: drawFeature

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例3: index

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例4: drawFeature

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例5: validateGeometryIndex

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例6: addEditableShapeBack

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例7: validateGeometryIndex

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的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

示例8: fineFilterResults

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Fine filter the index results verifying the click location is within the tolerance of each feature row
 *
 * @param results       feature index results
 * @param tolerance     distance tolerance
 * @param clickLocation click location
 * @return filtered feature index results
 */
private FeatureIndexResults fineFilterResults(FeatureIndexResults results, double tolerance, LatLng clickLocation) {

    FeatureIndexResults filteredResults = null;
    if(ignoreGeometryTypes.contains(geometryType)){
        filteredResults = new FeatureIndexListResults();
    }else if(clickLocation == null && ignoreGeometryTypes.isEmpty()){
        filteredResults = results;
    } else {

        FeatureIndexListResults filteredListResults = new FeatureIndexListResults();

        GoogleMapShapeConverter converter = new GoogleMapShapeConverter(
                featureDao.getProjection());

        for (FeatureRow featureRow : results) {

            GeoPackageGeometryData geomData = featureRow.getGeometry();
            if (geomData != null) {
                Geometry geometry = geomData.getGeometry();
                if (geometry != null) {

                    if(!ignoreGeometryTypes.contains(geometry.getGeometryType())) {

                        if(clickLocation != null) {

                            GoogleMapShape mapShape = converter.toShape(geometry);
                            if (MapUtils.isPointOnShape(clickLocation, mapShape, geodesic, tolerance)) {

                                filteredListResults.addRow(featureRow);

                            }
                        }else{
                            filteredListResults.addRow(featureRow);
                        }

                    }
                }
            }

        }

        filteredResults = filteredListResults;
    }

    return filteredResults;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:55,代码来源:FeatureInfoBuilder.java

示例9: validateFeatureRow

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Validate a Feature Row result
 *
 * @param featureIndexManager
 * @param featureRow
 * @param queryEnvelope
 */
private static void validateFeatureRow(
        FeatureIndexManager featureIndexManager, FeatureRow featureRow, GeometryEnvelope queryEnvelope) {
    TestCase.assertNotNull(featureRow);
    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);

    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());
            }
        } else {
            TestCase.assertFalse(queryEnvelope.hasZ());
            TestCase.assertNull(queryEnvelope.getMinZ());
            TestCase.assertNull(queryEnvelope.getMaxZ());
        }
        if (envelope.isHasM()) {
            if (queryEnvelope.hasM()) {
                TestCase.assertTrue(envelope.getMinM() <= queryEnvelope.getMaxM());
                TestCase.assertTrue(envelope.getMaxM() >= queryEnvelope.getMinM());
            }
        } else {
            TestCase.assertFalse(queryEnvelope.hasM());
            TestCase.assertNull(queryEnvelope.getMinM());
            TestCase.assertNull(queryEnvelope.getMaxM());
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:49,代码来源:FeatureIndexManagerUtils.java

示例10: processFeatureRow

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Process the feature row
 *
 * @param task
 * @param database
 * @param featureDao
 * @param row
 * @param count
 * @param maxFeatures
 * @param editable
 * @param boundingBox
 * @param maxLongitude
 * @param filter
 */
private void processFeatureRow(MapFeaturesUpdateTask task, String database, FeatureDao featureDao,
                               GoogleMapShapeConverter converter, FeatureRow row, AtomicInteger count,
                               int maxFeatures, boolean editable, BoundingBox boundingBox, double maxLongitude,
                               boolean filter) {

    boolean exists = false;
    synchronized (featureShapes) {
        exists = featureShapes.exists(row.getId(), database, featureDao.getTableName());
    }

    if (!exists) {

        GeoPackageGeometryData geometryData = row.getGeometry();
        if (geometryData != null && !geometryData.isEmpty()) {

            final Geometry geometry = geometryData.getGeometry();

            if (geometry != null) {

                boolean passesFilter = true;

                if (filter && boundingBox != null) {
                    GeometryEnvelope envelope = geometryData.getEnvelope();
                    if (envelope == null) {
                        envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
                    }
                    if (envelope != null) {
                        if (geometry.getGeometryType() == GeometryType.POINT) {
                            mil.nga.wkb.geom.Point point = (mil.nga.wkb.geom.Point) geometry;
                            passesFilter = TileBoundingBoxUtils.isPointInBoundingBox(point, boundingBox, maxLongitude);
                        } else {
                            BoundingBox geometryBoundingBox = new BoundingBox(envelope);
                            passesFilter = TileBoundingBoxUtils.overlap(boundingBox, geometryBoundingBox, maxLongitude) != null;
                        }
                    }
                }

                if (passesFilter && count.getAndIncrement() < maxFeatures) {
                    final long featureId = row.getId();
                    final GoogleMapShape shape = converter.toShape(geometry);
                    updateFeaturesBoundingBox(shape);
                    prepareShapeOptions(shape, editable, true);
                    task.addToMap(featureId, database, featureDao.getTableName(), shape);
                }
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:63,代码来源:GeoPackageMapFragment.java

示例11: mapClickMessage

import mil.nga.geopackage.features.user.FeatureRow; //导入方法依赖的package包/类
/**
 * Build a map click location message from the clicked marker
 *
 * @param marker clicked marker
 * @return click message
 */
public String mapClickMessage(Marker marker) {
    String message = null;
    if (selectedReport == null) {
        MarkerFeature markerFeature = markerIds.get(marker.getId());
        if (markerFeature != null) {
            final GeoPackage geoPackage = manager.open(markerFeature.database);
            try {
                final FeatureDao featureDao = geoPackage
                        .getFeatureDao(markerFeature.tableName);

                final FeatureRow featureRow = featureDao.queryForIdRow(markerFeature.featureId);

                if (featureRow != null) {
                    GeoPackageGeometryData geomData = featureRow.getGeometry();
                    if (geomData != null && !geomData.isEmpty()) {
                        Geometry geometry = geomData.getGeometry();
                        if (geometry != null) {
                            StringBuilder messageBuilder = new StringBuilder();
                            messageBuilder.append(markerFeature.database).append(" - ").append(markerFeature.tableName).append("\n");
                            int geometryColumn = featureRow.getGeometryColumnIndex();
                            for (int i = 0; i < featureRow.columnCount(); i++) {
                                if (i != geometryColumn) {
                                    Object value = featureRow.getValue(i);
                                    if (value != null) {
                                        messageBuilder.append("\n").append(featureRow.getColumnName(i)).append(": ").append(value);
                                    }
                                }
                            }

                            if (messageBuilder.length() > 0) {
                                messageBuilder.append("\n\n");
                            }
                            messageBuilder.append(GeometryPrinter.getGeometryString(geometry));
                            message = messageBuilder.toString();
                        }
                    }
                }
            } finally {
                geoPackage.close();
            }
        }
    }
    return message;
}
 
开发者ID:ngageoint,项目名称:disconnected-content-explorer-android,代码行数:51,代码来源:GeoPackageMapOverlays.java


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