@Override
  public boolean onTap(final GeoPoint point, final MapView view) {
    if (mPopUpView != null) {
      view.removeView(mPopUpView);
    }
    // Projection接口用于屏幕像素点坐标系统和地球表面经纬度点坐标系统之间的变换
    mPopUpView = mInflater.inflate(R.layout.popup_mappoint, null);
    TextView textView = (TextView) mPopUpView.findViewById(R.id.PointName);
    if (mbStartFlag) {
      textView.setText("点击选择该点为起点");
    } else {
      textView.setText("点击选择该点为终点");
    }
    MapView.LayoutParams lp;
    lp =
        new MapView.LayoutParams(
            MapView.LayoutParams.WRAP_CONTENT,
            MapView.LayoutParams.WRAP_CONTENT,
            point,
            0,
            0,
            MapView.LayoutParams.BOTTOM_CENTER);
    view.addView(mPopUpView, lp);

    mPopUpView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Message msg = new Message();
            msg.what = Constants.FUNC_MAPPOINT;
            msg.obj = point;
            mContext.mHandler.sendMessage(msg);
            view.removeView(mPopUpView);
            mContext.mMapView.getOverlays().remove(this);
          }
        });

    return super.onTap(point, view);
  }
Esempio n. 2
0
  @Override
  protected boolean onTap(int index) {
    TrackInfo info = mTrackList.get(index);
    mMapController.setCenter(info.getGeoPoint());
    mMapView.removeView(mPopView);
    mMapView.addView(
        mPopView,
        new MapView.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT,
            info.getGeoPoint(),
            0,
            -mHeight,
            MapView.LayoutParams.BOTTOM_CENTER));

    TextView time = (TextView) mPopView.findViewById(R.id.track_time);
    TextView address = (TextView) mPopView.findViewById(R.id.track_address);

    time.setText(info.getTime().toString());
    address.setText(info.getAddress());
    return true;
  }