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


Java FeatureTiles类代码示例

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


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

示例1: FeatureOverlayQuery

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param context
 * @param boundedOverlay
 * @param featureTiles
 * @since 1.2.5
 */
public FeatureOverlayQuery(Context context, BoundedOverlay boundedOverlay, FeatureTiles featureTiles) {
    this.boundedOverlay = boundedOverlay;
    this.featureTiles = featureTiles;

    Resources resources = context.getResources();

    // Get the screen percentage to determine when a feature is clicked
    TypedValue screenPercentage = new TypedValue();
    resources.getValue(R.dimen.map_feature_overlay_click_screen_percentage, screenPercentage, true);
    screenClickPercentage = screenPercentage.getFloat();

    maxFeaturesInfo = resources.getBoolean(R.bool.map_feature_overlay_max_features_info);
    featuresInfo = resources.getBoolean(R.bool.map_feature_overlay_features_info);

    FeatureDao featureDao = featureTiles.getFeatureDao();
    featureInfoBuilder = new FeatureInfoBuilder(context, featureDao);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:26,代码来源:FeatureOverlayQuery.java

示例2: loadTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Load tiles from features
 *
 * @param activity
 * @param callback
 * @param active
 * @param geoPackage
 * @param tableName
 * @param featureTiles
 * @param minZoom
 * @param maxZoom
 * @param compressFormat
 * @param compressQuality
 * @param googleTiles
 * @param boundingBox
 * @param epsg
 */
public static void loadTiles(Activity activity, ILoadTilesTask callback,
                             GeoPackageDatabases active, GeoPackage geoPackage, String tableName,
                             FeatureTiles featureTiles, int minZoom, int maxZoom,
                             CompressFormat compressFormat, Integer compressQuality,
                             boolean googleTiles, BoundingBox boundingBox, long epsg) {

    GeoPackageUtils.prepareFeatureTiles(featureTiles);

    Projection projection = ProjectionFactory.getProjection(epsg);
    BoundingBox bbox = transform(boundingBox, projection);

    TileGenerator tileGenerator = new FeatureTileGenerator(activity, geoPackage,
            tableName, featureTiles, minZoom, maxZoom, bbox, projection);
    setTileGenerator(activity, tileGenerator, minZoom, maxZoom, compressFormat, compressQuality, googleTiles, boundingBox);

    loadTiles(activity, callback, active, geoPackage, tableName, tileGenerator);
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:35,代码来源:LoadTilesTask.java

示例3: createTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
private void createTiles(FeatureTiles featureTiles, int zoom) {
    int tilesPerSide = TileBoundingBoxUtils.tilesPerSide(zoom);
    for (int i = 0; i < tilesPerSide; i++) {
        for (int j = 0; j < tilesPerSide; j++) {
            Bitmap bitmap = featureTiles.drawTile(i, j, zoom);
            assertTrue(bitmap.getByteCount() > 0);
            assertEquals(featureTiles.getTileWidth(), bitmap.getWidth());
            assertEquals(featureTiles.getTileHeight(), bitmap.getHeight());
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:12,代码来源:FeatureTilesTest.java

示例4: createFeatureTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Create a new feature tiles
 *
 * @return
 */
public static FeatureTiles createFeatureTiles(Context context, GeoPackage geoPackage, FeatureDao featureDao) {

    FeatureTiles featureTiles = new DefaultFeatureTiles(context, featureDao);

    Paint pointPaint = featureTiles.getPointPaint();
    //pointPaint.setColor(Color.BLUE);
    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), mil.nga.geopackage.test.R.drawable.ic_launcher);
    bitmap = Bitmap.createScaledBitmap(bitmap, 25, 25, false);
    FeatureTilePointIcon icon = new FeatureTilePointIcon(bitmap);
    featureTiles.setPointIcon(icon);

    Paint linePaint = featureTiles.getLinePaint();
    linePaint.setColor(Color.GREEN);

    Paint polygonPaint = featureTiles.getPolygonPaint();
    polygonPaint.setColor(Color.RED);

    featureTiles.setFillPolygon(true);
    Paint polygonFillPaint = featureTiles.getPolygonFillPaint();
    polygonFillPaint.setColor(Color.RED);
    polygonFillPaint.setAlpha(50);

    featureTiles.calculateDrawOverlap();

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

示例5: testTileGenerator

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Test tile generator
 *
 * @throws java.io.IOException
 * @throws java.sql.SQLException
 */
public void testTileGenerator() throws IOException, SQLException {

    int minZoom = 0;
    int maxZoom = 4;

    FeatureDao featureDao = FeatureTileUtils.createFeatureDao(geoPackage);

    FeatureTileUtils.insertFeatures(geoPackage, featureDao);

    FeatureTiles featureTiles = FeatureTileUtils.createFeatureTiles(activity, geoPackage, featureDao);

    BoundingBox boundingBox = new BoundingBox();
    boundingBox = TileBoundingBoxUtils.boundWgs84BoundingBoxWithWebMercatorLimits(boundingBox);
    boundingBox = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM)
            .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR)
            .transform(boundingBox);
    TileGenerator tileGenerator = new FeatureTileGenerator(activity, geoPackage,
            "gen_feature_tiles", featureTiles, minZoom, maxZoom, boundingBox,
            ProjectionFactory.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR));
    tileGenerator.setGoogleTiles(false);

    int tiles = tileGenerator.generateTiles();

    int expectedTiles = 0;
    for (int i = minZoom; i <= maxZoom; i++) {
        int tilesPerSide = TileBoundingBoxUtils.tilesPerSide(i);
        expectedTiles += (tilesPerSide * tilesPerSide);
    }

    assertEquals(expectedTiles, tiles);

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

示例6: prepareFeatureTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Prepare the provided feature tiles
 *
 * @param featureTiles
 */
public static void prepareFeatureTiles(FeatureTiles featureTiles) {

    // TODO The projection for 27700 returns different values when going to and from web mercator
    // Buffer the pixels around the image when querying the feature index
    if (featureTiles.getFeatureDao().getProjection().equals(ProjectionConstants.AUTHORITY_EPSG, 27700)) {
        featureTiles.setHeightDrawOverlap(featureTiles.getHeightDrawOverlap() + 100);
    }

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

示例7: prepareFeatureDraw

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Prepare the feature draw limits and defaults
 *
 * @param pointAlpha
 * @param lineAlpha
 * @param polygonAlpha
 * @param polygonFillAlpha
 * @param pointColor
 * @param lineColor
 * @param pointRadius
 * @param lineStroke
 * @param polygonColor
 * @param polygonStroke
 * @param polygonFill
 * @param polygonFillColor
 */
private void prepareFeatureDraw(EditText pointAlpha, EditText lineAlpha, EditText polygonAlpha, EditText polygonFillAlpha,
                                Spinner pointColor, Spinner lineColor, EditText pointRadius, EditText lineStroke,
                                Spinner polygonColor, EditText polygonStroke, CheckBox polygonFill, Spinner polygonFillColor) {

    // Set feature limits
    pointAlpha.setFilters(new InputFilter[]{new InputFilterMinMax(
            0, 255)});
    lineAlpha.setFilters(new InputFilter[]{new InputFilterMinMax(
            0, 255)});
    polygonAlpha.setFilters(new InputFilter[]{new InputFilterMinMax(
            0, 255)});
    polygonFillAlpha.setFilters(new InputFilter[]{new InputFilterMinMax(
            0, 255)});

    // Set default feature attributes
    FeatureTiles featureTiles = new DefaultFeatureTiles(getActivity());
    String defaultColor = "black";

    Paint pointPaint = featureTiles.getPointPaint();
    pointColor.setSelection(((ArrayAdapter) pointColor.getAdapter()).getPosition(defaultColor));
    pointAlpha.setText(String.valueOf(pointPaint.getAlpha()));
    pointRadius.setText(String.valueOf(featureTiles.getPointRadius()));

    Paint linePaint = featureTiles.getLinePaint();
    lineColor.setSelection(((ArrayAdapter) lineColor.getAdapter()).getPosition(defaultColor));
    lineAlpha.setText(String.valueOf(linePaint.getAlpha()));
    lineStroke.setText(String.valueOf(linePaint.getStrokeWidth()));

    Paint polygonPaint = featureTiles.getPolygonPaint();
    polygonColor.setSelection(((ArrayAdapter) polygonColor.getAdapter()).getPosition(defaultColor));
    polygonAlpha.setText(String.valueOf(polygonPaint.getAlpha()));
    polygonStroke.setText(String.valueOf(polygonPaint.getStrokeWidth()));

    polygonFill.setChecked(featureTiles.isFillPolygon());
    Paint polygonFillPaint = featureTiles.getPolygonFillPaint();
    polygonFillColor.setSelection(((ArrayAdapter) polygonFillColor.getAdapter()).getPosition(defaultColor));
    polygonFillAlpha.setText(String.valueOf(polygonFillPaint.getAlpha()));
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:55,代码来源:GeoPackageManagerFragment.java

示例8: displayTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Display tiles
 *
 * @param tiles
 */
private void displayTiles(GeoPackageTileTable tiles) {

    GeoPackage geoPackage = geoPackages.get(tiles.getDatabase());

    TileDao tileDao = geoPackage.getTileDao(tiles.getName());

    BoundedOverlay overlay = GeoPackageOverlayFactory
            .getBoundedOverlay(tileDao);

    TileMatrixSet tileMatrixSet = tileDao.getTileMatrixSet();

    FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
    List<FeatureDao> featureDaos = linker.getFeatureDaosForTileTable(tileDao.getTableName());
    for (FeatureDao featureDao : featureDaos) {

        // Create the feature tiles
        FeatureTiles featureTiles = new DefaultFeatureTiles(getActivity(), featureDao);

        // Create an index manager
        FeatureIndexManager indexer = new FeatureIndexManager(getActivity(), geoPackage, featureDao);
        featureTiles.setIndexManager(indexer);

        featureOverlayTiles = true;

        // Add the feature overlay query
        FeatureOverlayQuery featureOverlayQuery = new FeatureOverlayQuery(getActivity(), overlay, featureTiles);
        featureOverlayQueries.add(featureOverlayQuery);
    }

    // Set the tiles index to be -2 of it is behind features and tiles drawn from features
    int zIndex = -2;

    // If these tiles are linked to features, set the zIndex to -1 so they are placed before imagery tiles
    if (!featureDaos.isEmpty()) {
        zIndex = -1;
    }

    displayTiles(overlay, tileMatrixSet.getBoundingBox(), tileMatrixSet.getSrs(), zIndex, null);
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:45,代码来源:GeoPackageMapFragment.java

示例9: createTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
private void createTiles(FeatureTiles featureTiles, int zoom) {
	int tilesPerSide = TileBoundingBoxUtils.tilesPerSide(zoom);
	for (int i = 0; i < tilesPerSide; i++) {
		for (int j = 0; j < tilesPerSide; j++) {
			BufferedImage image = featureTiles.drawTile(i, j, zoom);
			TestCase.assertEquals(featureTiles.getTileWidth(),
					image.getWidth());
			TestCase.assertEquals(featureTiles.getTileHeight(),
					image.getHeight());
		}
	}
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:13,代码来源:FeatureTilesTest.java

示例10: createFeatureTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Create a new feature tiles
 *
 * @param geoPackage
 * @param featureDao
 * @param useIcon
 *            true to use an icon instead of the default point
 * @return feature tiles
 */
public static FeatureTiles createFeatureTiles(GeoPackage geoPackage,
		FeatureDao featureDao, boolean useIcon) {

	FeatureTiles featureTiles = new DefaultFeatureTiles(featureDao);

	if (useIcon) {
		BufferedImage icon = new BufferedImage(5, 5,
				BufferedImage.TYPE_INT_ARGB);
		Graphics2D graphics = icon.createGraphics();
		graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		graphics.setColor(Color.MAGENTA);
		graphics.fillRect(0, 0, 5, 5);
		FeatureTilePointIcon pointIcon = new FeatureTilePointIcon(icon);
		pointIcon.centerIcon();
		featureTiles.setPointIcon(pointIcon);
	} else {
		featureTiles.setPointColor(Color.BLUE);
	}

	featureTiles.setLineColor(Color.GREEN);

	featureTiles.setPolygonColor(Color.RED);

	featureTiles.setFillPolygon(true);
	featureTiles.setPolygonFillColor(new Color(255, 0, 0, 50));

	featureTiles.calculateDrawOverlap();

	return featureTiles;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:41,代码来源:FeatureTileUtils.java

示例11: addTileTable

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Add a tile table to the map
 *
 * @param geoPackage
 * @param name
 * @param data
 */
private void addTileTable(GeoPackage geoPackage, String name, GeoPackageMapData data) {

    GeoPackageTableMapData tableData = new GeoPackageTableMapData(name, false);
    data.addTable(tableData);

    // Create a new GeoPackage tile provider and add to the map
    TileDao tileDao = geoPackage.getTileDao(name);
    BoundedOverlay geoPackageTileOverlay = GeoPackageOverlayFactory.getBoundedOverlay(tileDao);

    // Check for linked feature tables
    FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
    List<FeatureDao> featureDaos = linker.getFeatureDaosForTileTable(tileDao.getTableName());
    for (FeatureDao featureDao : featureDaos) {

        // Create the feature tiles
        FeatureTiles featureTiles = new DefaultFeatureTiles(context, featureDao);

        // Create an index manager
        FeatureIndexManager indexer = new FeatureIndexManager(context, geoPackage, featureDao);
        featureTiles.setIndexManager(indexer);

        // Add the feature overlay query
        FeatureOverlayQuery featureOverlayQuery = new FeatureOverlayQuery(context, geoPackageTileOverlay, featureTiles);
        tableData.addFeatureOverlayQuery(featureOverlayQuery);
    }

    // Set the tiles index to be -2 of it is behind features and tiles drawn from features
    int zIndex = -2;

    // If these tiles are linked to features, set the zIndex to -1 so they are placed before imagery tiles
    if (!featureDaos.isEmpty()) {
        zIndex = -1;
    }

    TileOverlayOptions overlayOptions = createTileOverlayOptions(geoPackageTileOverlay, zIndex);
    TileOverlay tileOverlay = map.addTileOverlay(overlayOptions);
    tableData.setTileOverlay(tileOverlay);
}
 
开发者ID:ngageoint,项目名称:disconnected-content-explorer-android,代码行数:46,代码来源:GeoPackageMapOverlays.java

示例12: addGeoPackageTileCacheOverlay

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Add the GeoPackage Tile Table Cache Overlay
 * @param enabledCacheOverlays
 * @param tileTableCacheOverlay
 * @param geoPackage
 * @param linkedToFeatures
 */
private void addGeoPackageTileCacheOverlay(Map<String, CacheOverlay> enabledCacheOverlays, GeoPackageTileTableCacheOverlay tileTableCacheOverlay, GeoPackage geoPackage, boolean linkedToFeatures){
	// Retrieve the cache overlay if it already exists (and remove from cache overlays)
	CacheOverlay cacheOverlay = cacheOverlays.remove(tileTableCacheOverlay.getCacheName());
	if(cacheOverlay != null){
		// If the existing cache overlay is being replaced, create a new cache overlay
		if(tileTableCacheOverlay.getParent().isAdded()){
			cacheOverlay = null;
		}
	}
	if(cacheOverlay == null){
		// Create a new GeoPackage tile provider and add to the map
		TileDao tileDao = geoPackage.getTileDao(tileTableCacheOverlay.getName());
		BoundedOverlay geoPackageTileProvider = GeoPackageOverlayFactory.getBoundedOverlay(tileDao);
		TileOverlayOptions overlayOptions = null;
		if(linkedToFeatures){
			overlayOptions = createFeatureTileOverlayOptions(geoPackageTileProvider);
		}else {
			overlayOptions = createTileOverlayOptions(geoPackageTileProvider);
		}
		TileOverlay tileOverlay = map.addTileOverlay(overlayOptions);
		tileTableCacheOverlay.setTileOverlay(tileOverlay);

		// Check for linked feature tables
		tileTableCacheOverlay.clearFeatureOverlayQueries();
		FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
		List<FeatureDao> featureDaos = linker.getFeatureDaosForTileTable(tileDao.getTableName());
		for(FeatureDao featureDao: featureDaos){

			// Create the feature tiles
			FeatureTiles featureTiles = new DefaultFeatureTiles(getActivity(), featureDao);

			// Create an index manager
			FeatureIndexManager indexer = new FeatureIndexManager(getActivity(), geoPackage, featureDao);
			featureTiles.setIndexManager(indexer);

			// Add the feature overlay query
			FeatureOverlayQuery featureOverlayQuery = new FeatureOverlayQuery(getActivity(), geoPackageTileProvider, featureTiles);
			tileTableCacheOverlay.addFeatureOverlayQuery(featureOverlayQuery);
		}

		cacheOverlay = tileTableCacheOverlay;
	}
	// Add the cache overlay to the enabled cache overlays
	enabledCacheOverlays.put(cacheOverlay.getCacheName(), cacheOverlay);
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:53,代码来源:MapFragment.java

示例13: displayFeatureTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Display feature tiles
 *
 * @param featureOverlayTable
 */
private void displayFeatureTiles(GeoPackageFeatureOverlayTable featureOverlayTable) {

    GeoPackage geoPackage = geoPackages.get(featureOverlayTable.getDatabase());
    FeatureDao featureDao = featureDaos.get(featureOverlayTable.getDatabase()).get(featureOverlayTable.getFeatureTable());

    BoundingBox boundingBox = new BoundingBox(featureOverlayTable.getMinLon(),
            featureOverlayTable.getMinLat(), featureOverlayTable.getMaxLon(), featureOverlayTable.getMaxLat());

    // Load tiles
    FeatureTiles featureTiles = new DefaultFeatureTiles(getActivity(), featureDao);

    featureTiles.setMaxFeaturesPerTile(featureOverlayTable.getMaxFeaturesPerTile());
    if (featureOverlayTable.getMaxFeaturesPerTile() != null) {
        featureTiles.setMaxFeaturesTileDraw(new NumberFeaturesTile(getActivity()));
    }

    FeatureIndexManager indexer = new FeatureIndexManager(getActivity(), geoPackage, featureDao);
    featureTiles.setIndexManager(indexer);

    Paint pointPaint = featureTiles.getPointPaint();
    pointPaint.setColor(Color.parseColor(featureOverlayTable.getPointColor()));

    pointPaint.setAlpha(featureOverlayTable.getPointAlpha());
    featureTiles.setPointRadius(featureOverlayTable.getPointRadius());

    Paint linePaint = featureTiles.getLinePaint();
    linePaint.setColor(Color.parseColor(featureOverlayTable.getLineColor()));

    linePaint.setAlpha(featureOverlayTable.getLineAlpha());
    linePaint.setStrokeWidth(featureOverlayTable.getLineStrokeWidth());

    Paint polygonPaint = featureTiles.getPolygonPaint();
    polygonPaint.setColor(Color.parseColor(featureOverlayTable.getPolygonColor()));

    polygonPaint.setAlpha(featureOverlayTable.getPolygonAlpha());
    polygonPaint.setStrokeWidth(featureOverlayTable.getPolygonStrokeWidth());

    featureTiles.setFillPolygon(featureOverlayTable.isPolygonFill());
    if (featureTiles.isFillPolygon()) {
        Paint polygonFillPaint = featureTiles.getPolygonFillPaint();
        polygonFillPaint.setColor(Color.parseColor(featureOverlayTable.getPolygonFillColor()));

        polygonFillPaint.setAlpha(featureOverlayTable.getPolygonFillAlpha());
    }

    featureTiles.calculateDrawOverlap();

    FeatureOverlay overlay = new FeatureOverlay(featureTiles);
    overlay.setBoundingBox(boundingBox, ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM));
    overlay.setMinZoom(featureOverlayTable.getMinZoom());
    overlay.setMaxZoom(featureOverlayTable.getMaxZoom());

    FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
    List<TileDao> tileDaos = linker.getTileDaosForFeatureTable(featureDao.getTableName());
    overlay.ignoreTileDaos(tileDaos);

    GeometryColumns geometryColumns = featureDao.getGeometryColumns();
    Contents contents = geometryColumns.getContents();

    GeoPackageUtils.prepareFeatureTiles(featureTiles);

    featureOverlayTiles = true;

    FeatureOverlayQuery featureOverlayQuery = new FeatureOverlayQuery(getActivity(), overlay);
    featureOverlayQueries.add(featureOverlayQuery);

    displayTiles(overlay, contents.getBoundingBox(), contents.getSrs(), -1, boundingBox);
}
 
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:74,代码来源:GeoPackageMapFragment.java

示例14: testFeatureTiles

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Test feature tiles
 *
 * @param useIcon
 *
 * @throws java.sql.SQLException
 */
public void testFeatureTiles(boolean useIcon) throws SQLException {

	FeatureDao featureDao = FeatureTileUtils.createFeatureDao(geoPackage);

	int num = FeatureTileUtils.insertFeatures(geoPackage, featureDao);

	FeatureTiles featureTiles = FeatureTileUtils.createFeatureTiles(
			geoPackage, featureDao, useIcon);

	FeatureTableIndex featureIndex = new FeatureTableIndex(geoPackage,
			featureDao);
	int indexed = featureIndex.index();
	TestCase.assertEquals(num, indexed);

	createTiles(featureTiles, 0, 2);

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

示例15: testTileGenerator

import mil.nga.geopackage.tiles.features.FeatureTiles; //导入依赖的package包/类
/**
 * Test tile generator
 *
 * @param index
 * @param useIcon
 * @param maxFeatures
 *
 * @throws java.io.IOException
 * @throws java.sql.SQLException
 */
public void testTileGenerator(boolean index, boolean useIcon,
		boolean maxFeatures) throws IOException, SQLException {

	int minZoom = 0;
	int maxZoom = 4;

	FeatureDao featureDao = FeatureTileUtils.createFeatureDao(geoPackage);

	int num = FeatureTileUtils.insertFeatures(geoPackage, featureDao);

	FeatureTiles featureTiles = FeatureTileUtils.createFeatureTiles(
			geoPackage, featureDao, useIcon);

	if (index) {
		FeatureTableIndex featureIndex = new FeatureTableIndex(geoPackage,
				featureDao);
		int indexed = featureIndex.index();
		TestCase.assertEquals(num, indexed);
		featureTiles.setFeatureIndex(featureIndex);
	}

	if (maxFeatures) {
		featureTiles.setMaxFeaturesPerTile(10);
		featureTiles.setMaxFeaturesTileDraw(new NumberFeaturesTile());
	}

	BoundingBox boundingBox = new BoundingBox();
	boundingBox = TileBoundingBoxUtils
			.boundWgs84BoundingBoxWithWebMercatorLimits(boundingBox);
	boundingBox = ProjectionFactory
			.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM)
			.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR)
			.transform(boundingBox);
	TileGenerator tileGenerator = new FeatureTileGenerator(geoPackage,
			"gen_feature_tiles", featureTiles, minZoom, maxZoom,
			boundingBox,
			ProjectionFactory
					.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR));
	tileGenerator.setGoogleTiles(false);

	int tiles = tileGenerator.generateTiles();

	int expectedTiles = 0;
	for (int i = minZoom; i <= maxZoom; i++) {
		int tilesPerSide = TileBoundingBoxUtils.tilesPerSide(i);
		expectedTiles += (tilesPerSide * tilesPerSide);
	}

	TestCase.assertEquals(expectedTiles, tiles);

	// TileWriter.writeTiles(geoPackage, "gen_feature_tiles", new File(
	// "/Users/osbornb/Documents/generator/tiles"), null, null, true);

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


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