Пример #1
0
  @Override
  public void onReceiveLocation(BDLocation bdLocation) {
    // 信息没有参考性
    // MMLog.autoDebug(MMLog.printObjectFields(locationClient));

    if (bdLocation == null) {
      return;
    }

    log(bdLocation);

    if (!(bdLocation.getLocType() == BDLocation.TypeGpsLocation
        || bdLocation.getLocType() == BDLocation.TypeNetWorkLocation)) {
      return;
    }

    // 发送定位后的经纬度。
    PointD pointDTemp = new PointD();
    pointDTemp.longitude = bdLocation.getLongitude();
    pointDTemp.latitude = bdLocation.getLatitude();
    pointDTemp.province = bdLocation.getProvince();
    pointDTemp.city = bdLocation.getCity();
    pointDTemp.district = bdLocation.getDistrict();
    pointDTemp.addr = bdLocation.getAddrStr();

    setPointD(pointDTemp);

    stop();

    Msg msg = new Msg();
    msg.setData(pointDTemp);
    MsgMgr.getInstance().sendMsg(MsgType.MT_Util_Location, msg);

    startTime();
  }
Пример #2
0
  /**
   * 指定一个固定位置。
   *
   * @param longitude
   * @param latitude
   */
  public void setFixPlace(double longitude, double latitude) {
    fixPlace.longitude = longitude;
    fixPlace.latitude = latitude;
    useFixPlace = true;

    writeCfg();
  }
Пример #3
0
  private void readCfg() {
    if (pointD == null) {
      pointD = new PointD();
    }

    try {
      pointD.longitude = Double.valueOf(ModuleMgr.getCfgMgr().getString("LM_longitude", "1000"));
      pointD.latitude = Double.valueOf(ModuleMgr.getCfgMgr().getString("LM_latitude", "1000"));

      pointD.province = ModuleMgr.getCfgMgr().getString("LM_province", "");
      pointD.city = ModuleMgr.getCfgMgr().getString("LM_city", "");
      pointD.district = ModuleMgr.getCfgMgr().getString("LM_district", "");

      pointD.addr = ModuleMgr.getCfgMgr().getString("LM_addr", "");

      useFixPlace = ModuleMgr.getCfgMgr().getBoolean("LM_Fix_use", false);
      fixPlace.longitude =
          Double.valueOf(ModuleMgr.getCfgMgr().getString("LM_Fix_latitude", "1000"));
      fixPlace.latitude =
          Double.valueOf(ModuleMgr.getCfgMgr().getString("LM_Fix_longitude", "1000"));
    } catch (Exception e) {
      MMLog.printThrowable(e);
    }
  }