WEB开发网
开发学院手机开发Android 开发 Android 数据库与MapView总结 阅读

Android 数据库与MapView总结

 2010-11-05 00:54:34 来源:WEB开发网   
核心提示:this.drawableID = drawableID;}public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when){Projection projection=mapView.getProjection();if(sh

this.drawableID = drawableID;

}

public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when){

Projection projection=mapView.getProjection();

if(shadow==false){

GeoPoint gp=new GeoPoint((int)this.geoLatitude, (int)this.geoLongitude);

Point point=new Point();

projection.toPixels(gp, point);

Paint paint=new Paint();

paint.setAntiAlias(true);

Bitmap bm=BitmapFactory.decodeResource(mapView.getResources(), this.drawableID);

canvas.drawBitmap(bm, point.x, point.y, paint);

}

return super.draw(canvas, mapView, shadow, when);

}

public void updateLocation(Location location)

{

this.mLocation = location;

}

public Location getLocation()

{

return mLocation;

}

}

package irdc.ex10_06;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.Canvas;

import android.graphics.Paint;

import android.graphics.Point;

import android.location.Location;

import com.google.android.maps.GeoPoint;

import com.google.android.maps.MapView;

import com.google.android.maps.Overlay;

import com.google.android.maps.Projection;

public class GeoPointImageOverlay extends Overlay

{

private Location mLocation;

private int drawableID;

private double geoLatitude,geoLongitude;

/* 建构方法一,传入Location对象 */

public GeoPointImageOverlay(Location location, int drawableID)

{

this.mLocation = location;

this.drawableID = drawableID;

/* 取得Location的经纬度 */

this.geoLatitude = this.mLocation.getLatitude()*1E6;

上一页  22 23 24 25 26 27 28 29 30 31  下一页

Tags:Android 数据库 MapView

编辑录入:coldstar [复制链接] [打 印]
赞助商链接