本文整理汇总了Java中org.oscim.core.BoundingBox类的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox类的具体用法?Java BoundingBox怎么用?Java BoundingBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundingBox类属于org.oscim.core包,在下文中一共展示了BoundingBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBoundingBox
import org.oscim.core.BoundingBox; //导入依赖的package包/类
private BoundingBox createBoundingBox(final GeoPoint[] geoPoints) {
// this is optimized for performance by using an array which BoundingBox do no support
int minLat = Integer.MAX_VALUE;
int minLon = Integer.MAX_VALUE;
int maxLat = Integer.MIN_VALUE;
int maxLon = Integer.MIN_VALUE;
for (final GeoPoint geoPoint : geoPoints) {
if (geoPoint != null) {
minLat = Math.min(minLat, geoPoint.latitudeE6);
minLon = Math.min(minLon, geoPoint.longitudeE6);
maxLat = Math.max(maxLat, geoPoint.latitudeE6);
maxLon = Math.max(maxLon, geoPoint.longitudeE6);
}
}
return new BoundingBox(minLat, minLon, maxLat, maxLon);
}
示例2: setMapLocation
import org.oscim.core.BoundingBox; //导入依赖的package包/类
/**
* Set map location with or without animation
*
* @param map
* @param boundingBox
* @param locationAnimationTime
*/
public static void setMapLocation(final Map map, final BoundingBox boundingBox, int locationAnimationTime) {
final Animator animator = map.animator();
// zero will not move the map, set 1 ms
if (locationAnimationTime == 0 || isAnimateLocation == false) {
locationAnimationTime = 1;
}
animator.cancel();
animator.animateTo(//
locationAnimationTime,
boundingBox,
Easing.Type.SINE_INOUT,
Animator.ANIM_MOVE | Animator.ANIM_SCALE);
}
示例3: setup
import org.oscim.core.BoundingBox; //导入依赖的package包/类
@Before
public void setup() throws Exception {
application = (TestMapzenApplication) Robolectric.application;
application.inject(this);
TestHelper.initBaseActivity();
TestMap testMap = (TestMap) mapController.getMap();
viewController = Mockito.mock(ViewController.class);
testMap.setViewport(viewController);
task = new DrawPathTask(application);
box = Mockito.mock(BoundingBox.class);
stub(viewController.getBBox()).toReturn(box);
outsideBefore1 = new Location("f");
outsideBefore1.setLatitude(1);
outsideBefore2 = new Location("f");
outsideBefore2.setLatitude(2);
inside1 = new Location("f");
inside1.setLatitude(3);
inside2 = new Location("f");
inside2.setLatitude(4);
outSideAfter1 = new Location("f");
outSideAfter1.setLatitude(5);
outSideAfter2 = new Location("f");
outSideAfter2.setLatitude(6);
}
示例4: doWork
import org.oscim.core.BoundingBox; //导入依赖的package包/类
/** running on worker thread */
@Override
public boolean doWork(Task t) {
Viewport v = mMap.viewport();
BoundingBox bbox;
synchronized (v) {
bbox = v.getBBox();
v.getMapPosition(t.position);
}
double scale = t.position.scale * Tile.SIZE;
t.position.x = (long) (t.position.x * scale) / scale;
t.position.y = (long) (t.position.y * scale) / scale;
processFeatures(t, bbox);
mMap.render();
return true;
}
示例5: getUrlInside
import org.oscim.core.BoundingBox; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private String getUrlInside(BoundingBox boundingBox, int maxResults, String query) {
StringBuffer url = new StringBuffer("http://picasaweb.google.com/data/feed/api/all?");
url.append("bbox=" + boundingBox.getMinLongitude());
url.append("," + boundingBox.getMinLatitude());
url.append("," + boundingBox.getMaxLongitude());
url.append("," + boundingBox.getMaxLatitude());
url.append("&max-results=" + maxResults);
url.append("&thumbsize=64c"); //thumbnail size: 64, cropped.
url.append("&fields=openSearch:totalResults,entry(summary,media:group/media:thumbnail,media:group/media:title,gphoto:*,georss:where,link)");
if (query != null)
url.append("&q=" + URLEncoder.encode(query));
if (mAccessToken != null) {
//TODO: warning: not tested...
url.append("&access_token=" + mAccessToken);
}
return url.toString();
}
示例6: getUrlInside
import org.oscim.core.BoundingBox; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private String getUrlInside(BoundingBox boundingBox, String query, int maxResults) {
StringBuffer url = new StringBuffer(
"https://api.foursquare.com/v2/venues/search?v=20120321"
+ "&intent=browse"
+ "&client_id=ZUN4ZMNZUFT3Z5QQZNMQ3ACPL4OJMBFGO15TYX51D5MHCIL3"
+ "&client_secret=X1RXCVF4VVSG1Y2FUDQJLKQUC1WF4XXKIMK2STXKACLPDGLY");
url.append("&sw=");
url.append(boundingBox.getMinLatitude());
url.append(',');
url.append(boundingBox.getMinLongitude());
url.append("&ne=");
url.append(boundingBox.getMaxLatitude());
url.append(',');
url.append(boundingBox.getMaxLongitude());
url.append("&limit=");
url.append(maxResults);
if (query != null)
url.append("&query=" + URLEncoder.encode(query));
return url.toString();
}
示例7: getUrlInside
import org.oscim.core.BoundingBox; //导入依赖的package包/类
private String getUrlInside(BoundingBox boundingBox, int maxResults) {
StringBuffer url = new StringBuffer(
"http://api.flickr.com/services/rest/?method=flickr.photos.search");
url.append("&api_key=" + mApiKey);
url.append("&bbox=" + boundingBox.getMinLongitude());
url.append("," + boundingBox.getMinLatitude());
url.append("," + boundingBox.getMaxLongitude());
url.append("," + boundingBox.getMaxLatitude());
url.append("&has_geo=1");
// url.append("&geo_context=2");
// url.append("&is_commons=true");
url.append("&format=json&nojsoncallback=1");
url.append("&per_page=" + maxResults);
// From Flickr doc:
// "Geo queries require some sort of limiting agent in order to prevent the database from crying."
// And min_date_upload is considered as a limiting agent. So:
url.append("&min_upload_date=2005/01/01");
// Ask to provide some additional attributes we will need:
url.append("&extras=geo,url_sq");
url.append("&sort=interestingness-desc");
return url.toString();
}
示例8: initialize
import org.oscim.core.BoundingBox; //导入依赖的package包/类
static TileSource.OpenResult initialize(SQLiteTileSource tileSource, SQLiteDatabase database) {
try {
int minZoom = (int) database.compileStatement(SQL_GET_MIN_ZOOM).simpleQueryForLong();
int maxZoom = (int) database.compileStatement(SQL_GET_MAX_ZOOM).simpleQueryForLong();
tileSource.setMinZoom(minZoom);
tileSource.setMaxZoom(maxZoom);
String[] args = {String.valueOf(17 - maxZoom)};
int minX = getInt(database, SQL_GET_MIN_X, args);
int minY = getInt(database, SQL_GET_MIN_Y, args);
int maxX = getInt(database, SQL_GET_MAX_X, args) + 1;
int maxY = getInt(database, SQL_GET_MAX_Y, args) + 1;
double scale = 1 << maxZoom;
tileSource.mBoundingBox = new BoundingBox(
MercatorProjection.toLatitude(maxY / scale),
MercatorProjection.toLongitude(minX / scale),
MercatorProjection.toLatitude(minY / scale),
MercatorProjection.toLongitude(maxX / scale)
);
//TODO Try to fill zoom table and see what happens
} catch (SQLException e) {
return new TileSource.OpenResult(e.getMessage());
}
return TileSource.OpenResult.SUCCESS;
}
示例9: onTrackView
import org.oscim.core.BoundingBox; //导入依赖的package包/类
@Override
public void onTrackView(Track track) {
if (mLocationState == LocationState.NORTH || mLocationState == LocationState.TRACK) {
mLocationState = LocationState.ENABLED;
updateLocationDrawable();
}
BoundingBox box = track.getBoundingBox();
box.extendBy(0.05);
mMap.animator().animateTo(box);
}
示例10: getBoundingBox
import org.oscim.core.BoundingBox; //导入依赖的package包/类
@Override
public BoundingBox getBoundingBox() {
if (getBBox() != null) {
BBox b = getBBox();
return new BoundingBox(b.get(0), b.get(2), b.get(1), b.get(3));
}
return null;
}
示例11: animateTo
import org.oscim.core.BoundingBox; //导入依赖的package包/类
public synchronized void animateTo(long duration, BoundingBox bbox) {
mMap.getMapPosition(mStartPos);
/* TODO for large distance first scale out, then in
* calculate the maximum scale at which the BoundingBox
* is completely visible */
double dx = Math.abs(longitudeToX(bbox.getMaxLongitude())
- longitudeToX(bbox.getMinLongitude()));
double dy = Math.abs(latitudeToY(bbox.getMinLatitude())
- latitudeToY(bbox.getMaxLatitude()));
log.debug("anim bbox " + bbox);
double zx = mMap.getWidth() / (dx * Tile.SIZE);
double zy = mMap.getHeight() / (dy * Tile.SIZE);
double newScale = Math.min(zx, zy);
GeoPoint p = bbox.getCenterPoint();
mDeltaPos.set(longitudeToX(p.getLongitude()) - mStartPos.x,
latitudeToY(p.getLatitude()) - mStartPos.y,
newScale - mStartPos.scale,
-mStartPos.bearing,
-mStartPos.tilt);
animStart(duration, ANIM_MOVE | ANIM_SCALE | ANIM_ROTATE | ANIM_TILT);
}
示例12: getBBox
import org.oscim.core.BoundingBox; //导入依赖的package包/类
/**
* Get the minimal axis-aligned BoundingBox that encloses
* the visible part of the map.
*
* @return BoundingBox containing view
*/
public synchronized BoundingBox getBBox(int expand) {
getBBox(mMapBBox, expand);
/* scale map-pixel coordinates at current scale to
* absolute coordinates and apply mercator projection. */
double minLon = MercatorProjection.toLongitude(mMapBBox.xmin);
double maxLon = MercatorProjection.toLongitude(mMapBBox.xmax);
double minLat = MercatorProjection.toLatitude(mMapBBox.ymax);
double maxLat = MercatorProjection.toLatitude(mMapBBox.ymin);
return new BoundingBox(minLat, minLon, maxLat, maxLon);
}
示例13: readBoundingBox
import org.oscim.core.BoundingBox; //导入依赖的package包/类
static OpenResult readBoundingBox(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) {
// get and check the minimum latitude (4 bytes)
int minLatitude = readBuffer.readInt();
if (minLatitude < LATITUDE_MIN || minLatitude > LATITUDE_MAX) {
return new OpenResult("invalid minimum latitude: " + minLatitude);
}
// get and check the minimum longitude (4 bytes)
int minLongitude = readBuffer.readInt();
if (minLongitude < LONGITUDE_MIN || minLongitude > LONGITUDE_MAX) {
return new OpenResult("invalid minimum longitude: " + minLongitude);
}
// get and check the maximum latitude (4 bytes)
int maxLatitude = readBuffer.readInt();
if (maxLatitude < LATITUDE_MIN || maxLatitude > LATITUDE_MAX) {
return new OpenResult("invalid maximum latitude: " + maxLatitude);
}
// get and check the maximum longitude (4 bytes)
int maxLongitude = readBuffer.readInt();
if (maxLongitude < LONGITUDE_MIN || maxLongitude > LONGITUDE_MAX) {
return new OpenResult("invalid maximum longitude: " + maxLongitude);
}
// check latitude and longitude range
if (minLatitude > maxLatitude) {
return new OpenResult("invalid latitude range: " + minLatitude + SPACE + maxLatitude);
} else if (minLongitude > maxLongitude) {
return new OpenResult("invalid longitude range: " + minLongitude + SPACE + maxLongitude);
}
mapFileInfoBuilder.boundingBox = new BoundingBox(minLatitude, minLongitude, maxLatitude,
maxLongitude);
return OpenResult.SUCCESS;
}
示例14: onKeyDown
import org.oscim.core.BoundingBox; //导入依赖的package包/类
@Override
protected boolean onKeyDown(int keycode) {
if (keycode == Input.Keys.NUM_1) {
mMap.animator().animateTo(new BoundingBox(53.1, 8.8, 53.2, 8.9));
return true;
}
return false;
}
示例15: getViewBox
import org.oscim.core.BoundingBox; //导入依赖的package包/类
/**
* Get the minimal axis-aligned BoundingBox that encloses
* the visible part of the map.
*
* @return BoundingBox containing view
*/
public synchronized BoundingBox getViewBox() {
getViewBox(mMapBBox);
// scale map-pixel coordinates at current scale to
// absolute coordinates and apply mercator projection.
double minLon = MercatorProjection.toLongitude(mMapBBox.minX);
double maxLon = MercatorProjection.toLongitude(mMapBBox.maxX);
// sic(k)
double minLat = MercatorProjection.toLatitude(mMapBBox.maxY);
double maxLat = MercatorProjection.toLatitude(mMapBBox.minY);
return new BoundingBox(minLat, minLon, maxLat, maxLon);
}