parent
							
								
									0814bc4f89
								
							
						
					
					
						commit
						133941b13f
					
				
				 12 changed files with 760 additions and 2 deletions
			
			
		
									
										Binary file not shown.
									
								
							
						
									
										Binary file not shown.
									
								
							
						| @ -0,0 +1,445 @@ | ||||
| package com.project.survey.ui.instrument.basestationtranslation; | ||||
| 
 | ||||
| import android.content.DialogInterface; | ||||
| import android.content.SharedPreferences; | ||||
| import android.graphics.Color; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| 
 | ||||
| import androidx.appcompat.app.AlertDialog; | ||||
| import androidx.preference.PreferenceManager; | ||||
| 
 | ||||
| import com.afollestad.materialdialogs.MaterialDialog; | ||||
| import com.bingce.coordlib.model.Blh; | ||||
| import com.bingce.coordlib.model.Coordinate; | ||||
| import com.bingce.coordlib.model.CoordinateSystem; | ||||
| import com.bingce.data.cache.AbstractCachedObserver; | ||||
| import com.bingce.data.cache.CachedCurrentCoordinateSystem; | ||||
| import com.bingce.data.database.ProjectDb; | ||||
| import com.bingce.device.Device; | ||||
| import com.bingce.device.enums.ConnectTypeEnum; | ||||
| import com.bingce.log.BCLog; | ||||
| import com.bingce.rtk.gnss.Gnss; | ||||
| import com.bingce.rtk.gnss.setting.BaseCorrect; | ||||
| import com.bingce.rtk.model.GnssPosition; | ||||
| import com.bingce.rtk.util.CoordTransUtil; | ||||
| 
 | ||||
| import com.bingce.surveyor.agentweb.HelpWebActivity; | ||||
| 
 | ||||
| import com.bingce.utils.ThreadPoolUtil; | ||||
| import com.bingce.utils.Util; | ||||
| import com.project.survey.App; | ||||
| import com.project.survey.R; | ||||
| import com.project.survey.databinding.ActivityRtkCorrectBinding; | ||||
| import com.project.survey.ui.base.BaseSurveyNewActivity; | ||||
| import com.project.survey.ui.instrument.setupstation.ControlPointsNewActivity; | ||||
| import com.project.survey.ui.instrument.setupstation.CoordinatePointsLibraryActivity; | ||||
| import com.project.survey.ui.instrument.setupstation.StakingNewJobActivity; | ||||
| import com.project.survey.util.CommonUtils; | ||||
| import com.project.survey.util.DrawableUtils; | ||||
| 
 | ||||
| import blankj.utilcode.util.StringUtils; | ||||
| import blankj.utilcode.util.ToastUtils; | ||||
| import blankj.utilcode.util.Utils; | ||||
| 
 | ||||
| 
 | ||||
| public class RtkBaseCorrectActivity extends BaseSurveyNewActivity { | ||||
|     private int mTimes = -1; | ||||
|     double latSum = 0, lngSum = 0, altSum = 0; | ||||
|     private double originalLatitude, originalLongitude, originalAltitude; | ||||
|     protected final CachedCurrentCoordinateSystem cachedCoordinateSystem = new CachedCurrentCoordinateSystem(this); | ||||
| 
 | ||||
|     private ActivityRtkCorrectBinding binding; | ||||
| 
 | ||||
|     @Override | ||||
|     public View getContentView() { | ||||
|         binding = ActivityRtkCorrectBinding.inflate(getLayoutInflater()); | ||||
|         return binding.getRoot(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void initView() { | ||||
| //        setTitle(R.string.rtk_base_correct);
 | ||||
|         cachedCoordinateSystem.observe(new AbstractCachedObserver<CoordinateSystem>() { | ||||
|             @Override | ||||
|             public void onChanged(boolean isFirstTimeDataChanged, CoordinateSystem coordinateSystem) { | ||||
|                 if (isFirstTimeDataChanged) { | ||||
|                     binding.activityRtkCorrectTvCorrectCurrent.setText(String.format("%s:\n%s:%s\n%s:%s\n%s:%s", | ||||
|                             getString(R.string.current), getString(R.string.rtk_correct_x), | ||||
|                             Util.formatDouble2StringDotAuto(coordinateSystem.correctN), | ||||
|                             getString(R.string.rtk_correct_y), | ||||
|                             Util.formatDouble2StringDotAuto(coordinateSystem.correctE), | ||||
|                             getString(R.string.rtk_correct_z), | ||||
|                             Util.formatDouble2StringDotAuto(coordinateSystem.correctH))); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         binding.activityRtkCorrectBtnSmoothCollectTenTimes.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View view) { | ||||
|                 binding.activityRtkCorrectEt0.requestFocus();//作用:输入框不聚焦,防止实测坐标后页面自动滑动到顶部,同样避免RTK继续后输入框没有失效焦点,导致再输入内容输入法自动隐藏的问题
 | ||||
|                 CommonUtils.hideSoftInput(); | ||||
| 
 | ||||
|                 Device.getInstance().isRtkRunning = true; | ||||
|                 mTimes = 0; | ||||
|                 latSum = 0; | ||||
|                 lngSum = 0; | ||||
|                 altSum = 0; | ||||
|                 originalLatitude = 0; | ||||
|                 originalLongitude = 0; | ||||
|                 originalAltitude = 0; | ||||
|                 binding.activityRtkCorrectMetOriginalLatitude.setText(""); | ||||
|                 binding.activityRtkCorrectMetOriginalLongitude.setText(""); | ||||
|                 binding.activityRtkCorrectMetOriginalAltitude.setText(""); | ||||
|                 binding.activityRtkCorrectProgressbar.setProgress(0); | ||||
|             } | ||||
|         }); | ||||
|         binding.activityRtkCorrectBtnCorrect.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View v) { | ||||
|                 binding.activityRtkCorrectEt0.requestFocus();//作用:输入框不聚焦,防止实测坐标后页面自动滑动到顶部
 | ||||
|                 CommonUtils.hideSoftInput(); | ||||
|                 if (checkCalEnable()) { | ||||
|                     double control_x = Double.parseDouble(binding.activityRtkCorrectMetControlPointX.getText().toString()); | ||||
|                     double control_y = Double.parseDouble(binding.activityRtkCorrectMetControlPointY.getText().toString()); | ||||
|                     double control_z = Double.parseDouble(binding.activityRtkCorrectMetControlPointZ.getText().toString()); | ||||
|                     Coordinate coordinate = CoordTransUtil.blh2Xyz(originalLatitude, originalLongitude, originalAltitude, false, cachedCoordinateSystem.coordinateSystem()); | ||||
|                     if (coordinate == null) { | ||||
|                         ToastUtils.showShort(R.string.input_illegal); | ||||
|                         return; | ||||
|                     } | ||||
|                     double correctN = control_x - coordinate.getX(); | ||||
|                     double correctE = control_y - coordinate.getY(); | ||||
|                     double correctH = control_z - coordinate.getZ(); | ||||
| 
 | ||||
|                     new AlertDialog.Builder(RtkBaseCorrectActivity.this).setTitle(R.string.rtk_correct_result) | ||||
|                             .setMessage(getString(R.string.rtk_correct_x) + ":" + Util.formatDouble2StringDotAuto(correctN) + "\n" | ||||
|                                     + getString(R.string.rtk_correct_y) + ":" + Util.formatDouble2StringDotAuto(correctE) + "\n" | ||||
|                                     + getString(R.string.rtk_correct_z) + ":" + Util.formatDouble2StringDotAuto(correctH) + "\n") | ||||
|                             .setPositiveButton(R.string.global_apply, new DialogInterface.OnClickListener() { | ||||
|                                 @Override | ||||
|                                 public void onClick(DialogInterface dialogInterface, int i) { | ||||
|                                     binding.activityRtkCorrectBtnCorrect.setEnabled(false); | ||||
|                                     cachedCoordinateSystem.coordinateSystem().correctN = correctN; | ||||
|                                     cachedCoordinateSystem.coordinateSystem().correctE = correctE; | ||||
|                                     cachedCoordinateSystem.coordinateSystem().correctH = correctH; | ||||
| 
 | ||||
|                                     BCLog.BugCoordinateSystem.log(cachedCoordinateSystem.coordinateSystem(), () -> "坐标系校正后"); | ||||
| 
 | ||||
|                                     Coordinate correctPoint = new Coordinate(binding.activityRtkCorrectMetControlPointName.getText().toString(), control_x, control_y, control_z); | ||||
|                                     ThreadPoolUtil.execute(() -> { | ||||
|                                         CachedCurrentCoordinateSystem.saveCurrentCoordinateSystem(cachedCoordinateSystem.coordinateSystem()); | ||||
|                                         BCLog.BugCoordinateSystem.log(cachedCoordinateSystem.coordinateSystem(), () -> "执行坐标系存储"); | ||||
|                                         Gnss.getInstance().getSetting().setBaseCorrect(new BaseCorrect(correctPoint)); | ||||
|                                         Gnss.getInstance().save(); | ||||
|                                         runOnUiThread(new Runnable() { | ||||
|                                             @Override | ||||
|                                             public void run() { | ||||
|                                                 binding.activityRtkCorrectTvCorrectCurrent.setText(String.format("%s:\n%s:%s\n%s:%s\n%s:%s", | ||||
|                                                         getString(R.string.current), getString(R.string.rtk_correct_x), | ||||
|                                                         Util.formatDouble2StringDotAuto(cachedCoordinateSystem.coordinateSystem().correctN), | ||||
|                                                         getString(R.string.rtk_correct_y), | ||||
|                                                         Util.formatDouble2StringDotAuto(cachedCoordinateSystem.coordinateSystem().correctE), | ||||
|                                                         getString(R.string.rtk_correct_z), | ||||
|                                                         Util.formatDouble2StringDotAuto(cachedCoordinateSystem.coordinateSystem().correctH))); | ||||
|                                                 ToastUtils.showShort(R.string.apply_success); | ||||
|                                             } | ||||
|                                         }); | ||||
|                                     }); | ||||
|                                 } | ||||
|                             }).setNegativeButton(R.string.close, null).show(); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|         binding.activityRtkCorrectBtnCorrect.setEnabled(false); | ||||
|         DrawableUtils.tintModifyColorVector(binding.activityRtkCorrectBtnOpen1, R.drawable.icon_vector_folder); | ||||
|         binding.activityRtkCorrectBtnOpen1.setOnClickListener(v -> { | ||||
|             binding.activityRtkCorrectEt0.requestFocus();//作用:输入框不聚焦,防止实测坐标后页面自动滑动到顶部
 | ||||
|             CommonUtils.hideSoftInput(); | ||||
|             new MaterialDialog.Builder(RtkBaseCorrectActivity.this) | ||||
|                     .title(R.string.data_source) | ||||
|                     .items(new String[]{getString(R.string.road_control_point), getString(R.string.global_control_point), getString(R.string.point_survey_point_library), getString(R.string.staking_point_library)}) | ||||
|                     .itemsCallback((dialog, itemView, which, text) -> { | ||||
|                         switch (which) { | ||||
|                             case 0: | ||||
|                                 ControlPointsNewActivity.pickPoint(this, false, (name, code, x, y, z, remarks) -> { | ||||
|                                     onPicked(name, x, y, z); | ||||
|                                 }); | ||||
|                                 break; | ||||
|                             case 1: | ||||
|                                 ControlPointsNewActivity.pickPoint(this, true, (name, code, x, y, z, remarks) -> { | ||||
|                                     onPicked(name, x, y, z); | ||||
|                                 }); | ||||
|                                 break; | ||||
|                             case 2: | ||||
|                                 CoordinatePointsLibraryActivity.pickPoint(RtkBaseCorrectActivity.this, (name, code, x, y, z, b, l, h) -> { | ||||
|                                     onPicked(name, x, y, z); | ||||
|                                 }); | ||||
|                                 break; | ||||
|                             case 3: | ||||
|                                 StakingNewJobActivity.pickPoint(RtkBaseCorrectActivity.this, (name, x, y, z) -> { | ||||
|                                     onPicked(name, x, y, z); | ||||
|                                 }); | ||||
|                                 break; | ||||
|                         } | ||||
|                     }).show(); | ||||
|         }); | ||||
| 
 | ||||
|         initMaterialEditTextColor(); | ||||
| 
 | ||||
|         if (Device.getInstance().connectType == ConnectTypeEnum.CONNECT_TYPE_PHONE_LOCATION) { | ||||
|             new AlertDialog.Builder(this) | ||||
|                     .setTitle(R.string.hint) | ||||
|                     .setMessage("使用手机自带GPS时,请在RTK坐标系统里,坐标转换方法选择:手机gps校正,再点击校正;如果您想使用RTK放样,请重启软件,选择对应的RTK型号,再进入此界面校正") | ||||
|                     .setPositiveButton(R.string.i_know, null) | ||||
|                     .show(); | ||||
|         } else { | ||||
|             if (Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint() != null | ||||
|                     && !StringUtils.isEmpty(Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint().getName())) { | ||||
|                 try { | ||||
|                     new AlertDialog.Builder(this) | ||||
|                             .setTitle(R.string.hint) | ||||
|                             .setMessage(getString(R.string.ask_use_last_rtk_coordinate) + Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint().getName()) | ||||
|                             .setPositiveButton(R.string.use, new DialogInterface.OnClickListener() { | ||||
|                                 @Override | ||||
|                                 public void onClick(DialogInterface dialog, int which) { | ||||
|                                     binding.activityRtkCorrectMetControlPointName.setText(Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint().getName()); | ||||
|                                     binding.activityRtkCorrectMetControlPointX.setText(Util.formatDouble2StringDotAuto(Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint().getX())); | ||||
|                                     binding.activityRtkCorrectMetControlPointY.setText(Util.formatDouble2StringDotAuto(Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint().getY())); | ||||
|                                     binding.activityRtkCorrectMetControlPointZ.setText(Util.formatDouble2StringDotAuto(Gnss.getInstance().getSetting().getBaseCorrect().getCorrectPoint().getZ())); | ||||
|                                 } | ||||
|                             }) | ||||
|                             .setNegativeButton(R.string.cancel, null) | ||||
|                             .show(); | ||||
|                 } catch (NumberFormatException ignored) { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void initData() { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     private boolean checkCalEnable() { | ||||
|         //已知点检查
 | ||||
|         if ("".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim()) | ||||
|                 && "".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim()) | ||||
|                 && "".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointX.setError(getString(R.string.known_point_cannot_be_empty)); | ||||
|             binding.activityRtkCorrectMetControlPointY.setError(getString(R.string.known_point_cannot_be_empty)); | ||||
|             binding.activityRtkCorrectMetControlPointZ.setError(getString(R.string.known_point_cannot_be_empty)); | ||||
|             return false; | ||||
|         } else if ("-".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim()) | ||||
|                 || "-.".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim()) | ||||
|                 || ".".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim()) | ||||
|                 || "+.".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim()) | ||||
|                 || "+".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointX.setError(getString(R.string.input_illegal)); | ||||
|             return false; | ||||
|         } else if ("-".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim()) | ||||
|                 || "-.".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim()) | ||||
|                 || ".".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim()) | ||||
|                 || "+.".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim()) | ||||
|                 || "+".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointY.setError(getString(R.string.input_illegal)); | ||||
|             return false; | ||||
|         } else if ("-".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim()) | ||||
|                 || "-.".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim()) | ||||
|                 || ".".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim()) | ||||
|                 || "+.".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim()) | ||||
|                 || "+".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointZ.setError(getString(R.string.input_illegal)); | ||||
|             return false; | ||||
|         } | ||||
|         if ("".equals(binding.activityRtkCorrectMetControlPointX.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointX.setText("0"); | ||||
|         } | ||||
|         if ("".equals(binding.activityRtkCorrectMetControlPointY.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointY.setText("0"); | ||||
|         } | ||||
|         if ("".equals(binding.activityRtkCorrectMetControlPointZ.getText().toString().trim())) { | ||||
|             binding.activityRtkCorrectMetControlPointZ.setText("0"); | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     private void onPicked(String name, double x, double y, double z) { | ||||
|         String lastCorrectStr = null; | ||||
| //        int jobIndex = data.getIntExtra("returnJobIndex", -1);
 | ||||
| //        int coordIndex = data.getIntExtra("returnCoordIndex", -1);
 | ||||
| //        IStakingJobDataSource stakingJobDataSource = VersionController.instance.getStakingJobDataSource();
 | ||||
| //        if (jobIndex >= 0 && jobIndex < stakingJobDataSource.size()) {
 | ||||
| //            if (coordIndex >= 0 && coordIndex < stakingJobDataSource.get(jobIndex).getPointList().size()) {
 | ||||
| //                Point point = stakingJobDataSource.get(jobIndex).getPointList().get(coordIndex);
 | ||||
| //                binding.activityRtkCorrectMetControlPointName.setText(point.getName());
 | ||||
| //                binding.activityRtkCorrectMetControlPointX.setText(Util.formatDouble2String(point.getX()));
 | ||||
| //                binding.activityRtkCorrectMetControlPointY.setText(Util.formatDouble2String(point.getY()));
 | ||||
| //                binding.activityRtkCorrectMetControlPointZ.setText(Util.formatDouble2String(point.getZ()));
 | ||||
| //                lastCorrectStr = point.getName() + "," + point.getX() + "," + point.getY() + "," + point.getZ();
 | ||||
| //                ToastUtils.showShort(R.string.open_point_successful);
 | ||||
| //            }
 | ||||
| //        } else {
 | ||||
| //            String name = data.getStringExtra("name");
 | ||||
| //            double x = data.getDoubleExtra("x", 0);
 | ||||
| //            double y = data.getDoubleExtra("y", 0);
 | ||||
| //            double z = data.getDoubleExtra("z", 0);
 | ||||
|         binding.activityRtkCorrectMetControlPointName.setText(name); | ||||
|         binding.activityRtkCorrectMetControlPointX.setText(Util.formatDouble2StringDotAuto(x)); | ||||
|         binding.activityRtkCorrectMetControlPointY.setText(Util.formatDouble2StringDotAuto(y)); | ||||
|         binding.activityRtkCorrectMetControlPointZ.setText(Util.formatDouble2StringDotAuto(z)); | ||||
|         lastCorrectStr = name + "," + x + "," + y + "," + z; | ||||
|         ToastUtils.showShort(R.string.open_point_successful); | ||||
| //        }
 | ||||
|         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); | ||||
|         SharedPreferences.Editor editor = prefs.edit(); | ||||
|         editor.putString("lastRtkCorrectPoint", lastCorrectStr); | ||||
|         editor.apply(); | ||||
|         ToastUtils.showShort(R.string.open_point_successful); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onOptionsItemSelected(MenuItem item) { | ||||
|         switch (item.getItemId()) { | ||||
|             case R.id.menu_activity_rtk_correct_reset: | ||||
|                 cachedCoordinateSystem.coordinateSystem().correctN = 0; | ||||
|                 cachedCoordinateSystem.coordinateSystem().correctE = 0; | ||||
|                 cachedCoordinateSystem.coordinateSystem().correctH = 0; | ||||
|                 binding.activityRtkCorrectTvCorrectCurrent.setText(String.format("%s:\n%s:%s\n%s:%s\n%s:%s", | ||||
|                         getString(R.string.current), getString(R.string.rtk_correct_x), | ||||
|                         Util.formatDouble2StringDotAuto(cachedCoordinateSystem.coordinateSystem().correctN), | ||||
|                         getString(R.string.rtk_correct_y), | ||||
|                         Util.formatDouble2StringDotAuto(cachedCoordinateSystem.coordinateSystem().correctE), | ||||
|                         getString(R.string.rtk_correct_z), | ||||
|                         Util.formatDouble2StringDotAuto(cachedCoordinateSystem.coordinateSystem().correctH))); | ||||
|                 ThreadPoolUtil.execute(() -> { | ||||
|                     ProjectDb.getInstance().updateCurrentCoordinator(cachedCoordinateSystem.coordinateSystem()); | ||||
|                     ToastUtils.showShort(R.string.rtk_correct_reset); | ||||
|                 }); | ||||
|                 break; | ||||
|             case R.id.menu_help: | ||||
|                 HelpWebActivity.navigation2RtkBaseCorrectHelp(this); | ||||
|                 break; | ||||
|         } | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         super.onCreateOptionsMenu(menu); | ||||
|         getMenuInflater().inflate(R.menu.menu_activity_rtk_correct, menu); | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|     private void initMaterialEditTextColor() { | ||||
|         if (((App) Utils.getApp()).isThemeDark) { | ||||
|             binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.WHITE); | ||||
|             binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.WHITE); | ||||
|             binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.WHITE); | ||||
|             binding.activityRtkCorrectMetControlPointX.setMetTextColor(Color.WHITE); | ||||
|             binding.activityRtkCorrectMetControlPointY.setMetTextColor(Color.WHITE); | ||||
|             binding.activityRtkCorrectMetControlPointZ.setMetTextColor(Color.WHITE); | ||||
| 
 | ||||
|             binding.activityRtkCorrectMetOriginalLatitude.setPrimaryColor(Color.LTGRAY); | ||||
|             binding.activityRtkCorrectMetOriginalLongitude.setPrimaryColor(Color.LTGRAY); | ||||
|             binding.activityRtkCorrectMetOriginalAltitude.setPrimaryColor(Color.LTGRAY); | ||||
|             binding.activityRtkCorrectMetControlPointX.setPrimaryColor(Color.LTGRAY); | ||||
|             binding.activityRtkCorrectMetControlPointY.setPrimaryColor(Color.LTGRAY); | ||||
|             binding.activityRtkCorrectMetControlPointZ.setPrimaryColor(Color.LTGRAY); | ||||
| 
 | ||||
|             binding.activityRtkCorrectMetOriginalLatitude.setFocusFraction(1.0f); | ||||
|             binding.activityRtkCorrectMetOriginalLongitude.setFocusFraction(1.0f); | ||||
|             binding.activityRtkCorrectMetOriginalAltitude.setFocusFraction(1.0f); | ||||
|             binding.activityRtkCorrectMetControlPointX.setFocusFraction(1.0f); | ||||
|             binding.activityRtkCorrectMetControlPointY.setFocusFraction(1.0f); | ||||
|             binding.activityRtkCorrectMetControlPointZ.setFocusFraction(1.0f); | ||||
| 
 | ||||
|             binding.activityRtkCorrectMetOriginalLatitude.setMetHintTextColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetOriginalLongitude.setMetHintTextColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetOriginalAltitude.setMetHintTextColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetControlPointX.setMetHintTextColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetControlPointY.setMetHintTextColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetControlPointZ.setMetHintTextColor(Color.GRAY); | ||||
| 
 | ||||
|             binding.activityRtkCorrectMetOriginalLatitude.setUnderlineColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetOriginalLongitude.setUnderlineColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetOriginalAltitude.setUnderlineColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetControlPointX.setUnderlineColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetControlPointY.setUnderlineColor(Color.GRAY); | ||||
|             binding.activityRtkCorrectMetControlPointZ.setUnderlineColor(Color.GRAY); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onRtkPositionReceived(double antennaHeight, Blh blh, Blh originalBlh, Coordinate coordinate, double hdop, double vdop, double pdop) { | ||||
|         super.onRtkPositionReceived(antennaHeight, blh, originalBlh, coordinate, hdop, vdop, pdop); | ||||
|         if (mTimes >= 0 && mTimes < 10) { | ||||
|             latSum += originalBlh.getLatitude(); | ||||
|             lngSum += originalBlh.getLongitude(); | ||||
|             altSum += originalBlh.getAltitude(); | ||||
|             mTimes++; | ||||
|             binding.activityRtkCorrectProgressbar.setProgress(mTimes); | ||||
|             if (mTimes == 10) { | ||||
|                 originalLatitude = latSum / mTimes; | ||||
|                 originalLongitude = lngSum / mTimes; | ||||
|                 originalAltitude = altSum / mTimes; | ||||
|                 binding.activityRtkCorrectMetOriginalLatitude.setText(Util.radianToDmsDoubleString(Math.toRadians(originalLatitude), 6, false)); | ||||
|                 binding.activityRtkCorrectMetOriginalLongitude.setText(Util.radianToDmsDoubleString(Math.toRadians(originalLongitude), 6, false)); | ||||
|                 binding.activityRtkCorrectMetOriginalAltitude.setText(Util.formatDouble2StringDotAuto(originalAltitude)); | ||||
|                 binding.activityRtkCorrectBtnCorrect.setEnabled(true); | ||||
|             } | ||||
|         } | ||||
|         if (Device.getInstance().isRtkRunning) { | ||||
|             if (Gnss.getInstance().getDevice().isTiltOpen()) { | ||||
|                 if (GnssPosition.getInstance().isTiltEnable()) { | ||||
|                     if (((App) Utils.getApp()).isThemeDark) { | ||||
|                         binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.WHITE); | ||||
|                         binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.WHITE); | ||||
|                         binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.WHITE); | ||||
|                     } else { | ||||
|                         binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.BLACK); | ||||
|                         binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.BLACK); | ||||
|                         binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.BLACK); | ||||
|                     } | ||||
|                 } else { | ||||
|                     binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.RED); | ||||
|                     binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.RED); | ||||
|                     binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.RED); | ||||
|                 } | ||||
|             } else { | ||||
|                 switch (GnssPosition.getInstance().getPosType()) { | ||||
|                     case GnssPosition.POS_TYPE_FIXED: | ||||
|                         if (((App) Utils.getApp()).isThemeDark) { | ||||
|                             binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.WHITE); | ||||
|                             binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.WHITE); | ||||
|                             binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.WHITE); | ||||
|                         } else { | ||||
|                             binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.BLACK); | ||||
|                             binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.BLACK); | ||||
|                             binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.BLACK); | ||||
|                         } | ||||
|                         break; | ||||
|                     case GnssPosition.POS_TYPE_FLOAT: | ||||
|                         binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(getResources().getColor(R.color.md_deep_orange_400)); | ||||
|                         binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(getResources().getColor(R.color.md_deep_orange_400)); | ||||
|                         binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(getResources().getColor(R.color.md_deep_orange_400)); | ||||
|                         break; | ||||
|                     default: | ||||
|                         binding.activityRtkCorrectMetOriginalLatitude.setMetTextColor(Color.RED); | ||||
|                         binding.activityRtkCorrectMetOriginalLongitude.setMetTextColor(Color.RED); | ||||
|                         binding.activityRtkCorrectMetOriginalAltitude.setMetTextColor(Color.RED); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void onPause() { | ||||
|         super.onPause(); | ||||
|         binding.activityRtkCorrectEt0.requestFocus();//作用:输入框不聚焦,防止实测坐标后页面自动滑动到顶部
 | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,5 @@ | ||||
| <vector android:alpha="0.9" android:autoMirrored="true" | ||||
|     android:height="200dp" android:viewportHeight="200" | ||||
|     android:viewportWidth="200" android:width="200dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <path android:fillColor="#000000" android:pathData="M99.69,47.5C101.25,52.81 106.25,56.25 111.56,56.25H162.19C162.19,49.38 156.56,43.75 149.69,43.75H98.44L99.69,47.5ZM94.69,31.25H149.69C163.44,31.25 174.69,42.5 174.69,56.25V61.25C180.63,65.94 184.69,73.13 184.69,81.25V156.25C184.69,170 173.44,181.25 159.69,181.25H40.63C26.88,181.25 15.63,170 15.63,156.25V43.75C15.63,30 26.88,18.75 40.63,18.75H72.81C81.88,18.75 90.31,23.75 94.69,31.25ZM72.81,31.25H40.63C33.75,31.25 28.13,36.88 28.13,43.75V156.25C28.13,163.13 33.75,168.75 40.63,168.75H159.38C166.25,168.75 171.88,163.13 171.88,156.25V81.25C171.88,74.38 166.25,68.75 159.38,68.75H112.19C101.25,68.75 91.56,61.56 88.44,51.25L84.69,40C83.13,34.69 78.44,31.25 72.81,31.25ZM53.13,137.5H103.13C106.56,137.5 109.38,140.31 109.38,143.75C109.38,147.19 106.56,150 103.13,150H53.13C49.69,150 46.88,147.19 46.88,143.75C46.88,140.31 49.69,137.5 53.13,137.5Z"/> | ||||
| </vector> | ||||
| @ -0,0 +1,178 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:custom="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:orientation="vertical"> | ||||
| 
 | ||||
|     <EditText | ||||
|         android:id="@+id/activity_rtk_correct_et_0" | ||||
|         android:layout_width="0px" | ||||
|         android:layout_height="0px" /> | ||||
| 
 | ||||
|     <ScrollView | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="0dp" | ||||
|         android:layout_weight="1"> | ||||
| 
 | ||||
|         <LinearLayout | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:orientation="vertical" | ||||
|             android:paddingStart="16dp" | ||||
|             android:paddingEnd="16dp"> | ||||
| 
 | ||||
|             <LinearLayout | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:orientation="vertical"> | ||||
| 
 | ||||
|                 <com.daimajia.numberprogressbar.NumberProgressBar | ||||
|                     android:id="@+id/activity_rtk_correct_progressbar" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_marginTop="16dp" | ||||
|                     custom:progress_current="0" | ||||
|                     custom:progress_max="10" | ||||
|                     custom:progress_reached_bar_height="4dp" | ||||
|                     custom:progress_reached_color="?colorPrimary" | ||||
|                     custom:progress_text_size="10sp" | ||||
|                     custom:progress_text_visibility="visible" | ||||
|                     custom:progress_unreached_bar_height="3dp" /> | ||||
| 
 | ||||
|                 <com.rengwuxian.materialedittext.MaterialEditText | ||||
|                     android:id="@+id/activity_rtk_correct_met_original_latitude" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:editable="false" | ||||
|                     android:hint="@string/latitude" | ||||
|                     android:textSize="@dimen/myTextSize" | ||||
|                     app:met_floatingLabel="normal" | ||||
|                     app:met_floatingLabelText="@string/latitude" /> | ||||
| 
 | ||||
|                 <com.rengwuxian.materialedittext.MaterialEditText | ||||
|                     android:id="@+id/activity_rtk_correct_met_original_longitude" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:editable="false" | ||||
|                     android:hint="@string/longitude" | ||||
|                     android:textSize="@dimen/myTextSize" | ||||
|                     app:met_floatingLabel="normal" | ||||
|                     app:met_floatingLabelText="@string/longitude" /> | ||||
| 
 | ||||
|                 <com.rengwuxian.materialedittext.MaterialEditText | ||||
|                     android:id="@+id/activity_rtk_correct_met_original_altitude" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:editable="false" | ||||
|                     android:hint="@string/altitude" | ||||
|                     android:textSize="@dimen/myTextSize" | ||||
|                     app:met_floatingLabel="normal" | ||||
|                     app:met_floatingLabelText="@string/altitude" /> | ||||
| 
 | ||||
|             </LinearLayout> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:id="@+id/activity_rtk_correct_met_control_point_name" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginTop="16dp" | ||||
|                 android:hint="@string/point_name" /> | ||||
| 
 | ||||
|             <LinearLayout | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:orientation="vertical"> | ||||
| 
 | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content"> | ||||
| 
 | ||||
|                     <com.rengwuxian.materialedittext.MaterialEditText | ||||
|                         android:id="@+id/activity_rtk_correct_met_control_point_x" | ||||
|                         android:layout_width="0dp" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:hint="@string/control_x" | ||||
|                         android:inputType="numberDecimal|numberSigned" | ||||
|                         android:textSize="@dimen/myTextSize" | ||||
|                         app:met_clearButton="true" | ||||
|                         app:met_floatingLabel="normal" | ||||
|                         app:met_floatingLabelText="@string/control_x" /> | ||||
| 
 | ||||
|                     <ImageView | ||||
|                         android:id="@+id/activity_rtk_correct_btn_open1" | ||||
|                         android:layout_width="30dp" | ||||
|                         android:layout_height="30dp" | ||||
|                         android:layout_gravity="bottom" | ||||
|                         android:layout_marginBottom="15dp" | ||||
|                         android:layout_marginLeft="10dp" | ||||
|                         android:src="@drawable/icon_vector_folder" /> | ||||
| 
 | ||||
|                 </LinearLayout> | ||||
| 
 | ||||
|                 <com.rengwuxian.materialedittext.MaterialEditText | ||||
|                     android:id="@+id/activity_rtk_correct_met_control_point_y" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:hint="@string/control_y" | ||||
|                     android:inputType="numberDecimal|numberSigned" | ||||
|                     android:textSize="@dimen/myTextSize" | ||||
|                     app:met_clearButton="true" | ||||
|                     app:met_floatingLabel="normal" | ||||
|                     app:met_floatingLabelText="@string/control_y" /> | ||||
| 
 | ||||
|                 <com.rengwuxian.materialedittext.MaterialEditText | ||||
|                     android:id="@+id/activity_rtk_correct_met_control_point_z" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:hint="@string/control_z" | ||||
|                     android:inputType="numberDecimal|numberSigned" | ||||
|                     android:textSize="@dimen/myTextSize" | ||||
|                     app:met_clearButton="true" | ||||
|                     app:met_floatingLabel="normal" | ||||
|                     app:met_floatingLabelText="@string/control_z" /> | ||||
| 
 | ||||
|             </LinearLayout> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:id="@+id/activity_rtk_correct_tv_correct_current" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginTop="10dp" | ||||
|                 tools:text="当前点: 0/10" /> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginTop="10dp" | ||||
|                 android:text="@string/rtk_base_correct_tips" | ||||
|                 android:textSize="11sp" /> | ||||
|         </LinearLayout> | ||||
|     </ScrollView> | ||||
| 
 | ||||
|     <LinearLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="horizontal"> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/activity_rtk_correct_btn_smooth_collect_ten_times" | ||||
|             style="@style/Widget.AppCompat.Button.Colored" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="@dimen/bt_height" | ||||
|             android:layout_weight="1" | ||||
|             android:text="@string/smooth_collect_ten_times" /> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/activity_rtk_correct_btn_correct" | ||||
|             style="@style/Widget.AppCompat.Button.Colored" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="@dimen/bt_height" | ||||
|             android:layout_weight="1" | ||||
|             android:text="@string/correcting" /> | ||||
|     </LinearLayout> | ||||
| 
 | ||||
| </LinearLayout> | ||||
| @ -0,0 +1,14 @@ | ||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
| 
 | ||||
|     <item | ||||
|         android:id="@+id/menu_activity_rtk_correct_reset" | ||||
|         android:title="@string/reset" | ||||
|         app:showAsAction="ifRoom" /> | ||||
| 
 | ||||
|     <item | ||||
|         android:id="@+id/menu_help" | ||||
|         android:title="@string/help" | ||||
|         app:showAsAction="ifRoom" /> | ||||
| 
 | ||||
| </menu> | ||||
					Loading…
					
					
				
		Reference in new issue