當前位置: 首頁>>代碼示例>>Java>>正文


Java MapView.getMapOrientation方法代碼示例

本文整理匯總了Java中org.osmdroid.views.MapView.getMapOrientation方法的典型用法代碼示例。如果您正苦於以下問題:Java MapView.getMapOrientation方法的具體用法?Java MapView.getMapOrientation怎麽用?Java MapView.getMapOrientation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.osmdroid.views.MapView的用法示例。


在下文中一共展示了MapView.getMapOrientation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    if(!shadow) {
        if(this.mIcon != null) {
            Projection pj = mapView.getProjection();
            pj.toPixels(this.mPosition, this.mPositionPixels);
            int width = this.mIcon.getIntrinsicWidth();
            int height = this.mIcon.getIntrinsicHeight();
            Rect rect = new Rect(0, 0, width, height);
            rect.offset(-((int)(this.mAnchorU * (float)width)), -((int)(this.mAnchorV * (float)height)));
            this.mIcon.setBounds(rect);
            this.mIcon.setAlpha((int)(this.mAlpha * 255.0F));
            float rotationOnScreen = this.mFlat?-this.mBearing:mapView.getMapOrientation() - this.mBearing;
            drawAt(canvas, this.mIcon, this.mPositionPixels.x, this.mPositionPixels.y, false, rotationOnScreen);
        }
    }
}
 
開發者ID:Arman92,項目名稱:Mapsforge-OsmDroid-GraphHopper,代碼行數:17,代碼來源:MyMarker.java

示例2: draw

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override public void draw(Canvas canvas, MapView mapView, boolean shadow) {
	if (shadow)
		return;
	if (mIcon == null)
		return;
	
	final Projection pj = mapView.getProjection();
	
	pj.toPixels(mPosition, mPositionPixels);
	int width = mIcon.getIntrinsicWidth();
	int height = mIcon.getIntrinsicHeight();
	Rect rect = new Rect(0, 0, width, height);
	rect.offset(-(int)(mAnchorU*width), -(int)(mAnchorV*height));
	mIcon.setBounds(rect);
	
	mIcon.setAlpha((int)(mAlpha*255));
	
	float rotationOnScreen = (mFlat ? -mBearing : mapView.getMapOrientation()-mBearing);
	drawAt(canvas, mIcon, mPositionPixels.x, mPositionPixels.y, false, rotationOnScreen);
}
 
開發者ID:jeffallen,項目名稱:MarshrutMe,代碼行數:21,代碼來源:Marker.java

示例3: draw

import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override protected void draw(final Canvas canvas, final MapView mapView, final boolean shadow) {

		if (shadow) {
			return;
		}

		final int size = this.mPoints.size();
		if (size < 2) {
			// nothing to paint
			return;
		}

		final Projection pj = mapView.getProjection();

		// precompute new points to the intermediate projection.
		precomputePoints(pj);

		Point screenPoint0 = null; // points on screen
		Point screenPoint1;
		Point projectedPoint0; // points from the points list
		Point projectedPoint1;

		// clipping rectangle in the intermediate projection, to avoid performing projection.
		BoundingBoxE6 boundingBox = pj.getBoundingBox();
		Point topLeft = pj.toProjectedPixels(boundingBox.getLatNorthE6(),
				boundingBox.getLonWestE6(), null);
		Point bottomRight = pj.toProjectedPixels(boundingBox.getLatSouthE6(),
				boundingBox.getLonEastE6(), null);
		final Rect clipBounds = new Rect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
		// take into account map orientation:
		if (mapView.getMapOrientation() != 0.0f)
			GeometryMath.getBoundingBoxForRotatatedRectangle(clipBounds, mapView.getMapOrientation(), clipBounds);
		
		mPath.rewind();
		projectedPoint0 = this.mPoints.get(size - 1);
		mLineBounds.set(projectedPoint0.x, projectedPoint0.y, projectedPoint0.x, projectedPoint0.y);

		for (int i = size - 2; i >= 0; i--) {
			// compute next points
			projectedPoint1 = this.mPoints.get(i);
			mLineBounds.union(projectedPoint1.x, projectedPoint1.y);

			if (!Rect.intersects(clipBounds, mLineBounds)) {
				// skip this line, move to next point
				projectedPoint0 = projectedPoint1;
				screenPoint0 = null;
				continue;
			}

			// the starting point may be not calculated, because previous segment was out of clip
			// bounds
			if (screenPoint0 == null) {
				screenPoint0 = pj.toPixelsFromProjected(projectedPoint0, this.mTempPoint1);
				mPath.moveTo(screenPoint0.x, screenPoint0.y);
			}

			screenPoint1 = pj.toPixelsFromProjected(projectedPoint1, this.mTempPoint2);

			// skip this point, too close to previous point
			if (Math.abs(screenPoint1.x - screenPoint0.x) + Math.abs(screenPoint1.y - screenPoint0.y) <= 1) {
				continue;
			}

			mPath.lineTo(screenPoint1.x, screenPoint1.y);

			// update starting point to next position
			projectedPoint0 = projectedPoint1;
			screenPoint0.x = screenPoint1.x;
			screenPoint0.y = screenPoint1.y;
			mLineBounds.set(projectedPoint0.x, projectedPoint0.y, projectedPoint0.x, projectedPoint0.y);
		}

		canvas.drawPath(mPath, mPaint);
	}
 
開發者ID:jeffallen,項目名稱:MarshrutMe,代碼行數:75,代碼來源:Polyline.java


注:本文中的org.osmdroid.views.MapView.getMapOrientation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。