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

Java BoundingBox类代码示例

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

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



BoundingBox类属于org.oscim.core包,在下文中一共展示了BoundingBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:22,代码来源:Map25View.java


示例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);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:24,代码来源:Map25ConfigManager.java


示例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);
}
 
开发者ID:mapzen,项目名称:open,代码行数:25,代码来源:DrawPathTaskTest.java


示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:20,代码来源:AbstractVectorLayer.java


示例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();
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:19,代码来源:PicasaPOIProvider.java


示例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();
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:22,代码来源:FourSquareProvider.java


示例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();
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:24,代码来源:FlickrPOIProvider.java


示例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;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:28,代码来源:RMapsDatabase.java


示例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);
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:11,代码来源:MainActivity.java


示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:9,代码来源:SearchBox.java


示例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);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:28,代码来源:Animator.java


示例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);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:Viewport.java


示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:37,代码来源:RequiredFields.java


示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:9,代码来源:AnimatorTest.java


示例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);
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:20,代码来源:MapViewPosition.java


示例16: animateTo

import org.oscim.core.BoundingBox; //导入依赖的package包/类
public synchronized void animateTo(BoundingBox bbox) {

		// calculate the minimum scale at which the bbox is completely visible
		double dx = Math.abs(MercatorProjection.longitudeToX(bbox.getMaxLongitude())
				- MercatorProjection.longitudeToX(bbox.getMinLongitude()));

		double dy = Math.abs(MercatorProjection.latitudeToY(bbox.getMinLatitude())
				- MercatorProjection.latitudeToY(bbox.getMaxLatitude()));

		double zx = mWidth / (dx * Tile.SIZE);
		double zy = mHeight / (dy * Tile.SIZE);
		double newScale = Math.min(zx, zy);

		newScale = FastMath.clamp(newScale, MIN_SCALE, 1 << ABS_ZOOMLEVEL);

		float scale = (float) (newScale / mAbsScale);

		Log.d(TAG, "scale to " + bbox + " " + newScale + " " + mAbsScale
				+ " " + FastMath.log2((int) newScale) + " " + scale);

		mEndScale = mAbsScale * scale - mAbsScale;
		mStartScale = mAbsScale;
		mStartRotation = mRotation;

		double f = Tile.SIZE << ABS_ZOOMLEVEL;
		mStartX = mAbsX * f;
		mStartY = mAbsY * f;

		GeoPoint geoPoint = bbox.getCenterPoint();

		mEndX = MercatorProjection.longitudeToX(geoPoint.getLongitude()) * f;
		mEndY = MercatorProjection.latitudeToY(geoPoint.getLatitude()) * f;
		mEndX -= mStartX;
		mEndY -= mStartY;
		mAnimMove = true;
		mAnimScale = true;
		mAnimFling = false;
		animStart(500);
	}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:40,代码来源:MapViewPosition.java


示例17: 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;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:37,代码来源:RequiredFields.java


示例18: Route

import org.oscim.core.BoundingBox; //导入依赖的package包/类
/**
 * default constructor when normal loading failed: the route shape only
 * contains the waypoints; All distances and times are at 0; there is no
 * node; status equals DEFAULT.
 * 
 * @param waypoints
 *            ...
 */
public Route(List<GeoPoint> waypoints) {
	init();
	int n = waypoints.size();
	for (int i = 0; i < n; i++) {
		GeoPoint p = waypoints.get(i);
		routeHigh.add(p);
	}
	for (int i = 0; i < n - 1; i++) {
		RouteLeg leg = new RouteLeg(/* i, i+1, mLinks */);
		legs.add(leg);
	}
	boundingBox = BoundingBox.fromGeoPoints(routeHigh);
	status = STATUS_DEFAULT;
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:23,代码来源:Route.java


示例19: getUrlInside

import org.oscim.core.BoundingBox; //导入依赖的package包/类
private String getUrlInside(BoundingBox boundingBox, int maxResults) {
	StringBuffer url = new StringBuffer("http://api.geonames.org/wikipediaBoundingBoxJSON?");
	url.append("south=" + boundingBox.getMinLatitude());
	url.append("&north=" + boundingBox.getMaxLatitude());
	url.append("&west=" + boundingBox.getMinLongitude());
	url.append("&east=" + boundingBox.getMaxLongitude());
	url.append("&maxRows=" + maxResults);
	url.append("&lang=" + Locale.getDefault().getLanguage());
	url.append("&username=" + mUserName);
	return url.toString();
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:12,代码来源:GeoNamesPOIProvider.java


示例20: getUrlInside

import org.oscim.core.BoundingBox; //导入依赖的package包/类
private String getUrlInside(BoundingBox bb, String type, int maxResults) {
	StringBuffer urlString = getCommonUrl(type, maxResults);
	urlString.append("&viewbox=" + bb.getMaxLongitude() + ","
	        + bb.getMaxLatitude() + ","
	        + bb.getMinLongitude() + ","
	        + bb.getMinLatitude());
	return urlString.toString();
}
 
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:9,代码来源:NominatimPOIProvider.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java WordFactory类代码示例发布时间:2022-05-22
下一篇:
Java AutoBinding类代码示例发布时间: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