|
1.坐标接受
- public class GPSDataControl implements Process {
- private Context context;
- public GPSDataControl(Context context) {
- this.context = context;
- }
- @Override
- public boolean process(JNIMessage message) {
- String method = message.getStrParam(JNIMessage.Key.JNIMESSAGE_KEY_S_ID
- .getName());
- if (method.equals("GPSDATA")) {
- int token = message.getIntParam(
- JNIMessage.Key.JNIMESSAGE_KEY_I_TOKEN.getName(), -1);
- String s = message
- .getStrParam(JNIMessage.Key.JNIMESSAGE_KEY_S_RESULT
- .getName());
- String func = message
- .getStrParam(JNIMessage.Key.JNIMESSAGE_KEY_S_FUNCTION
- .getName());
- EventBus.getDefault().post( new GroupLocationEntity(GsonClient.getInstance().fromJson(s, BVCU_PUCFG_GPSData.class),func));
- }
- return false;
- }
- }
copycode
2.坐标接受
- private HashMap<String, GroupLocationEntity> userInfo;
-
- @Subscribe(threadMode = ThreadMode.MAIN)
- public void onEvent(GroupLocationEntity groupLocationEntity) {
- if (!groupLocationEntity.getUserId().contains(ProcessControl.getInstance().getApp().getServerParam().szClientID.split("_")[1])) {
- userInfo.put(groupLocationEntity.getUserId(), groupLocationEntity);
- }
- }
copycode
3.坐标纠偏
- //刷新请求数据
- private class RsfushRunable implements Runnable {
- @Override
- public void run() {
- for (Map.Entry<String, GroupLocationEntity> entityEntry : userInfo.entrySet()) {
- BDLocation bdLocation = new BDLocation();
- bdLocation.setLatitude(entityEntry.getValue().getGpsData().iLatitude / 10000000.0);
- bdLocation.setLongitude(entityEntry.getValue().getGpsData().iLongitude / 10000000.0);
- BDLocation location = GlobalTool.WGS84_to_GCJ02(bdLocation);
- double[] bd09Arr = GlobalTool.GCJ02_to_BD_09(location.getLongitude(), location.getLatitude());
- LatLng point = new LatLng(bd09Arr[0], bd09Arr[1]);
- String name = checkUserInfo(entityEntry.getKey());
- Bundle bundle = new Bundle();
- bundle.putString("id", entityEntry.getKey());
- bundle.putString("name", name);
- OverlayOptions option = new MarkerOptions()
- .position(point) //必传参数
- .icon(greenBitmap) //必传参数
- .draggable(true)
- .extraInfo(bundle)
- .flat(true);
- OverlayOptions mTextOptions = new TextOptions()
- .text(name) //文字内容
- .bgColor(0xFFFFFFFF) //背景色
- .fontSize(32) //字号
- .fontColor(0xFF68C270) //文字颜色
- .rotate(0) //旋转角度
- .position(point);
- optionList.add(option);
- optionList.add(mTextOptions);
- }
- handler.sendEmptyMessage(0);
- }
- }
copycode |
|