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


Java MapView.getZoomLevel方法代码示例

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


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

示例1: draw

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
    Projection projection = mapView.getProjection();
    if (shadow == false && mapView.getZoomLevel() >= minZoom) {
    		int zoomExtra = mapView.getZoomLevel() - minZoom;
         Paint rectPaint = new Paint();
         Paint textPaint = new Paint();
         Point point = new Point();
         projection.toPixels(gp, point);
         rectPaint.setColor(Color.GRAY);
         rectPaint.setAlpha(128);
         rectPaint.setStrokeWidth(2);
         textPaint.setTextSize(baseTextSize + (zoomExtra * 2));
         textPaint.setAntiAlias(true);
         //textPaint.setColor(Color.RED);
         textPaint.setColor(Color.parseColor(color));
         textPaint.setTextAlign(Align.LEFT);
         float textwidth = textPaint.measureText(text);
         canvas.drawRect(point.x, point.y, point.x + 4 + textwidth, point.y + 4 + textPaint.getTextSize(), rectPaint);
         rectPaint.setColor(Color.WHITE);
         canvas.drawCircle(point.x + 2, point.y + 2, 4, rectPaint);
         canvas.drawText(text, point.x + 1, point.y + textPaint.getTextSize(), textPaint);
    }
    return super.draw(canvas, mapView, shadow, when);
}
 
开发者ID:Hellek1,项目名称:viaja-facil,代码行数:26,代码来源:StationOverlay.java

示例2: draw

import com.google.android.maps.MapView; //导入方法依赖的package包/类
/**
 * Draws the overlay track on the canvas
 * @param canvas Reference to the {@link android.graphics.Canvas} to drawn on
 * @param mapView Reference to the {@link com.google.android.maps.MapView} that the track appears on
 * @param shadow draws a shadow (true) or not (false) under the track
 * @param when not used here but required, simply forwarded to super method
 */
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
        long when) 
{
    Projection projection = mapView.getProjection();
    
    
    if (shadow == false) 
    {
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        Point point = new Point();
        projection.toPixels(gp1, point);
        paint.setColor(Color.BLUE);
        Point point2 = new Point();
        projection.toPixels(gp2, point2);
        // stroke width depends on zoom level
        int zoomLevel = mapView.getZoomLevel();
        if (zoomLevel > 18)
        	paint.setStrokeWidth(6);
        else
        	paint.setStrokeWidth(4);
        // now draw line
        canvas.drawLine((float) point.x, (float) point.y, (float) point2.x,(float) point2.y, paint);
    }
    return super.draw(canvas, mapView, shadow, when);
}
 
开发者ID:BlackHawk90,项目名称:myStress,代码行数:35,代码来源:MapViewerOverlayTrack.java

示例3: draw

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL) {
		mapView.getController().zoomIn();
	}
	super.draw(canvas, mapView, shadow);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:CampusMapActivity.java

示例4: draw

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL)
		return;
	
	super.draw(canvas, mapView, shadow);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:POILayer.java

示例5: onTouchEvent

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL)
		return false;
	
	return super.onTouchEvent(event, mapView);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:POILayer.java

示例6: onTrackballEvent

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onTrackballEvent(MotionEvent event, MapView mapView) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL)
		return false;
	
	return super.onTrackballEvent(event, mapView);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:POILayer.java

示例7: onTap

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL)
		return false;
	
	return super.onTap(p, mapView);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:POILayer.java

示例8: onKeyDown

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event, MapView mapView) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL)
		return false;

	return super.onKeyDown(keyCode, event, mapView);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:POILayer.java

示例9: onKeyUp

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event, MapView mapView) {
	if (mapView.getZoomLevel() < MIN_ZOOM_LEVEL)
		return false;
	
	return super.onKeyUp(keyCode, event, mapView);
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:8,代码来源:POILayer.java

示例10: draw

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public void draw(final Canvas c, final MapView osmv, final boolean shadow) {
	if (DEBUGMODE) {
              Log.d(Constants.LOGTAG, "draw");
	}

	// Calculate the half-world size
	final Projection pj = osmv.getProjection();
	final int zoomLevel = osmv.getZoomLevel() - 1;
	final int tileSizePx = this.mTileProvider.getTileSource().getTileSizePixels();

	// Calculate the tiles needed for each side around the center one.
	final int latSpan = osmv.getLatitudeSpan();
	final int longSpan = osmv.getLongitudeSpan();
	final int topLatitude = osmv.getMapCenter().getLatitudeE6() + latSpan/2;
	final int leftLongitude = osmv.getMapCenter().getLongitudeE6() - longSpan/2;
	final int bottomLatitude = osmv.getMapCenter().getLatitudeE6() - latSpan/2;
	final int rightLongitude = osmv.getMapCenter().getLongitudeE6() + longSpan/2;
	final Point leftTopXY = Mercator.projectGeoPoint(topLatitude*1E-6, leftLongitude*1E-6, zoomLevel, new Point(0,0));
	final Point rightBottomXY = Mercator.projectGeoPoint(bottomLatitude*1E-6, rightLongitude*1E-6, zoomLevel, new Point(0,0));
	final int tileNeededAtLeft = leftTopXY.x;
	final int tileNeededAtRight = rightBottomXY.x;
	final int tileNeededAtTop = leftTopXY.y;
	final int tileNeededAtBottom = rightBottomXY.y;

	final int mapTileUpperBound = 1 << zoomLevel;
	// make sure the cache is big enough for all the tiles
	final int numNeeded = (tileNeededAtBottom - tileNeededAtTop + 1)
			* (tileNeededAtRight - tileNeededAtLeft + 1);
	mTileProvider.ensureCapacity(numNeeded);
	/* Draw all the MapTiles (from the upper left to the lower right). */
	for (int y = tileNeededAtTop; y <= tileNeededAtBottom; y++) {
		for (int x = tileNeededAtLeft; x <= tileNeededAtRight; x++) {
			// Construct a MapTile to request from the tile provider.
			final int tileY = MyMath.mod(y, mapTileUpperBound);
			final int tileX = MyMath.mod(x, mapTileUpperBound);
			final MapTile tile = new MapTile(zoomLevel, tileX, tileY);
			final Drawable currentMapTile = mTileProvider.getMapTile(tile);
			if (currentMapTile != null) {
				final GeoPoint gp = new GeoPoint(
						(int) (Mercator.tile2lat(y, zoomLevel) * 1E6),
						(int) (Mercator.tile2lon(x, zoomLevel) * 1E6));
				pj.toPixels(gp, mTilePos);
				mTileRect.set(mTilePos.x, mTilePos.y, mTilePos.x + tileSizePx, mTilePos.y + tileSizePx);
				currentMapTile.setBounds(mTileRect);
				currentMapTile.draw(c);
			}

			if (DEBUGMODE) {
				c.drawText(tile.toString(), mTileRect.left + 1, mTileRect.top + mPaint.getTextSize(), mPaint);
				c.drawLine(mTileRect.left, mTileRect.top, mTileRect.right, mTileRect.top, mPaint);
				c.drawLine(mTileRect.left, mTileRect.top, mTileRect.left, mTileRect.bottom, mPaint);
			}
		}
	}

	// draw a cross at center in debug mode
	if (DEBUGMODE) {
		final GeoPoint center = osmv.getMapCenter();
		final Point centerPoint = pj.toPixels(center, null);
		c.drawLine(centerPoint.x, centerPoint.y - 9, centerPoint.x, centerPoint.y + 9, mPaint);
		c.drawLine(centerPoint.x - 9, centerPoint.y, centerPoint.x + 9, centerPoint.y, mPaint);
	}
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:65,代码来源:GoogleTilesOverlay.java

示例11: isVisible

import com.google.android.maps.MapView; //导入方法依赖的package包/类
/**
 * Determine if the text will be visible on the given MapView
 * 
 * @param mapView The MapView to check against
 * @return True if the overlay will be visible
 */
public boolean isVisible(MapView mapView) {
	return mapView.getZoomLevel() >= minZoomLevel;
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:10,代码来源:TextOverlay.java


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