Java 类com.baidu.mapapi.map.MyLocationOverlay 实例源码

项目:FunWeibo    文件:BaiduMapActivity.java   
/**
 * 初始化地图
 */
private void initMap() {
    //设置MapView
    mMapView = (MapView)findViewById(R.id.bmapsView);
    mMapView.setBuiltInZoomControls(true);                      //设置启用内置的缩放控件
    mMapView.showScaleControl(true);                            //显示比例尺

    //地图控制器
    mMapController = mMapView.getController();

    //我的位置
    myLocationOverlay = new MyLocationOverlay(mMapView);

    //设置弹出窗
    mPopWindow = new PopupOverlay(mMapView, new MyPopupClickListener());
}
项目:itmarry    文件:PoiSelectActivity.java   
private void initLocationClient() {
    client = new LocationClient(getApplicationContext());
    MyApplication myapp = (MyApplication) this.getApplication();
    client.setAK(myapp.getKEK());// ���ö�λ�����KEY
    client.registerLocationListener(new BDLocationListener() {
        public void onReceivePoi(BDLocation arg0) {
        }

        public void onReceiveLocation(BDLocation res) {
            if (res != null) {
                LocationData data = new LocationData();
                data.latitude = res.getLatitude();
                data.longitude = res.getLongitude();
                data.accuracy = res.getRadius();
                MyLocationOverlay locationOverlay = new MyLocationOverlay(
                        map);
                GeoPoint poi = new GeoPoint(
                        (int) (res.getLatitude() * 1e6), (int) (res
                                .getLongitude() * 1e6));
                locationOverlay.setData(data);
                map.getOverlays().add(locationOverlay);
                map.refresh();
                map.getController().animateTo(poi);
                probar.setVisibility(View.GONE);
                flag.setVisibility(View.VISIBLE);
            }

        }
    });// ע�����
    LocationClientOption option = new LocationClientOption();// ���ö�λ����
    option.setAddrType("all");// ����������Ϣ
    option.disableCache(true);// �����涨λ��Ϣ
    option.setCoorType("bd09ll");// ���ص���������
    option.setTimeOut(8000);// ���ö�λ��ʱ
    client.setLocOption(option);// �������
    client.start();
}
项目:itmarry    文件:TabMap.java   
public void handleMessage(Message msg) {
    switch (msg.what) {
    case 1:
        beanRwgg br = (beanRwgg) msg.obj;
        Log.d("jd", br.getCjb_jd());
        Log.d("wd", br.getCjd_wd());
        if (br.getCjb_jd().equals("") || br.getCjb_jd().equals("0.0")
                || br.getCjb_jd().equals("0")) {
            Toast.makeText(TabMap.this, "��ǰ�ɼ���û���κε�����Ϣ��", 1).show();
            finish();
        } else {
            DecimalFormat df = new DecimalFormat(".###");
            locData.latitude = Double.parseDouble(df.format(Double
                    .parseDouble(br.getCjd_wd())));
            locData.longitude = Double.parseDouble(df.format(Double
                    .parseDouble(br.getCjb_jd())));
        }

        pdialog.dismiss();
        MyLocationOverlay myLocationOverlay = new MyLocationOverlay(
                mMapView);

        myLocationOverlay.setData(locData);
        GeoPoint point = new GeoPoint((int) (locData.latitude * 1e6),
                (int) (locData.longitude * 1e6));
        // �ø����ľ�γ�ȹ���һ��GeoPoint����λ��΢�� (�� * 1E6)
        mMapController.setCenter(point);// ���õ�ͼ���ĵ�
        mMapController.setZoom(18);// ���õ�ͼzoom����
        mMapView.getOverlays().add(myLocationOverlay);
        mMapView.refresh();
        mMapView.getController().animateTo(point);
        break;
    }

}
项目:calltaxi    文件:MapActivity.java   
public void addSelfOverlay(double Lati, double Long) {
    myLocationOverlay = new MyLocationOverlay(mMapView);
    LocationData locData = new LocationData();
    locData.latitude = Lati;
    locData.longitude = Long;
    myLocationOverlay.setData(locData);
    mMapView.getOverlays().add(myLocationOverlay);
    mMapView.refresh();
    mMapView.getController().animateTo(new GeoPoint((int)( locData.latitude * 1e6),(int)(locData.longitude * 1e6)));
}
项目:calltaxi    文件:MapActivity.java   
public void addSelfOverlay(double Lati, double Long) {
    myLocationOverlay = new MyLocationOverlay(mMapView);
    LocationData locData = new LocationData();
    locData.latitude = Lati;
    locData.longitude = Long;
    myLocationOverlay.setData(locData);
    mMapView.getOverlays().add(myLocationOverlay);
    mMapView.refresh();
    mMapView.getController().animateTo(new GeoPoint((int)( locData.latitude * 1e6),(int)(locData.longitude * 1e6)));
}
项目:NeXT_pyp    文件:BMapLocActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 初始化
    initEngineManager(this);


    // 布局获取ID
    setContentView(R.layout.pyp_page_map);
    mMapView = (MapView) findViewById(R.id.bmapView);

     //实例化监听事件
       mMapView.regMapViewListener(mBMapManager, mMapListener);
       mMapView.regMapTouchListner(mapTouchListener);

       //实例化工具
       myLocationOverlay = new MyLocationOverlay(mMapView);
       mLocClient = new LocationClient(this.getApplicationContext());       
    option = new LocationClientOption();
       myListener = new MyLocationListenner();
       locData = new LocationData();

       mLocClient.setAK(APPCodeConst.ak);
       mLocClient.registerLocationListener(myListener); 
       mLocClient.start();
       mLocClient.requestLocation();
       //对应方法
       setOption();

}
项目:NeXT_pyp    文件:BMapLocActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 初始化
    initEngineManager(this);


    // 布局获取ID
    setContentView(R.layout.pyp_page_map);
    mMapView = (MapView) findViewById(R.id.bmapView);

     //实例化监听事件
       mMapView.regMapViewListener(mBMapManager, mMapListener);
       mMapView.regMapTouchListner(mapTouchListener);

       //实例化工具
       myLocationOverlay = new MyLocationOverlay(mMapView);
       mLocClient = new LocationClient(this.getApplicationContext());       
    option = new LocationClientOption();
       myListener = new MyLocationListenner();
       locData = new LocationData();

       mLocClient.setAK(APPCodeConst.ak);
       mLocClient.registerLocationListener(myListener); 
       mLocClient.start();
       mLocClient.requestLocation();
       //对应方法
       setOption();

}
项目:p1-android    文件:VenueActivity.java   
private void setMyLocationOverlay() {
    MyLocationOverlay locationOverlay = new MyLocationOverlay(mMapView);
    LocationData locdata = new LocationData();
    locdata.latitude = mLastLocation.getLatitude();
    locdata.longitude = mLastLocation.getLongitude();
    locdata.direction = 0.0f;
    locationOverlay.setData(locdata);
    mMapView.getOverlays().add(locationOverlay);
    mMapView.refresh();
    mMapView.getController().animateTo(
            Utils.LocationDataToGeoPoint(locdata));
}
项目:itmarry    文件:MapActivity.java   
private void initOverlays() {
    myLocation = new MyLocationOverlay(mMapView);
    lbsoverlay = new CloudOverlay(this, mMapView);
    mMapView.getOverlays().add(myLocation);
    mMapView.getOverlays().add(lbsoverlay);
}
项目:itmarry    文件:LjghTab.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_map);

    mMapView = (MapView) findViewById(R.id.bmapsView);
    mMapView.setBuiltInZoomControls(true);
    // mMapView.setSatellite(true);
    // �����������õ����ſؼ�
    mMapController = mMapView.getController();
    // �õ�mMapView�Ŀ���Ȩ,�����������ƺ�����ƽ�ƺ�����
    locData = new LocationData();
    locData.direction = 2.0f;

    Intent intent = this.getIntent();
    this.jd=intent.getDoubleExtra("jd", 0);
    this.wd=intent.getDoubleExtra("wd", 0);

    // ��ȡ���������
    Log.d("wd", jd + "");
    Log.d("jd", wd + "");
    locData.latitude = wd;
    locData.longitude = jd;
    myLocationOverlay = new MyLocationOverlay(mMapView);

    myLocationOverlay.setData(locData);
    GeoPoint point = new GeoPoint((int) (locData.latitude * 1e6),
            (int) (locData.longitude * 1e6));
    // �ø����ľ�γ�ȹ���һ��GeoPoint����λ��΢�� (�� * 1E6)
    mMapController.setCenter(point);// ���õ�ͼ���ĵ�
    mMapController.setZoom(18);// ���õ�ͼzoom����
    mMapView.getOverlays().add(myLocationOverlay);
    mMapView.refresh();
    mMapView.getController().animateTo(point);

    // ��ʼ��ȡ��ǰλ������

    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    mLocClient.setAK(Utils.getMetaValue(getApplication(), "map_api_key"));
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// ��gps
    option.setCoorType("bd09ll"); // ������������
    option.setScanSpan(1000);
    option.setAddrType("all");
    mLocClient.setLocOption(option);

    mLocClient.start();
}