示例#1
0
  private void initCurrentMap() {
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Message msg = new Message();
    msg.what = 1;
    handler.sendMessage(msg);
    double latitude = CheezhiApplication.getLat();
    double longitude = CheezhiApplication.getLon();
    Log.e("wwwwwwwwww", latitude + "&&" + longitude);
    tipPlace(latitude, longitude);
    if (i == 0) {
      setLating(latitude);
      setLonging(longitude);
      i++;
    }

    if (latitude != getLating() || longitude != getLonging()) {
      //			Toast.makeText(TripActivity.this, getLating()+"==="+getLonging(),
      // Toast.LENGTH_LONG).show();
      drawLines(getLating(), latitude, getLonging(), longitude);
      setLating(latitude);
      setLonging(longitude);
    }
  }
示例#2
0
 public void handleMessage(android.os.Message msg) {
   switch (msg.what) {
     case 1:
       distance_text.setText(CheezhiApplication.getDistances() + "");
       now_range.setText((int) CheezhiApplication.getDistances() + "\n" + "m");
       break;
     default:
       break;
   }
 };
示例#3
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(R.layout.activity_trip);
   initView();
   initViewMap();
   CheezhiApplication.setZooms(20); // 初始化地图的缩放级别为20
   showHistogram(); // 显示柱状图
 }
示例#4
0
  private void tipPlace(double lats, double longs) {
    if (i != 0) {
      // Log.e("iii", "i = "+i);
      marker.remove();
    }

    LatLng point = new LatLng(lats, longs);
    MapStatus mMapStatus =
        new MapStatus.Builder().target(point).zoom(CheezhiApplication.getZooms()).build();

    // mMapView.getMap().get

    MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
    mBaiduMap.setMapStatus(mMapStatusUpdate);
    MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(point);
    mBaiduMap.animateMapStatus(u);

    BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_geo);

    OverlayOptions options =
        new MarkerOptions().position(point).icon(bitmap).zIndex(9).draggable(true);

    marker = (Marker) (mBaiduMap.addOverlay(options));
  }