• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FeatureCursor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: drawTile

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Bitmap drawTile(int zoom, BoundingBox boundingBox, FeatureCursor cursor) {

    Bitmap bitmap = createNewBitmap();
    Canvas canvas = new Canvas(bitmap);

    ProjectionTransform transform = getProjectionToWebMercatorTransform(featureDao.getProjection());

    while (cursor.moveToNext()) {
        FeatureRow row = cursor.getRow();
        drawFeature(zoom, boundingBox, transform, canvas, row);
    }

    cursor.close();

    return bitmap;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:21,代码来源:DefaultFeatureTiles.java


示例2: indexRows

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Index the feature rows in the cursor
 *
 * @param tableIndex table index
 * @param cursor     feature cursor
 * @return count
 */
private int indexRows(TableIndex tableIndex, FeatureCursor cursor) {

    int count = 0;

    try {
        while ((progress == null || progress.isActive())
                && cursor.moveToNext()) {
            try {
                FeatureRow row = cursor.getRow();
                if (row.isValid()) {
                    boolean indexed = index(tableIndex,
                            row.getId(), row.getGeometry());
                    if (indexed) {
                        count++;
                    }
                    if (progress != null) {
                        progress.addProgress(1);
                    }
                }
            } catch (Exception e) {
                Log.e(FeatureTableIndex.class.getSimpleName(), "Failed to index feature. Table: "
                        + tableIndex.getTableName() + ", Position: " + cursor.getPosition(), e);
            }
        }
    } finally {
        cursor.close();
    }

    return count;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:38,代码来源:FeatureTableIndex.java


示例3: getFeatureDao

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public FeatureDao getFeatureDao(GeometryColumns geometryColumns) {

    if (geometryColumns == null) {
        throw new GeoPackageException("Non null "
                + GeometryColumns.class.getSimpleName()
                + " is required to create "
                + FeatureDao.class.getSimpleName());
    }

    // Read the existing table and create the dao
    FeatureTableReader tableReader = new FeatureTableReader(geometryColumns);
    final FeatureTable featureTable = tableReader.readTable(new FeatureWrapperConnection(database));
    FeatureConnection userDb = new FeatureConnection(database);
    FeatureDao dao = new FeatureDao(getName(), database, userDb, geometryColumns, featureTable);

    // Register the table name (with and without quotes) to wrap cursors with the feature cursor
    cursorFactory.registerTable(geometryColumns.getTableName(),
            new GeoPackageCursorWrapper() {

                @Override
                public Cursor wrapCursor(Cursor cursor) {
                    return new FeatureCursor(featureTable, cursor);
                }
            });

    // TODO
    // GeoPackages created with SQLite version 4.2.0+ with GeoPackage support are not supported
    // in Android (Nougat uses SQLite version 3.9.2)
    dropSQLiteTriggers(geometryColumns);

    return dao;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:37,代码来源:GeoPackageImpl.java


示例4: drawUnindexedTile

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Bitmap drawUnindexedTile(int tileWidth, int tileHeight, long totalFeatureCount, FeatureCursor allFeatureResults) {

    Bitmap bitmap = null;

    if (drawUnindexedTiles) {
        // Draw a tile indicating we have no idea if there are features inside.
        // The table is not indexed and more features exist than the max feature count set.
        bitmap = drawTile(tileWidth, tileHeight, "?");
    }

    return bitmap;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:17,代码来源:NumberFeaturesTile.java


示例5: drawTileQueryAll

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Draw a tile bitmap from the x, y, and zoom level by querying all features. This could
 * be very slow if there are a lot of features
 *
 * @param x
 * @param y
 * @param zoom
 * @return drawn bitmap, or null
 */
public Bitmap drawTileQueryAll(int x, int y, int zoom) {

    BoundingBox boundingBox = TileBoundingBoxUtils
            .getWebMercatorBoundingBox(x, y, zoom);

    Bitmap bitmap = null;

    // Query for all features
    FeatureCursor cursor = featureDao.queryForAll();

    try {

        Integer totalCount = null;
        if (maxFeaturesPerTile != null) {
            totalCount = cursor.getCount();
        }

        if (maxFeaturesPerTile == null || totalCount <= maxFeaturesPerTile) {

            // Draw the tile bitmap
            bitmap = drawTile(zoom, boundingBox, cursor);

        } else if (maxFeaturesTileDraw != null) {

            // Draw the unindexed max features tile
            bitmap = maxFeaturesTileDraw.drawUnindexedTile(tileWidth, tileHeight, totalCount, cursor);
        }
    } finally {
        cursor.close();
    }

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


示例6: indexTable

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Index the feature table
 *
 * @return count
 */
private int indexTable() {

    int count = 0;

    // Get or create the table metadata
    TableMetadataDataSource tableDs = new TableMetadataDataSource(db);
    TableMetadata metadata = tableDs.getOrCreate(featureDao.getDatabase(), featureDao.getTableName());

    // Delete existing index rows
    geometryMetadataDataSource.delete(featureDao.getDatabase(), featureDao.getTableName());

    // Index all features
    FeatureCursor cursor = featureDao.queryForAll();
    try {
        while ((progress == null || progress.isActive()) && cursor.moveToNext()) {
            try {
                FeatureRow row = cursor.getRow();
                boolean indexed = index(metadata.getGeoPackageId(), row, false);
                if (indexed) {
                    count++;
                }
                if (progress != null) {
                    progress.addProgress(1);
                }
            } catch (Exception e) {
                Log.e(FeatureIndexer.class.getSimpleName(), "Failed to index feature. Table: "
                        + featureDao.getTableName() + ", Position: " + cursor.getPosition(), e);
            }
        }
    } finally {
        cursor.close();
    }

    // Update the last indexed time
    if (progress == null || progress.isActive()) {
        updateLastIndexed(db, metadata.getGeoPackageId());
    }

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


示例7: testDelete

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Test delete
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void testDelete(GeoPackage geoPackage) throws SQLException {

	GeometryColumnsDao geometryColumnsDao = geoPackage
			.getGeometryColumnsDao();

	if (geometryColumnsDao.isTableExists()) {
		List<GeometryColumns> results = geometryColumnsDao.queryForAll();

		for (GeometryColumns geometryColumns : results) {

			FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
			TestCase.assertNotNull(dao);

			FeatureCursor cursor = dao.queryForAll();
			int count = cursor.getCount();
			if (count > 0) {

				// Choose random feature
				int random = (int) (Math.random() * count);
				cursor.moveToPosition(random);

				FeatureRow featureRow = cursor.getRow();
				cursor.close();

				// Delete row
				try {
					TestCase.assertEquals(1, dao.delete(featureRow));
				} catch (SQLiteException e) {
					if (TestUtils.isFutureSQLiteException(e)) {
						continue;
					} else {
						throw e;
					}
				}

				// Verify deleted
				FeatureRow queryFeatureRow = dao.queryForIdRow(featureRow
						.getId());
				TestCase.assertNull(queryFeatureRow);
				cursor = dao.queryForAll();
				TestCase.assertEquals(count - 1, cursor.getCount());
				cursor.close();
			}
			cursor.close();
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:54,代码来源:FeatureUtils.java


示例8: testGeometryProjectionTransform

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Test transforming geometries between projections
 *
 * @param geoPackage
 * @throws SQLException
 * @throws IOException
 */
public static void testGeometryProjectionTransform(GeoPackage geoPackage)
		throws SQLException, IOException {

	GeometryColumnsDao geometryColumnsDao = geoPackage
			.getGeometryColumnsDao();

	if (geometryColumnsDao.isTableExists()) {
		List<GeometryColumns> results = geometryColumnsDao.queryForAll();

		for (GeometryColumns geometryColumns : results) {

			FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
			TestCase.assertNotNull(dao);

			FeatureCursor cursor = dao.queryForAll();

			while (cursor.moveToNext()) {

				GeoPackageGeometryData geometryData = cursor.getGeometry();
				if (geometryData != null) {

					Geometry geometry = geometryData.getGeometry();

					if (geometry != null) {

						SpatialReferenceSystemDao srsDao = geoPackage
								.getSpatialReferenceSystemDao();
						long srsId = geometryData.getSrsId();
						SpatialReferenceSystem srs = srsDao
								.queryForId(srsId);

						long epsg = srs.getOrganizationCoordsysId();
						Projection projection = ProjectionFactory
								.getProjection(srs);
						long toEpsg = -1;
						if (epsg == ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) {
							toEpsg = ProjectionConstants.EPSG_WEB_MERCATOR;
						} else {
							toEpsg = ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM;
						}
						ProjectionTransform transformTo = projection
								.getTransformation(toEpsg);
						ProjectionTransform transformFrom = transformTo
								.getToProjection().getTransformation(srs);

						byte[] bytes = geometryData.getWkbBytes();

						Geometry projectedGeometry = transformTo
								.transform(geometry);
						GeoPackageGeometryData projectedGeometryData = new GeoPackageGeometryData(
								-1);
						projectedGeometryData
								.setGeometry(projectedGeometry);
						projectedGeometryData.toBytes();
						byte[] projectedBytes = projectedGeometryData
								.getWkbBytes();

						if (epsg > 0) {
							TestCase.assertFalse(equalByteArrays(bytes,
									projectedBytes));
						}

						Geometry restoredGeometry = transformFrom
								.transform(projectedGeometry);

						compareGeometries(geometry, restoredGeometry, .001);
					}
				}

			}
			cursor.close();
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:82,代码来源:GeoPackageGeometryDataUtils.java


示例9: drawUnindexedTile

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Draw a custom tile when the number of features within the tile is unknown.
 * This is called when a feature table is not indexed and more total features exist than the
 * max per tile.
 *
 * @param tileWidth         tile width to draw
 * @param tileHeight        tile height to draw
 * @param totalFeatureCount count of total features in the feature table
 * @param allFeatureResults           results in a feature cursor
 * @return custom bitmap, or null
 */
public Bitmap drawUnindexedTile(int tileWidth, int tileHeight, long totalFeatureCount, FeatureCursor allFeatureResults);
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:13,代码来源:CustomFeaturesTile.java


示例10: drawTile

import mil.nga.geopackage.features.user.FeatureCursor; //导入依赖的package包/类
/**
 * Draw a tile bitmap from feature geometries in the provided cursor
 *
 * @param zoom                   zoom level
 * @param webMercatorBoundingBox
 * @param cursor
 * @return tile
 * @since 2.0.0
 */
public abstract Bitmap drawTile(int zoom, BoundingBox webMercatorBoundingBox, FeatureCursor cursor);
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:11,代码来源:FeatureTiles.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScreenViewBuilder类代码示例发布时间:2022-05-22
下一篇:
Java LoginContextFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap