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

Java ProjectionTransform类代码示例

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

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



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

示例1: getBoundingBox

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public BoundingBox getBoundingBox() {
    Contents contents = geometryColumns.getContents();

    BoundingBox boundingBox = contents.getBoundingBox();
    if (boundingBox != null) {
        Projection contentsProjection = ProjectionFactory
                .getProjection(contents.getSrs());
        if (!projection.equals(contentsProjection)) {
            ProjectionTransform transform = contentsProjection
                    .getTransformation(projection);
            boundingBox = transform.transform(boundingBox);
        }
    }

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


示例2: drawTile

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Bitmap drawTile(int zoom, BoundingBox webMercatorBoundingBox, FeatureIndexResults results) {

    // Create bitmap and canvas
    Bitmap bitmap = createNewBitmap();
    Canvas canvas = new Canvas(bitmap);

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

    for (FeatureRow featureRow : results) {
        drawFeature(zoom, webMercatorBoundingBox, transform, canvas, featureRow);
    }

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


示例3: addLineString

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Add the linestring to the path
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param lineString
 */
private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) {

    List<Point> points = lineString.getPoints();

    if (points.size() >= 2) {

        // Try to simplify the number of points in the LineString
        points = simplifyPoints(simplifyTolerance, points);

        for (int i = 0; i < points.size(); i++) {
            Point point = points.get(i);
            Point webMercatorPoint = getPoint(transform, point);
            float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
                    webMercatorPoint.getX());
            float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
                    webMercatorPoint.getY());
            if (i == 0) {
                path.moveTo(x, y);
            } else {
                path.lineTo(x, y);
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:34,代码来源:DefaultFeatureTiles.java


示例4: addPolygon

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Add the polygon on the canvas
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param polygon
 */
private void addPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, Polygon polygon) {
    List<LineString> rings = polygon.getRings();
    if (!rings.isEmpty()) {

        // Add the polygon points
        LineString polygonLineString = rings.get(0);
        List<Point> polygonPoints = polygonLineString.getPoints();
        if (polygonPoints.size() >= 2) {
            addRing(simplifyTolerance, boundingBox, transform, path, polygonPoints);

            // Add the holes
            for (int i = 1; i < rings.size(); i++) {
                LineString holeLineString = rings.get(i);
                List<Point> holePoints = holeLineString.getPoints();
                if (holePoints.size() >= 2) {
                    addRing(simplifyTolerance, boundingBox, transform, path, holePoints);
                }
            }
        }
    }
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:31,代码来源:DefaultFeatureTiles.java


示例5: addRing

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Add a ring
 *
 * @param simplifyTolerance simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param path
 * @param points
 */
private void addRing(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, List<Point> points) {

    // Try to simplify the number of points in the LineString
    points = simplifyPoints(simplifyTolerance, points);

    for (int i = 0; i < points.size(); i++) {
        Point point = points.get(i);
        Point webMercatorPoint = getPoint(transform, point);
        float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
                webMercatorPoint.getX());
        float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
                webMercatorPoint.getY());
        if (i == 0) {
            path.moveTo(x, y);
        } else {
            path.lineTo(x, y);
        }
    }
    path.close();
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:DefaultFeatureTiles.java


示例6: drawPoint

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Draw the point on the canvas
 *
 * @param boundingBox
 * @param transform
 * @param canvas
 * @param paint
 * @param point
 */
private void drawPoint(BoundingBox boundingBox, ProjectionTransform transform, Canvas canvas, Paint paint, Point point) {

    Point webMercatorPoint = getPoint(transform, point);
    float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
            webMercatorPoint.getX());
    float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
            webMercatorPoint.getY());

    if (pointIcon != null) {
        if (x >= 0 - pointIcon.getWidth() && x <= tileWidth + pointIcon.getWidth() && y >= 0 - pointIcon.getHeight() && y <= tileHeight + pointIcon.getHeight()) {
            canvas.drawBitmap(pointIcon.getIcon(), x - pointIcon.getXOffset(), y - pointIcon.getYOffset(), paint);
        }
    } else {
        if (x >= 0 - pointRadius && x <= tileWidth + pointRadius && y >= 0 - pointRadius && y <= tileHeight + pointRadius) {
            canvas.drawCircle(x, y, pointRadius, paint);
        }
    }

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


示例7: getZoomLevel

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Get the approximate zoom level of where the bounding box of the user data
 * fits into the world
 * 
 * @return zoom level
 * @since 1.1.0
 */
public int getZoomLevel() {
	Projection projection = getProjection();
	if (projection == null) {
		throw new GeoPackageException(
				"No projection was set which is required to determine the zoom level");
	}
	int zoomLevel = 0;
	BoundingBox boundingBox = getBoundingBox();
	if (boundingBox != null) {
		if (projection.getUnit() instanceof DegreeUnit) {
			boundingBox = TileBoundingBoxUtils
					.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
		}
		ProjectionTransform webMercatorTransform = projection
				.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
		BoundingBox webMercatorBoundingBox = webMercatorTransform
				.transform(boundingBox);
		zoomLevel = TileBoundingBoxUtils
				.getZoomLevel(webMercatorBoundingBox);
	}
	return zoomLevel;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:30,代码来源:UserCoreDao.java


示例8: getBoundingBox

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public BoundingBox getBoundingBox() {
	Contents contents = geometryColumns.getContents();
	Projection contentsProjection = ProjectionFactory
			.getProjection(contents.getSrs());

	BoundingBox boundingBox = contents.getBoundingBox();
	if (!projection.equals(contentsProjection)) {
		ProjectionTransform transform = contentsProjection
				.getTransformation(projection);
		boundingBox = transform.transform(boundingBox);
	}

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


示例9: drawTile

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public BufferedImage drawTile(int zoom, BoundingBox webMercatorBoundingBox,
		CloseableIterator<GeometryIndex> results) {

	// Create image and graphics
	BufferedImage image = createNewImage();
	Graphics2D graphics = getGraphics(image);

	// WGS84 to web mercator projection and google shape converter
	ProjectionTransform webMercatorTransform = getWebMercatorTransform();

	while (results.hasNext()) {
		GeometryIndex geometryIndex = results.next();
		FeatureRow featureRow = getFeatureIndex().getFeatureRow(
				geometryIndex);
		drawFeature(zoom, webMercatorBoundingBox, webMercatorTransform,
				graphics, featureRow);
	}

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


示例10: drawFeature

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的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


示例11: getArea

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Get the area of the polygon
 *
 * @param simplifyTolerance
 *            simplify tolerance in meters
 * @param boundingBox
 * @param transform
 * @param lineString
 */
private Area getArea(double simplifyTolerance, BoundingBox boundingBox,
		ProjectionTransform transform, Polygon polygon) {

	Area area = null;

	for (LineString ring : polygon.getRings()) {

		Path2D path = getPath(simplifyTolerance, boundingBox, transform,
				ring);
		Area ringArea = new Area(path);

		if (area == null) {
			area = ringArea;
		} else {
			area.subtract(ringArea);
		}

	}

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


示例12: getTileSources

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * returns ALL available raster tile sources for all "imported" geopackage databases
 *
 * @return
 */
public List<GeopackageRasterTileSource> getTileSources() {
    List<GeopackageRasterTileSource> srcs = new ArrayList<>();

    List<String> databases = manager.databases();
    for (int i = 0; i < databases.size(); i++) {

        GeoPackage open = manager.open(databases.get(i));
        List<String> tileTables = open.getTileTables();
        for (int k = 0; k < tileTables.size(); k++) {
            TileDao tileDao = open.getTileDao(tileTables.get(k));
            mil.nga.geopackage.BoundingBox boundingBox = tileDao.getBoundingBox();
            ProjectionTransform transformation = tileDao.getProjection().getTransformation(tileDao.getProjection());
            boundingBox = transformation.transform(boundingBox);
            BoundingBox bounds = new BoundingBox(boundingBox.getMaxLatitude(), boundingBox.getMaxLongitude(), boundingBox.getMinLatitude(), boundingBox.getMinLongitude());
            srcs.add(new GeopackageRasterTileSource(databases.get(i), tileTables.get(k), (int)tileDao.getMinZoom(), (int)tileDao.getMaxZoom(), bounds));

        }
        open.close();
    }

    return srcs;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:28,代码来源:GeoPackageMapTileModuleProvider.java


示例13: getTileSource

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
public GeopackageRasterTileSource getTileSource(String database, String table) {
    Iterator<GeoPackage> iterator = geopackage.tileSources.iterator();
    while (iterator.hasNext()){
        GeoPackage next = iterator.next();
        if (next.getName().equalsIgnoreCase(database)) {
            //found the database
            if (next.getTileTables().contains(table)) {
                //find the tile table
                TileDao tileDao = next.getTileDao(table);
                mil.nga.geopackage.BoundingBox boundingBox = tileDao.getBoundingBox();
                ProjectionTransform transformation = tileDao.getProjection().getTransformation(tileDao.getProjection());
                boundingBox=transformation.transform(boundingBox);
                BoundingBox bounds =new BoundingBox(boundingBox.getMaxLatitude(),boundingBox.getMaxLongitude(),boundingBox.getMinLatitude(),boundingBox.getMinLongitude());
                return new GeopackageRasterTileSource(database,table, (int)tileDao.getMinZoom(),(int)tileDao.getMaxZoom(), bounds);
            }
        }
    }

    return null;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:21,代码来源:GeoPackageProvider.java


示例14: projectGeometry

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的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


示例15: setBoundingBox

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Set the bounding box, provided as the indicated projection
 *
 * @param boundingBox
 * @param projection
 */
public void setBoundingBox(BoundingBox boundingBox, Projection projection) {
    ProjectionTransform projectionToWebMercator = projection
            .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
    webMercatorBoundingBox = projectionToWebMercator
            .transform(boundingBox);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:13,代码来源:BoundedOverlay.java


示例16: getBoundingBox

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Get the bounding box as the provided projection
 *
 * @param projection
 */
public BoundingBox getBoundingBox(Projection projection) {
    ProjectionTransform webMercatorToProjection = ProjectionFactory
            .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR)
            .getTransformation(projection);
    return webMercatorToProjection
            .transform(webMercatorBoundingBox);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:13,代码来源:BoundedOverlay.java


示例17: getFeatureBoundingBox

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Get the bounding box in the feature projection from the bounding box in
 * the provided projection
 *
 * @param boundingBox bounding box
 * @param projection  projection
 * @return feature projected bounding box
 */
private BoundingBox getFeatureBoundingBox(BoundingBox boundingBox,
                                          Projection projection) {
    ProjectionTransform projectionTransform = projection
            .getTransformation(featureDao.getProjection());
    BoundingBox featureBoundingBox = projectionTransform
            .transform(boundingBox);
    return featureBoundingBox;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:17,代码来源:FeatureTableIndex.java


示例18: getFeatureBoundingBox

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Get the bounding box in the feature projection from the bounding box in
 * the provided projection
 *
 * @param boundingBox
 * @param projection
 * @return feature projected bounding box
 */
private BoundingBox getFeatureBoundingBox(BoundingBox boundingBox,
                                          Projection projection) {
    ProjectionTransform projectionTransform = projection
            .getTransformation(featureDao.getProjection());
    BoundingBox featureBoundingBox = projectionTransform
            .transform(boundingBox);
    return featureBoundingBox;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:17,代码来源:FeatureIndexer.java


示例19: getTileCount

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Get the tile count of tiles to be generated
 *
 * @return tile count
 */
public int getTileCount() {
    if (tileCount == null) {
        long count = 0;
        BoundingBox requestBoundingBox = null;
        if (projection.getUnit() instanceof DegreeUnit) {
            requestBoundingBox = boundingBox;
        } else {
            ProjectionTransform transform = projection.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
            requestBoundingBox = transform.transform(boundingBox);
        }
        for (int zoom = minZoom; zoom <= maxZoom; zoom++) {
            // Get the tile grid that includes the entire bounding box
            TileGrid tileGrid = null;
            if (projection.getUnit() instanceof DegreeUnit) {
                tileGrid = TileBoundingBoxUtils.getTileGridWGS84(requestBoundingBox, zoom);
            } else {
                tileGrid = TileBoundingBoxUtils.getTileGrid(requestBoundingBox, zoom);
            }

            count += tileGrid.count();
            tileGrids.put(zoom, tileGrid);
        }

        tileCount = (int) Math.min(count, Integer.MAX_VALUE);
    }
    return tileCount;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:33,代码来源:TileGenerator.java


示例20: adjustGoogleBounds

import mil.nga.geopackage.projection.ProjectionTransform; //导入依赖的package包/类
/**
 * Adjust the tile matrix set and web mercator bounds for Google tile format
 */
private void adjustGoogleBounds() {
    // Set the tile matrix set bounding box to be the world
    BoundingBox standardWgs84Box = new BoundingBox(-ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH,
            ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE,
            ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH,
            ProjectionConstants.WEB_MERCATOR_MAX_LAT_RANGE);
    ProjectionTransform wgs84ToWebMercatorTransform = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM)
            .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
    tileGridBoundingBox = wgs84ToWebMercatorTransform.transform(standardWgs84Box);
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:14,代码来源:TileGenerator.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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