diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index bd7bc0f..7649837 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -142,6 +142,10 @@
android:name=".ui.instrument.mobilestationmode.base.RtkPointCorrectActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize|stateHidden" />
+
diff --git a/app/src/main/java/com/project/survey/adapter/LoftingListAdapter.java b/app/src/main/java/com/project/survey/adapter/LoftingListAdapter.java
index 3557d8d..5e1a270 100644
--- a/app/src/main/java/com/project/survey/adapter/LoftingListAdapter.java
+++ b/app/src/main/java/com/project/survey/adapter/LoftingListAdapter.java
@@ -9,15 +9,18 @@ import com.project.survey.adapter.base.BaseAdapter;
import com.project.survey.adapter.viewholder.LoftingListViewHolder;
import com.project.survey.databinding.ItemLoftingListBinding;
import com.project.survey.model.LoftingListBean;
+import com.project.survey.ui.lofting.pointlofting.PointStakingActivity;
/**
* 放样列表
*/
public class LoftingListAdapter extends BaseAdapter {
+ private final Context context;
public LoftingListAdapter(Context context) {
super(context);
+ this.context = context;
}
@NonNull
@@ -29,6 +32,9 @@ public class LoftingListAdapter extends BaseAdapter {
+ PointStakingActivity.start(context);
+ });
}
}
diff --git a/app/src/main/java/com/project/survey/ui/lofting/pointlofting/PointStakingActivity.java b/app/src/main/java/com/project/survey/ui/lofting/pointlofting/PointStakingActivity.java
new file mode 100644
index 0000000..bf47983
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/lofting/pointlofting/PointStakingActivity.java
@@ -0,0 +1,1159 @@
+package com.project.survey.ui.lofting.pointlofting;
+
+import static com.bingce.surveyor.util.ConstUtils.intentConst.KEY_JOB_ID;
+import static com.bingce.surveyor.util.ConstUtils.intentConst.KEY_PROJECT_ID;
+import static com.bingce.surveyor.util.ConstUtils.intentConst.KEY_ROAD_ID;
+
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.DashPathEffect;
+import android.view.View;
+
+import androidx.preference.PreferenceManager;
+import androidx.sqlite.db.SimpleSQLiteQuery;
+
+import com.bingce.autounit.IText;
+import com.bingce.autounit.TextFactory;
+import com.bingce.chart.ChartViewUtils;
+import com.bingce.coordlib.model.Blh;
+import com.bingce.coordlib.model.Coordinate;
+import com.bingce.coordlib.util.CoordUtil;
+import com.bingce.data.DeviceInfoData;
+import com.bingce.data.cache.CachedCurrentJob;
+import com.bingce.data.cache.CachedCurrentRoad;
+import com.bingce.data.cache.CachedProject;
+import com.bingce.data.database.DBQueryConstant;
+import com.bingce.data.database.PointDb;
+import com.bingce.data.database.PointStakeDb;
+import com.bingce.data.surveyor.surveydata.pointstake.PointStakeConstants;
+import com.bingce.data.surveyor.surveydata.pointstake.PointStakeRecord;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord;
+import com.bingce.device.Device;
+import com.bingce.device.enums.DeviceTypeEnum;
+import com.bingce.device.util.DeviceUtils;
+import com.bingce.logic.PointStakingLogic;
+import com.bingce.logic.bean.MeasuredPoint;
+import com.bingce.logic.bean.MoveValue;
+import com.bingce.logic.bean.StakingPoint;
+import com.bingce.logic.linestaking.TargetCompassHelper;
+import com.bingce.road.move.MoveK;
+import com.bingce.road.move.MoveLeftRight;
+
+import com.bingce.surveyor.agentweb.HelpWebActivity;
+import com.bingce.surveyor.util.ConstUtils;
+import com.bingce.surveyor.util.DeviceConnectUtil;
+import com.bingce.surveyor.util.PreferencesUtil;
+import com.bingce.surveyor.util.SurveyLimitCheckUtils;
+import com.bingce.surveyor.util.SurveyRemarksUtils;
+import com.bingce.surveyor.util.SurveyToolBarClickListenerUtils;
+import com.bingce.surveyor.util.SurveyUIUtils;
+import com.bingce.surveyor.util.dialog.CustomDialog;
+import com.bingce.surveyor.util.dialog.CustomRecycleDialog;
+import com.bingce.totalstation.TotalStation;
+import com.bingce.totalstation.TsConfig;
+import com.bingce.utils.IntentUtil;
+import com.bingce.utils.PointUtils;
+import com.bingce.utils.SoundPoolUtil;
+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.ActivityPointStakingBinding;
+import com.project.survey.ui.base.BaseSurveyNewActivity;
+import com.project.survey.util.DrawableUtils;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import blankj.utilcode.util.ToastUtils;
+import blankj.utilcode.util.Utils;
+import cn.liuyanbing.surveyor.model.base.BasePoint;
+import cn.liuyanbing.surveyor.model.util.CUtil;
+import lecho.hellocharts.listener.LineChartOnValueSelectListener;
+import lecho.hellocharts.model.Line;
+import lecho.hellocharts.model.LineChartData;
+import lecho.hellocharts.model.PointValue;
+import lecho.hellocharts.renderer.LineChartRenderer;
+
+public class PointStakingActivity extends BaseSurveyNewActivity {
+
+ private ActivityPointStakingBinding binding;
+ private final Line currentPointLine = new Line(); //实测点
+ private final Line surveyBasePointLine = new Line();//待放样点(点库的点)
+ private final Line stakingPointLine = new Line(); //放样点
+ private final Line recordPointLine = new Line(); //记录点
+ private final Line effectGuideLine = new Line(); //放样引导线
+ private final Line effectHorLine = new Line(); //放样提示横向虚线
+ private final Line effectVerLine = new Line(); //放样提示纵向虚线
+ private final List stakingLibraryPointList = new ArrayList<>();
+ private List recordStakingBasePointList;
+ private PointRecord targetStakePointRecord;
+ private Coordinate currentCoordinate;
+ private Coordinate currentSmoothCoordinate;
+ protected final CachedCurrentRoad cachedRoad = new CachedCurrentRoad(this);
+ private final SurveyRemarksUtils surveyRemarksUtils = new SurveyRemarksUtils();
+ private IText distance, moveWestEast, moveSouthNorth, moveDigFill, moveLeftRight, moveBeforeAfter;
+ private MoveValue moveK;
+ private MoveValue moveD;
+ private boolean isTsWatchRecord;
+ private final TargetCompassHelper targetCompassHelper = new TargetCompassHelper(this, ((App) Utils.getApp()).magneticDeclination);
+ private final PointStakingLogic pointStakingLogic = new PointStakingLogic(() -> this);
+ private boolean isTirpsAddSP;
+ private CustomDialog.Builder builder;
+ private String recordRemarks;
+ private final List stringListLibraty = new ArrayList<>();
+ private final List methodList = new ArrayList<>();
+ private SharedPreferences preferences;
+ private boolean isFirstUpdateChartView;
+
+ @Override
+ public View getContentView() {
+ binding = ActivityPointStakingBinding.inflate(getLayoutInflater());
+ return binding.getRoot();
+ }
+
+ @Override
+ protected void initView() {
+ preferences = PreferenceManager.getDefaultSharedPreferences(this);
+ targetCompassHelper.register(angle -> {
+ binding.dirCompass.setAngle(angle);
+ });
+ builder = new CustomDialog.Builder(PointStakingActivity.this);
+ initChartView();
+
+ if (((App) Utils.getApp()).isThemeDark) {
+ binding.layoutPoleHrHeight.tvPoleHrHeight.setTextColor(getColor(R.color.white));
+ binding.tvStakingPointName.setTextColor(getColor(R.color.white));
+ binding.tvDistance.setTextColor(getColor(R.color.white));
+ binding.tvDigFill.setTextColor(getColor(R.color.white));
+ binding.tvTopThree.setTextColor(getColor(R.color.white));
+ binding.tvTopFour.setTextColor(getColor(R.color.white));
+ binding.tvTopFive.setTextColor(getColor(R.color.white));
+ binding.tvTopSix.setTextColor(getColor(R.color.white));
+ binding.tvLastPoint.setTextColor(getColor(R.color.white));
+ binding.tvRecentlyPoint.setTextColor(getColor(R.color.white));
+ binding.tvNextPoint.setTextColor(getColor(R.color.white));
+ binding.tvScale.setTextColor(getColor(R.color.white));
+
+ binding.tvTargetCoordinate.setTextColor(getColor(R.color.white));
+ binding.tvTargetX.setTextColor(getColor(R.color.white));
+ binding.tvTargetY.setTextColor(getColor(R.color.white));
+ binding.tvTargetZ.setTextColor(getColor(R.color.white));
+ binding.tvMeasuredCoordinate.setTextColor(getColor(R.color.white));
+ binding.tvSurveyX.setTextColor(getColor(R.color.white));
+ binding.tvSurveyY.setTextColor(getColor(R.color.white));
+ binding.tvSurveyZ.setTextColor(getColor(R.color.white));
+
+ DrawableUtils.tintModifyColorVector(binding.ivLastPoint, R.drawable.icon_triangle_left, R.color.white);
+ DrawableUtils.tintModifyColorVector(binding.ivNextPoint, R.drawable.icon_triangle_right, R.color.white);
+ DrawableUtils.tintModifyColorVector(binding.ivScale, R.drawable.ic_scale, R.color.white);
+ DrawableUtils.setClickBackgroundEffect(binding.topLayout, R.color.theme_dark_black, R.color.theme_dark_black, 10, RADIUS_BOTTOM);
+ DrawableUtils.setClickBackgroundEffect(binding.bottomLayout, R.color.theme_dark_black, R.color.theme_dark_black, 10, RADIUS_TOP);
+ }
+
+ //比例尺
+ SurveyToolBarClickListenerUtils.setScaleViewOnClickListener(binding.lineChartView, binding.tvScale, binding.ivScale);
+ //工具栏功能(左上角)
+ SurveyToolBarClickListenerUtils.setOnClickListener(this, true, true,
+ baseSurveyActivityUtils.activityBaseSurveyBinding,
+ binding.baseSurveyStakingSetting, new SurveyToolBarClickListenerUtils.IToolBarClickListener() {
+ @Override
+ public void onSettingClickListener() {
+ stopSoundPool();
+ PointStakingSettingActivity.start(PointStakingActivity.this);
+ }
+
+ @Override
+ public void onPositionCenterClickListener() {
+ if (currentCoordinate == null) {
+ ToastUtils.showShort(getString(R.string.please_observe_measure_first));
+ return;
+ }
+ binding.lineChartView.setZoomLevel(currentCoordinate.getY(), currentCoordinate.getX(), binding.lineChartView.getZoomLevel());
+ binding.lineChartView.moveToWithAnimation(currentCoordinate.getY(), currentCoordinate.getX());
+ }
+
+ @Override
+ public void onFullScreenClickListener() {
+ ChartViewUtils.centerInScreen(binding.lineChartView);
+ }
+
+ @Override
+ public void onAutoPrimsClickListener() {
+ //自动全站仪寻点
+ if (!TotalStation.getInstance().isSupportMotor()) {
+ ToastUtils.showShort(getString(R.string.device_not_support_auto_search_point));
+ return;
+ }
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.please_input_staking_target_point));
+ return;
+ }
+ Coordinate target;
+ if (CUtil.isEqual(targetStakePointRecord.h, 0)) {
+ target = new Coordinate(targetStakePointRecord.x, targetStakePointRecord.y, TsConfig.getInstance().getStationZ());
+ } else {
+ target = new Coordinate(targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h);
+ }
+ ToastUtils.showShort(getString(R.string.start_auto_find_point));
+ TotalStation.getInstance().requestMotorTurnToTarget(target, TsConfig.getInstance().getHr(), false);
+ }
+ });
+ //点库选点
+ binding.pointLibrary.setOnClickListener(v ->
+ CustomRecycleDialog.showDialog(PointStakingActivity.this, R.string.data_source, stringListLibraty, 0, false, (index, itemString) -> {
+ stopSoundPool();
+ switch (index) {
+ case 0:
+ StakingNewJobActivity.pickPoint(PointStakingActivity.this, (pointId, pointsListIndex, name, x, y, z) ->
+ onPickedPoint(true, pointId, name, x, y, z));
+ break;
+ case 1:
+ ControlPointsNewActivity.pickPoint(PointStakingActivity.this, false, (pointId, name, code, x, y, z, remarks) -> {
+ onPickedPoint(false, pointId, name, x, y, z);
+ });
+ break;
+ case 2:
+ ControlPointsNewActivity.pickPoint(PointStakingActivity.this, true, (pointId, name, code, x, y, z, remarks) -> {
+ onPickedPoint(false, pointId, name, x, y, z);
+ });
+ break;
+ case 3:
+ CoordinatePointsLibraryActivity.pickPoint(PointStakingActivity.this, (pointId, name, code, x, y, z, b, l, h) -> {
+ onPickedPoint(false, pointId, name, x, y, z);
+ });
+ break;
+ }
+ }));
+ //移动方法
+ showTopMoveMethod();
+ binding.tvMoveMethod.setOnClickListener(v -> {
+ methodList.clear();
+ methodList.add(getString(R.string.k_d));
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ methodList.add(getString(R.string.before_after_left_right));
+ }
+ methodList.add(getString(R.string.east_west_north_south));
+ CustomRecycleDialog.showDialog(PointStakingActivity.this, R.string.move_method, methodList,
+ Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS ? PreferencesUtil.getMoveMethodTypeTS()
+ : PreferencesUtil.getMoveMethodTypeRTK(), false, (index, itemString) -> {
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ PreferencesUtil.putPreference(ConstUtils.preferConst.moveMethodTypeTS, index);
+ } else {
+ PreferencesUtil.putPreference(ConstUtils.preferConst.moveMethodTypeRTK, index);
+ }
+ if (currentCoordinate != null && targetStakePointRecord != null) {
+ updateTopInfo(currentCoordinate);
+ } else {
+ showTopMoveMethod();
+ }
+ });
+ });
+ //放样记录
+ binding.tvStakingRecord.setOnClickListener(v -> {
+ stopSoundPool();
+ RecordsActivity.start(PointStakingActivity.this, RecordTypeConstants.TYPE_POINT_STAKE);
+ });
+ //仅观测
+ binding.layoutDragButton.drWatchSurvey.setOnClickListener(v -> watchSurvey());
+ //观测并记录
+ binding.layoutDragButton.drWatchSurveyRecord.setOnClickListener(v -> watchSurveyRecord());
+ //长按保存
+ binding.layoutDragButton.drWatchSurveyRecord.setTouchOnLongClickListener(() ->
+ SurveyRemarksUtils.createRecordRemarks(this, recordRemarks, remarks ->
+ recordRemarks = remarks
+ )
+ );
+ //上一点
+ binding.llLastPoint.setOnClickListener(v -> {
+ onLastOrNextPoint(true);
+ });
+ //最近点
+ binding.llRecentlyPoint.setOnClickListener(v -> {
+ onRecentlyPoint();
+ });
+ //下一点
+ binding.llNextPoint.setOnClickListener(v -> {
+ onLastOrNextPoint(false);
+ });
+
+ //输入实测点
+ binding.baseSurveyStakingSetting.rlInputCurrentPoint.setOnClickListener(v -> {
+ if (Device.getInstance().isDeviceConnected() && Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_RTK) {
+ ToastUtils.showShort(getString(R.string.disconnect_device_use_input_point));
+ return;
+ }
+ String inputSurveyX = currentCoordinate != null ? Util.formatDouble2String(currentCoordinate.getX(), 4) : "";
+ String inputSurveyY = currentCoordinate != null ? Util.formatDouble2String(currentCoordinate.getY(), 4) : "";
+ String inputSurveyZ = currentCoordinate != null ? Util.formatDouble2String(currentCoordinate.getZ(), 4) : "";
+ new CustomInputListDialog.Builder(this).setTitle(getString(R.string.input_current_point))
+ .setInputHint01("X")
+ .setInputHint02("Y")
+ .setInputHint03("Z")
+ .setInputText01(inputSurveyX).setInputText02(inputSurveyY).setInputText03(inputSurveyZ)
+ .setInputFormat(CustomInputListDialog.Builder.INPUT_TYPE_PM_DECIMAL)
+ .setButtonConfirm((editText01, editText02, editText03) -> {
+ if (android.text.TextUtils.isEmpty(editText01) || android.text.TextUtils.isEmpty(editText02) || android.text.TextUtils.isEmpty(editText03)) {
+ ToastUtils.showShort(getString(R.string.please_input_full_coordinate_parameters));
+ return;
+ }
+ binding.baseSurveyStakingSetting.ivPositionCenter.setImageResource(R.drawable.icon_survey_position_center_black);
+ currentCoordinate = new Coordinate(Double.parseDouble(editText01), Double.parseDouble(editText02), Double.parseDouble(editText03));
+ updatePosition();
+ }).create().show();
+ });
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ //左侧工具栏的状态显示
+ SurveyUIUtils.updatePoleHrHeightDraggingToolBarLayout(
+ this, true,
+ binding.layoutPoleHrHeight, binding.layoutDragButton, binding.baseSurveyStakingSetting,
+ true, true, currentCoordinate);
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ binding.topFiveSixLayout.setVisibility(View.VISIBLE);
+ } else {
+ binding.topFiveSixLayout.setVisibility(View.GONE);
+ }
+ }
+
+ private void initChartView() {
+
+ List lineChartDataList = new ArrayList<>();
+ LineChartData lineBasePointChartData = new LineChartData();
+ int blackPointColor = ((App) Utils.getApp()).isThemeDark ? getColor(R.color.color_E2E1DD) : getColor(R.color.color_575757);
+ int greenPointColor = getColor(R.color.theme_green);
+ int redPointColor = getColor(R.color.color_FF1515);
+ int lightGreenPointColor = getColor(R.color.theme_green_press);
+ int redLineColor = getColor(R.color.color_FF1515);
+ int pointRadius = 3;
+ int strokeWidth = 1;
+ int effectLineWidth = 6;
+
+ surveyBasePointLine.setCubic(false).setHasLabels(true).setHasPoints(true).setStrokeWidth(strokeWidth).setHasLines(false).setPointRadius(pointRadius).setPointColor(blackPointColor).setShowLabelBackground(false).setLabelTextColor(blackPointColor);
+ stakingPointLine.setCubic(false).setHasLabels(true).setHasPoints(true).setStrokeWidth(strokeWidth).setHasLines(false).setPointRadius(pointRadius).setPointColor(greenPointColor).setShowLabelBackground(false).setLabelTextColor(greenPointColor);
+ currentPointLine.setCubic(false).setHasLabels(true).setHasPoints(true).setStrokeWidth(strokeWidth).setHasLines(false).setPointRadius(pointRadius).setPointColor(redPointColor).setShowLabelBackground(false).setLabelTextColor(redPointColor);
+ recordPointLine.setCubic(false).setHasLabels(true).setHasPoints(true).setStrokeWidth(strokeWidth).setHasLines(false).setPointRadius(pointRadius).setPointColor(lightGreenPointColor).setShowLabelBackground(false).setLabelTextColor(lightGreenPointColor);
+ effectGuideLine.setCubic(false).setStrokeWidth(strokeWidth).setPointRadius(0).setColor(redLineColor).setPathEffect(new DashPathEffect(new float[]{effectLineWidth, effectLineWidth}, 0));
+ effectHorLine.setCubic(false).setStrokeWidth(strokeWidth).setPointRadius(0).setColor(blackPointColor).setPathEffect(new DashPathEffect(new float[]{effectLineWidth, effectLineWidth}, 0));
+ effectVerLine.setCubic(false).setStrokeWidth(strokeWidth).setPointRadius(0).setColor(blackPointColor).setPathEffect(new DashPathEffect(new float[]{effectLineWidth, effectLineWidth}, 0));
+
+ //lineBasePointChartData添加一下line的顺序勿随意改动,此顺序涉及到lineChartView图选点功能
+ lineBasePointChartData.getLines().add(currentPointLine);
+ lineBasePointChartData.getLines().add(surveyBasePointLine);
+ lineBasePointChartData.getLines().add(stakingPointLine);
+ lineBasePointChartData.getLines().add(recordPointLine);
+ lineBasePointChartData.getLines().add(effectGuideLine);
+ lineBasePointChartData.getLines().add(effectHorLine);
+ lineBasePointChartData.getLines().add(effectVerLine);
+ lineChartDataList.add(lineBasePointChartData);
+
+ CommonUtils.mChartViewSetLineChartDatas(binding.lineChartView, lineChartDataList, false, false);
+ if (binding.lineChartView.getChartRenderer() instanceof LineChartRenderer) {
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ }
+
+ binding.lineChartView.setMaxZoom(1000);
+ binding.lineChartView.setViewportCalculationEnabled(false);
+ binding.lineChartView.setCurrentViewport(binding.lineChartView.getMaximumViewport());
+
+ binding.lineChartView.setOnValueTouchListener(new LineChartOnValueSelectListener() {
+ @Override
+ public void onValueSelected(int lineIndex, int pointIndex, PointValue value) {
+ if (lineIndex == 1) {//代表选中的点属于surveyBasePointLine
+ if (pointIndex > stakingLibraryPointList.size() - 1) {
+ return;
+ }
+ String content = getString(R.string.whether_staking_selected_point) + getString(R.string.colon) + stakingLibraryPointList.get(pointIndex).name + "\n"
+ + "X" + getString(R.string.colon) + Util.formatDouble2Double(stakingLibraryPointList.get(pointIndex).x, ((App) Utils.getApp()).notNumber()) + " "
+ + "Y" + getString(R.string.colon) + Util.formatDouble2Double(stakingLibraryPointList.get(pointIndex).y, ((App) Utils.getApp()).notNumber()) + "\n"
+ + "Z" + getString(R.string.colon) + Util.formatDouble2Double(stakingLibraryPointList.get(pointIndex).h, ((App) Utils.getApp()).notNumber());
+ builder.setContent(content).setButtonConfirm(v -> {
+ targetStakePointRecord = stakingLibraryPointList.get(pointIndex);
+ updateUI();
+ }).create().show();
+ }
+ }
+
+ @Override
+ public void onValueDeselected() {
+
+ }
+ });
+ }
+
+ @Override
+ protected void initData() {
+
+ stringListLibraty.add(getString(R.string.staking_point_library));
+ stringListLibraty.add(getString(R.string.road_control_point));
+ stringListLibraty.add(getString(R.string.global_control_point));
+ stringListLibraty.add(getString(R.string.point_survey_point_library));
+
+ PointDb.getInstance().rawQueryListLiveData(PointConstants.findKnownPointByJob(jobId())).observe(this, pointRecords -> {
+ surveyBasePointLine.getValues().clear();
+ stakingPointLine.getValues().clear();
+ recordPointLine.getValues().clear();
+ effectGuideLine.getValues().clear();
+ stakingLibraryPointList.clear();
+ stakingLibraryPointList.addAll(pointRecords);
+ for (int i = 0; i < stakingLibraryPointList.size(); i++) {
+ PointRecord pointRecord = stakingLibraryPointList.get(i);
+ surveyBasePointLine.getValues().add(new PointValue(pointRecord.y, pointRecord.x).setLabel(pointRecord.name));
+ }
+ if (stakingLibraryPointList.size() > 0) {
+ targetStakePointRecord = stakingLibraryPointList.get(0);
+ stakingPointLine.getValues().add(new PointValue(targetStakePointRecord.y, targetStakePointRecord.x).setLabel(targetStakePointRecord.name));
+ updateBottomInfo(targetStakePointRecord.name, targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h);
+ drawRecordPointLine();
+ if (currentCoordinate != null) {
+ drawCurrentPointLine(currentCoordinate.getX(), currentCoordinate.getY(), currentCoordinate.getZ());
+ updateTopInfo(currentCoordinate);
+ } else {
+ showTopMoveMethod();
+ }
+ isTirpsAddSP = false;
+ } else {
+ targetStakePointRecord = null;
+ binding.tvStakingPointName.setText(getString(R.string.staking_point_name));
+ binding.tvTargetX.setText(TextFactory.fixedString("X"));
+ binding.tvTargetY.setText(TextFactory.fixedString("Y"));
+ binding.tvTargetZ.setText(TextFactory.fixedString("Z"));
+ showTopMoveMethod();
+ isTirpsAddSP = true;
+ }
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ binding.lineChartView.setCurrentViewport(binding.lineChartView.getMaximumViewport());
+ });
+ }
+
+ private void watchSurvey() {
+ if (DeviceConnectUtil.isDeviceConnectSelectDialog(this, baseSurveyActivityUtils.activityBaseSurveyBinding)) {
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ isTsWatchRecord = false;
+ tsMeasCoordinateManager.measureCoordinate();
+ } else {
+ ToastUtils.showShort(getString(R.string.not_support_function_observation_only));
+ }
+ }
+ }
+
+ private CustomLineChartDialog.Builder lineChartViewBuilder;
+ private CustomLineChartDialog customDialog;
+ private boolean isControlSurvey;
+
+ private void watchSurveyRecord() {
+ if (DeviceConnectUtil.isDeviceConnectSelectDialog(this, baseSurveyActivityUtils.activityBaseSurveyBinding)) {
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ isTsWatchRecord = true;
+ if (currentCoordinate != null) {
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.add_points_staking_point_first));
+ return;
+ }
+ SurveyLimitCheckUtils.checkStakingLimit(PointStakingActivity.this, currentCoordinate, new Coordinate(targetStakePointRecord.x, targetStakePointRecord.y), (currentCoordinate, targetCoordinate) -> recordPoint());
+ } else {
+ tsMeasCoordinateManager.measureCoordinate();
+ }
+ } else {
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.add_points_staking_point_first));
+ return;
+ }
+ boolean isSmoothStaking = PreferencesUtil.getPreferenceInt(ConstUtils.preferConst.rtkStakingSmoothPointsNumber, 1) != 1;
+ if (isSmoothStaking) {
+ lineChartViewBuilder = new CustomLineChartDialog.Builder(this).setTitle(getString(R.string.staking_points_being_collected));
+ lineChartViewBuilder.setButtonConfirmTextColor(R.color.color_E2E1DD);
+ lineChartViewBuilder.setButtonConfirm(v -> {
+
+ SurveyLimitCheckUtils.checkStakingLimit(PointStakingActivity.this, currentSmoothCoordinate, new Coordinate(targetStakePointRecord.x, targetStakePointRecord.y), (currentCoordinate, targetCoordinate) -> recordPoint());
+ });
+// lineChartViewBuilder.setButtonConfirm(v -> checkRtkStringLimit());
+ customDialog = lineChartViewBuilder.create();
+ customDialog.show();
+ isControlSurvey = true;
+ } else {
+ SurveyLimitCheckUtils.checkStakingLimit(PointStakingActivity.this, currentCoordinate, new Coordinate(targetStakePointRecord.x, targetStakePointRecord.y), (currentCoordinate, targetCoordinate) -> recordPoint());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void performMeasure() {
+ watchSurvey();
+ }
+
+ @Override
+ protected void performMeasureRecord() {
+ watchSurveyRecord();
+ }
+
+ @Override
+ protected void performLast() {
+ onLastOrNextPoint(true);
+ }
+
+ @Override
+ protected void performNext() {
+ onLastOrNextPoint(false);
+ }
+
+ @Override
+ protected void performRecord() {
+ binding.layoutDragButton.drWatchSurveyRecord.performClick();
+ }
+
+ private void onRecentlyPoint() {
+ if (currentCoordinate == null) {
+ ToastUtils.showShort(getString(R.string.return_coordinate_empty_check_device));
+ return;
+ }
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.add_points_staking_point_first));
+ return;
+ }
+ if (stakingLibraryPointList.size() > 0) {
+ stakingLibraryPointList.size();
+ double minDistance = PointUtils.getDistance2D(new BasePoint(stakingLibraryPointList.get(0).x, stakingLibraryPointList.get(0).y), new BasePoint(currentCoordinate.getX(), currentCoordinate.getY()));
+ targetStakePointRecord = stakingLibraryPointList.get(0);
+ for (int i = 1; i < stakingLibraryPointList.size(); i++) {
+ double distance2D = PointUtils.getDistance2D(new BasePoint(stakingLibraryPointList.get(i).x, stakingLibraryPointList.get(i).y), new BasePoint(currentCoordinate.getX(), currentCoordinate.getY()));
+ if (minDistance > distance2D) {
+ targetStakePointRecord = stakingLibraryPointList.get(i);
+ minDistance = distance2D;
+ }
+ }
+ ToastUtils.showShort(targetStakePointRecord.name + " " + getString(R.string.is_current_recently_point));
+ updateUI();
+ }
+ }
+
+ private void onLastOrNextPoint(boolean nextOrLast) {
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.add_points_staking_point_first));
+ return;
+ }
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ String jobId = CachedCurrentJob.currentJobId(projectId);
+ PointRecord pointRecord = PointDb.getInstance().rawQueryData(PointConstants.findLastNextKnownPointByJobAndDate(jobId, targetStakePointRecord.createDate, nextOrLast));
+ runOnUiThread(() -> {
+ if (pointRecord == null) {
+ ToastUtils.showShort(nextOrLast ? getString(R.string.the_first_staking_point_list) : getString(R.string.the_last_staking_point_list));
+ return;
+ }
+ targetStakePointRecord = pointRecord;
+
+ updateUI();
+ });
+ });
+ }
+
+ /**
+ * 点库返回选择的点
+ */
+ private void onPickedPoint(boolean isStakingLibPoint, String pointId, String name, double x, double y, double z) {
+ if (!isStakingLibPoint) {
+ DeviceInfoData deviceInfoData = DeviceUtils.collectDeviceInfo();
+ PointRecord tempStakePointRecord = new PointRecord(pointId, "", "",
+ PointConstants.POINT_TYPE_SURVEY_CONTROL_POINT, name, "", "",
+ x, y, z, 0, 0, 0, PointConstants.POINT_FORMAT_XYZ, deviceInfoData);
+ stakingLibraryPointList.add(tempStakePointRecord);
+ targetStakePointRecord = tempStakePointRecord;
+ surveyBasePointLine.getValues().add(new PointValue(tempStakePointRecord.y, tempStakePointRecord.x).setLabel(tempStakePointRecord.name));
+ updateUI();
+ } else {
+ ThreadPoolUtil.execute(() -> {
+ PointRecord knowPointRecord = PointDb.getInstance().rawQueryData(PointConstants.findKnownPointById(pointId));
+ runOnUiThread(() -> {
+ targetStakePointRecord = knowPointRecord;
+ updateUI();
+ });
+ });
+ }
+ }
+
+ private void updateUI() {
+ if (targetStakePointRecord == null) {
+ return;
+ }
+ stakingPointLine.getValues().clear();
+ stakingPointLine.getValues().add(new PointValue(targetStakePointRecord.y, targetStakePointRecord.x).setLabel(targetStakePointRecord.name));
+ updateBottomInfo(targetStakePointRecord.name, targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h);
+ if (currentCoordinate == null) {
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ return;
+ }
+ effectGuideLine.getValues().clear();
+ if (currentCoordinate != null) {
+ effectGuideLine.getValues().add(new PointValue(targetStakePointRecord.y, targetStakePointRecord.x));
+ effectGuideLine.getValues().add(new PointValue(currentCoordinate.getY(), currentCoordinate.getX()));
+ updateTopInfo(currentCoordinate);
+ }
+
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ drawRecordPointLine();
+ }
+
+ private double controlX, controlY, controlZ;
+ private double controlLat, controlLon, controlAlt;
+
+ @Override
+ public void onDeviceConnectLost() {
+ super.onDeviceConnectLost();
+ clearRefreshReset();
+ }
+
+ @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);
+ currentCoordinate = coordinate;
+ updatePosition();
+ if (isControlSurvey) {
+ if (lineChartViewBuilder.pointList.size() < (PreferencesUtil.getPreferenceInt(ConstUtils.preferConst.rtkStakingSmoothPointsNumber, 1))) {
+ lineChartViewBuilder.addDrawBlackSurveyPoint(coordinate, blh);
+ } else {
+ double control_all_x = 0;
+ double control_all_y = 0;
+ double control_all_z = 0;
+ double control_all_lat = 0;
+ double control_all_lon = 0;
+ double control_all_alt = 0;
+ for (int i = 0; i < lineChartViewBuilder.pointList.size(); i++) {
+ control_all_x += lineChartViewBuilder.pointList.get(i).getX();
+ control_all_y += lineChartViewBuilder.pointList.get(i).getY();
+ control_all_z += lineChartViewBuilder.pointList.get(i).getZ();
+ control_all_lat += lineChartViewBuilder.pointList.get(i).getLatitude();
+ control_all_lon += lineChartViewBuilder.pointList.get(i).getLongitude();
+ control_all_alt += lineChartViewBuilder.pointList.get(i).getAltitude();
+ }
+
+ int sNum = PreferencesUtil.getPreferenceInt(ConstUtils.preferConst.rtkStakingSmoothPointsNumber, 1);
+
+ controlX = control_all_x / sNum;
+ controlY = control_all_y / sNum;
+ controlZ = control_all_z / sNum;
+ controlLat = control_all_lat / sNum;
+ controlLon = control_all_lon / sNum;
+ controlAlt = control_all_alt / sNum;
+ currentSmoothCoordinate = new Coordinate(controlX, controlY, controlZ);
+ lineChartViewBuilder.addDrawRedSurvryPoint(new ControlRecord(controlX, controlY, controlZ, controlLat, controlLon, controlAlt, getString(R.string.setting_point)));
+ lineChartViewBuilder.pointList.add(0, new ControlRecord(controlX, controlY, controlZ, controlLat, controlLon, controlAlt, getString(R.string.setting_point)));
+
+ isControlSurvey = false;
+
+ lineChartViewBuilder.setButtonConfirmTextColor(R.color.color_575757);
+ }
+ }
+ }
+
+ @Override
+ public void onMeasCoordinateSuccess(Coordinate coordinate) {
+ super.onMeasCoordinateSuccess(coordinate);
+ currentCoordinate = coordinate;
+ updatePosition();
+ if (isTsWatchRecord) {
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.add_points_staking_point_first));
+ return;
+ }
+// if (lineChartViewBuilder.pointList.size() < (PreferencesUtil.getPreferenceInt(ConstUtils.preferConst.rtkStakingSmoothPointsNumber, 1))) {
+// lineChartViewBuilder.addDrawBlackSurveyPoint(new Coordinate(x,y,z), new Blh());
+// } else {
+// double control_all_x = 0;
+// double control_all_y = 0;
+// double control_all_z = 0;
+//// double control_all_lat = 0;
+//// double control_all_lon = 0;
+//// double control_all_alt = 0;
+// for (int i = 0; i < lineChartViewBuilder.pointList.size(); i++) {
+// control_all_x += lineChartViewBuilder.pointList.get(i).getX();
+// control_all_y += lineChartViewBuilder.pointList.get(i).getY();
+// control_all_z += lineChartViewBuilder.pointList.get(i).getZ();
+//// control_all_lat += lineChartViewBuilder.pointList.get(i).getLatitude();
+//// control_all_lon += lineChartViewBuilder.pointList.get(i).getLongitude();
+//// control_all_alt += lineChartViewBuilder.pointList.get(i).getAltitude();
+// }
+//
+// int sNum = PreferencesUtil.getPreferenceInt(ConstUtils.preferConst.rtkStakingSmoothPointsNumber, 1);
+//
+// controlX = control_all_x / sNum;
+// controlY = control_all_y / sNum;
+// controlZ = control_all_z / sNum;
+//// controlLat = control_all_lat / sNum;
+//// controlLon = control_all_lon / sNum;
+//// controlAlt = control_all_alt / sNum;
+// currentSmoothCoordinate = new Coordinate(controlX,controlY,controlZ);
+// lineChartViewBuilder.addDrawRedSurvryPoint(new ControlRecord(controlX, controlY, controlZ, 0, 0, 0, getString(R.string.setting_point)));
+// lineChartViewBuilder.pointList.add(0, new ControlRecord(controlX, controlY, controlZ, 0, 0, 0, getString(R.string.setting_point)));
+//
+// isTsWatchRecord = false;
+//
+// lineChartViewBuilder.setButtonConfirmTextColor(R.color.color_575757);
+// }
+ SurveyLimitCheckUtils.checkStakingLimit(this, currentCoordinate, new Coordinate(targetStakePointRecord.x, targetStakePointRecord.y), (currentCoordinate, targetCoordinate) -> recordPoint());
+ }
+ }
+
+ private void clearRefreshReset() {
+
+ currentCoordinate = null;
+
+ showTopMoveMethod();
+
+ binding.tvTargetX.setText(TextFactory.fixedString("X"));
+ binding.tvTargetY.setText(TextFactory.fixedString("Y"));
+ binding.tvTargetZ.setText(TextFactory.fixedString("Z"));
+
+ binding.tvSurveyX.setText(TextFactory.fixedString("X"));
+ binding.tvSurveyY.setText(TextFactory.fixedString("Y"));
+ binding.tvSurveyZ.setText(TextFactory.fixedString("Z"));
+
+ if (currentPointLine != null) {
+ currentPointLine.getValues().clear();
+ }
+ if (effectGuideLine != null) {
+ effectGuideLine.getValues().clear();
+ }
+ if (effectHorLine != null) {
+ effectHorLine.getValues().clear();
+ }
+ if (effectVerLine != null) {
+ effectVerLine.getValues().clear();
+ }
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ }
+
+ /**
+ * 更新坐实测点坐标信息
+ */
+ private void updatePosition() {
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS && currentCoordinate == null) {
+ ToastUtils.showShort(getString(R.string.return_coordinate_empty_check_device));
+ return;
+ }
+ double x = currentCoordinate.getX();
+ double y = currentCoordinate.getY();
+ double z = currentCoordinate.getZ();
+ drawCurrentPointLine(x, y, z);
+ updateBottomInfo(x, y, z);
+ updateTopInfo(new Coordinate(x, y, z));
+ }
+
+
+ /**
+ * 更新顶部信息
+ */
+ @SuppressLint("SetTextI18n")
+ private void updateTopInfo(Coordinate currentCoordinate) {
+ if (currentCoordinate == null) {
+ ToastUtils.showShort(getString(R.string.return_coordinate_empty_check_device));
+ return;
+ }
+
+ if (targetStakePointRecord == null) {
+ if (isTirpsAddSP) {
+ builder.setContent(getString(R.string.add_points_staking_point_first)).setButtonConfirm(v -> {
+ StakingNewJobActivity.start(PointStakingActivity.this);
+ }).create().show();
+ isTirpsAddSP = false;
+ }
+ return;
+ }
+
+ ThreadPoolUtil.execute(() -> {
+ int moveType = 0;
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ moveType = PreferencesUtil.getMoveMethodTypeTS();
+ } else {
+ if (PreferencesUtil.getMoveMethodTypeRTK() == 1) {
+ moveType = 2;
+ }
+ }
+
+ if (!cachedRoad.isDataReady()) {
+ return;
+ }
+
+ PointStakingLogic.Result result = pointStakingLogic.calculate(cachedRoad.roadEditor(),
+ new PointStakingLogic.Configs(((App) Utils.getApp()).notNumber(), moveType),
+ new PointStakingLogic.Parameter(
+ new MeasuredPoint(currentCoordinate.getX(), currentCoordinate.getY(), currentCoordinate.getZ(), currentCoordinate.getName()),
+ new StakingPoint(targetStakePointRecord.name, -1, "", targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h),
+ CommonUtils.toBasePoint(TsConfig.getInstance().getStation()))
+ );
+ runOnUiThread(() -> {
+ if (result == null) {
+ return;
+ }
+
+ moveK = null;
+ moveD = null;
+ moveWestEast = null;
+ moveSouthNorth = null;
+ moveBeforeAfter = null;
+ moveLeftRight = null;
+
+ targetCompassHelper.updateTargetAzimuth(result.targetAzimuth);
+
+ distance = TextFactory.distanceFormatDouble2String(getString(R.string.distance) + getString(R.string.colon), PointUtils.getDistance2D(new BasePoint(targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h), new BasePoint(currentCoordinate.getX(), currentCoordinate.getY(), currentCoordinate.getZ())), ((App) Utils.getApp()).notNumber());
+ binding.tvDistance.setText(distance);
+
+ moveDigFill = currentCoordinate.getZ() > targetStakePointRecord.h
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.down_dig), currentCoordinate.getZ() - targetStakePointRecord.h, ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.up_fill), targetStakePointRecord.h - currentCoordinate.getZ(), ((App) Utils.getApp()).notNumber());
+ binding.tvDigFill.setText(currentCoordinate.getZ() > targetStakePointRecord.h
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.down_dig) + getString(R.string.colon), currentCoordinate.getZ() - targetStakePointRecord.h, ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.up_fill) + getString(R.string.colon), targetStakePointRecord.h - currentCoordinate.getZ(), ((App) Utils.getApp()).notNumber()));
+
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ switch (PreferencesUtil.getMoveMethodTypeTS()) {
+ case 0:
+ moveKD(result);
+ break;
+ case 1:
+ moveForeBack();
+ break;
+ case 2:
+ moveWestEast();
+ break;
+ }
+ binding.topFiveSixLayout.setVisibility(View.VISIBLE);
+ double station_angle = PointUtils.getDirectionDegrees(CommonUtils.toBasePoint(TsConfig.getInstance().getStation()), new BasePoint(targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h));
+ double display_station_angle = station_angle + TsConfig.getInstance().getAngleDifference();
+ while (display_station_angle < 0)
+ display_station_angle += Math.PI * 2;
+ while (display_station_angle >= Math.PI * 2)
+ display_station_angle -= Math.PI * 2;
+ double measured_angle = CoordUtil.calcAzimuth(TsConfig.getInstance().getStation(), currentCoordinate);
+ binding.tvTopFive.setText(getString(R.string.station_angle) + getString(R.string.colon) + Util.radianToDmsString(display_station_angle, ((App) Utils.getApp()).angleNotNumber()));
+ binding.tvTopSix.setText(getString(R.string.station_angle_diff) + getString(R.string.colon) + Util.radianToDmsString(station_angle - measured_angle, ((App) Utils.getApp()).angleNotNumber(), false));
+ } else {
+ switch (PreferencesUtil.getMoveMethodTypeRTK()) {
+ case 0:
+ moveKD(result);
+ break;
+ case 1:
+ moveWestEast();
+ break;
+ }
+ binding.topFiveSixLayout.setVisibility(View.GONE);
+ binding.tvTopFive.setText(getString(R.string.station_angle));
+ binding.tvTopSix.setText(getString(R.string.station_angle_diff));
+ }
+ });
+ });
+ }
+
+ private void moveKD(PointStakingLogic.Result result) {
+ moveK = result.kMove;
+ moveD = result.dMove;
+
+ binding.tvTopThree.setText(moveK != null && moveK.value != null ? moveK.value : TextFactory.fixedString(""));
+ binding.tvTopFour.setText(moveD != null && moveD.value != null ? moveD.value : TextFactory.fixedString(""));
+ }
+
+ private void moveForeBack() {
+ BasePoint moveDistance = Util.moveDistance(CommonUtils.toBasePoint(TsConfig.getInstance().getStation()),
+ new BasePoint(targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h)
+ , new BasePoint(currentCoordinate.getX(), currentCoordinate.getY(), currentCoordinate.getZ()));
+
+ double foreBackMoveValue = moveDistance.getX();
+ moveBeforeAfter = foreBackMoveValue >= 0
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_before), Math.abs(foreBackMoveValue), ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_after), Math.abs(foreBackMoveValue), ((App) Utils.getApp()).notNumber());
+
+ binding.tvTopThree.setText(foreBackMoveValue >= 0
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_before) + getString(R.string.colon), Math.abs(foreBackMoveValue), ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_after) + getString(R.string.colon), Math.abs(foreBackMoveValue), ((App) Utils.getApp()).notNumber()));
+
+ double leftRightValue = moveDistance.getY();
+ moveLeftRight = leftRightValue >= 0
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_right), Math.abs(leftRightValue), ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_left), Math.abs(leftRightValue), ((App) Utils.getApp()).notNumber());
+
+ binding.tvTopFour.setText(leftRightValue >= 0
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_right) + getString(R.string.colon), Math.abs(leftRightValue), ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_left) + getString(R.string.colon), Math.abs(leftRightValue), ((App) Utils.getApp()).notNumber()));
+ }
+
+ private void moveWestEast() {
+ moveWestEast = currentCoordinate.getY() > targetStakePointRecord.y
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_west), currentCoordinate.getY() - targetStakePointRecord.y, ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_east), targetStakePointRecord.y - currentCoordinate.getY(), ((App) Utils.getApp()).notNumber());
+
+ moveSouthNorth = currentCoordinate.getX() > targetStakePointRecord.x
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_south), currentCoordinate.getX() - targetStakePointRecord.x, ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_north), targetStakePointRecord.x - currentCoordinate.getX(), ((App) Utils.getApp()).notNumber());
+
+ binding.tvTopThree.setText(currentCoordinate.getY() > targetStakePointRecord.y
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_west) + getString(R.string.colon), currentCoordinate.getY() - targetStakePointRecord.y, ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_east) + getString(R.string.colon), targetStakePointRecord.y - currentCoordinate.getY(), ((App) Utils.getApp()).notNumber()));
+
+ binding.tvTopFour.setText(currentCoordinate.getX() > targetStakePointRecord.x
+ ? TextFactory.distanceFormatDouble2String(getString(R.string.to_south) + getString(R.string.colon), currentCoordinate.getX() - targetStakePointRecord.x, ((App) Utils.getApp()).notNumber())
+ : TextFactory.distanceFormatDouble2String(getString(R.string.to_north) + getString(R.string.colon), targetStakePointRecord.x - currentCoordinate.getX(), ((App) Utils.getApp()).notNumber()));
+ }
+
+ /**
+ * 更新底部信息
+ */
+ private void updateBottomInfo(double x, double y, double z) {
+ updateBottomInfo("", x, y, z);
+ }
+
+ @SuppressLint("SetTextI18n")
+ private void updateBottomInfo(String stakingName, double x, double y, double z) {
+ if (!TextUtils.isEmpty(stakingName)) {
+ binding.tvStakingPointName.setText(getString(R.string.staking_point_name) + getString(R.string.colon) + stakingName);
+ binding.tvTargetX.setText(TextFactory.distanceFormatDouble2String("X" + getString(R.string.colon), x, ((App) Utils.getApp()).notNumber()));
+ binding.tvTargetY.setText(TextFactory.distanceFormatDouble2String("Y" + getString(R.string.colon), y, ((App) Utils.getApp()).notNumber()));
+ binding.tvTargetZ.setText(TextFactory.distanceFormatDouble2String("Z" + getString(R.string.colon), z, ((App) Utils.getApp()).notNumber()));
+ } else {
+ binding.tvSurveyX.setText(TextFactory.distanceFormatDouble2String("X" + getString(R.string.colon), x, ((App) Utils.getApp()).notNumber()));
+ binding.tvSurveyY.setText(TextFactory.distanceFormatDouble2String("Y" + getString(R.string.colon), y, ((App) Utils.getApp()).notNumber()));
+ binding.tvSurveyZ.setText(TextFactory.distanceFormatDouble2String("Z" + getString(R.string.colon), z, ((App) Utils.getApp()).notNumber()));
+ }
+ }
+
+ /**
+ * 画红色实测点和虚线引导线
+ *
+ * @param x
+ * @param y
+ * @param z
+ */
+ private void drawCurrentPointLine(double x, double y, double z) {
+ if (currentPointLine.getValues().isEmpty() && surveyBasePointLine.getValues().isEmpty()
+ && stakingPointLine.getValues().isEmpty() && recordPointLine.getValues().isEmpty()
+ && effectGuideLine.getValues().isEmpty() && effectHorLine.getValues().isEmpty()
+ && effectVerLine.getValues().isEmpty()) {
+ isFirstUpdateChartView = !isFirstUpdateChartView;
+ }
+ if (currentPointLine != null) {
+ currentPointLine.getValues().clear();
+ currentPointLine.getValues().add(new PointValue(y, x).setLabel(getString(R.string.measured_point)));
+ }
+ if (effectGuideLine != null) {
+ effectGuideLine.getValues().clear();
+ }
+ if (effectHorLine != null) {
+ effectHorLine.getValues().clear();
+ }
+ if (effectVerLine != null) {
+ effectVerLine.getValues().clear();
+ }
+ if (targetStakePointRecord != null && effectGuideLine != null) {
+ effectGuideLine.getValues().add(new PointValue(y, x));
+ effectGuideLine.getValues().add(new PointValue(targetStakePointRecord.y, targetStakePointRecord.x));
+
+ double distance2D = Util.formatDouble2Double(PointUtils.getDistance2D(new BasePoint(targetStakePointRecord.x, targetStakePointRecord.y), new BasePoint(x, y)), ((App) Utils.getApp()).notNumber());
+
+ double disTipsRange2D = Double.parseDouble(PreferencesUtil.getPointStakingTipsRangeLimit());
+ if (distance2D <= disTipsRange2D) {
+ if (effectHorLine != null && effectVerLine != null) {
+ effectHorLine.getValues().add(new PointValue((y - disTipsRange2D), x));
+ effectHorLine.getValues().add(new PointValue((y + disTipsRange2D), x));
+ effectVerLine.getValues().add(new PointValue(y, (x - disTipsRange2D)));
+ effectVerLine.getValues().add(new PointValue(y, (x + disTipsRange2D)));
+ }
+ if (preferences.getBoolean("key_is_tts_open", true)) {
+ SoundPoolUtil.getInstance().play(SoundPoolUtil.ALPHA_STAKING);
+ }
+ } else {
+ stopSoundPool();
+ }
+ }
+ if (isFirstUpdateChartView) {
+ ChartViewUtils.centerInScreen(binding.lineChartView);
+ isFirstUpdateChartView = !isFirstUpdateChartView;
+ }
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ }
+
+ private void drawRecordPointLine() {
+ if (targetStakePointRecord == null) {
+ return;
+ }
+ ThreadPoolUtil.execute(() -> {
+ recordStakingBasePointList = PointStakeDb.getInstance().rawQueryListData(new SimpleSQLiteQuery("SELECT * FROM " + PointStakeConstants.DB_NAME + " WHERE " + DBQueryConstant.NOT_DELETED + DBQueryConstant.AND + " (pointId='" + targetStakePointRecord.id + "')"));
+ runOnUiThread(() -> {
+ if (recordPointLine != null) {
+ recordPointLine.getValues().clear();
+ for (int i = 0; i < recordStakingBasePointList.size(); i++) {
+ PointStakeRecord pointStakeRecord = recordStakingBasePointList.get(i);
+ recordPointLine.getValues().add(new PointValue(pointStakeRecord.measuredY, pointStakeRecord.measuredX).setLabel(""));
+ }
+ }
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ });
+ });
+ }
+
+ /**
+ * 记录保存放样记录点
+ */
+ private void recordPoint() {
+ if (currentCoordinate == null) {
+ ToastUtils.showShort(getString(R.string.return_coordinate_empty_check_device));
+ return;
+ }
+ if (targetStakePointRecord == null) {
+ ToastUtils.showShort(getString(R.string.add_points_staking_point_first));
+ return;
+ }
+ boolean needCurrentSmoothCoordinate = Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_RTK && PreferencesUtil.getPreferenceInt(ConstUtils.preferConst.rtkStakingSmoothPointsNumber, 1) != 1;
+ if (needCurrentSmoothCoordinate) {
+ if (currentSmoothCoordinate == null) {
+ ToastUtils.showShort(getString(R.string.return_coordinate_empty_check_device));
+ return;
+ }
+ }
+
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ String jobId = CachedCurrentJob.currentJobId(projectId);
+ String roadId = CachedCurrentRoad.currentRoadId(projectId);
+
+ DeviceUtils.StationData stationData = DeviceUtils.stationData(
+ new BasePoint(targetStakePointRecord.x, targetStakePointRecord.y, targetStakePointRecord.h),
+ ((App) Utils.getApp()).angleNotNumber(),
+ ((App) Utils.getApp()).notNumber());
+ DeviceInfoData deviceInfoData = DeviceUtils.collectDeviceInfo();
+ PointStakeRecord pointStakeRecord = new PointStakeRecord(projectId, jobId, roadId,
+ targetStakePointRecord.id, moveBeforeAfter != null ? moveBeforeAfter.getString() : "", moveLeftRight != null ? moveLeftRight.getString() : "", moveWestEast != null ? moveWestEast.getString() : "", moveSouthNorth != null ? moveSouthNorth.getString() : "",
+ cachedRoad.road().getName()
+ , targetStakePointRecord.name
+ , Util.formatDouble2StringDotAuto(targetStakePointRecord.x)
+ , Util.formatDouble2StringDotAuto(targetStakePointRecord.y)
+ , Util.formatDouble2StringDotAuto(targetStakePointRecord.h)
+ , Util.formatDouble2StringDotAuto(needCurrentSmoothCoordinate ? currentSmoothCoordinate.getX() : currentCoordinate.getX())
+ , Util.formatDouble2StringDotAuto(needCurrentSmoothCoordinate ? currentSmoothCoordinate.getY() : currentCoordinate.getY())
+ , Util.formatDouble2StringDotAuto(needCurrentSmoothCoordinate ? currentSmoothCoordinate.getZ() : currentCoordinate.getZ())
+ , Util.formatDouble2StringDotAuto(distance.getDouble())
+ , moveDigFill != null ? moveDigFill.getString() : ""
+ , moveK != null && moveK.value != null ? moveK.value.getString() : ""
+ , moveD != null && moveD.value != null ? moveD.value.getString() : ""
+ , stationData.stationAngle, stationData.stationDistance
+ , recordRemarks
+ , new Date()
+ , deviceInfoData);
+
+ PointStakeDb.getInstance().save(pointStakeRecord);
+
+ runOnUiThread(() -> {
+ recordPointLine.getValues().add(new PointValue(pointStakeRecord.measuredY, pointStakeRecord.measuredX).setLabel(""));
+ stopSoundPool();
+ recordRemarks = "";
+ if (preferences.getBoolean("key_is_tts_open", true)) {
+ SoundPoolUtil.getInstance().singlePlayStopRecord();
+ }
+ ((LineChartRenderer) binding.lineChartView.getChartRenderer()).calculateMaxViewport(1.5f);
+ binding.lineChartView.onChartDataChange();
+ });
+ });
+ }
+
+ /**
+ * 显示的移动方法赋值
+ */
+ private void showTopMoveMethod() {
+ binding.tvDistance.setText(getString(R.string.distance));
+ binding.tvDigFill.setText(getString(R.string.dig_fill));
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_TS) {
+ switch (PreferencesUtil.getMoveMethodTypeTS()) {
+ case 0:
+ binding.tvTopThree.setText(getString(R.string.k));
+ binding.tvTopFour.setText(getString(R.string.d));
+ break;
+ case 1:
+ binding.tvTopThree.setText(getString(R.string.to_before));
+ binding.tvTopFour.setText(getString(R.string.to_left));
+ break;
+ case 2:
+ binding.tvTopThree.setText(getString(R.string.to_north));
+ binding.tvTopFour.setText(getString(R.string.to_east));
+ break;
+ }
+ binding.topFiveSixLayout.setVisibility(View.VISIBLE);
+ } else {
+ switch (PreferencesUtil.getMoveMethodTypeRTK()) {
+ case 0:
+ binding.tvTopThree.setText(getString(R.string.k));
+ binding.tvTopFour.setText(getString(R.string.d));
+ break;
+ case 1:
+ binding.tvTopThree.setText(getString(R.string.to_north));
+ binding.tvTopFour.setText(getString(R.string.to_east));
+ break;
+ }
+ binding.topFiveSixLayout.setVisibility(View.GONE);
+ }
+ binding.tvTopFive.setText(getString(R.string.station_angle));
+ binding.tvTopSix.setText(getString(R.string.station_angle_diff));
+ }
+
+ @Override
+ protected void onHelpClicked() {
+ HelpWebActivity.navigation2KnownPointStakingHelp(this);
+ }
+
+ @Override
+ public boolean isShowTopBarHrPoleLayout() {
+ return false;
+ }
+
+ private String jobId() {
+ return IntentUtil.stringExtra(getIntent(), KEY_JOB_ID);
+ }
+
+ public static void start(Context context) {
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ String roadId = CachedCurrentRoad.currentRoadId(projectId);
+ String jobId = CachedCurrentJob.currentJobId(projectId);
+ Intent intent = new Intent(context, PointStakingActivity.class);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ intent.putExtra(KEY_PROJECT_ID, projectId);
+ intent.putExtra(KEY_ROAD_ID, roadId);
+ context.startActivity(intent);
+ });
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ stopSoundPool();
+ }
+
+ private void stopSoundPool() {
+ SoundPoolUtil.getInstance().stop();
+ }
+
+ @Override
+ public void onRtkTiltSwitched(boolean onOff) {
+ super.onRtkTiltSwitched(onOff);
+ if (onOff) {
+ binding.baseSurveyStakingSetting.ivTiltPrimAuto.setImageResource(R.drawable.icon_survey_tilt_black);
+ binding.baseSurveyStakingSetting.tvTiltPrimAuto.setTextColor(getColor(R.color.black));
+ } else {
+ binding.baseSurveyStakingSetting.ivTiltPrimAuto.setImageResource(R.drawable.icon_survey_tilt_gray);
+ binding.baseSurveyStakingSetting.tvTiltPrimAuto.setTextColor(getColor(R.color.color_BCBCBC));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/icon_triangle_left.xml b/app/src/main/res/drawable/icon_triangle_left.xml
new file mode 100644
index 0000000..7765333
--- /dev/null
+++ b/app/src/main/res/drawable/icon_triangle_left.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/icon_triangle_right.xml b/app/src/main/res/drawable/icon_triangle_right.xml
new file mode 100644
index 0000000..0c1d82e
--- /dev/null
+++ b/app/src/main/res/drawable/icon_triangle_right.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_point_staking.xml b/app/src/main/res/layout/activity_point_staking.xml
new file mode 100644
index 0000000..5729075
--- /dev/null
+++ b/app/src/main/res/layout/activity_point_staking.xml
@@ -0,0 +1,521 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7713a54..cd53313 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -256,6 +256,13 @@
确定要清空编码库所有的编码吗?
编码模板库
导入成功
+ 放样点名
+ 点库选点
+ 上一点
+ 最近点
+ 下一点
+ 采集\n记录
+ 实测坐标
\ No newline at end of file