当前位置: 首页>>代码示例>>Java>>正文


Java MapView.getWidth方法代码示例

本文整理汇总了Java中com.google.android.maps.MapView.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.getWidth方法的具体用法?Java MapView.getWidth怎么用?Java MapView.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.maps.MapView的用法示例。


在下文中一共展示了MapView.getWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
  if (overlayImage == null || overlayImage.isRecycled()) {
    return false;
  }
  float x = mapView.getWidth() / 2f;
  float y = mapView.getHeight() / 2f;

  imageMatrix.reset();
  imageMatrix.postTranslate(-centerX + x, -centerY + y);
  imageMatrix.postRotate(rotation, x, y);
  imageMatrix.postScale(scale, scale, x, y);

  canvas.drawBitmap(overlayImage, imageMatrix, transparency);

  // Draw small black ring with white edge to indicate center point
  centerPaint.setColor(0xffffffff);
  centerPaint.setStrokeWidth(4f);
  canvas.drawCircle(x, y, 5, centerPaint);
  centerPaint.setColor(0xff000000);
  centerPaint.setStrokeWidth(2f);
  canvas.drawCircle(x, y, 5, centerPaint);

  return false;
}
 
开发者ID:markoteittinen,项目名称:custom-maps,代码行数:26,代码来源:MapImageOverlay.java

示例2: animateTo

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
protected void animateTo(int index, GeoPoint center) {
	if (manager != null) {
		manager.markSelected();
	}
	MapView mapView = getMapView();
	ViewController controller = new ViewController(mapView);
	Point pt = new Point(mapView.getWidth() / 2, mapView.getHeight() / 2);
	int spanLat = bounds.top - bounds.bottom;
	int spanLon = bounds.left - bounds.right;
	controller.animateTo(center, pt, spanLat, spanLon, animate);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:13,代码来源:DirectionsLayer.java

示例3: animateTo

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
protected void animateTo(int index, GeoPoint center) {
	if (manager != null) {
		manager.markSelected();
	}
	MapView mapView = getMapView();
	ViewController controller = new ViewController(mapView);
	Point pt = new Point(mapView.getWidth() / 2, mapView.getHeight() / 4 * 3);
	controller.animateTo(center, pt, MIN_ZOOM_LEVEL + 1, true);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:11,代码来源:LocationSearchLayer.java

示例4: animateTo

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
protected void animateTo(int index, GeoPoint center) {
	if (manager != null) {
		manager.markSelected();
	}
	MapView mapView = getMapView();
	ViewController controller = new ViewController(mapView);
	Point pt = new Point(mapView.getWidth() / 2, mapView.getHeight() / 4 * 3);
	controller.animateTo(center, pt, MIN_ZOOM_LEVEL + 1, animate);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:11,代码来源:POILayer.java

示例5: onTouchEvent

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView) {

	if (directions == null)
		return super.onTouchEvent(event, mapView);

	Point center = new Point(mapView.getWidth() / 2, mapView.getHeight() / 2); // simple calc of center pixel

	int closestDir = curDir; // assume its the same
	double bestMin = Double.MAX_VALUE; // closest direction so far

	// the algorithm is as follows: find the shortest distance from the
	// center
	// of the screen to each direction. Then, change to the direction that
	// is
	// closest to the center

	for (int i = 0; i < directions.length; i++) {
		Point[] dirPixelPoints = pixelPoints[i];
		if (directions[i].getType() == Direction.SAME_FLOOR) {
			double avgDist = (DrawingHelpers.distance(dirPixelPoints[0],center)
					+ DrawingHelpers.distance(dirPixelPoints[dirPixelPoints.length / 2],center) + DrawingHelpers.distance(
					dirPixelPoints[dirPixelPoints.length - 1], center)) / 2.0;
			if (avgDist < bestMin) {
				bestMin = avgDist;
				closestDir = i;
			}
		}
	}

	// only changes the direction if the direction being automatically
	// switched to is and outside direction
	if (curDir != closestDir && // inefficient to setui if we don't need to
			app.campus.buildingIsOutside(directions[closestDir].getBuilding()) && // only change if moving between outside points
			app.campus.buildingIsOutside(directions[curDir].getBuilding())) {
		if (main != null) {
			main.setUI(closestDir, false); // calling this, we set the bitmaps + the icons
		} else {
			main.setUI(closestDir, false);
		}
	}
	return super.onTouchEvent(event, mapView); // not stealing the event
}
 
开发者ID:Mapyst,项目名称:Mapyst,代码行数:44,代码来源:RouteMapOverlay.java


注:本文中的com.google.android.maps.MapView.getWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。