本文整理汇总了Java中mil.nga.geopackage.projection.Projection类的典型用法代码示例。如果您正苦于以下问题:Java Projection类的具体用法?Java Projection怎么用?Java Projection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Projection类属于mil.nga.geopackage.projection包,在下文中一共展示了Projection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GoogleMapShapeConverter
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Constructor with specified projection, see
* {@link FeatureDao#getProjection}
*
* @param projection
*/
public GoogleMapShapeConverter(Projection projection) {
this.projection = projection;
if (projection != null) {
toWgs84 = projection
.getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
Projection wgs84 = toWgs84.getToProjection();
fromWgs84 = wgs84.getTransformation(projection);
toWebMercator = projection.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
Projection webMercator = toWebMercator.getToProjection();
fromWebMercator = webMercator.getTransformation(projection);
} else {
toWgs84 = null;
fromWgs84 = null;
toWebMercator = null;
fromWebMercator = null;
}
}
示例2: getBoundingBox
import mil.nga.geopackage.projection.Projection; //导入依赖的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;
}
示例3: query
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Query for feature index results within the bounding box in
* the provided projection
*
* @param boundingBox bounding box
* @param projection projection
* @return feature index results, close when done
*/
public FeatureIndexResults query(BoundingBox boundingBox, Projection projection) {
FeatureIndexResults results = null;
switch (getIndexedType()) {
case GEOPACKAGE:
long count = featureTableIndex.count(boundingBox, projection);
CloseableIterator<GeometryIndex> geometryIndices = featureTableIndex.query(boundingBox, projection);
results = new FeatureIndexGeoPackageResults(featureTableIndex, count, geometryIndices);
break;
case METADATA:
Cursor geometryMetadata = featureIndexer.query(boundingBox, projection);
results = new FeatureIndexMetadataResults(featureIndexer, geometryMetadata);
break;
}
return results;
}
示例4: UrlTileGenerator
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Constructor
*
* @param context app context
* @param geoPackage GeoPackage
* @param tableName table name
* @param tileUrl tile url
* @param minZoom min zoom
* @param maxZoom max zoom
* @param boundingBox tiles bounding box
* @param projection tiles projection
* @since 1.3.0
*/
public UrlTileGenerator(Context context, GeoPackage geoPackage,
String tableName, String tileUrl, int minZoom, int maxZoom, BoundingBox boundingBox, Projection projection) {
super(context, geoPackage, tableName, minZoom, maxZoom, boundingBox, projection);
try {
this.tileUrl = URLDecoder.decode(tileUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new GeoPackageException("Failed to decode tile url: "
+ tileUrl, e);
}
this.urlHasXYZ = hasXYZ(tileUrl);
this.urlHasBoundingBox = hasBoundingBox(tileUrl);
if (!this.urlHasXYZ && !this.urlHasBoundingBox) {
throw new GeoPackageException(
"URL does not contain x,y,z or bounding box variables: "
+ tileUrl);
}
}
示例5: ElevationTilesCore
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Constructor
*
* @param geoPackage
* GeoPackage
* @param tileMatrixSet
* tile matrix set
* @param width
* specified results width
* @param height
* specified results height
* @param requestProjection
* request projection
*/
protected ElevationTilesCore(GeoPackageCore geoPackage,
TileMatrixSet tileMatrixSet, Integer width, Integer height,
Projection requestProjection) {
super(geoPackage);
this.tileMatrixSet = tileMatrixSet;
griddedCoverageDao = geoPackage.getGriddedCoverageDao();
griddedTileDao = geoPackage.getGriddedTileDao();
queryGriddedCoverage();
this.width = width;
this.height = height;
this.requestProjection = requestProjection;
elevationProjection = ProjectionFactory.getProjection(tileMatrixSet
.getSrs());
elevationBoundingBox = tileMatrixSet.getBoundingBox();
// Check if the projections have the same units
if (requestProjection != null) {
sameProjection = (requestProjection.getUnit().name
.equals(elevationProjection.getUnit().name));
} else {
sameProjection = true;
}
}
示例6: getZoomLevel
import mil.nga.geopackage.projection.Projection; //导入依赖的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;
}
示例7: loadTiles
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Load tiles from a URL
*
* @param activity
* @param callback
* @param active
* @param database
* @param tableName
* @param tileUrl
* @param minZoom
* @param maxZoom
* @param compressFormat
* @param compressQuality
* @param googleTiles
* @param boundingBox
* @param epsg
*/
public static void loadTiles(Activity activity, ILoadTilesTask callback,
GeoPackageDatabases active, String database, String tableName,
String tileUrl, int minZoom, int maxZoom,
CompressFormat compressFormat, Integer compressQuality,
boolean googleTiles, BoundingBox boundingBox, long epsg) {
GeoPackageManager manager = GeoPackageFactory.getManager(activity);
GeoPackage geoPackage = manager.open(database);
Projection projection = ProjectionFactory.getProjection(epsg);
BoundingBox bbox = transform(boundingBox, projection);
TileGenerator tileGenerator = new UrlTileGenerator(activity, geoPackage,
tableName, tileUrl, minZoom, maxZoom, bbox, projection);
setTileGenerator(activity, tileGenerator, minZoom, maxZoom, compressFormat, compressQuality, googleTiles, boundingBox);
loadTiles(activity, callback, active, geoPackage, tableName, tileGenerator);
}
示例8: getBoundingBox
import mil.nga.geopackage.projection.Projection; //导入依赖的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;
}
示例9: UrlTileGenerator
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Constructor
*
* @param geoPackage
* GeoPackage
* @param tableName
* table name
* @param tileUrl
* tile url
* @param minZoom
* min zoom
* @param maxZoom
* max zoom
* @param boundingBox
* tiles bounding box
* @param projection
* tiles projection
* @since 1.2.0
*/
public UrlTileGenerator(GeoPackage geoPackage, String tableName,
String tileUrl, int minZoom, int maxZoom, BoundingBox boundingBox,
Projection projection) {
super(geoPackage, tableName, minZoom, maxZoom, boundingBox, projection);
try {
this.tileUrl = URLDecoder.decode(tileUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new GeoPackageException("Failed to decode tile url: "
+ tileUrl, e);
}
this.urlHasXYZ = hasXYZ(tileUrl);
this.urlHasBoundingBox = hasBoundingBox(tileUrl);
if (!this.urlHasXYZ && !this.urlHasBoundingBox) {
throw new GeoPackageException(
"URL does not contain x,y,z or bounding box variables: "
+ tileUrl);
}
}
示例10: OsmMapShapeConverter
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Constructor with specified projection, see
*
* @param projection
*/
public OsmMapShapeConverter(Projection projection, MarkerOptions options, PolylineOptions polylineOptions,
PolygonOptions polygonOptions) {
Log.i(IMapView.LOGTAG, "Geopackage support is BETA. Please report any issues");
this.projection = projection;
this.polylineOptions=polylineOptions;
this.polygonOptions=polygonOptions;
this.makerOptions=options;
if (projection != null) {
toWgs84 = projection
.getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
Projection wgs84 = toWgs84.getToProjection();
fromWgs84 = wgs84.getTransformation(projection);
} else {
toWgs84 = null;
fromWgs84 = null;
}
}
示例11: buildResultsInfoMessageAndClose
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Build a feature results information message and close the results
*
* @param results feature index results
* @param tolerance distance tolerance
* @param clickLocation map click location
* @param projection desired geometry projection
* @return results message or null if no results
*/
public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) {
String message = null;
try {
message = buildResultsInfoMessage(results, tolerance, clickLocation, projection);
} finally {
results.close();
}
return message;
}
示例12: projectGeometry
import mil.nga.geopackage.projection.Projection; //导入依赖的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);
}
}
}
示例13: queryFeatures
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Query for features in the bounding box
*
* @param boundingBox query bounding box
* @param projection bounding box projection
* @return feature index results, must be closed
*/
public FeatureIndexResults queryFeatures(BoundingBox boundingBox, Projection projection) {
if (projection == null) {
projection = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM);
}
// Query for features
FeatureIndexManager indexManager = featureTiles.getIndexManager();
if (indexManager == null) {
throw new GeoPackageException("Index Manager is not set on the Feature Tiles and is required to query indexed features");
}
FeatureIndexResults results = indexManager.query(boundingBox, projection);
return results;
}
示例14: buildMapClickMessage
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Perform a query based upon the map click location and build a info message
*
* @param latLng location
* @param zoom current zoom level
* @param boundingBox click bounding box
* @param tolerance tolerance distance
* @param projection desired geometry projection
* @return information message on what was clicked, or null
*/
private String buildMapClickMessage(LatLng latLng, double zoom, BoundingBox boundingBox, double tolerance, Projection projection) {
String message = null;
// Verify the features are indexed and we are getting information
if (isIndexed() && (maxFeaturesInfo || featuresInfo)) {
if (isOnAtCurrentZoom(zoom, latLng)) {
// Get the number of features in the tile location
long tileFeatureCount = tileFeatureCount(latLng, zoom);
// If more than a configured max features to draw
if (isMoreThanMaxFeatures(tileFeatureCount)) {
// Build the max features message
if (maxFeaturesInfo) {
message = buildMaxFeaturesInfoMessage(tileFeatureCount);
}
}
// Else, query for the features near the click
else if (featuresInfo) {
// Query for results and build the message
FeatureIndexResults results = queryFeatures(boundingBox, projection);
message = featureInfoBuilder.buildResultsInfoMessageAndClose(results, tolerance, latLng, projection);
}
}
}
return message;
}
示例15: buildMapClickTableData
import mil.nga.geopackage.projection.Projection; //导入依赖的package包/类
/**
* Perform a query based upon the map click location and build feature table data
*
* @param latLng location
* @param zoom current zoom level
* @param boundingBox click bounding box
* @param tolerance distance tolerance
* @param projection desired geometry projection
* @return table data on what was clicked, or null
*/
private FeatureTableData buildMapClickTableData(LatLng latLng, double zoom, BoundingBox boundingBox, double tolerance, Projection projection) {
FeatureTableData tableData = null;
// Verify the features are indexed and we are getting information
if (isIndexed() && (maxFeaturesInfo || featuresInfo)) {
if (isOnAtCurrentZoom(zoom, latLng)) {
// Get the number of features in the tile location
long tileFeatureCount = tileFeatureCount(latLng, zoom);
// If more than a configured max features to draw
if (isMoreThanMaxFeatures(tileFeatureCount)) {
// Build the max features message
if (maxFeaturesInfo) {
tableData = new FeatureTableData(featureTiles.getFeatureDao().getTableName(), tileFeatureCount);
}
}
// Else, query for the features near the click
else if (featuresInfo) {
// Query for results and build the message
FeatureIndexResults results = queryFeatures(boundingBox, projection);
tableData = featureInfoBuilder.buildTableDataAndClose(results, tolerance, latLng, projection);
}
}
}
return tableData;
}