本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}