diff --git a/app/build.gradle b/app/build.gradle
index 9d2a9be..de28a27 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -151,6 +151,7 @@ dependencies {
annotationProcessor AndroidX.Room.compiler
annotationProcessor Libs.Glide.compiler
+ implementation Libs.LeanCloud.storage
// constraints {
// implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10") {
@@ -173,6 +174,11 @@ dependencies {
implementation 'io.github.inflationx:calligraphy3:3.1.1'
// implementation 'io.github.inflationx:viewpump:2.0.3'
implementation 'com.gyf.immersionbar:immersionbar:3.0.0-beta05'
+ implementation 'com.github.getActivity:ShapeView:9.2'
+ implementation 'com.sherlockshi.widget:sherlockspinner:1.0.2'
+ implementation 'com.zhy:flowlayout-lib:1.0.3'
+ implementation 'net.sourceforge.jexcelapi:jxl:2.6.12'
+
}
\ No newline at end of file
diff --git a/app/libs/bc-dialog-release.aar b/app/libs/bc-dialog-release.aar
new file mode 100644
index 0000000..46d8df8
Binary files /dev/null and b/app/libs/bc-dialog-release.aar differ
diff --git a/app/libs/tensorFlowTTS-release.aar b/app/libs/tensorFlowTTS-release.aar
new file mode 100644
index 0000000..0971af4
Binary files /dev/null and b/app/libs/tensorFlowTTS-release.aar differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4bb1330..1b887a5 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -126,6 +126,10 @@
android:name=".ui.instrument.satellitosis.SatelliteSystemSwitchActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize|stateHidden" />
+
diff --git a/app/src/main/java/com/project/survey/App.java b/app/src/main/java/com/project/survey/App.java
index c86ed48..b9297e1 100644
--- a/app/src/main/java/com/project/survey/App.java
+++ b/app/src/main/java/com/project/survey/App.java
@@ -6,6 +6,7 @@ import android.app.Application;
import android.util.Log;
import com.bingce.AppChannel;
+import com.bingce.BaseApp;
import org.polaric.colorful.Colorful;
@@ -13,12 +14,17 @@ import blankj.utilcode.util.Utils;
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;
-public class App extends Application {
+public class App extends BaseApp {
private static App app;
public boolean isThemeDark;
+ @Override
+ public boolean isLandscape() {
+ return false;
+ }
+
@Override
public void onCreate() {
customChannel = AppChannel.CUSTOM_CONTROL_PRO;//AppChannel.CUSTOM_PUBLIC;
@@ -38,6 +44,26 @@ public class App extends Application {
}
+ @Override
+ protected void initTtsManager() {
+
+ }
+
+ @Override
+ public String applicationId() {
+ return "";
+ }
+
+ @Override
+ public boolean isThemeDark() {
+ return false;
+ }
+
+ @Override
+ public int angleNotNumber() {
+ return 0;
+ }
+
private void initThemeDark() {
Colorful.defaults()
.primaryColor(Colorful.ThemeColor.BLUE)
diff --git a/app/src/main/java/com/project/survey/dialog/CustomStyleDialog.java b/app/src/main/java/com/project/survey/dialog/CustomStyleDialog.java
new file mode 100644
index 0000000..11700a8
--- /dev/null
+++ b/app/src/main/java/com/project/survey/dialog/CustomStyleDialog.java
@@ -0,0 +1,154 @@
+package com.project.survey.dialog;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.project.survey.R;
+
+
+public class CustomStyleDialog extends Dialog {
+
+ private CustomStyleDialog(Context context, int themeResId) {
+ super(context, themeResId);
+ }
+
+ private CustomStyleDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
+ super(context, cancelable, cancelListener);
+ }
+
+ /* Builder */
+ public static class Builder {
+ private TextView tvTitle, tvContent;
+ private TextView btnSample,btnCancel, btnConfirm;
+
+ private View mLayout;
+ private View.OnClickListener mButtonSampleClickListener;
+ private View.OnClickListener mButtonCancelClickListener;
+ private View.OnClickListener mButtonConfirmClickListener;
+
+ private CustomStyleDialog mDialog;
+
+ public Builder(Context context) {
+ mDialog = new CustomStyleDialog(context, R.style.gif_dialog);
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ // 加载布局文件
+ mLayout = inflater.inflate(R.layout.layout_content_style_dialog, null, false);
+ // 添加布局文件到 Dialog
+ mDialog.addContentView(mLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
+
+ tvTitle = mLayout.findViewById(R.id.tv_title);
+ tvContent = mLayout.findViewById(R.id.tv_content);
+ btnSample = mLayout.findViewById(R.id.btn_look_sample);
+ btnCancel = mLayout.findViewById(R.id.btn_cancel);
+ btnConfirm = mLayout.findViewById(R.id.btn_confirm);
+ }
+
+ /**
+ * 设置 Dialog 标题
+ */
+ public Builder setTitle(String title) {
+ tvTitle.setText(title);
+ tvTitle.setVisibility(View.VISIBLE);
+ return this;
+ }
+
+ /**
+ * 设置 Dialog内容
+ */
+ public Builder setContent(String content) {
+ tvContent.setText(content);
+ return this;
+ }
+
+ public Builder setButtonSample(String text){
+ btnSample.setText(text);
+ return this;
+ }
+
+ public Builder setButtonSample(View.OnClickListener listener) {
+ mButtonSampleClickListener = listener;
+ return this;
+ }
+
+ public Builder setButtonSample(String text, View.OnClickListener listener) {
+ btnSample.setText(text);
+ mButtonSampleClickListener = listener;
+ return this;
+ }
+
+ /**
+ * 设置取消按钮文字和监听
+ */
+ public Builder setButtonCancel(String text) {
+ btnCancel.setText(text);
+ return this;
+ }
+
+ public Builder setButtonCancel(View.OnClickListener listener) {
+ mButtonCancelClickListener = listener;
+ return this;
+ }
+
+ public Builder setButtonCancel(String text, View.OnClickListener listener) {
+ btnCancel.setText(text);
+ mButtonCancelClickListener = listener;
+ return this;
+ }
+
+ /**
+ * 设置确认按钮文字和监听
+ */
+ public Builder setButtonConfirm(View.OnClickListener listener) {
+ mButtonConfirmClickListener = listener;
+ return this;
+ }
+
+ public Builder setButtonConfirm(String text, View.OnClickListener listener) {
+ btnConfirm.setText(text);
+ mButtonConfirmClickListener = listener;
+ return this;
+ }
+
+ public CustomStyleDialog create() {
+
+ btnSample.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mDialog.dismiss();
+ if (mButtonSampleClickListener != null) {
+ mButtonSampleClickListener.onClick(view);
+ }
+ }
+ });
+
+ btnCancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mDialog.dismiss();
+ if (mButtonCancelClickListener != null) {
+ mButtonCancelClickListener.onClick(view);
+ }
+ }
+ });
+
+ btnConfirm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mDialog.dismiss();
+ if (mButtonConfirmClickListener != null) {
+ mButtonConfirmClickListener.onClick(view);
+ }
+ }
+ });
+
+ mDialog.setContentView(mLayout);
+ mDialog.setCancelable(true);
+ mDialog.setCanceledOnTouchOutside(false);
+ return mDialog;
+ }
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/AddResultFormatActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/AddResultFormatActivity.java
new file mode 100644
index 0000000..1ed739a
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/AddResultFormatActivity.java
@@ -0,0 +1,390 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.content.Context;
+import android.content.Intent;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.activity.result.ActivityResultLauncher;
+
+
+import com.bingce.surveyor.util.ConstUtils;
+
+import com.bingce.utils.IntentUtil;
+import com.bingce.utils.ThreadPoolUtil;
+import com.google.gson.Gson;
+import com.project.survey.R;
+import com.project.survey.databinding.ActivityAddResultFormatBinding;
+import com.project.survey.ui.base.BaseSurveyNewActivity;
+import com.project.survey.ui.instrument.setupstation.db.RecordsFixedDataBase;
+import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord;
+import com.project.survey.util.SystemUtils;
+import com.zhy.view.flowlayout.FlowLayout;
+import com.zhy.view.flowlayout.TagAdapter;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import blankj.utilcode.util.ToastUtils;
+
+
+public class AddResultFormatActivity extends BaseSurveyNewActivity {
+
+ public ActivityAddResultFormatBinding binding;
+
+ private final int[] mItemsFileHeader = new int[]{R.string.yes, R.string.no};
+ private List mItemsFileHeaderArrayList;
+ private int indexOfFileHeader = 0;
+
+ private final int[] mItemsSuffix = new int[]{R.string.xls, R.string.dat, R.string.txt,R.string.csv};
+ private List mItemsSuffixArrayList;
+ private int indexOfSuffix = 0;
+
+ private final int[] mItemsAngleFormat = new int[]{R.string.af_d_ms, R.string.af_d_m_s, R.string.af_d, R.string.af_radian};
+ private List mItemsAngleFormatArrayList;
+ private int indexOfAngleFormat = 0;
+
+ private final int[] mItemsDividedSymbols = new int[]{R.string.split_comma, R.string.split_at, R.string.split_space, R.string.split_tab, R.string.split_enter};
+ private List mItemsDividedSymbolsArrayList;
+ private int indexOfDividedSymbols = 0;
+
+ private TagAdapter selAdapter,tagAdapter;
+ private List tagTab = new ArrayList();
+ private List selTab = new ArrayList();
+ private String uid;
+ private boolean isNewCraet;
+ private List allTagList = new ArrayList<>();
+ public static int SUFFIX_XLS_NUM = 0;
+ public static int SUFFIX_DAT_NUM = 1;
+ public static int SUFFIX_TXT_NUM = 2;
+ public static int SUFFIX_CSV_NUM = 3;
+
+ private int SYMBOLS_COMMMA = 0;
+ private int SYMBOLS_AT = 1;
+ private int SYMBOLS_SPACE = 2;
+ private int SYMBOLS_TAB = 3;
+ private int SYMBOLS_ENTER = 4;
+
+ public static int ANGLE_FORMAT_D_MS = 0;
+ public static int ANGLE_FORMAT_D_M_S = 1;
+ public static int ANGLE_FORMAT_D = 2;
+ public static int ANGLE_FORMAT_R = 3;
+
+ @Override
+ public View getContentView() {
+ binding = ActivityAddResultFormatBinding.inflate(getLayoutInflater());
+ return binding.getRoot();
+ }
+
+ @Override
+ protected void initView() {
+
+ isNewCraet = IntentUtil.boolExtra(this, ConstUtils.intentConst.keyIsNewCreateResultFormat);
+
+ if (isNewCraet){
+ setTitle(getString(R.string.new_export_format));
+ }else {
+ setTitle(getString(R.string.edit_export_format));
+ }
+ binding.tvFormatName.setText(getString(R.string.format_name) + ":");
+ binding.tvFileHeader.setText(getString(R.string.file_header) + ":");
+ binding.tvFileSuffix.setText(getString(R.string.file_suffix) + ":");
+ binding.tvAngleFormat.setText(getString(R.string.angle_formats) + ":");
+ binding.tvDividedSymbols.setText(getString(R.string.divided_symbols) + ":");
+
+ binding.btnConfirm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String formatName = binding.etFormatName.getText().toString();
+ if (TextUtils.isEmpty(formatName)){
+ ToastUtils.showShort(getString(R.string.enter_format_name));
+ return;
+ }
+
+ if (selTab != null && selTab.size() == 0){
+ ToastUtils.showShort(getString(R.string.select_custom_format_description));
+ return;
+ }
+
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < selTab.size(); i++) {
+ if (i == selTab.size() - 1){
+ stringBuilder.append(selTab.get(i));
+ }else {
+ stringBuilder.append(selTab.get(i)).append(binding.sherlockSymbol.getText().toString());
+ }
+ }
+
+ ThreadPoolUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ FormatRecord formatRecord = new FormatRecord();
+ formatRecord.id = uid;
+ formatRecord.format_name = formatName;
+ formatRecord.format_content = stringBuilder.toString();
+ formatRecord.divided_symbols = mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols);
+ formatRecord.file_suffix = indexOfSuffix;
+ formatRecord.file_header = indexOfFileHeader == 0 ? true : false;
+ formatRecord.angle_format = indexOfAngleFormat;
+ RecordsFixedDataBase.getInstance().formatRecordDao().save(formatRecord);
+ Intent intent = new Intent();
+ intent.putExtra(ConstUtils.intentConst.keyResultFormatRecord, new Gson().toJson(formatRecord));
+ intent.putExtra(ConstUtils.intentConst.keyIsNewCreateResultFormat, isNewCraet);
+ setResult(LauncherEvent.launcher_results_export,intent);
+ finish();
+ }
+ });
+ }
+ });
+ }
+
+ @Override
+ protected void initData() {
+ allTagList.add(getString(R.string.point_name));
+ allTagList.add(getString(R.string.point_code));
+ allTagList.add(getString(R.string.latitude));
+ allTagList.add(getString(R.string.longitude));
+ allTagList.add(getString(R.string.altitude));
+ allTagList.add(getString(R.string.antenna_type));
+ allTagList.add(getString(R.string.antenna_height));
+ allTagList.add(getString(R.string.northing));
+ allTagList.add(getString(R.string.easting));
+ allTagList.add(getString(R.string.elevation));
+ allTagList.add(getString(R.string.solution_state));
+ allTagList.add(getString(R.string.satellite_num));
+ allTagList.add(getString(R.string.satellite_track_num));
+ allTagList.add(getString(R.string.pdop));
+ allTagList.add(getString(R.string.hrms));
+ allTagList.add(getString(R.string.vrms));
+ allTagList.add(getString(R.string.diff_delay));
+ allTagList.add(getString(R.string.remark));
+ allTagList.add(getString(R.string.acquisition_time));
+ allTagList.add(getString(R.string.tilt_survey));
+
+ if (isNewCraet){
+ uid = SystemUtils.getUUID();
+ for (int i = 0; i < allTagList.size(); i++) {
+ if (i == 0){
+ selTab.add(allTagList.get(i));
+ }else {
+ tagTab.add(allTagList.get(i));
+ }
+ }
+
+ TagFormatData();
+
+ TagFlowData();
+
+ }else {
+ uid = IntentUtil.stringExtra(this, ConstUtils.intentConst.keyResultsExportFormatId);
+
+ ThreadPoolUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ FormatRecord formatRecord = RecordsFixedDataBase.getInstance().formatRecordDao().findById(uid);
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+
+ binding.etFormatName.setText(formatRecord.format_name);
+
+ String[] split = formatRecord.format_content.split(formatRecord.divided_symbols);
+ for (int i = 0; i < split.length; i++) {
+ selTab.add(split[i]);
+ }
+
+ for (int i = 0; i < allTagList.size(); i++) {
+ if (!selTab.contains(allTagList.get(i))){
+ tagTab.add(allTagList.get(i));
+ }
+ }
+
+ if (formatRecord.file_header){
+ indexOfFileHeader = 0;
+ }else {
+ indexOfFileHeader = 1;
+ }
+
+ indexOfSuffix = formatRecord.file_suffix;
+
+ if (indexOfSuffix == SUFFIX_TXT_NUM || indexOfSuffix == SUFFIX_CSV_NUM){
+ binding.llSherlockSymbol.setVisibility(View.VISIBLE);
+ }else {
+ binding.llSherlockSymbol.setVisibility(View.GONE);
+ }
+
+ indexOfAngleFormat = formatRecord.angle_format;
+
+ if (formatRecord.divided_symbols.equals(getString(R.string.split_comma))){
+ indexOfDividedSymbols = SYMBOLS_COMMMA;
+ }else if (formatRecord.divided_symbols.equals(getString(R.string.split_at))){
+ indexOfDividedSymbols = SYMBOLS_AT;
+ }else if (formatRecord.divided_symbols.equals(getString(R.string.split_space))){
+ indexOfDividedSymbols = SYMBOLS_SPACE;
+ }else if (formatRecord.divided_symbols.equals(getString(R.string.split_tab))){
+ indexOfDividedSymbols = SYMBOLS_TAB;
+ }else if (formatRecord.divided_symbols.equals(getString(R.string.split_enter))){
+ indexOfDividedSymbols = SYMBOLS_ENTER;
+ }
+
+ TagFormatData();
+
+ TagFlowData();
+ }
+ });
+ }
+ });
+ }
+ }
+
+ private void TagFormatData() {
+ mItemsFileHeaderArrayList = new ArrayList<>();
+ for (int mItem : mItemsFileHeader) {
+ mItemsFileHeaderArrayList.add(getResources().getString(mItem));
+ }
+ ArrayAdapter fileHeaderAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mItemsFileHeaderArrayList);
+ binding.sherlockFileHeader.setAdapter(fileHeaderAdapter);
+ binding.sherlockFileHeader.setText(mItemsFileHeaderArrayList.get(indexOfFileHeader));
+ binding.sherlockFileHeader.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ indexOfFileHeader = position;
+ binding.sherlockFileHeader.setText(mItemsFileHeaderArrayList.get(indexOfFileHeader));
+ }
+ });
+
+ mItemsSuffixArrayList = new ArrayList<>();
+ for (int mItem : mItemsSuffix) {
+ mItemsSuffixArrayList.add(getResources().getString(mItem));
+ }
+ ArrayAdapter suffixAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mItemsSuffixArrayList);
+ binding.sherlockSuffix.setAdapter(suffixAdapter);
+ binding.sherlockSuffix.setText(mItemsSuffixArrayList.get(indexOfSuffix));
+ if (indexOfSuffix == SUFFIX_XLS_NUM){
+ binding.rlFileHeader.setVisibility(View.VISIBLE);
+ }else {
+ binding.rlFileHeader.setVisibility(View.GONE);
+ }
+ binding.sherlockSuffix.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ indexOfSuffix = position;
+ binding.sherlockSuffix.setText(mItemsSuffixArrayList.get(indexOfSuffix));
+ if (indexOfSuffix == SUFFIX_TXT_NUM || indexOfSuffix == SUFFIX_CSV_NUM){
+ binding.llSherlockSymbol.setVisibility(View.VISIBLE);
+ }else {
+ indexOfDividedSymbols = SYMBOLS_COMMMA;
+ binding.sherlockSymbol.setText(mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols));
+ binding.llSherlockSymbol.setVisibility(View.GONE);
+ }
+
+ if (indexOfSuffix == SUFFIX_XLS_NUM){
+ binding.rlFileHeader.setVisibility(View.VISIBLE);
+ indexOfFileHeader = 0;
+ }else {
+ binding.rlFileHeader.setVisibility(View.GONE);
+ indexOfFileHeader = 1;
+ }
+ binding.sherlockFileHeader.setText(mItemsFileHeaderArrayList.get(indexOfFileHeader));
+ }
+ });
+
+ mItemsAngleFormatArrayList = new ArrayList<>();
+ for (int mItem : mItemsAngleFormat) {
+ mItemsAngleFormatArrayList.add(getResources().getString(mItem));
+ }
+ ArrayAdapter angleFormatAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mItemsAngleFormatArrayList);
+ binding.sherlockAngleFormat.setAdapter(angleFormatAdapter);
+ binding.sherlockAngleFormat.setText(mItemsAngleFormatArrayList.get(indexOfAngleFormat));
+ binding.sherlockAngleFormat.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ indexOfAngleFormat = position;
+ binding.sherlockAngleFormat.setText(mItemsAngleFormatArrayList.get(indexOfAngleFormat));
+ }
+ });
+
+ mItemsDividedSymbolsArrayList = new ArrayList<>();
+ for (int mItem : mItemsDividedSymbols) {
+ mItemsDividedSymbolsArrayList.add(getResources().getString(mItem));
+ }
+ ArrayAdapter dividedSymbolsAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mItemsDividedSymbolsArrayList);
+ binding.sherlockSymbol.setAdapter(dividedSymbolsAdapter);
+ binding.sherlockSymbol.setText(mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols));
+ binding.sherlockSymbol.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ indexOfDividedSymbols = position;
+ binding.sherlockSymbol.setText(mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols));
+ }
+ });
+ }
+
+ private void TagFlowData() {
+
+ selAdapter = new TagAdapter(selTab){
+ @Override
+ public View getView(FlowLayout parent, final int position, String s) {
+ RelativeLayout view = (RelativeLayout) LayoutInflater.from(AddResultFormatActivity.this).inflate( R.layout.layout_format_flowlayout, binding.flowlayout,false);
+ TextView viewById = (TextView) view.findViewById(R.id.tv_name);
+ viewById.setText(s);
+ ImageView imageView = (ImageView) view.findViewById(R.id.iv_delete);
+ imageView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ tagTab.add(selTab.get(position));
+ tagAdapter.notifyDataChanged();
+
+ selTab.remove(position);
+ selAdapter.notifyDataChanged();
+ }
+ });
+ return view;
+ }
+ };
+ binding.flowlayout.setAdapter(selAdapter);
+
+ tagAdapter = new TagAdapter(tagTab){
+ @Override
+ public View getView(FlowLayout parent, final int position, String s) {
+ LinearLayout view = (LinearLayout) LayoutInflater.from(AddResultFormatActivity.this).inflate( R.layout.layout_format_flowlayout_tag, binding.tagFlowlayout,false);
+ TextView viewById = (TextView) view.findViewById(R.id.tv_name);
+ viewById.setText(s);
+ //如果点击就添加元素并刷新adapter
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //将新加入的数据加到集合的最后一个位置,而原来的添加图标会到 +1 的位置
+ selTab.add(tagTab.get(position));
+ selAdapter.notifyDataChanged();
+
+ tagTab.remove(position);
+ tagAdapter.notifyDataChanged();
+ }
+ });
+ return view ;
+ }
+ };
+ binding.tagFlowlayout.setAdapter(tagAdapter);
+ }
+
+
+ public static void start(ActivityResultLauncher launcher, Context context, boolean isNewCraet){
+ start(launcher,context,isNewCraet,"");
+ }
+
+ public static void start(ActivityResultLauncher launcher,Context context, boolean isNewCraet, String uid) {
+ Intent intent = new Intent(context,AddResultFormatActivity.class);
+ intent.putExtra(ConstUtils.intentConst.keyIsNewCreateResultFormat,isNewCraet);
+ intent.putExtra(ConstUtils.intentConst.keyResultsExportFormatId,uid);
+ launcher.launch(intent);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/BingCeBaseSurveyPresenter.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/BingCeBaseSurveyPresenter.java
new file mode 100644
index 0000000..48214aa
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/BingCeBaseSurveyPresenter.java
@@ -0,0 +1,49 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import com.bingce.BaseApp;
+import com.bingce.coordlib.model.Blh;
+import com.bingce.rtk.model.GnssPosition;
+import com.bingce.utils.Util;
+import com.project.survey.util.CommonUtils;
+
+import net.tatans.tensorflowtts.tts.TtsManager;
+
+import blankj.utilcode.util.Utils;
+import cn.leancloud.types.LCGeoPoint;
+import cn.liuyanbing.surveyor.model.util.CUtil;
+
+public class BingCeBaseSurveyPresenter {
+ public static void hideSoftKey() {
+ CommonUtils.hideSoftInput();
+ }
+
+ public static void speak(String string) {
+ TtsManager.getInstance().speak(string);
+ }
+
+ public static void updateLastRTKLocation() {
+ if (((BaseApp) Utils.getApp()).avGeoPoint == null && GnssPosition.getInstance().validate) {
+ Blh blh = GnssPosition.getInstance().getWgs84Blh();
+ if (!CUtil.isEqual(blh.getLatitude(), 0) && !CUtil.isEqual(blh.getLongitude(), 0)) {
+ ((BaseApp) Utils.getApp()).avGeoPoint = new LCGeoPoint(blh.getLatitude(), blh.getLongitude());
+ ((BaseApp) Utils.getApp()).lastRTKLocation = ((BaseApp) Utils.getApp()).avGeoPoint.getLatitude() + "," + ((BaseApp) Utils.getApp()).avGeoPoint.getLongitude();
+ Util.putPreference("lastRTKLocation", ((BaseApp) Utils.getApp()).lastRTKLocation);
+ }
+ }
+ }
+
+ public static boolean checkRegister() {
+ return true;
+ }
+
+
+ public static int volumeUpAction() {
+// return ((App) Utils.getApp()).volumeUpAction;
+ return 0;
+ }
+
+ public static int volumeDownAction() {
+// return ((App) Utils.getApp()).volumeDownAction;
+ return 0;
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointLibraryAdapter.kt b/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointLibraryAdapter.kt
new file mode 100644
index 0000000..4234147
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointLibraryAdapter.kt
@@ -0,0 +1,181 @@
+package com.project.survey.ui.instrument.setupstation
+
+import android.content.Context
+import android.graphics.Color
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.paging.PagingDataAdapter
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.RecyclerView
+import com.bingce.data.database.PointDb
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord
+import com.bingce.utils.DateUtils
+import com.bingce.utils.ThreadPoolUtil
+import com.bingce.utils.Util
+import com.project.survey.databinding.ItemCoordinatePointLibraryBinding
+import com.project.survey.databinding.ItemCoordinatePointNameLibraryBinding
+
+class CoordinatePointLibraryAdapter(
+ diffCallback: DiffUtil.ItemCallback,
+ val context: Context,
+ private val onlyPointName: Boolean
+) : PagingDataAdapter(diffCallback) {
+ private var mSelItemPos = mutableSetOf()
+ fun toggleSelItemPos(pos: Int) {
+ if (mSelItemPos.contains(pos)) {
+ mSelItemPos.remove(pos)
+ } else {
+ mSelItemPos.add(pos)
+ }
+ notifyDataSetChanged()
+ }
+
+ fun selAll() {
+ mSelItemPos.addAll((0 until itemCount))
+ notifyDataSetChanged()
+ }
+
+ fun getSelItemPos(): List {
+ return mSelItemPos.toList()
+ }
+
+ fun resetConfig() {
+ mSelItemPos.clear()
+ }
+
+ fun getSelItem(): MutableList? {
+ if (mSelItemPos.size == 0) return null
+ val list = mutableListOf()
+ mSelItemPos.forEach { getItem(it)?.let { it1 -> list.add(it1) } }
+ return list
+ }
+
+ fun resetSelPos() {
+ mSelItemPos.clear()
+ }
+
+ fun clear() {
+ val list = ArrayList()
+ ThreadPoolUtil.execute {
+ (0 until itemCount).forEach {
+ getItem(it)?.let { it1 -> list.add(it1) }
+ }
+ mSelItemPos.clear()
+ PointDb.getInstance().delete(list)
+ }
+ }
+
+ fun clear(pointRecords: List) {
+ mSelItemPos.clear()
+ PointDb.getInstance().delete(pointRecords)
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseVH {
+ return if (onlyPointName) {
+ VH2(
+ ItemCoordinatePointNameLibraryBinding.inflate(
+ LayoutInflater.from(context),
+ parent,
+ false
+ )
+ )
+ } else {
+ VH(
+ ItemCoordinatePointLibraryBinding.inflate(
+ LayoutInflater.from(context),
+ parent,
+ false
+ )
+ )
+ }
+ }
+
+// override fun getItemCount(): Int {
+// return arrayList.size
+// }
+
+ override fun onBindViewHolder(holder: BaseVH, position: Int) {
+ getItem(position)?.let { holder.update(it) }
+ }
+
+ override fun onBindViewHolder(holder: BaseVH, position: Int, payloads: MutableList) {
+ if (payloads.isEmpty()) {
+ onBindViewHolder(holder, position)
+ } else {
+ val bundle = payloads[0]
+ getItem(position)?.let { holder.updatePart(it, bundle as Bundle) }
+ }
+ }
+
+ inner class VH2(val vb: ItemCoordinatePointNameLibraryBinding) : BaseVH(vb.root) {
+ override fun update(pointRecord: PointRecord) {
+ vb.tvName.text = pointRecord.name
+ if (mSelItemPos.contains(absoluteAdapterPosition)) {
+ vb.root.setBackgroundColor(Color.rgb(226, 236, 215))
+ vb.checkBox.isChecked = true
+ } else {
+ vb.root.background = null
+ vb.checkBox.isChecked = false
+ }
+// vb.checkBox.setOnCheckedChangeListener{_,isChecked->
+// if (isChecked){
+// mSelItemPos.add(absoluteAdapterPosition)
+// }else{
+// mSelItemPos.remove(absoluteAdapterPosition)
+// }
+// notifyItemChanged(absoluteAdapterPosition)
+// }
+ }
+
+ override fun updatePart(pointRecord: PointRecord, bundle: Bundle) {
+ for (key in bundle.keySet()) {
+ val value = bundle.getString(key) ?: ""
+ when (key) {
+ "name" -> vb.tvName.text = value
+ else -> {}
+ }
+ }
+ }
+ }
+
+ inner class VH(val vb: ItemCoordinatePointLibraryBinding) : BaseVH(vb.root) {
+ override fun update(pointRecord: PointRecord) {
+ vb.tvCode.text = pointRecord.code
+ vb.tvX.text = Util.formatDouble2StringDotAuto(pointRecord.x)
+ vb.tvY.text = Util.formatDouble2StringDotAuto(pointRecord.y)
+ vb.tvH.text = Util.formatDouble2StringDotAuto(pointRecord.h)
+ vb.tvLatitude.text =
+ Util.radianToDmsDoubleString(Math.toRadians(pointRecord.latitude), 6, false)
+ vb.tvLongitude.text =
+ Util.radianToDmsDoubleString(Math.toRadians(pointRecord.longitude), 6, false)
+ vb.tvEarthH.text = Util.formatDouble2String(pointRecord.altitude, 4)
+ vb.tvTime.text = DateUtils.toFull(pointRecord.createDate)
+ if (mSelItemPos.contains(absoluteAdapterPosition)) {
+ vb.root.setBackgroundColor(Color.rgb(226, 236, 215))
+ } else {
+ vb.root.background = null
+ }
+ }
+
+ override fun updatePart(pointRecord: PointRecord, bundle: Bundle) {
+ for (key in bundle.keySet()) {
+ val value = bundle.getString(key) ?: ""
+ when (key) {
+ "code" -> vb.tvCode.text = value
+ "x" -> vb.tvX.text = value
+ "y" -> vb.tvY.text = value
+ "h" -> vb.tvH.text = value
+ "time" -> vb.tvTime.text = value
+ else -> {}
+ }
+ }
+ }
+ }
+
+ abstract class BaseVH(val view: View) : RecyclerView.ViewHolder(view) {
+ abstract fun update(pointRecord: PointRecord)
+ abstract fun updatePart(pointRecord: PointRecord, bundle: Bundle)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointsLibraryActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointsLibraryActivity.java
new file mode 100644
index 0000000..d601d02
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointsLibraryActivity.java
@@ -0,0 +1,502 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Handler;
+import android.text.Editable;
+import android.view.View;
+
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts;
+import androidx.annotation.NonNull;
+import androidx.fragment.app.FragmentActivity;
+import androidx.lifecycle.LiveData;
+import androidx.paging.Pager;
+import androidx.paging.PagingConfig;
+import androidx.paging.PagingData;
+import androidx.paging.PagingDataTransforms;
+import androidx.paging.PagingLiveData;
+import androidx.paging.PagingSource;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bingce.data.cache.CachedCurrentJob;
+import com.bingce.data.cache.CachedProject;
+import com.bingce.data.database.DBQueryConstant;
+import com.bingce.data.database.JobDb;
+import com.bingce.data.database.PointDb;
+import com.bingce.data.surveyor.designdata.job.JobConstants;
+import com.bingce.data.surveyor.designdata.job.JobRecord;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord;
+import com.bingce.error.BingCeErrorCode;
+import com.bingce.ui.BcDialogExt;
+import com.bingce.utils.ActivityUtils;
+import com.bingce.utils.SimpleTextWatcher;
+import com.bingce.utils.ThreadPoolUtil;
+import com.bingce.viewmodel.AbstractCoordinatePointsLibraryViewModelKt;
+import com.project.survey.App;
+import com.project.survey.R;
+import com.project.survey.databinding.ActivityCoordinatePointsLibraryBinding;
+import com.project.survey.dialog.BubblePopWindow;
+import com.project.survey.ui.base.BaseSurveyNewActivity;
+
+import java.util.Arrays;
+import java.util.List;
+
+import blankj.utilcode.util.ToastUtils;
+import blankj.utilcode.util.Utils;
+
+import kotlinx.coroutines.Dispatchers;
+import kotlinx.coroutines.ExecutorsKt;
+
+public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity {
+
+ private ActivityCoordinatePointsLibraryBinding binding;
+ private RecyclerView.OnScrollListener leftScrollListener = new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+ if (recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) {
+ binding.bodyRv.scrollBy(dx, dy);
+ }
+ }
+
+ @Override
+ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
+ super.onScrollStateChanged(recyclerView, newState);
+ binding.bodyHsv.setIntercept(newState != RecyclerView.SCROLL_STATE_IDLE);
+ }
+ };
+ private RecyclerView.OnScrollListener rightScrollListener = new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+ if (!isFinishing() && recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) {
+ binding.bodyNameRv.scrollBy(dx, dy);
+ }
+ }
+
+ @Override
+ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
+ super.onScrollStateChanged(recyclerView, newState);
+ binding.bodyNameRl.setIntercept(newState != RecyclerView.SCROLL_STATE_IDLE);
+ }
+ };
+
+ private final CoordinatePointLibraryAdapter coordinatePointLibraryAdapter = new CoordinatePointLibraryAdapter(new PointRecordDiffCallback2(), this, false);
+ private final CoordinatePointLibraryAdapter coordinatePointNameLibraryAdapter = new CoordinatePointLibraryAdapter(new PointRecordDiffCallback2(), this, true);
+
+ private String jobId;
+ private AbstractCoordinatePointsLibraryViewModelKt.FilterParameter filterParameter = new AbstractCoordinatePointsLibraryViewModelKt.FilterParameter();
+ private Pager pager = new Pager<>(
+ new PagingConfig(100),
+ this::dataSourse);
+
+ private PagingSource dataSourse() {
+ return PointDb.getInstance().rawQueryPagingSource(CoordinatePointsLibraryActivitySQLiteUtils.searchSQLit(
+ jobId,
+ filterParameter, binding.etEnterNameCode.getText().toString().trim()
+ ));
+ }
+ private List getAllPoint(){
+ return PointDb.getInstance().rawQueryListData(CoordinatePointsLibraryActivitySQLiteUtils.searchSQLit(
+ jobId,
+ filterParameter, binding.etEnterNameCode.getText().toString().trim()
+ ));
+ }
+
+ private LiveData> pagingDataLiveData;
+ private final FilterHandlerNew filterHandler = new FilterHandlerNew(new FilterHandlerNew.FilterCallBack() {
+ @Override
+ public void fireByKey(String key) {
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ jobId = CachedCurrentJob.currentJobId(projectId);
+ ThreadPoolUtil.executeInMain(() -> {
+ pagingDataLiveData.removeObservers(CoordinatePointsLibraryActivity.this);
+ pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle());
+ pagingDataLiveData.observe(CoordinatePointsLibraryActivity.this, downloadRecordPagingData -> {
+ refreshAdapter(downloadRecordPagingData);
+ });
+
+ });
+ });
+ }
+ });
+
+ private void refreshAdapter(PagingData downloadRecordPagingData) {
+ coordinatePointLibraryAdapter.submitData(getLifecycle(), downloadRecordPagingData);
+ coordinatePointNameLibraryAdapter.submitData(getLifecycle(), downloadRecordPagingData);
+ coordinatePointLibraryAdapter.resetConfig();
+ coordinatePointNameLibraryAdapter.resetConfig();
+ coordinatePointLibraryAdapter.notifyDataSetChanged();
+ coordinatePointNameLibraryAdapter.notifyDataSetChanged();
+ new Handler().postDelayed(() -> binding.tvPointNumber.setText(coordinatePointLibraryAdapter.getItemCount() + ""), 500);
+ }
+
+ private void resetSelPos() {
+ coordinatePointLibraryAdapter.resetSelPos();
+ coordinatePointNameLibraryAdapter.resetSelPos();
+ }
+
+ @Override
+ public View getContentView() {
+ binding = ActivityCoordinatePointsLibraryBinding.inflate(getLayoutInflater());
+ return binding.getRoot();
+ }
+
+ @Override
+ protected void initView() {
+ setTitle(getString(R.string.point_survey_point_library));
+
+ if (((App) Utils.getApp()).isThemeDark) {
+ binding.topLayout.setBackgroundColor(getColor(R.color.theme_dark_black));
+ }
+
+ binding.bodyRv.setAdapter(coordinatePointLibraryAdapter);
+ binding.bodyNameRv.setAdapter(coordinatePointNameLibraryAdapter);
+ binding.bodyHsv.setScrollView(binding.headerHsv);
+ binding.headerHsv.setScrollView(binding.bodyHsv);
+
+ binding.tvLatitude.setText(getString(R.string.latitude) + "(dd.mmss)");
+ binding.tvLongitude.setText(getString(R.string.longitude) + "(dd.mmss)");
+
+ binding.bodyRv.addOnScrollListener(rightScrollListener);
+
+ binding.bodyNameRv.addOnScrollListener(leftScrollListener);
+ binding.bodyRv.addOnItemTouchListener(new SimpleRecyclerViewItemClickListener(binding.bodyRv, (view, position) -> {
+ coordinatePointLibraryAdapter.toggleSelItemPos(position);
+ coordinatePointNameLibraryAdapter.toggleSelItemPos(position);
+ }));
+ binding.bodyNameRv.addOnItemTouchListener(new SimpleRecyclerViewItemClickListener(binding.bodyNameRv, (view, position) -> {
+ coordinatePointLibraryAdapter.toggleSelItemPos(position);
+ coordinatePointNameLibraryAdapter.toggleSelItemPos(position);
+ }));
+ binding.tvSelAll.setOnClickListener(v -> {
+ if (coordinatePointLibraryAdapter.getItemCount() == coordinatePointLibraryAdapter.getSelItemPos().size()) {
+ coordinatePointLibraryAdapter.resetSelPos();
+ coordinatePointNameLibraryAdapter.resetSelPos();
+ coordinatePointLibraryAdapter.notifyDataSetChanged();
+ coordinatePointNameLibraryAdapter.notifyDataSetChanged();
+ }else {
+ coordinatePointLibraryAdapter.resetSelPos();
+ coordinatePointNameLibraryAdapter.resetSelPos();
+ coordinatePointLibraryAdapter.selAll();
+ coordinatePointNameLibraryAdapter.selAll();
+ coordinatePointLibraryAdapter.notifyDataSetChanged();
+ coordinatePointNameLibraryAdapter.notifyDataSetChanged();
+ }
+ });
+
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ jobId = CachedCurrentJob.currentJobId(projectId);
+ ThreadPoolUtil.executeInMain(() -> {
+ pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle());
+ pagingDataLiveData
+ .observe(this, downloadRecordPagingData -> {
+ PagingDataTransforms.map(downloadRecordPagingData, ExecutorsKt.asExecutor(Dispatchers.getIO()), item -> {
+ return item;
+ });
+ refreshAdapter(downloadRecordPagingData);
+ });
+
+ });
+ });
+
+ binding.etEnterNameCode.addTextChangedListener(new SimpleTextWatcher() {
+ @Override
+ public void afterTextChanged(Editable s) {
+ filterHandler.onFilterStringChanged(s.toString());
+ }
+ });
+
+ binding.pointsLibraryBtnFilter.setOnClickListener(v -> {
+ PointFilterActivity.startFilter(CoordinatePointsLibraryActivity.this, false,
+ filterParameter.getNeedSurvey(), filterParameter.getNeedInput(), filterParameter.getNeedControl(),
+ filterParameter.getDateStart(), filterParameter.getDateEnd(),
+ filterParameter.getNameKey(), filterParameter.getCodeKey(), filterParameter.getRemarkKey(),
+ (needSurvey, needInput, needControl, dateStart, dateEnd, nameKey, codeKey, remarksKey) -> {
+ filterParameter.setNeedSurvey(needSurvey);
+ filterParameter.setNeedInput(needInput);
+ filterParameter.setNeedControl(needControl);
+ filterParameter.setDateStart(dateStart);
+ filterParameter.setDateEnd(dateEnd);
+ filterParameter.setNameKey(nameKey);
+ filterParameter.setCodeKey(codeKey);
+ filterParameter.setRemarkKey(remarksKey);
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ jobId = CachedCurrentJob.currentJobId(projectId);
+ ThreadPoolUtil.executeInMain(() -> {
+ pagingDataLiveData.removeObservers(this);
+ pagingDataLiveData =
+ PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle());
+ pagingDataLiveData.observe(this, downloadRecordPagingData -> {
+ refreshAdapter(downloadRecordPagingData);
+ });
+ });
+ });
+ });
+ });
+
+ binding.pointsLibraryBtnEdit.setOnClickListener(v -> {
+ List selItem = coordinatePointNameLibraryAdapter.getSelItem();
+ if (selItem == null || selItem.size() != 1) {
+ ToastUtils.showShort(R.string.please_select_one_data_item);
+ return;
+ }
+ EditCoordinatePointActivity.start(launcher, CoordinatePointsLibraryActivity.this, selItem.get(0).id);
+ });
+
+ binding.pointsLibraryBtnDelete.setOnClickListener(v -> {
+ List selItem = coordinatePointLibraryAdapter.getSelItem();
+ if (selItem == null || selItem.size() == 0) {
+ ToastUtils.showShort(R.string.please_select_one_data_item);
+ return;
+ }
+ BcDialogExt.create().showMessage(getString(R.string.warning),"确定要删除选择的点吗?",
+ getString(R.string.confirm), getString(R.string.cancel), (baseDialog, view) -> {
+ ThreadPoolUtil.execute(() -> {
+ PointDb.getInstance().delete(selItem);
+ resetSelPos();
+ });
+ return false;
+ }, (baseDialog, view) -> false);
+
+ });
+
+ binding.pointsLibraryBtnExport.setOnClickListener(v -> {
+ ResultsTheExportActivity.start(CoordinatePointsLibraryActivity.this, "导出", false,
+ filterParameter.getNameKey(),
+ filterParameter.getCodeKey(),
+ filterParameter.getRemarkKey(),
+ filterParameter.getDateStart(),
+ filterParameter.getDateEnd());
+ });
+
+ binding.pointsLibraryBtnConfirm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ List selItem = coordinatePointLibraryAdapter.getSelItem();
+ if (selItem == null || selItem.size() != 1) {
+ ToastUtils.showShort(R.string.please_select_one_data_item);
+ return;
+ }
+ PointRecord pointRecord = selItem.get(0);
+
+ // 数据是使用Intent返回
+ Intent intent = new Intent();
+ // 把返回数据存入Intent
+ intent.putExtra(RESULT_ID, pointRecord.id);
+ intent.putExtra(RESULT_NAME, pointRecord.name);
+ intent.putExtra(RESULT_CODE, pointRecord.code);
+ intent.putExtra(RESULT_X, pointRecord.x);
+ intent.putExtra(RESULT_Y, pointRecord.y);
+ intent.putExtra(RESULT_Z, pointRecord.h);
+ intent.putExtra(RESULT_B, pointRecord.latitude);
+ intent.putExtra(RESULT_L, pointRecord.longitude);
+ intent.putExtra(RESULT_H, pointRecord.altitude);
+ // 设置返回数据
+ setResult(RESULT_OK, intent);
+ // 关闭Activity
+ finish();
+ }
+ });
+
+ boolean isSelect = getIntent().getBooleanExtra(KEY_IS_PICK,false);
+
+ if (isSelect) {
+ binding.pointsLibraryBtnConfirm.setVisibility(View.VISIBLE);
+ binding.pointsLibraryBtnEdit.setVisibility(View.GONE);
+ binding.pointsLibraryBtnDelete.setVisibility(View.GONE);
+ binding.pointsLibraryBtnExport.setVisibility(View.GONE);
+ } else {
+ binding.pointsLibraryBtnConfirm.setVisibility(View.GONE);
+ binding.pointsLibraryBtnEdit.setVisibility(View.VISIBLE);
+ binding.pointsLibraryBtnDelete.setVisibility(View.VISIBLE);
+ binding.pointsLibraryBtnExport.setVisibility(View.VISIBLE);
+ }
+ }
+
+ @Override
+ protected void initData() {
+
+ }
+
+ @Override
+ public BubblePopWindow newBubblePopWindow(Context context) {
+ return new BubblePopWindow(this, Arrays.asList(new BubblePopWindow.CustomMenuItem(R.drawable.icon_function_delete, getString(R.string.batch_delete), () -> {
+ List selItemPos = coordinatePointLibraryAdapter.getSelItem();
+ if (selItemPos != null && selItemPos.size() > 0) {
+ BcDialogExt.create().showMessageWithTick(getString(R.string.warning), getString(R.string.want_to_batch_delete_points), getString(R.string.confirm), getString(R.string.cancel), (baseDialog, view) -> {
+ ThreadPoolUtil.execute(() -> {
+ PointDb.getInstance().delete(selItemPos);
+ resetSelPos();
+ });
+ return false;
+ }, (baseDialog, view) -> false);
+ } else {
+ ToastUtils.showShort(getString(R.string.select_batch_delete_data));
+ }
+ })));
+ }
+
+ @Override
+ public boolean isHideHelpDoc() {
+ return true;
+ }
+
+ public final static String KEY_JOB_ID = "JOBID";
+ final static String FORCE_SURVEY_POINT_LIBRARY = "should survey point library";
+
+ public static void start4Result(ActivityResultLauncher launcher, Context context, String jobId) {
+ Intent intent = new Intent(context, CoordinatePointsLibraryActivity.class);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ intent.putExtra(KEY_IS_PICK, false);
+ launcher.launch(intent);
+ }
+
+ public static void start(Context context, String jobId) {
+ Intent intent = new Intent(context, CoordinatePointsLibraryActivity.class);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ intent.putExtra(KEY_IS_PICK, false);
+ context.startActivity(intent);
+ }
+
+ public final ActivityResultLauncher launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
+ if (result != null) {
+ if (result.getResultCode() == LauncherEvent.launcher_update_point_library) {
+// holderInActivity.getViewModel().refreshCurrentPage();
+ }
+ }
+ });
+ public static void start(FragmentActivity fragmentActivity) {
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ String jobId = CachedCurrentJob.currentJobId(projectId);
+ JobRecord jobRecord = JobDb.getInstance()
+ .rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, jobId));
+ if (jobRecord == null) {
+ BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_JOB);
+ return;
+ }
+ Intent intent = new Intent(fragmentActivity, CoordinatePointsLibraryActivity.class);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ fragmentActivity.startActivity(intent);
+ });
+ }
+ private static final String RESULT_ID = "id";
+ private static final String RESULT_NAME = "name";
+ private static final String RESULT_CODE = "code";
+ private static final String RESULT_X = "x";
+ private static final String RESULT_Y = "y";
+ private static final String RESULT_Z = "z";
+ private static final String RESULT_B = "b";
+ private static final String RESULT_L = "l";
+ private static final String RESULT_H = "h";
+
+ private static final String KEY_IS_PICK = "is pick";
+
+ public static void pickPoint(@NonNull FragmentActivity fragmentActivity, @NonNull ICallback callback) {
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ String jobId = CachedCurrentJob.currentJobId(projectId);
+ JobRecord jobRecord = JobDb.getInstance()
+ .rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, jobId));
+ if (jobRecord == null) {
+ BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_JOB);
+ return;
+ }
+ Intent intent = new Intent(fragmentActivity, CoordinatePointsLibraryActivity.class);
+ intent.putExtra(KEY_IS_PICK, true);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ fragmentActivity.runOnUiThread(() -> {
+ ActivityUtils.startActivityForResults(fragmentActivity, intent, result -> {
+ if (result == null) {
+ return;
+ }
+ if (result.getResultCode() != RESULT_OK) {
+ return;
+ }
+ Intent data = result.getData();
+ if (data == null) {
+ return;
+ }
+ callback.onPicked(
+ data.getStringExtra(RESULT_NAME),
+ data.getStringExtra(RESULT_CODE),
+ data.getDoubleExtra(RESULT_X, 0),
+ data.getDoubleExtra(RESULT_Y, 0),
+ data.getDoubleExtra(RESULT_Z, 0),
+ data.getDoubleExtra(RESULT_B, 0),
+ data.getDoubleExtra(RESULT_L, 0),
+ data.getDoubleExtra(RESULT_H, 0));
+ });
+ });
+ });
+ }
+
+ public interface ICallback {
+ void onPicked(String name, String code,
+ double x, double y, double z,
+ double b, double l, double h);
+ }
+
+ public static void pickPoint(@NonNull FragmentActivity fragmentActivity, @NonNull ICallback2 callback) {
+ ThreadPoolUtil.execute(() -> {
+ String projectId = CachedProject.currentProjectId();
+ String jobId = CachedCurrentJob.currentJobId(projectId);
+ JobRecord jobRecord = JobDb.getInstance()
+ .rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, jobId));
+ if (jobRecord == null) {
+ BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_JOB);
+ return;
+ }
+ Intent intent = new Intent(fragmentActivity, CoordinatePointsLibraryActivity.class);
+ intent.putExtra(KEY_IS_PICK, true);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ fragmentActivity.runOnUiThread(() -> {
+ ActivityUtils.startActivityForResults(fragmentActivity, intent, result -> {
+ if (result == null) {
+ return;
+ }
+ if (result.getResultCode() != RESULT_OK) {
+ return;
+ }
+ Intent data = result.getData();
+ if (data == null) {
+ return;
+ }
+ callback.onPicked(
+ data.getStringExtra(RESULT_ID),
+ data.getStringExtra(RESULT_NAME),
+ data.getStringExtra(RESULT_CODE),
+ data.getDoubleExtra(RESULT_X, 0),
+ data.getDoubleExtra(RESULT_Y, 0),
+ data.getDoubleExtra(RESULT_Z, 0),
+ data.getDoubleExtra(RESULT_B, 0),
+ data.getDoubleExtra(RESULT_L, 0),
+ data.getDoubleExtra(RESULT_H, 0));
+ });
+ });
+ });
+ }
+
+
+ public interface ICallback2 {
+ void onPicked(String pointId, String name, String code,
+ double x, double y, double z,
+ double b, double l, double h);
+ }
+
+ @Override
+ protected void onDestroy() {
+ try {
+ binding.bodyNameRv.removeOnScrollListener(leftScrollListener);
+ binding.bodyRv.removeOnScrollListener(rightScrollListener);
+ leftScrollListener = null;
+ rightScrollListener = null;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ super.onDestroy();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointsLibraryActivitySQLiteUtils.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointsLibraryActivitySQLiteUtils.java
new file mode 100644
index 0000000..553b8d8
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/CoordinatePointsLibraryActivitySQLiteUtils.java
@@ -0,0 +1,88 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import static com.bingce.data.database.DBQueryConstant.NOT_DELETED;
+import static com.bingce.data.database.DBQueryConstant.WHERE;
+import static com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants.surveyorPoint;
+
+import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+import androidx.sqlite.db.SimpleSQLiteQuery;
+import androidx.sqlite.db.SupportSQLiteQuery;
+
+import com.bingce.data.BingCeDbConstant;
+import com.bingce.data.database.DBQueryConstant;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants;
+import com.bingce.utils.RoomFilterBuilder;
+import com.bingce.utils.StringUtil;
+import com.bingce.viewmodel.AbstractCoordinatePointsLibraryViewModelKt.FilterParameter;
+
+
+public class CoordinatePointsLibraryActivitySQLiteUtils {
+ @NonNull
+ static SimpleSQLiteQuery getSimpleSQLiteQuery(FilterParameter parameter, StringBuilder stringBuilder, String jobId, int pageIndex, int pageSize, String nameOrCodeStr) {
+ if (parameter == null) {
+ return new SimpleSQLiteQuery(stringBuilder.toString());
+ }
+ stringBuilder.append(WHERE).append(NOT_DELETED);
+ boolean filtered = RoomFilterBuilder.appendEqualsFilter(true, stringBuilder, BingCeDbConstant.DB_KEY_JOB_ID, jobId);
+ filtered = surveyorPoint(filtered, stringBuilder);
+
+ if (!StringUtil.isEmpty(parameter.getNameKey())) {
+ filtered = RoomFilterBuilder.appendLikesFilter(filtered, stringBuilder, PointConstants.COL_NAME, parameter.getNameKey());
+ }
+ if (!StringUtil.isEmpty(parameter.getCodeKey())) {
+ filtered = RoomFilterBuilder.appendLikesFilter(filtered, stringBuilder, PointConstants.COL_CODE, parameter.getCodeKey());
+ }
+ if (!StringUtil.isEmpty(parameter.getRemarkKey())) {
+ filtered = RoomFilterBuilder.appendLikesFilter(filtered, stringBuilder, BingCeDbConstant.DB_KEY_REMARKS, parameter.getRemarkKey());
+ }
+ if (!TextUtils.isEmpty(nameOrCodeStr)){
+ stringBuilder.append(" AND ");
+ stringBuilder.append(" (");
+ stringBuilder.append(RoomFilterBuilder.filterLike(PointConstants.COL_NAME, nameOrCodeStr));
+ RoomFilterBuilder.appendOrLikesFilter(filtered,stringBuilder,PointConstants.COL_CODE,nameOrCodeStr);
+ stringBuilder.append(") ");
+ }
+
+ if (parameter.getDateStart() != null && parameter.getDateEnd() != null) {
+ filtered = RoomFilterBuilder.appendBetweenDate(filtered, stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE,
+ parameter.getDateStart(), parameter.getDateEnd());
+ } else if (parameter.getDateStart() != null) {
+ filtered = RoomFilterBuilder.appendDateFilter(filtered, stringBuilder, parameter.getDateStart(), BingCeDbConstant.DB_KEY_CREATED_DATE, true);
+ } else if (parameter.getDateEnd() != null) {
+ filtered = RoomFilterBuilder.appendDateFilter(filtered, stringBuilder, parameter.getDateEnd(), BingCeDbConstant.DB_KEY_CREATED_DATE, false);
+ }
+
+// if (pageIndex < 0 || pageSize < 0) {
+ RoomFilterBuilder.appendDateOrder(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE, false);
+// } else {
+// if (pageIndex == 0) {
+// RoomFilterBuilder.appendDateOrderAndNumLimit(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE, pageSize, false);
+// } else {
+// RoomFilterBuilder.appendDateOrderAndNumLimitOffset(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE,
+// pageSize, pageSize * pageIndex, false);
+// }
+// }
+
+ return new SimpleSQLiteQuery(stringBuilder.toString());
+ }
+
+
+ static SupportSQLiteQuery countSQLit(String jobId, FilterParameter parameter) {
+ StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.COUNT_FROM)
+ .append(PointConstants.DB_NAME);
+ return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, -1, -1,null);
+ }
+
+ static SupportSQLiteQuery searchSQLit(String jobId, FilterParameter parameter, int pageIndex, int pageSize) {
+ StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.SELECT_FROM)
+ .append(PointConstants.DB_NAME);
+ return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, pageIndex, pageSize,null);
+ }
+ public static SupportSQLiteQuery searchSQLit(String jobId, FilterParameter parameter, String nameOrCode){
+ StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.SELECT_FROM)
+ .append(PointConstants.DB_NAME);
+ return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, -1, -1,nameOrCode);
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/EditCoordinatePointActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/EditCoordinatePointActivity.java
new file mode 100644
index 0000000..20c3285
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/EditCoordinatePointActivity.java
@@ -0,0 +1,153 @@
+package com.project.survey.ui.instrument.setupstation;
+
+
+import static com.project.survey.ui.instrument.setupstation.LauncherEvent.launcher_update_point_library;
+
+import android.content.Context;
+import android.content.Intent;
+import android.text.TextUtils;
+import android.view.View;
+
+import androidx.activity.result.ActivityResultLauncher;
+
+import com.bingce.data.DeprecatedDeviceData;
+import com.bingce.data.DeviceInfoData;
+import com.bingce.data.DeviceInfoDataUtils;
+import com.bingce.data.RTKStatusData;
+import com.bingce.data.TSStatusData;
+import com.bingce.data.database.DBQueryConstant;
+import com.bingce.data.database.JobDb;
+import com.bingce.data.database.PointDb;
+import com.bingce.data.surveyor.designdata.job.JobConstants;
+import com.bingce.data.surveyor.designdata.job.JobRecord;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord;
+import com.bingce.utils.DateUtils;
+import com.bingce.utils.IntentUtil;
+import com.bingce.utils.StringUtil;
+import com.bingce.utils.ThreadPoolUtil;
+import com.bingce.utils.Util;
+import com.project.survey.R;
+import com.project.survey.databinding.ActivityEditCoordinatePointBinding;
+import com.project.survey.ui.base.BaseSurveyNewActivity;
+
+import blankj.utilcode.util.ToastUtils;
+
+public class EditCoordinatePointActivity extends BaseSurveyNewActivity {
+
+ private ActivityEditCoordinatePointBinding binding;
+ private PointRecord pointRecord;
+ private double recordHigh, recordAltitude, recordHr;
+
+ @Override
+ public View getContentView() {
+ binding = ActivityEditCoordinatePointBinding.inflate(getLayoutInflater());
+ return binding.getRoot();
+ }
+
+ @Override
+ protected void initView() {
+
+ binding.editCoordinatePointBtnConfirm.setOnClickListener(v -> {
+
+ if (pointRecord != null) {
+ if (TextUtils.isEmpty(binding.etPointName.getText().toString())) {
+ ToastUtils.showShort("请输入点名");
+ return;
+ }
+ if (TextUtils.isEmpty(binding.etAntennaHeight.getText().toString())) {
+ ToastUtils.showShort(getString(R.string.enter_pole_height));
+ return;
+ }
+ pointRecord.name = binding.etPointName.getText().toString();
+ pointRecord.code = binding.etCode.getText().toString();
+ pointRecord.remarks = binding.etRemark.getText().toString();
+
+ String inputHrString = binding.etAntennaHeight.getText().toString();
+ double inputHrDouble = Double.parseDouble(inputHrString);
+
+ if (pointRecord.deviceInfoData.tsStatusData != null) {
+ TSStatusData pointRecordTSInfo = pointRecord.deviceInfoData.tsStatusData;
+ TSStatusData tsStatusData = new TSStatusData(pointRecordTSInfo.deviceType, pointRecordTSInfo.x, pointRecordTSInfo.y, pointRecordTSInfo.z, inputHrDouble, pointRecordTSInfo.setupStationMethod, pointRecordTSInfo.stationName, pointRecordTSInfo.stationX, pointRecordTSInfo.stationY, pointRecordTSInfo.stationZ, pointRecordTSInfo.hi, pointRecordTSInfo.ha, pointRecordTSInfo.va, pointRecordTSInfo.sd, pointRecordTSInfo.angleDifference, pointRecordTSInfo.powerLevel, pointRecordTSInfo.backSightPoints, pointRecordTSInfo.checkPoints, pointRecordTSInfo.deviceModel, pointRecordTSInfo.deviceSn);
+ DeviceInfoData deviceInfoData = new DeviceInfoData(tsStatusData);
+ pointRecord.deviceInfoData = deviceInfoData;
+ }
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ RTKStatusData pointRecordRTKInfo = pointRecord.deviceInfoData.rtkStatusData;
+ RTKStatusData rtkStatusData = new RTKStatusData(pointRecordRTKInfo.deviceType, pointRecordRTKInfo.workMode, pointRecordRTKInfo.posType, pointRecordRTKInfo.solutionState, pointRecordRTKInfo.latitude, pointRecordRTKInfo.longitude, pointRecordRTKInfo.altitude, pointRecordRTKInfo.x, pointRecordRTKInfo.y, pointRecordRTKInfo.z, pointRecordRTKInfo.isTiltOpen, pointRecordRTKInfo.isTiltEnable, pointRecordRTKInfo.diffAge, pointRecordRTKInfo.pdop, pointRecordRTKInfo.hrms, pointRecordRTKInfo.vrms, inputHrDouble, pointRecordRTKInfo.powerLevel, pointRecordRTKInfo.satTrackNum, pointRecordRTKInfo.satSolutionNum, pointRecordRTKInfo.deviceModel, pointRecordRTKInfo.deviceSn);
+ DeviceInfoData deviceInfoData = new DeviceInfoData(rtkStatusData);
+ pointRecord.deviceInfoData = deviceInfoData;
+ }
+ if (pointRecord.deviceInfoData.deprecatedDeviceData != null) {
+ DeprecatedDeviceData pointRecordDeprecatedInfo = pointRecord.deviceInfoData.deprecatedDeviceData;
+ DeprecatedDeviceData deprecatedDeviceData = new DeprecatedDeviceData(pointRecordDeprecatedInfo.satellite, binding.etAntennaHeight.getText().toString(), pointRecordDeprecatedInfo.electricity, pointRecordDeprecatedInfo.posType, pointRecordDeprecatedInfo.hrms, pointRecordDeprecatedInfo.vrms, pointRecordDeprecatedInfo.posType, pointRecordDeprecatedInfo.diffAge, pointRecordDeprecatedInfo.stationType, pointRecordDeprecatedInfo.solutionState);
+ DeviceInfoData deviceInfoData = new DeviceInfoData(deprecatedDeviceData);
+ pointRecord.deviceInfoData = deviceInfoData;
+ }
+
+ pointRecord.h = recordHigh + recordHr - inputHrDouble;
+ pointRecord.altitude = recordAltitude + recordHr - inputHrDouble;
+
+ ThreadPoolUtil.execute(() -> {
+ PointDb.getInstance().save(pointRecord);
+ runOnUiThread(() -> {
+ setResult(launcher_update_point_library);
+ finish();
+ });
+ });
+ }
+ });
+ }
+
+ @Override
+ protected void initData() {
+ String recordId = IntentUtil.stringExtra(getIntent(), KEY_RECORD);
+ if (StringUtil.isEmpty(recordId)) {
+ finish();
+ ToastUtils.showShort("无记录");
+ return;
+ }
+ ThreadPoolUtil.execute(() -> {
+ pointRecord = PointDb.getInstance()
+ .rawQueryData(DBQueryConstant.findById(PointConstants.DB_NAME, recordId));
+ JobRecord jobRecord = JobDb.getInstance()
+ .rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, pointRecord.jobId));
+ String jobName = jobRecord == null ? getString(R.string.empty) : jobRecord.name;
+
+ recordHigh = pointRecord.h;
+ recordAltitude = pointRecord.altitude;
+ recordHr = Double.parseDouble(DeviceInfoDataUtils.hrString(pointRecord.deviceInfoData));
+
+ setRecord(pointRecord, jobName);
+ });
+ }
+
+ private void setRecord(PointRecord results, String jobName) {
+ setTitle(jobName);
+ binding.etPointName.setText(results.name);
+ binding.etCode.setText(results.code);
+ binding.etAntennaHeight.setText(DeviceInfoDataUtils.hrString(results.deviceInfoData));
+ binding.etRemark.setText(results.remarks);
+ binding.tvX.setText(Util.formatDouble2StringDotAuto(results.x));
+ binding.tvY.setText(Util.formatDouble2StringDotAuto(results.y));
+ binding.tvZ.setText(Util.formatDouble2StringDotAuto(results.h));
+ binding.tvLatitude.setText(Util.radianToDmsDoubleString(Math.toRadians(results.latitude), 6, false));
+ binding.tvLongitude.setText(Util.radianToDmsDoubleString(Math.toRadians(results.longitude), 6, false));
+ binding.tvAltitude.setText(Util.formatDouble2StringDotAuto(results.altitude));
+ binding.tvHrms.setText(DeviceInfoDataUtils.hrmsString(results.deviceInfoData));
+ binding.tvVrms.setText(DeviceInfoDataUtils.vrmsString(results.deviceInfoData));
+ binding.tvPdop.setText(DeviceInfoDataUtils.pdopString(results.deviceInfoData));
+ binding.tvDiffAge.setText(DeviceInfoDataUtils.diffAgeString(this, results.deviceInfoData));
+ binding.tvSolutionStatus.setText(DeviceInfoDataUtils.solutionStateString(results.deviceInfoData));
+ binding.tvSolutionSatelliteNumber.setText(DeviceInfoDataUtils.satelliteString(this, results.deviceInfoData));
+ binding.tvRecordTime.setText(DateUtils.toFull(results.createDate));
+ }
+
+ private static final String KEY_RECORD = "record";
+
+ public static void start(ActivityResultLauncher launcher, Context context, String recordId) {
+ Intent intent = new Intent(context, EditCoordinatePointActivity.class);
+ intent.putExtra(KEY_RECORD, recordId);
+ launcher.launch(intent);
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/FilterHandlerNew.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/FilterHandlerNew.java
new file mode 100644
index 0000000..68d6f3d
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/FilterHandlerNew.java
@@ -0,0 +1,71 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+
+import androidx.annotation.NonNull;
+
+import com.bingce.utils.ThreadPoolUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public final class FilterHandlerNew extends Handler {
+ private static final int MSG_WORK = 0;//过滤关键字发生变化
+ private static final List filterKey = new ArrayList<>();
+ private final AtomicBoolean isWorking = new AtomicBoolean(false);
+ private FilterCallBack iData;
+ public interface FilterCallBack{
+ void fireByKey(String key);
+ }
+
+ public FilterHandlerNew(FilterCallBack callBack) {
+ super(Looper.getMainLooper());
+ this.iData = callBack;
+ }
+ @Override
+ public void handleMessage(@NonNull Message msg) {
+ if (!isWorking.compareAndSet(false, true)) {
+ return;
+ }
+ String targetKey = null;
+ synchronized (this) {
+ if (!filterKey.isEmpty()) {
+ targetKey = filterKey.get(filterKey.size() - 1);
+ filterKey.clear();
+ }
+ }
+ //检测是否有key
+ if (targetKey == null) {
+ isWorking.set(false);
+ return;
+ }
+ //执行数据更新
+ String finalTargetKey = targetKey;
+ ThreadPoolUtil.executeInQueue(() -> {
+ iData.fireByKey(finalTargetKey);
+ //执行完毕后,不管后续是否还有其他消息,都要再检查一下
+ isWorking.set(false);
+ startLoop();
+ });
+ }
+
+ public void onFilterStringChanged(String string) {
+ removeMessages(MSG_WORK);
+ synchronized (this) {
+ filterKey.add(string);
+ startLoop();
+ }
+ }
+
+ /**
+ * 启动消息循环
+ */
+ private void startLoop() {
+ Message msg = Message.obtain();
+ msg.what = MSG_WORK;
+ sendMessageDelayed(msg,400);
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/InstrumentSetFragmentSetupStationTypeUtils.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/InstrumentSetFragmentSetupStationTypeUtils.java
new file mode 100644
index 0000000..f8ae524
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/InstrumentSetFragmentSetupStationTypeUtils.java
@@ -0,0 +1,55 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.content.Intent;
+
+import androidx.fragment.app.Fragment;
+
+import com.afollestad.materialdialogs.MaterialDialog;
+import com.bingce.device.Device;
+import com.bingce.device.enums.DeviceTypeEnum;
+import com.bingce.totalstation.TsConfig;
+import com.bingce.totalstation.enums.SetupStationMethodEnum;
+import com.project.survey.R;
+
+import blankj.utilcode.util.ToastUtils;
+import blankj.utilcode.util.Utils;
+
+
+public class InstrumentSetFragmentSetupStationTypeUtils {
+ /**
+ * 选择设站模式
+ */
+ public static void chooseSetupStationType(Fragment fragment) {
+ if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_RTK) {
+ ToastUtils.showShort("当前仪器模式不支持");
+ return;
+ }
+ new MaterialDialog.Builder(fragment.getActivity())
+ .items(R.array.setup_station_type_with_current)
+ .itemsCallback((dialog, view, which, text) -> {
+ switch (which) {
+ case 0:
+ fragment.startActivity(new Intent(Utils.getApp(), SetupStationCurrentActivity.class));
+ break;
+ case 1:
+ TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.TS_DONE_SKIP);
+ ToastUtils.showShort(R.string.apply_success);
+ break;
+ case 2:
+ TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.TS_DONE_INPUT_INTO_APP);
+ fragment.startActivity(new Intent(Utils.getApp(), SetupStationInputActivity.class));
+ break;
+ case 3:
+ TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.APP_SETUP_KNOWN_BACK_SIGHT);
+ fragment.startActivity(new Intent(Utils.getApp(), SetupStationKnownBackSightActivity.class));
+ break;
+ case 4:
+ TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.APP_SETUP_RESECTION);
+ fragment.startActivity(new Intent(Utils.getApp(), SetupStationResectionActivity.class));
+ }
+ TsConfig.getInstance().save();
+// ((App) Utils.getApp()).lastTsSetupStationType = which - 1;
+// Util.putPreference("lastTsSetupStationType", ((App) Utils.getApp()).lastTsSetupStationType);
+ }).show();
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/LauncherEvent.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/LauncherEvent.java
new file mode 100644
index 0000000..5a090a3
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/LauncherEvent.java
@@ -0,0 +1,14 @@
+package com.project.survey.ui.instrument.setupstation;
+
+public class LauncherEvent {
+ public final static int point_survey_list_change_number = 22;
+ public final static int launcher_delete_point_lib = point_survey_list_change_number + 1;
+ public final static int launcher_results_export = launcher_delete_point_lib + 1;
+ public final static int launcher_add_code_color = launcher_results_export + 1;
+ public final static int launcher_code_style = launcher_add_code_color + 1;
+ public final static int launcher_code_shape_surface = launcher_code_style + 1;
+ public final static int launcher_code_library_update = launcher_code_shape_surface + 1;
+ public final static int launcher_code_apply_id = launcher_code_library_update + 1;
+ public final static int launcher_update_point_library = launcher_code_apply_id + 1;
+ public final static int launcher_update_area_survey = launcher_update_point_library + 1;
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/PointFilterActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/PointFilterActivity.java
new file mode 100644
index 0000000..86c0e40
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/PointFilterActivity.java
@@ -0,0 +1,263 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.content.Intent;
+import android.view.View;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.bingce.dialog.TimePicker;
+import com.bingce.utils.ActivityUtils;
+import com.bingce.utils.IntentUtil;
+import com.project.survey.R;
+import com.project.survey.databinding.ActivityPointFilterBinding;
+import com.project.survey.ui.base.BaseSurveyNewActivity;
+
+import java.util.Calendar;
+import java.util.Date;
+
+
+public class PointFilterActivity extends BaseSurveyNewActivity {
+ private ActivityPointFilterBinding binding;
+ private TimePicker timePicker = null;
+ private long startTime = -1;
+ private long endTime = -1;
+ @Override
+ public View getContentView() {
+ binding = ActivityPointFilterBinding.inflate(getLayoutInflater());
+ return binding.getRoot();
+ }
+
+ private void onTodayClicked() {
+ setBtnDayBackground(0, true);
+ setBtnDayBackground(1, false);
+ setBtnDayBackground(2, false);
+ setCalendarBackground(0, false);
+ setCalendarBackground(1, false);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(new Date());
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 1);
+ startTime = calendar.getTime().getTime();
+ endTime = startTime + 1000 * 60 * 60 * 24 - 2000;//减2s到23:59:59
+ binding.tvStartDate.setText(TimePicker.getTime(new Date(startTime)));
+ binding.tvEndDate.setText(TimePicker.getTime(new Date(endTime)));
+ }
+
+ private void on7DayClicked() {
+ setBtnDayBackground(0, false);
+ setBtnDayBackground(1, true);
+ setBtnDayBackground(2, false);
+ setCalendarBackground(0, false);
+ setCalendarBackground(1, false);
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(new Date());
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ endTime = calendar.getTime().getTime();
+ startTime = endTime - 1000 * 60 * 60 * 24 * 7 + 2000;//加2s,到0:0:1
+ binding.tvStartDate.setText(TimePicker.getTime(new Date(startTime)));
+ binding.tvEndDate.setText(TimePicker.getTime(new Date(endTime)));
+ }
+
+ private void onAllDayClicked() {
+ setBtnDayBackground(0, false);
+ setBtnDayBackground(1, false);
+ setBtnDayBackground(2, true);
+ setCalendarBackground(0, false);
+ setCalendarBackground(1, false);
+
+ startTime = -1;
+ endTime = -1;
+ binding.tvStartDate.setText("");
+ binding.tvEndDate.setText("");
+ }
+
+ @Override
+ protected void initView() {
+ setTitle(getString(R.string.filter));
+ timePicker = new TimePicker(this, R.color.theme_green);
+ boolean forceSurvey = IntentUtil.boolExtra(this, KEY_FORCE_SURVEY);
+ if (forceSurvey) {
+ binding.typeLabel.setVisibility(View.GONE);
+ binding.typeCheckBoxes.setVisibility(View.GONE);
+ }
+ setBtnDayBackground(0, true);
+ binding.tvToday.setOnClickListener(v -> onTodayClicked());
+ binding.tvNearly7Days.setOnClickListener(v -> on7DayClicked());
+ binding.tvAllDays.setOnClickListener(v -> onAllDayClicked());
+ binding.rlStartDate.setOnClickListener(v -> {
+ timePicker.select(instance -> {
+ setBtnDayBackground(0, false);
+ setBtnDayBackground(1, false);
+ setBtnDayBackground(2, false);
+ setCalendarBackground(0, true);
+ binding.tvStartDate.setText(TimePicker.getTime(new Date(instance)));
+ startTime = instance;
+ });
+ });
+ binding.rlEndDate.setOnClickListener(v -> {
+ timePicker.select(binding.tvStartDate.getText().toString(), instance -> {
+ setBtnDayBackground(0, false);
+ setBtnDayBackground(1, false);
+ setBtnDayBackground(2, false);
+ setCalendarBackground(1, true);
+ binding.tvEndDate.setText(TimePicker.getTime(new Date(instance)));
+ endTime = instance;
+ });
+ });
+
+ binding.filterBtnConfirm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent();
+ if (forceSurvey) {
+ intent.putExtra(KEY_NEED_SURVEY, true);
+ } else {
+ intent.putExtra(KEY_NEED_SURVEY, binding.cbSurvey.isChecked());
+ intent.putExtra(KEY_NEED_INPUT, binding.cbInput.isChecked());
+ intent.putExtra(KEY_NEED_CONTROL, binding.cbControl.isChecked());
+ }
+ if (startTime > 0) {
+ intent.putExtra(KEY_DATE_START, startTime);
+ }
+ if (endTime > 0) {
+ intent.putExtra(KEY_DATE_END, endTime);
+ }
+ intent.putExtra(KEY_NAME, binding.etName.getText().toString());
+ intent.putExtra(KEY_CODE, binding.etCode.getText().toString());
+ intent.putExtra(KEY_REMARKS, binding.etRemarks.getText().toString());
+
+ setResult(RESULT_OK, intent);
+ finish();
+ }
+ });
+
+ binding.filterBtnCancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ //除时间外,设置默认值
+ binding.cbSurvey.setChecked(IntentUtil.boolExtra(this, KEY_NEED_SURVEY));
+ binding.cbInput.setChecked(IntentUtil.boolExtra(this, KEY_NEED_INPUT));
+ binding.cbControl.setChecked(IntentUtil.boolExtra(this, KEY_NEED_CONTROL));
+
+ binding.etName.setText(IntentUtil.stringExtra(this, KEY_NAME));
+ binding.etCode.setText(IntentUtil.stringExtra(this, KEY_CODE));
+ binding.etRemarks.setText(IntentUtil.stringExtra(this, KEY_REMARKS));
+ }
+
+ @Override
+ protected void initData() {
+ long start = IntentUtil.longExtra(this, KEY_DATE_START);
+ long end = IntentUtil.longExtra(this, KEY_DATE_END);
+ if (start < 0 && end < 0) {
+ onAllDayClicked();
+ } else {
+ if (end - start == 1000 * 60 * 60 * 24 * 7 - 2000){
+ on7DayClicked();
+ }else {
+ onTodayClicked();
+ }
+ }
+ }
+
+ /**
+ * @param selectedIndex 0--今天,1--7天,2--全部
+ */
+ private void setBtnDayBackground(int selectedIndex, boolean selected) {
+ if (0 == selectedIndex) {
+ binding.tvToday.setBackgroundResource(buttonBg(selected));
+ binding.tvToday.setTextColor(getResources().getColor(buttonColor(selected)));
+ } else if (1 == selectedIndex) {
+ binding.tvNearly7Days.setBackgroundResource(buttonBg(selected));
+ binding.tvNearly7Days.setTextColor(getResources().getColor(buttonColor(selected)));
+ } else if (2 == selectedIndex) {
+ binding.tvAllDays.setBackgroundResource(buttonBg(selected));
+ binding.tvAllDays.setTextColor(getResources().getColor(buttonColor(selected)));
+ }
+ }
+
+ private static int buttonBg(boolean selected) {
+ return selected ?
+ R.drawable.rectangle_radius_5_theme_green_press_full :
+ R.drawable.rectangle_radius_5_theme_green_line;
+ }
+
+ private static int buttonColor(boolean selected) {
+ return selected ? R.color.white : R.color.theme_green;
+ }
+
+ private void setCalendarBackground(int selectedIndex, boolean selected) {
+ if (0 == selectedIndex) {
+ binding.rlStartDate.setBackgroundResource(selected ?
+ R.drawable.rectangle_radius_5_theme_green_line :
+ R.drawable.rectangle_radius_5_theme_gray_line);
+ binding.tvStartDate.setTextColor(getResources().getColor(selected ?
+ R.color.theme_green : R.color.color_575757));
+ binding.ivStartCalendar.setImageResource(selected ?
+ R.mipmap.icon_calendar_green : R.mipmap.icon_calendar_gray);
+ } else if (1 == selectedIndex) {
+ binding.rlEndDate.setBackgroundResource(selected ?
+ R.drawable.rectangle_radius_5_theme_green_line :
+ R.drawable.rectangle_radius_5_theme_gray_line);
+ binding.tvEndDate.setTextColor(getResources().getColor(selected ?
+ R.color.theme_green : R.color.color_575757));
+ binding.ivEndCalendar.setImageResource(selected ?
+ R.mipmap.icon_calendar_green : R.mipmap.icon_calendar_gray);
+ }
+ }
+
+ public interface IFilterCallback {
+ void onFilter(boolean needSurvey, boolean needInput, boolean needControl,
+ Date dateStart, Date dateEnd, String nameKey, String codeKey, String remarksKey);
+ }
+
+ private static final String KEY_FORCE_SURVEY = "FORCE SURVEY";//只在测量点中过滤
+
+ private static final String KEY_NEED_SURVEY = "NEED_SURVEY";
+ private static final String KEY_NEED_INPUT = "NEED INPUT";
+ private static final String KEY_NEED_CONTROL = "NEED CONTROL";
+ private static final String KEY_DATE_START = "date start";
+ private static final String KEY_DATE_END = "date end";
+ private static final String KEY_NAME = "name key";
+ private static final String KEY_CODE = "code key";
+ private static final String KEY_REMARKS = "remarks key";
+
+ public static void startFilter(AppCompatActivity activity, boolean forceSurvey,
+ boolean needSurvey, boolean needInput, boolean needControl,
+ Date dateStart, Date dateEnd, String nameKey, String codeKey, String remarksKey,
+ IFilterCallback callback) {
+ Intent intent2StartActivity = new Intent(activity, PointFilterActivity.class);
+ intent2StartActivity.putExtra(KEY_FORCE_SURVEY, forceSurvey);
+ intent2StartActivity.putExtra(KEY_NEED_SURVEY, needSurvey);
+ intent2StartActivity.putExtra(KEY_NEED_INPUT, needInput);
+ intent2StartActivity.putExtra(KEY_NEED_CONTROL, needControl);
+ intent2StartActivity.putExtra(KEY_DATE_START, dateStart == null ? -1 : dateStart.getTime());
+ intent2StartActivity.putExtra(KEY_DATE_END, dateEnd == null ? -1 : dateEnd.getTime());
+ intent2StartActivity.putExtra(KEY_NAME, nameKey);
+ intent2StartActivity.putExtra(KEY_CODE, codeKey);
+ intent2StartActivity.putExtra(KEY_REMARKS, remarksKey);
+
+ ActivityUtils.startActivityForResults(activity, intent2StartActivity, result -> {
+ if (result == null || result.getData() == null || result.getResultCode() != RESULT_OK) {
+ return;
+ }
+ Intent intent = result.getData();
+ long start = intent.getLongExtra(KEY_DATE_START, -1);
+ long end = intent.getLongExtra(KEY_DATE_END, -1);
+ callback.onFilter(
+ intent.getBooleanExtra(KEY_NEED_SURVEY, false),
+ intent.getBooleanExtra(KEY_NEED_INPUT, false),
+ intent.getBooleanExtra(KEY_NEED_CONTROL, false),
+ start > 0 ? new Date(start) : null,
+ end > 0 ? new Date(end) : null,
+ intent.getStringExtra(KEY_NAME),
+ intent.getStringExtra(KEY_CODE),
+ intent.getStringExtra(KEY_REMARKS));
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/PointRecordDiffCallback2.kt b/app/src/main/java/com/project/survey/ui/instrument/setupstation/PointRecordDiffCallback2.kt
new file mode 100644
index 0000000..7782ce1
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/PointRecordDiffCallback2.kt
@@ -0,0 +1,43 @@
+package com.project.survey.ui.instrument.setupstation
+
+import android.os.Bundle
+import androidx.recyclerview.widget.DiffUtil
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord
+import com.bingce.utils.DateUtils
+import com.bingce.utils.Util
+
+class PointRecordDiffCallback2: DiffUtil.ItemCallback() {
+
+ override fun areItemsTheSame(oldItem: PointRecord, newItem: PointRecord): Boolean {
+ return oldItem.id == newItem.id
+ }
+
+ override fun areContentsTheSame(oldItem: PointRecord, newItem: PointRecord): Boolean {
+ return oldItem == newItem
+ }
+
+ override fun getChangePayload(oldItem: PointRecord, newItem: PointRecord): Any? {
+ val bundle = Bundle()
+
+ if (oldItem.name != newItem.name){
+ bundle.putString("name",newItem.name)
+ }
+ if (oldItem.code != newItem.code){
+ bundle.putString("code",newItem.code)
+ }
+ if (oldItem.x != newItem.x){
+ bundle.putString("x", Util.formatDouble2StringDotAuto(newItem.x))
+ }
+ if (oldItem.y != newItem.y){
+ bundle.putString("y", Util.formatDouble2StringDotAuto(newItem.y))
+ }
+ if (oldItem.h != newItem.h){
+ bundle.putString("h", Util.formatDouble2StringDotAuto(newItem.h))
+ }
+ if (oldItem.createDate.time != newItem.createDate.time){
+ bundle.putString("time", DateUtils.toFull(newItem.createDate))
+ }
+ if (bundle.size() == 0) return null
+ return bundle
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/ResultsExportAdapter.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/ResultsExportAdapter.java
new file mode 100644
index 0000000..699dc2b
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/ResultsExportAdapter.java
@@ -0,0 +1,234 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bingce.surveyor.util.dialog.CustomDialog;
+import com.project.survey.R;
+import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord;
+
+import java.util.List;
+
+
+public class ResultsExportAdapter extends RecyclerView.Adapter {
+ private Context context;
+ private OnItemClickListener onClickListener;
+ private int selectPosition;
+ private List formatRecordList;
+
+ public ResultsExportAdapter(Context context, List formatRecordList, int defPosition) {
+ this.selectPosition = defPosition;
+ this.context = context;
+ this.formatRecordList = formatRecordList;
+ }
+
+ @NonNull
+ @Override
+ public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ ViewHolder holder = new ViewHolder(LayoutInflater.from(
+ context).inflate(R.layout.layout_results_export_item, parent,
+ false));
+ return holder;
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ViewHolder viewHolder, @SuppressLint("RecyclerView") int position) {
+ FormatRecord formatRecord = formatRecordList.get(position);
+
+ if (TextUtils.isEmpty(formatRecord.id)) {
+ viewHolder.iv_format_fixed.setVisibility(View.VISIBLE);
+ } else {
+ viewHolder.iv_format_fixed.setVisibility(View.GONE);
+ }
+ viewHolder.tv_name.setText(formatRecord.format_name);
+
+ StringBuilder stringBuilder = new StringBuilder();
+ String[] split = formatRecord.format_content.split(formatRecord.divided_symbols);
+ if (position == 5) {
+ viewHolder.tv_view_all.setVisibility(View.VISIBLE);
+ } else {
+ viewHolder.tv_view_all.setVisibility(View.GONE);
+ }
+
+ viewHolder.tv_view_all.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ new CustomDialog.Builder(context).setContent(formatRecord.format_content).create().show();
+ }
+ });
+
+ for (int i = 0; i < split.length; i++) {
+ switch (split[i]) {
+ case "点名":
+ split[i] = context.getString(R.string.point_name);
+ break;
+ case "编码":
+ split[i] = "编码";
+ break;
+ case "纬度":
+ split[i] = "纬度";
+ break;
+ case "经度":
+ split[i] = context.getString(R.string.longitude);
+ break;
+ case "大地高":
+ split[i] = "大地高";
+ break;
+ case "天线类型":
+ split[i] = "天线类型";
+ break;
+ case "天线高度":
+ split[i] = context.getString(R.string.antenna_height);
+ break;
+ case "北坐标":
+ split[i] = "北坐标";
+ break;
+ case "东坐标":
+ split[i] = "东坐标";
+ break;
+ case "高程":
+ split[i] = "高程";
+ break;
+ case "解状态":
+ split[i] = "解状态";
+ break;
+ case "解算卫星":
+ split[i] = "解算卫星";
+ break;
+ case "可见卫星":
+ split[i] = "可见卫星";
+ break;
+ case "PDOP":
+ split[i] = "PDOP";
+ break;
+ case "HRMS":
+ split[i] = "HRMS";
+ break;
+ case "VRMS":
+ split[i] = "VRMS";
+ break;
+ case "差分延迟":
+ split[i] = "差分延迟";
+ break;
+ case "采集时间":
+ split[i] = "采集时间";
+ break;
+ case "基站ID":
+ split[i] = "基站ID";
+ break;
+ case "基站纬度":
+ split[i] = "基站纬度";
+ break;
+ case "基站经度":
+ split[i] = "基站经度";
+ break;
+ case "基站距离":
+ split[i] = "基站距离";
+ break;
+ case "惯导测量":
+ split[i] = "惯导测量";
+ break;
+ }
+
+ if (i == split.length - 1) {
+ stringBuilder.append("[" + split[i] + "]");
+ } else {
+ stringBuilder.append("[" + split[i] + "]" + formatRecord.divided_symbols);
+ }
+ }
+
+ viewHolder.tv_content.setText(stringBuilder.toString());
+ switch (formatRecord.file_suffix) {
+ case 0:
+ viewHolder.tv_suffix.setText(".xls");
+ break;
+ case 1:
+ viewHolder.tv_suffix.setText(".dat");
+ break;
+ case 2:
+ viewHolder.tv_suffix.setText(".txt");
+ break;
+ case 3:
+ viewHolder.tv_suffix.setText(".csv");
+ break;
+ case 4:
+ viewHolder.tv_suffix.setText(".dxf");
+ break;
+ case 5:
+ viewHolder.tv_suffix.setText(".kml");
+ break;
+ }
+
+ viewHolder.tv_file_header.setText("文件表头" + ":" + (formatRecord.file_header ? context.getString(R.string.yes) : context.getString(R.string.no)));
+
+ if (formatRecord.angle_format == 0) {
+ viewHolder.tv_angle_formats.setText("度.分秒");
+ } else if (formatRecord.angle_format == 1) {
+ viewHolder.tv_angle_formats.setText("度°分′秒″");
+ } else if (formatRecord.angle_format == 2) {
+ viewHolder.tv_angle_formats.setText("度");
+ } else if (formatRecord.angle_format == 3) {
+ viewHolder.tv_angle_formats.setText("弧度");
+ }
+
+ if (selectPosition == position) {
+ viewHolder.iv_checkbox.setImageResource(R.mipmap.icon_checkbox_select);
+ } else {
+ viewHolder.iv_checkbox.setImageResource(R.mipmap.icon_checkbox_unselect);
+ }
+ viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onClickListener.OnItemClick(position);
+ selectPosition = position;
+ notifyDataSetChanged();
+ }
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return formatRecordList == null ? 0 : formatRecordList.size();
+ }
+
+ public void setUpdateList(int position, List formatRecordList) {
+ this.selectPosition = position;
+ this.formatRecordList = formatRecordList;
+ notifyDataSetChanged();
+ }
+
+ public class ViewHolder extends RecyclerView.ViewHolder {
+ TextView tv_name, tv_content, tv_suffix, tv_file_header, tv_angle_formats, tv_view_all;
+ ImageView iv_checkbox;
+ ImageView iv_format_fixed;
+
+ public ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ iv_format_fixed = itemView.findViewById(R.id.iv_format_fixed);
+ tv_name = itemView.findViewById(R.id.tv_name);
+ tv_content = itemView.findViewById(R.id.tv_content);
+ tv_suffix = itemView.findViewById(R.id.tv_suffix);
+ iv_checkbox = itemView.findViewById(R.id.iv_checkbox);
+ tv_file_header = itemView.findViewById(R.id.tv_file_header);
+ tv_angle_formats = itemView.findViewById(R.id.tv_angle_formats);
+ tv_view_all = itemView.findViewById(R.id.tv_view_all);
+ }
+ }
+
+ public interface OnItemClickListener {
+ void OnItemClick(int position);
+ }
+
+ public void setOnClickListener(OnItemClickListener onClickListener) {
+ this.onClickListener = onClickListener;
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/ResultsTheExportActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/ResultsTheExportActivity.java
new file mode 100644
index 0000000..519ad99
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/ResultsTheExportActivity.java
@@ -0,0 +1,649 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;
+
+import android.content.Context;
+import android.content.Intent;
+import android.view.View;
+
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+import com.bingce.coordlib.model.CoordinateSystem;
+import com.bingce.data.cache.CachedCurrentCoordinateSystem;
+import com.bingce.data.cache.CachedCurrentJob;
+import com.bingce.data.cache.CachedProject;
+import com.bingce.data.database.PointDb;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord;
+
+import com.bingce.surveyor.util.ConstUtils;
+
+import com.bingce.surveyor.util.dialog.CustomDialog;
+import com.bingce.utils.IntentUtil;
+import com.bingce.utils.StringUtil;
+import com.bingce.utils.ThreadPoolUtil;
+import com.bingce.utils.Util;
+import com.hjq.permissions.OnPermissionCallback;
+import com.hjq.permissions.Permission;
+import com.hjq.permissions.XXPermissions;
+import com.project.survey.R;
+import com.project.survey.databinding.ActivityResultsTheExportBinding;
+import com.project.survey.ui.base.BaseSurveyNewActivity;
+import com.project.survey.ui.instrument.setupstation.db.PointSurveyRecord;
+import com.project.survey.ui.instrument.setupstation.db.RecordsFixedDataBase;
+import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord;
+import com.project.survey.util.ExcelUtil;
+import com.project.survey.util.FormatSuffixesUtils;
+import com.project.survey.util.SystemUtils;
+import com.project.survey.util.TxtUtil;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import blankj.utilcode.util.ToastUtils;
+
+
+public class ResultsTheExportActivity extends BaseSurveyNewActivity {
+
+ private ActivityResultsTheExportBinding binding;
+ private final String filterId = SystemUtils.getUUID();
+ private ResultsExportAdapter adapter;
+ private String uid;
+ private final List selectedPoints = new ArrayList<>();
+ private int defPosition = 0;
+ private List formatRecordList = new ArrayList<>();
+ private String title;
+ private boolean isImport;
+ private List fileTypeSuffixList;
+ private String txtContent = "";
+ private final CachedProject currentProject = new CachedProject(this);
+
+ @Override
+ public View getContentView() {
+ binding = ActivityResultsTheExportBinding.inflate(getLayoutInflater());
+ return binding.getRoot();
+ }
+
+ @Override
+ protected void initView() {
+ title = IntentUtil.stringExtra(this, ConstUtils.intentConst.keyActivityTitleName);
+ isImport = IntentUtil.boolExtra(this, ConstUtils.intentConst.keyIsImport);
+ if (StringUtil.isEmpty(title)) {
+ setTitle("导出");
+ } else {
+ setTitle(title);
+ }
+
+ binding.pointsLibraryBtnNewCreate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ AddResultFormatActivity.start(launcher, ResultsTheExportActivity.this, true);
+ }
+ });
+
+ binding.pointsLibraryBtnEdit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (formatRecordList != null && formatRecordList.size() > 0) {
+ if (defPosition == -1) {
+ ToastUtils.showShort(getString(R.string.select_format_want_edit));
+ return;
+ }
+
+ if (StringUtil.isEmpty(formatRecordList.get(defPosition).id)) {
+ ToastUtils.showShort(getString(R.string.default_format_not_allowed_edit_delete));
+ return;
+ }
+
+ AddResultFormatActivity.start(launcher, ResultsTheExportActivity.this, false, uid);
+ }
+ }
+ });
+
+ binding.pointsLibraryBtnDelete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (formatRecordList != null && formatRecordList.size() > 0) {
+ if (defPosition == -1) {
+ ToastUtils.showShort(getString(R.string.select_format_want_delete));
+ return;
+ }
+
+ if (StringUtil.isEmpty(formatRecordList.get(defPosition).id)) {
+ ToastUtils.showShort(getString(R.string.default_format_not_allowed_edit_delete));
+ return;
+ }
+
+ ThreadPoolUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ RecordsFixedDataBase.getInstance().formatRecordDao().deleteById(uid);
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ adapter.notifyItemRemoved(defPosition);
+ formatRecordList.remove(defPosition);
+ defPosition = -1;
+ uid = "";
+ adapter.setUpdateList(defPosition, formatRecordList);
+ }
+ });
+ }
+ });
+ }
+ }
+ });
+
+ binding.pointsLibraryBtnImportExport.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (formatRecordList != null && formatRecordList.size() > 0) {
+ requestStoragePermission();
+ } else {
+ ToastUtils.showShort(getString(R.string.create_new_export_format_first));
+ }
+ }
+ });
+ }
+
+ public void requestStoragePermission() {
+ XXPermissions.with(this)
+ .permission(Permission.MANAGE_EXTERNAL_STORAGE)
+ .request(new OnPermissionCallback() {
+ @Override
+ public void onGranted(List permissions, boolean all) {
+ if (!isImport) {
+ export();
+ } else {
+ importContent();
+ }
+ }
+
+ @Override
+ public void onDenied(List permissions, boolean never) {
+ if (never) {
+ ToastUtils.showShort("请手动授予文件读写权限");
+ // 如果是被永久拒绝就跳转到应用权限系统设置页面
+ XXPermissions.startPermissionActivity(ResultsTheExportActivity.this, permissions);
+ } else {
+ requestStoragePermission();
+ }
+ }
+ });
+ }
+
+ private void export() {
+ //导出功能
+ ThreadPoolUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ if (pointBaseRecordList2Export() != null && pointBaseRecordList2Export().size() > 0) {
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ switch (formatRecordList.get(defPosition).file_suffix) {
+ case 0:
+ ExcelUtil.exportFormat(ExcelUtil.ID_POINT_COORDINATE, ResultsTheExportActivity.this, currentProject, formatRecordList.get(defPosition), filePaths -> {
+ ExcelUtil.exportCoordinator(pointBaseRecordList2Export(), filePaths, ResultsTheExportActivity.this, formatRecordList.get(defPosition));
+ });
+ break;
+ case 1:
+ ExportCassCsvTxt(FormatSuffixesUtils.formatDAT);
+ break;
+ case 2:
+ ExportCassCsvTxt(FormatSuffixesUtils.formatTXT);
+ break;
+ case 3:
+ ExportCassCsvTxt(FormatSuffixesUtils.formatCSV);
+ break;
+ case 4:
+ ExportDxf();
+ break;
+ case 5:
+ ExportKml();
+ break;
+ }
+ }
+ });
+ } else {
+ ToastUtils.showShort(getString(R.string.no_exportable_data));
+ }
+ }
+ });
+ }
+
+ private void importContent() {
+ //导入功能
+ fileTypeSuffixList = new ArrayList<>();
+ String fileFormatName = "";
+ int suffix = formatRecordList.get(defPosition).file_suffix;
+ if (suffix == AddResultFormatActivity.SUFFIX_XLS_NUM) {
+ fileTypeSuffixList = Arrays.asList("xls", "xlsx");
+ fileFormatName = "Excel";
+ } else if (suffix == AddResultFormatActivity.SUFFIX_DAT_NUM) {
+ fileTypeSuffixList = Arrays.asList("dat", "DAT");
+ fileFormatName = "Cass";
+ } else if (suffix == AddResultFormatActivity.SUFFIX_TXT_NUM) {
+ fileTypeSuffixList = Arrays.asList("txt", "TXT");
+ fileFormatName = "Txt";
+ } else if (suffix == AddResultFormatActivity.SUFFIX_CSV_NUM) {
+ fileTypeSuffixList = Arrays.asList("csv", "CSV");
+ fileFormatName = "Csv";
+ }
+ new CustomDialog.Builder(ResultsTheExportActivity.this)
+ .setTitle(getString(R.string.import1) + fileFormatName + getString(R.string.file))
+ .setContent("选择导入的文件,请严格按照以下" + "\n\n[" + formatRecordList.get(defPosition).format_content + "]" + "\n" + "以免出现导入失败等情况!")
+ .setButtonConfirm(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+// SelectFilePathActivity.select(ResultsTheExportActivity.this, fileTypeSuffixList, instance -> {
+// ThreadPoolUtil.execute(() -> {
+// List pointSurveyRecordList = null;
+// String projectId = CachedProject.currentProjectId();
+// if (suffix == AddResultFormatActivity.SUFFIX_XLS_NUM){
+// pointSurveyRecordList = ImportCoordinatorUtils.doImport(formatRecordList.get(defPosition),projectId, ResultsTheExportActivity.this, instance);
+// }else if (suffix == AddResultFormatActivity.SUFFIX_DAT_NUM || suffix == AddResultFormatActivity.SUFFIX_TXT_NUM || suffix == AddResultFormatActivity.SUFFIX_CSV_NUM){
+// pointSurveyRecordList = CassCsvTxtImportUtil.importControlPoint(formatRecordList.get(defPosition),ResultsTheExportActivity.this, instance);
+// }
+// Intent intent = new Intent();
+// intent.putExtra(ConstUtils.intentConst.keyCoordinatePointsLibrary,new Gson().toJson(pointSurveyRecordList));
+// setResult(LauncherEvent.launcher_coordinate_point_library,intent);
+// finish();
+// });
+// });
+ }
+ }).create().show();
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == XXPermissions.REQUEST_CODE) {
+ if (XXPermissions.isGranted(this, Permission.MANAGE_EXTERNAL_STORAGE)) {
+ if (!isImport) {
+ export();
+ } else {
+ importContent();
+ }
+ } else {
+ ToastUtils.showLong(getString(R.string.open_read_write_permissions));
+ }
+ }
+ }
+
+ private void ExportKml() {
+ ThreadPoolUtil.execute(() -> {
+ List pointSurveyRecordList = pointBaseRecordList2Export();
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ if (pointSurveyRecordList != null && pointSurveyRecordList.size() > 0) {
+ String txtContentHead = "\n" +
+ "\n" +
+ "\n" +
+ "" + currentProject.currentProject().name + "\n" +
+ "\t1\n" +
+ "\t";
+
+ for (int i = 0; i < pointSurveyRecordList.size(); i++) {
+ txtContent += "\n" +
+ "\t" + pointSurveyRecordList.get(i).pointName + "\n" +
+ "\t#khStyle\n" +
+ "\t\n" +
+ "\t\n" +
+ "\t\n" +
+ "\t" + pointSurveyRecordList.get(i).planeN + "," + pointSurveyRecordList.get(i).planeE + "," + pointSurveyRecordList.get(i).altitude + "\n" +
+ "\t\n" +
+ "\t\n" +
+ "\t";
+ }
+
+ String txtContentFoot = "\n" +
+ "";
+
+ TxtUtil.exportFormat(ResultsTheExportActivity.this, txtContentHead + txtContent + txtContentFoot, FormatSuffixesUtils.formatKML, currentProject);
+ } else {
+ ToastUtils.showShort(getString(R.string.no_exportable_data));
+ }
+ }
+ });
+ });
+ }
+
+ private void ExportDxf() {
+ ThreadPoolUtil.execute(() -> {
+ List pointSurveyRecordList = pointBaseRecordList2Export();
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ if (pointSurveyRecordList != null && pointSurveyRecordList.size() > 0) {
+ DxfUtil.exportFormat(ResultsTheExportActivity.this, currentProject, pointSurveyRecordList);
+ } else {
+ ToastUtils.showShort(getString(R.string.no_exportable_data));
+ }
+ }
+ });
+ });
+ }
+
+ private void ExportCassCsvTxt(String formatDat) {
+ ThreadPoolUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ CoordinateSystem coordinateSystem = CachedCurrentCoordinateSystem.currentCoordinateSystem();
+ List pointBaseRecordList = pointBaseRecordList2Export();
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ CassCsvTxtExportUtil.exportFormat(ResultsTheExportActivity.this, formatDat, currentProject, formatRecordList.get(defPosition), pointBaseRecordList, coordinateSystem);
+ }
+ });
+ }
+ });
+ }
+
+ private List pointBaseRecordList2Export() {
+ if (selectedPoints.isEmpty()) {
+ String jobId = IntentUtil.stringExtra(getIntent(), KEY_JOB_ID);
+ String filterName = IntentUtil.stringExtra(getIntent(), KEY_NAME);
+ String filterCode = IntentUtil.stringExtra(getIntent(), KEY_CODE);
+ String filterRemark = IntentUtil.stringExtra(getIntent(), KEY_REMARK);
+ Date filterStart = new Date(IntentUtil.longExtra(getIntent(), KEY_START_DATE));
+ Date filterEnd = new Date(IntentUtil.longExtra(getIntent(), KEY_END_DATE));
+ List results = PointDb.getInstance().rawQueryListData(PointConstants.findPointSurveyByJobNameCodeRemarkDate(jobId, filterName, filterCode, filterRemark, filterStart, filterEnd));
+ if (results != null) {
+ for (int i = 0; i < results.size(); i++) {
+ PointRecord pointRecord = results.get(i);
+ if (pointRecord == null) {
+ continue;
+ }
+ PointSurveyRecord pointSurveyRecord = new PointSurveyRecord(pointRecord);
+ pointSurveyRecord.pointId = pointRecord.id;
+ pointSurveyRecord.pointName = pointRecord.name;
+ pointSurveyRecord.code = pointRecord.code;
+ pointSurveyRecord.planeN = pointRecord.x;
+ pointSurveyRecord.planeE = pointRecord.y;
+ pointSurveyRecord.planeH = pointRecord.h;
+ pointSurveyRecord.latitude = pointRecord.latitude;
+ pointSurveyRecord.longitude = pointRecord.longitude;
+ pointSurveyRecord.altitude = pointRecord.altitude;
+ pointSurveyRecord.originalLatitude = pointRecord.originalLatitude;
+ pointSurveyRecord.originalLongitude = pointRecord.originalLongitude;
+ pointSurveyRecord.originalAltitude = pointRecord.originalAltitude;
+ pointSurveyRecord.remarks = pointRecord.remarks;
+ pointSurveyRecord.createdAt = pointRecord.createDate;
+ if (pointRecord.deviceInfoData.rtkStatusData == null && pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.solutionState = "";
+ } else if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.solutionState = pointRecord.deviceInfoData.rtkStatusData.solutionState;
+ } else {
+ pointSurveyRecord.solutionState = pointRecord.deviceInfoData.deprecatedDeviceData.solutionState;
+ }
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.satelliteNum = pointRecord.deviceInfoData.rtkStatusData.satSolutionNum;
+ } else {
+ if (pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.satelliteNum = -1;
+ } else {
+ if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.satellite)) {
+ pointSurveyRecord.satelliteNum = Integer.parseInt(pointRecord.deviceInfoData.deprecatedDeviceData.satellite);
+ } else {
+ pointSurveyRecord.satelliteNum = -1;
+ }
+ }
+ }
+ pointSurveyRecord.satelliteTrackNum = pointRecord.deviceInfoData.rtkStatusData != null ? pointRecord.deviceInfoData.rtkStatusData.satTrackNum : -1;
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.pdop = pointRecord.deviceInfoData.rtkStatusData.pdop;
+ } else {
+ if (pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.pdop = -1;
+ } else {
+ if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.pdop)) {
+ pointSurveyRecord.pdop = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.pdop);
+ } else {
+ pointSurveyRecord.pdop = -1;
+ }
+ }
+ }
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.hrms = pointRecord.deviceInfoData.rtkStatusData.hrms;
+ } else {
+ if (pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.hrms = -1;
+ } else {
+ if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.hrms)) {
+ pointSurveyRecord.hrms = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.hrms);
+ } else {
+ pointSurveyRecord.hrms = -1;
+ }
+ }
+ }
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.vrms = pointRecord.deviceInfoData.rtkStatusData.vrms;
+ } else {
+ if (pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.vrms = -1;
+ } else {
+ if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.vrms)) {
+ pointSurveyRecord.vrms = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.vrms);
+ } else {
+ pointSurveyRecord.vrms = -1;
+ }
+ }
+ }
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.diffAge = pointRecord.deviceInfoData.rtkStatusData.diffAge;
+ } else {
+ if (pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.diffAge = -1;
+ } else {
+ if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.diffAge)) {
+ pointSurveyRecord.diffAge = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.diffAge);
+ } else {
+ pointSurveyRecord.diffAge = -1;
+ }
+ }
+ }
+ pointSurveyRecord.isTiltEnable = pointRecord.deviceInfoData.rtkStatusData != null && pointRecord.deviceInfoData.rtkStatusData.isTiltEnable;
+ if (pointRecord.deviceInfoData.rtkStatusData != null) {
+ pointSurveyRecord.antennaHeight = pointRecord.deviceInfoData.rtkStatusData.poleHeight;
+ } else {
+ if (pointRecord.deviceInfoData.deprecatedDeviceData == null) {
+ pointSurveyRecord.antennaHeight = -1;
+ } else {
+ if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.hr)) {
+ pointSurveyRecord.antennaHeight = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.hr);
+ } else {
+ pointSurveyRecord.antennaHeight = -1;
+ }
+ }
+ }
+ selectedPoints.add(pointSurveyRecord);
+ }
+ }
+ }
+ return selectedPoints;
+ }
+
+ @Override
+ protected void initData() {
+ ThreadPoolUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ formatRecordList = RecordsFixedDataBase.getInstance().formatRecordDao().findAll();
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ if (formatRecordList != null && formatRecordList.size() > 0) {
+ uid = formatRecordList.get(defPosition).id;
+ } else {
+ uid = "";
+ }
+
+ FormatRecord formatRecordCass = new FormatRecord();
+ formatRecordCass.id = "";
+ formatRecordCass.format_name = "Cass";
+ formatRecordCass.format_content = "点名,编码,东坐标,北坐标,高程";
+ formatRecordCass.divided_symbols = ",";
+ formatRecordCass.file_suffix = 1;
+ formatRecordCass.file_header = false;
+ formatRecordCass.angle_format = 0;
+ formatRecordList.add(0, formatRecordCass);
+
+ FormatRecord formatRecordPlane = new FormatRecord();
+ formatRecordPlane.id = "";
+ formatRecordPlane.format_name = getString(R.string.plane_coordinate);
+ formatRecordPlane.format_content = "点名,北坐标,东坐标,高程,编码";
+ formatRecordPlane.divided_symbols = ",";
+ formatRecordPlane.file_suffix = 3;
+ formatRecordPlane.file_header = false;
+ formatRecordPlane.angle_format = 0;
+ formatRecordList.add(1, formatRecordPlane);
+
+ FormatRecord formatRecordLatLon = new FormatRecord();
+ formatRecordLatLon.id = "";
+ formatRecordLatLon.format_name = getString(R.string.lat_lon_coordinate);
+ formatRecordLatLon.format_content = "点名,纬度,经度,大地高,编码";
+ formatRecordLatLon.divided_symbols = ",";
+ formatRecordLatLon.file_suffix = 3;
+ formatRecordLatLon.file_header = false;
+ formatRecordLatLon.angle_format = 0;
+ formatRecordList.add(2, formatRecordLatLon);
+
+ FormatRecord formatRecordDxf = new FormatRecord();
+ formatRecordDxf.id = "";
+ formatRecordDxf.format_name = "dxf";
+ formatRecordDxf.format_content = "点名,经度,纬度,大地高";
+ formatRecordDxf.divided_symbols = ",";
+ formatRecordDxf.file_suffix = 4;
+ formatRecordDxf.file_header = false;
+ formatRecordDxf.angle_format = 0;
+ formatRecordList.add(3, formatRecordDxf);
+
+ FormatRecord formatRecordKml = new FormatRecord();
+ formatRecordKml.id = "";
+ formatRecordKml.format_name = "google kml";
+ formatRecordKml.format_content = "点名,北坐标,东坐标,高程";
+ formatRecordKml.divided_symbols = ",";
+ formatRecordKml.file_suffix = 5;
+ formatRecordKml.file_header = false;
+ formatRecordKml.angle_format = 0;
+ formatRecordList.add(4, formatRecordKml);
+
+ FormatRecord formatRecordAllCsv = new FormatRecord();
+ formatRecordAllCsv.id = "";
+ formatRecordAllCsv.format_name = getString(R.string.format_original_data);
+ formatRecordAllCsv.format_content = "点名,编码,纬度,经度,大地高,天线类型,天线高,北坐标,东坐标,高程,解状态,解算卫星,可见卫星,PDOP,HRMS,VRMS,差分延迟,备注,采集时间,惯导测量";
+ formatRecordAllCsv.divided_symbols = ",";
+ formatRecordAllCsv.file_suffix = 3;
+ formatRecordAllCsv.file_header = false;
+ formatRecordAllCsv.angle_format = 0;
+ formatRecordList.add(5, formatRecordAllCsv);
+
+ adapter = new ResultsExportAdapter(ResultsTheExportActivity.this, formatRecordList, defPosition);
+ LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ResultsTheExportActivity.this);
+ linearLayoutManager.setOrientation(VERTICAL);
+ binding.recyclerView.setLayoutManager(linearLayoutManager);
+ binding.recyclerView.setAdapter(adapter);
+
+ adapter.setOnClickListener(new ResultsExportAdapter.OnItemClickListener() {
+ @Override
+ public void OnItemClick(int position) {
+ defPosition = position;
+ uid = formatRecordList.get(position).id;
+ }
+ });
+ }
+ });
+ }
+ });
+ }
+
+ public final ActivityResultLauncher launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
+ if (result != null) {
+ switch (result.getResultCode()) {
+ case LauncherEvent.launcher_results_export:
+ FormatRecord formatRecord = new Gson().fromJson(result.getData().getStringExtra(ConstUtils.intentConst.keyResultFormatRecord), FormatRecord.class);
+ if (result.getData().getBooleanExtra(ConstUtils.intentConst.keyIsNewCreateResultFormat, false)) {
+ formatRecordList.add(formatRecord);
+ if (formatRecordList != null && formatRecordList.size() > 0) {
+ adapter.setUpdateList(formatRecordList.size() - 1, formatRecordList);
+ defPosition = formatRecordList.size() - 1;
+ } else {
+ adapter.setUpdateList(0, formatRecordList);
+ defPosition = 0;
+ }
+ uid = formatRecord.id;
+ } else {
+ formatRecordList.set(defPosition, formatRecord);
+ adapter.setUpdateList(defPosition, formatRecordList);
+ }
+ break;
+ }
+ }
+ });
+
+ /**
+ * 根据成果导出的格式,经纬度进行转换导出
+ *
+ * @param angle_format_type
+ * @param l
+ * @return
+ */
+ private static String converAngleFormat(int angle_format_type, double l) {
+ if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D_MS) {
+ //度.分秒
+ return Util.radianToDmsDoubleString(Math.toRadians(l), 6, false);
+ } else if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D_M_S) {
+ //度°分′秒″
+ return Util.radianToDmsString(Math.toRadians(l), 6, true);
+ } else if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D) {
+ //度
+ return Util.formatDouble2String(l, 6);
+ } else {
+ //弧度
+ return Util.formatDouble2String(Math.toRadians(l), 6);
+ }
+ }
+
+ private final static String KEY_JOB_ID = "JOBID";
+ private final static String KEY_NAME = "KEYNAME";
+ private final static String KEY_CODE = "KEYCODE";
+ private final static String KEY_REMARK = "KEYREMARK";
+ private final static String KEY_START_DATE = "KEYSTARTDATE";
+ private final static String KEY_END_DATE = "KEYENDDATE";
+
+ public static void start(Context context, String title, Boolean isImport, String name, String code, String remark, Date startDate, Date endDate) {
+ ThreadPoolUtil.execute(() -> {
+ String jobId = CachedCurrentJob.currentJobId(CachedProject.currentProjectId());
+ Intent intent = new Intent(context, ResultsTheExportActivity.class);
+ intent.putExtra(ConstUtils.intentConst.keyActivityTitleName, title);
+ intent.putExtra(ConstUtils.intentConst.keyIsImport, isImport);
+ intent.putExtra(KEY_JOB_ID, jobId);
+ intent.putExtra(KEY_NAME, name);
+ intent.putExtra(KEY_CODE, code);
+ intent.putExtra(KEY_REMARK, remark);
+ intent.putExtra(KEY_START_DATE, startDate == null ? null : startDate.getTime());
+ intent.putExtra(KEY_END_DATE, endDate == null ? SystemUtils.getSimpleDateTimeStamp() : endDate.getTime());
+ context.startActivity(intent);
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/SetupStationCurrentActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/SetupStationCurrentActivity.java
new file mode 100644
index 0000000..028a109
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/SetupStationCurrentActivity.java
@@ -0,0 +1,13 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import com.bingce.device.ui.totalstation.AbstractSetupStationCurrentActivity;
+import com.project.survey.App;
+
+import blankj.utilcode.util.Utils;
+
+public class SetupStationCurrentActivity extends AbstractSetupStationCurrentActivity {
+ @Override
+ protected boolean isThemeDark() {
+ return ((App) Utils.getApp()).isThemeDark;
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/SetupStationInputActivity.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/SetupStationInputActivity.java
new file mode 100644
index 0000000..4ab4b90
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/SetupStationInputActivity.java
@@ -0,0 +1,73 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import com.afollestad.materialdialogs.MaterialDialog;
+import com.bingce.AppChannel;
+import com.bingce.device.ui.totalstation.AbstractSetupStationInputActivity;
+import com.project.survey.App;
+import com.project.survey.R;
+
+
+import blankj.utilcode.util.Utils;
+
+public class SetupStationInputActivity extends AbstractSetupStationInputActivity {
+ @Override
+ protected void selectPoint() {
+ String[] titles = new String[]{
+ getString(R.string.point_survey_point_library),
+ getString(R.string.staking_point_library)};
+ new MaterialDialog.Builder(this)
+ .title(R.string.data_source)
+ .items(titles)
+ .itemsCallback((dialog, itemView, which, text) -> {
+ switch (which) {
+ case 0:
+ CoordinatePointsLibraryActivity.pickPoint(this, (name, code, x, y, z, b, l, h) -> {
+ onPicked(name, x, y, z);
+ });
+ break;
+ case 1:
+ StakingNewJobActivity.pickPoint(this, (name, x, y, z) -> {
+ onPicked(name, x, y, z);
+ });
+ break;
+ }
+ }).show();
+ }
+
+
+ @Override
+ protected boolean isThemeDark() {
+ return ((App) Utils.getApp()).isThemeDark;
+ }
+
+ @Override
+ protected void hideSoftKey() {
+ BingCeBaseSurveyPresenter.hideSoftKey();
+ }
+
+ @Override
+ protected void speak(String string) {
+ BingCeBaseSurveyPresenter.speak(string);
+ }
+
+ @Override
+ protected void updateLastRTKLocation() {
+ BingCeBaseSurveyPresenter.updateLastRTKLocation();
+ }
+
+ @Override
+ protected boolean checkRegister() {
+ return BingCeBaseSurveyPresenter.checkRegister();
+ }
+
+ @Override
+ protected int volumeUpAction() {
+ return BingCeBaseSurveyPresenter.volumeUpAction();
+ }
+
+ @Override
+ protected int volumeDownAction() {
+ return BingCeBaseSurveyPresenter.volumeDownAction();
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/SimpleRecyclerViewItemClickListener.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/SimpleRecyclerViewItemClickListener.java
new file mode 100644
index 0000000..189ecf5
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/SimpleRecyclerViewItemClickListener.java
@@ -0,0 +1,118 @@
+package com.project.survey.ui.instrument.setupstation;
+
+import android.graphics.Rect;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.IdRes;
+import androidx.core.view.GestureDetectorCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * description: recyclerView的单击与长按事件监听器
+ * version:
+ * state: done
+ */
+public class SimpleRecyclerViewItemClickListener extends RecyclerView.SimpleOnItemTouchListener {
+
+ private OnItemClickListener mListener;
+ private GestureDetectorCompat mGestureDetector;
+ private RecyclerView mRecyclerView;
+ private int[] ids;
+
+ public SimpleRecyclerViewItemClickListener(RecyclerView rv, OnItemClickListener listener, @IdRes int... ids) {
+ this.mListener = listener;
+ this.mRecyclerView = rv;
+ this.ids = ids;
+ }
+ public SimpleRecyclerViewItemClickListener(RecyclerView rv, OnItemClickListener listener) {
+ this.mListener = listener;
+ this.mRecyclerView = rv;
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
+ if (mGestureDetector == null) {
+ initGestureDetector(mRecyclerView);
+ }
+ return mGestureDetector.onTouchEvent(e);// 把事件交给GestureDetector处理
+ }
+
+ private Rect getRelativeRectTo(RecyclerView recyclerView,View otherView,View view){
+ Rect rootRect = new Rect();
+ recyclerView.getGlobalVisibleRect(rootRect);
+ Rect otherRect = new Rect();
+ otherView.getGlobalVisibleRect(otherRect);
+ Rect rect = new Rect();
+ view.getGlobalVisibleRect(rect);
+ int relativeLeft = rect.left - otherRect.left;
+ int relativeTop = rect.top - rootRect.top;
+ int relativeRight = relativeLeft + (rect.right - rect.left);
+ int relativeBottom = relativeTop + (rect.bottom - rect.top);
+ return new Rect(relativeLeft, relativeTop, relativeRight, relativeBottom);
+ }
+ /**
+ * 初始化GestureDetector
+ */
+ private void initGestureDetector(final RecyclerView recyclerView) {
+ mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new GestureDetector.SimpleOnGestureListener() { // 这里选择SimpleOnGestureListener实现类,可以根据需要选择重写的方法
+
+ /**
+ * 单击事件
+ */
+ @Override
+ public boolean onSingleTapUp(MotionEvent e) {
+ View childView = recyclerView.findChildViewUnder(e.getX(), e.getY());
+ if (childView != null && mListener != null) {
+ if (childView instanceof ViewGroup && ids != null && ids.length != 0) {
+ for (int id:ids) {
+ if (getRelativeRectTo(recyclerView,childView, childView.findViewById(id)).contains((int) e.getX(), (int) e.getY())) {
+ mListener.onItemClick(childView.findViewById(id), recyclerView.getChildLayoutPosition(childView));
+ return false;
+ }
+ }
+ }
+ mListener.onItemClick(childView, recyclerView.getChildLayoutPosition(childView));
+ }
+ return false;
+ }
+
+ /**
+ * 长按事件
+ */
+ @Override
+ public void onLongPress(MotionEvent e) {
+ View childView = recyclerView.findChildViewUnder(e.getX(), e.getY());
+ if (childView != null && mListener != null) {
+ if (childView instanceof ViewGroup && ids != null && ids.length != 0) {
+ for (int id:ids) {
+ if (getRelativeRectTo(recyclerView,childView, childView.findViewById(id)).contains((int) e.getX(), (int) e.getY())) {
+ mListener.onItemLongClick(childView.findViewById(id), recyclerView.getChildLayoutPosition(childView));
+ return;
+ }
+ }
+ }
+ mListener.onItemLongClick(childView, recyclerView.getChildLayoutPosition(childView));
+ }
+ }
+
+ });
+
+ }
+
+ public interface OnItemClickListener {
+
+ /**
+ * 当ItemView的单击事件触发时调用
+ */
+ void onItemClick(View view, int position);
+
+ /**
+ * 当ItemView的长按事件触发时调用
+ */
+ default void onItemLongClick(View view, int position){};
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/PointSurveyRecord.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/PointSurveyRecord.java
new file mode 100644
index 0000000..fe669e3
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/PointSurveyRecord.java
@@ -0,0 +1,155 @@
+package com.project.survey.ui.instrument.setupstation.db;
+
+import androidx.annotation.NonNull;
+import androidx.room.ColumnInfo;
+import androidx.room.PrimaryKey;
+
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord;
+
+import java.util.Date;
+
+public class PointSurveyRecord {
+ @PrimaryKey
+ @NonNull
+ @ColumnInfo(name = "pointId")
+ public String pointId;
+
+ @ColumnInfo(name = "workId")
+ public String workId;
+
+ @ColumnInfo(name = "pointType")
+ public int pointType;
+
+ @ColumnInfo(name = "pointName")
+ public String pointName;
+
+ @ColumnInfo(name = "format")//坐标格式
+ public int format;
+
+ @ColumnInfo(name = "latitude")
+ public double latitude;
+
+ @ColumnInfo(name = "longitude")
+ public double longitude;
+
+ @ColumnInfo(name = "altitude")
+ public double altitude;
+
+ @ColumnInfo(name = "originalLatitude")
+ public double originalLatitude;
+
+ @ColumnInfo(name = "originalLongitude")
+ public double originalLongitude;
+
+ @ColumnInfo(name = "originalAltitude")
+ public double originalAltitude;
+
+ @ColumnInfo(name = "planeN")
+ public double planeN;
+
+ @ColumnInfo(name = "planeE")
+ public double planeE;
+
+ @ColumnInfo(name = "planeH")
+ public double planeH;
+
+ @ColumnInfo(name = "code")//编码
+ public String code;
+
+ @ColumnInfo(name = "remarks")//备注
+ public String remarks;
+
+ @ColumnInfo(name = "createdAt")//创建或保存时间
+ public Date createdAt;
+
+ @ColumnInfo(name = "timeStamp")//时间戳(创建或保存时间)
+ public long timeStamp;
+
+ @ColumnInfo(name = "projectId")
+ public String projectId;
+
+ @ColumnInfo(name = "hr")//棱镜高
+ public double hr;
+
+ @ColumnInfo(name = "electricity")//仪器电量
+ public int electricity;
+
+ @ColumnInfo(name = "pdop")
+ public double pdop;
+
+ @ColumnInfo(name = "hrms")
+ public double hrms;
+
+ @ColumnInfo(name = "vrms")
+ public double vrms;
+
+ @ColumnInfo(name = "posType")//解状态 id(仪器返回的id)
+ public int posType;
+
+ @ColumnInfo(name = "diffAge")//延迟(差分延时)
+ public double diffAge;
+
+ @ColumnInfo(name = "sysMode")//系统模式
+ public String sysMode;
+
+ @ColumnInfo(name = "isSelect")//是否可选(非必传)
+ public boolean isSelect;
+
+ @ColumnInfo(name = "antennaHeight")//天线高度
+ public double antennaHeight;
+
+ @ColumnInfo(name = "antennaType")//天线类型id
+ public int antennaType;
+
+ @ColumnInfo(name = "antennaTypeName")//天线类型name
+ public String antennaTypeName;
+
+ @ColumnInfo(name = "solutionState")//解状态 name(名称)
+ public String solutionState;
+
+ @ColumnInfo(name = "satelliteNum")//解算卫星数量
+ public int satelliteNum;
+
+ @ColumnInfo(name = "satelliteTrackNum")//可见卫星数量
+ public int satelliteTrackNum;
+
+ @ColumnInfo(name = "siteId")//基站id
+ public String siteId;
+
+ @ColumnInfo(name = "siteLatitude")//基站纬度
+ public double siteLatitude;
+
+ @ColumnInfo(name = "siteLongitude")//基站经度
+ public double siteLongitude;
+
+ @ColumnInfo(name = "siteDistance2D")//基站距离(平面)
+ public double siteDistance2D;
+
+ @ColumnInfo(name = "isTiltEnable")//惯导是否可用
+ public boolean isTiltEnable;
+
+ public final PointRecord record;
+
+ public PointSurveyRecord(PointRecord record) {
+ this.record = record;
+ }
+
+ public static PointSurveyRecord convert(PointRecord pointRecord){
+ PointSurveyRecord pointSurveyRecord = new PointSurveyRecord(pointRecord);
+ pointSurveyRecord.pointId = pointRecord.id;
+ pointSurveyRecord.pointName = pointRecord.name;
+ pointSurveyRecord.code = pointRecord.code;
+ pointSurveyRecord.remarks = pointRecord.remarks;
+ pointSurveyRecord.planeN = pointRecord.x;
+ pointSurveyRecord.planeE = pointRecord.y;
+ pointSurveyRecord.planeH = pointRecord.h;
+ pointSurveyRecord.latitude = pointRecord.latitude;
+ pointSurveyRecord.longitude = pointRecord.longitude;
+ pointSurveyRecord.altitude = pointRecord.altitude;
+ pointSurveyRecord.originalLatitude = pointRecord.originalLatitude;
+ pointSurveyRecord.originalLongitude = pointRecord.originalLongitude;
+ pointSurveyRecord.originalAltitude = pointRecord.originalAltitude;
+ pointSurveyRecord.createdAt = pointRecord.createDate;
+ return pointSurveyRecord;
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/RecordsFixedDataBase.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/RecordsFixedDataBase.java
new file mode 100644
index 0000000..54fea4e
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/RecordsFixedDataBase.java
@@ -0,0 +1,49 @@
+package com.project.survey.ui.instrument.setupstation.db;
+
+import android.content.Context;
+
+import androidx.room.Database;
+import androidx.room.Room;
+import androidx.room.RoomDatabase;
+
+
+import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord;
+import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecordDao;
+
+import blankj.utilcode.util.Utils;
+
+@Database(entities = {
+ FormatRecord.class
+}, version = 1)
+
+public abstract class RecordsFixedDataBase extends RoomDatabase {
+ public static final String DB_NAME = "records_fixed.db";
+ public abstract FormatRecordDao formatRecordDao();
+
+ private static RecordsFixedDataBase instance = null;
+
+ public static void reset() {
+ synchronized (RecordsFixedDataBase.class) {
+ Context applicationContext = Utils.getApp().getApplicationContext();
+ //2.创建数据实例
+ instance = readInstance(applicationContext);
+ }
+ }
+
+ public static RecordsFixedDataBase readInstance(Context context) {
+ return Room.databaseBuilder(
+ context.getApplicationContext(),
+ RecordsFixedDataBase.class,
+ DB_NAME)
+ .enableMultiInstanceInvalidation()
+ .fallbackToDestructiveMigrationOnDowngrade()
+ .build();
+ }
+
+ public static RecordsFixedDataBase getInstance() {
+ if (instance == null) {
+ reset();
+ }
+ return instance;
+ }
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatConstants.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatConstants.java
new file mode 100644
index 0000000..b4552ae
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatConstants.java
@@ -0,0 +1,5 @@
+package com.project.survey.ui.instrument.setupstation.db.resultformat;
+
+public class FormatConstants {
+ public static final String DB_NAME = "LocalResultExportFormat";
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatRecord.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatRecord.java
new file mode 100644
index 0000000..2409c24
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatRecord.java
@@ -0,0 +1,38 @@
+package com.project.survey.ui.instrument.setupstation.db.resultformat;
+
+import androidx.annotation.NonNull;
+import androidx.room.ColumnInfo;
+import androidx.room.Entity;
+import androidx.room.PrimaryKey;
+import androidx.room.TypeConverters;
+
+import com.bingce.data.converter.DateConverter;
+
+@Entity(tableName = FormatConstants.DB_NAME)
+@TypeConverters(DateConverter.class)
+public class FormatRecord {
+
+ @PrimaryKey
+ @NonNull
+ @ColumnInfo(name = "id")
+ public String id;
+
+ @ColumnInfo(name = "format_name")
+ public String format_name;
+
+ @ColumnInfo(name = "format_content")
+ public String format_content;
+
+ @ColumnInfo(name = "divided_symbols")
+ public String divided_symbols;
+
+ @ColumnInfo(name = "file_suffix")
+ public int file_suffix;
+
+ @ColumnInfo(name = "file_header")
+ public boolean file_header;
+
+ @ColumnInfo(name = "angle_format")
+ public int angle_format;
+
+}
diff --git a/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatRecordDao.java b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatRecordDao.java
new file mode 100644
index 0000000..0d75116
--- /dev/null
+++ b/app/src/main/java/com/project/survey/ui/instrument/setupstation/db/resultformat/FormatRecordDao.java
@@ -0,0 +1,27 @@
+package com.project.survey.ui.instrument.setupstation.db.resultformat;
+
+import androidx.room.Dao;
+import androidx.room.Insert;
+import androidx.room.OnConflictStrategy;
+import androidx.room.Query;
+
+import java.util.List;
+
+@Dao
+public interface FormatRecordDao {
+
+ @Query("SELECT * FROM " + FormatConstants.DB_NAME)
+ List findAll();
+
+ @Query("SELECT * FROM " + FormatConstants.DB_NAME + " ORDER BY id DESC")
+ List findDescAll();
+
+ @Query("SELECT * FROM " + FormatConstants.DB_NAME + " WHERE id=:id")
+ FormatRecord findById(String id);
+
+ @Query("DELETE FROM " + FormatConstants.DB_NAME + " WHERE id=:id")
+ void deleteById(String id);
+
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ void save(FormatRecord record);
+}
diff --git a/app/src/main/java/com/project/survey/util/CommonUtils.java b/app/src/main/java/com/project/survey/util/CommonUtils.java
new file mode 100644
index 0000000..ab747b6
--- /dev/null
+++ b/app/src/main/java/com/project/survey/util/CommonUtils.java
@@ -0,0 +1,440 @@
+package com.project.survey.util;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.DashPathEffect;
+import android.graphics.Rect;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.bingce.chart.ChartViewUtils;
+import com.bingce.coordlib.model.Coordinate;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants;
+import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord;
+import com.bingce.utils.FileUtil;
+import com.bingce.utils.PointUtils;
+import com.bingce.utils.SoftKeyUtils;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import blankj.utilcode.util.ActivityUtils;
+import blankj.utilcode.util.ToastUtils;
+import blankj.utilcode.util.Utils;
+import cn.liuyanbing.surveyor.model.base.BasePoint;
+import cn.liuyanbing.surveyor.model.base.Road;
+import cn.liuyanbing.surveyor.model.horizontalcurve.JDCurveElement;
+import cn.liuyanbing.surveyor.model.horizontalcurve.JDElement;
+import cn.liuyanbing.surveyor.model.horizontalcurve.JDFiveCurveElement;
+import cn.liuyanbing.surveyor.model.horizontalcurve.XJDCurveElement;
+import cn.liuyanbing.surveyor.model.horizontalcurve.XYCurveElement;
+
+public class CommonUtils {
+
+ /**
+ * 隐藏软键盘
+ */
+ public static void hideSoftInput() {
+ SoftKeyUtils.hideSoftKey(ActivityUtils.getTopActivity());
+ }
+
+ /**
+ * 创建文件在路径下
+ *
+ * @param path 路径{方法中包含sd卡路径}
+ * @param filename 文件名称
+ */
+ public static File createMkdirsAndFiles(String path, String filename) {
+ if (TextUtils.isEmpty(path)) {
+ throw new RuntimeException("路径不能为空");
+ }
+ path = FileUtil.getSDPath() + File.separator + path;
+ File file = new File(path);
+ if (!file.exists()) {
+ try {
+ file.mkdirs();
+ } catch (Exception e) {
+ throw new RuntimeException("创建文件夹失败");
+ }
+ }
+ File file1 = new File(file, filename);
+ if (!file1.exists()) {
+ try {
+ file1.createNewFile();
+ } catch (IOException e) {
+ throw new RuntimeException("创建文件失败");
+ }
+ }
+ return file1;
+ }
+
+// /**
+// * 移动文件
+// *
+// * @param oldFile 待移动文件
+// * @param nDir 新目录
+// * @param nName 新文件名称
+// */
+// public static boolean moveFileTo(File oldFile, String nDir, String nName) {
+// if (oldFile == null) {
+// ToastUtils.showShort("移动文件不存在-0");
+// return false;
+// }
+// if (!oldFile.exists()) {
+// ToastUtils.showShort("移动文件不存在-1");
+// return false;
+// }
+// File fileDir = new File(FileUtil.getSDPath() + File.separator + nDir);
+// if (!fileDir.exists()) {
+// fileDir.mkdirs();
+// }
+// return oldFile.renameTo(new File(fileDir, nName));
+// }
+
+
+ /**
+ * 将view转化为bitmap
+ */
+ public static Bitmap view2Bitmap(View view) {
+ int w = view.getWidth();
+ int h = view.getHeight();
+ Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bmp);
+ canvas.drawColor(Color.WHITE);
+ view.layout(0, 0, w, h);
+ view.draw(canvas);
+ return bmp;
+ }
+
+ /**
+ * 将bitmap转化为数据流
+ *
+ * @return 生成的图片压缩20%
+ */
+ public static InputStream bitmap2InputStream(Bitmap bitmap) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ bitmap.compress(Bitmap.CompressFormat.PNG, 80, baos);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ return bais;
+ }
+
+ /**
+ * 获取数据对象
+ */
+ public static List mJson2Lists(String content, Class cls) {
+ List list = new ArrayList<>();
+ String json = content;
+ if (!TextUtils.isEmpty(json)) {
+ Gson gson = new Gson();
+ JsonArray array = new JsonParser().parse(json).getAsJsonArray();
+ for (JsonElement elem : array) {
+ list.add(gson.fromJson(elem, cls));
+ }
+ }
+ return list;
+ }
+
+ /**
+ * 数据转换为json格式
+ */
+ public static String mLists2Json(List datalist) {
+ String result;
+ if (null == datalist || datalist.size() <= 0) {
+ result = "";
+ } else {
+ Gson gson = new Gson();
+ //转换成json数据,再保存
+ result = gson.toJson(datalist);
+ }
+ return result;
+ }
+
+
+ /**
+ * 导入exl文件
+ *
+ * @param remarks 备注
+ * @param file 文件路径
+ */
+ public static List importExl(Context context, String projectId, String jobId, String roadId, String remarks, File file) {
+ long time = new Date().getTime();
+ List records = new ArrayList<>();
+ int line = 0;
+ try {
+ List> iResult = ExcelReadHelper.excelRead(file, ExcelReadHelper.FIRST_ROW_NOT_IGNORE);
+ if (iResult == null || iResult.isEmpty()) {
+ return null;
+ }
+ for (int i = 0; i < iResult.size(); i++) {
+ List row = iResult.get(i);
+ line = i + 1;
+ if (row.isEmpty() || ExcelReadHelper.isRowEmpty(row) || row.size() < 3)
+ continue;
+ if (row.size() == 3) {
+ PointRecord record = new PointRecord(projectId, jobId, roadId,
+ PointConstants.POINT_TYPE_SURVEY_AREA, line + "", line + ""
+ , remarks == null ? context.getString(R.string.record_none) : remarks
+ , Double.parseDouble(row.get(0)), Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), 0, 0, 0
+ , PointConstants.POINT_FORMAT_XYZ, null);
+ record.createDate = new Date(time + i);
+ records.add(record);
+ }
+ if (row.size() == 4) {
+ PointRecord record = new PointRecord(projectId, jobId, roadId,
+ PointConstants.POINT_TYPE_SURVEY_AREA, row.get(0), row.get(0)
+ , remarks == null ? context.getString(R.string.record_none) : remarks
+ , Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3)), 0, 0, 0
+ , PointConstants.POINT_FORMAT_XYZ, null);
+ record.createDate = new Date(time + i);
+ records.add(record);
+ }
+ }
+ ToastUtils.showLong(file.getAbsolutePath() + ",导入成功");
+ return records;
+ } catch (Exception e) {
+ ToastUtils.showLong(file.getAbsolutePath() + ",导入失败.Error:第" + line + "行,数据格式有误.可能存在非数组坐标");
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 导入txt文件
+ *
+ * @param context 上下文
+ * @param jobId 作业Id
+ * @param remarks 备注
+ * @param file 文件
+ */
+ public static List importTxt(Context context, String projectId, String jobId, String roadId, String remarks, File file) {
+ long time = new Date().getTime();
+ List records = new ArrayList<>();
+ String result = null;
+ FileInputStream fis = null;
+ BufferedInputStream bis = null;
+ BufferedReader buff = null;
+ int line = 0;
+ try {
+ fis = new FileInputStream(file);
+ bis = new BufferedInputStream(fis);
+ buff = new BufferedReader(new InputStreamReader(bis, "utf-8"));
+ String a = null;
+ while ((a = buff.readLine()) != null)// 检查数据
+ {
+ line++;
+ if ("".equals(a.trim())) {
+ continue;
+ }
+ a = a.replaceAll("(^[\u0020\u0009\u3000]*)|([\u0020\u0009\u3000]*$)", "");// 删除首尾空格、制表及全角空格
+ String[] arr = a.split(",");
+ if (arr.length < 3) {
+ result = file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,元素个数不能少于4个";
+ continue;
+ }
+ if (arr.length == 3) {
+ PointRecord record = new PointRecord(projectId, jobId, roadId,
+ PointConstants.POINT_TYPE_SURVEY_AREA, line + "", line + ""
+ , remarks == null ? context.getString(R.string.record_none) : remarks
+ , Double.parseDouble(arr[0]), Double.parseDouble(arr[1]), Double.parseDouble(arr[2]), 0, 0, 0
+ , PointConstants.POINT_FORMAT_XYZ, null);
+ record.createDate = new Date(time++);
+ records.add(record);
+ }
+ if (arr.length == 4) {
+ PointRecord record = new PointRecord(projectId, jobId, roadId,
+ PointConstants.POINT_TYPE_SURVEY_AREA, arr[0], arr[0]
+ , remarks == null ? context.getString(R.string.record_none) : remarks
+ , Double.parseDouble(arr[1]), Double.parseDouble(arr[2]), Double.parseDouble(arr[3]), 0, 0, 0
+ , PointConstants.POINT_FORMAT_XYZ, null);
+ record.createDate = new Date(time++);
+ records.add(record);
+ }
+ }
+ if (result != null)
+ ToastUtils.showLong(result);
+ return records;
+ } catch (NumberFormatException e) {
+ result = file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串";
+ ToastUtils.showLong(result);
+ e.printStackTrace();
+ return null;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ } finally {
+ if (fis != null) {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (bis != null) {
+ try {
+ bis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (buff != null) {
+ try {
+ buff.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ /**
+ * huo
+ *
+ * @param startK
+ * @param endK
+ * @return
+ */
+ public static List getMainPoints(Road currentRoad, double startK, double endK) {
+ List mainPoints = new ArrayList<>();
+ if (currentRoad.isUseJD()) {
+ for (int i = 0; i < currentRoad.getJdHorList().size(); i++) {
+ JDElement jde = currentRoad.getJdHorList().get(i);
+ if (jde.isCurveElement()) {
+ JDCurveElement curveElement = JDCurveElement.dynamic_cast(jde);
+ if (curveElement.getZHK() >= startK && curveElement.getZHK() <= endK) {
+ mainPoints.add(curveElement.getZHK());
+ }
+ if (curveElement.getHYK() >= startK && curveElement.getHYK() <= endK) {
+ mainPoints.add(curveElement.getHYK());
+ }
+ if (curveElement.getQZK() >= startK && curveElement.getQZK() <= endK) {
+ mainPoints.add(curveElement.getQZK());
+ }
+ if (curveElement.getYHK() >= startK && curveElement.getYHK() <= endK) {
+ mainPoints.add(curveElement.getYHK());
+ }
+ if (curveElement.getHZK() >= startK && curveElement.getHZK() <= endK) {
+ mainPoints.add(curveElement.getHZK());
+ }
+ } else if (jde.isFiveCurveElement()) {
+ JDFiveCurveElement fiveCurveElement = JDFiveCurveElement.dynamic_cast(jde);
+ if (fiveCurveElement.getZHK() >= startK && fiveCurveElement.getZHK() <= endK) {
+ mainPoints.add(fiveCurveElement.getZHK());
+ }
+ if (fiveCurveElement.getHYK1() >= startK && fiveCurveElement.getHYK1() <= endK) {
+ mainPoints.add(fiveCurveElement.getHYK1());
+ }
+ if (fiveCurveElement.getQZK1() >= startK && fiveCurveElement.getQZK1() <= endK) {
+ mainPoints.add(fiveCurveElement.getQZK1());
+ }
+ if (fiveCurveElement.getYHK1() >= startK && fiveCurveElement.getYHK1() <= endK) {
+ mainPoints.add(fiveCurveElement.getYHK1());
+ }
+ if (fiveCurveElement.getHYK2() >= startK && fiveCurveElement.getHYK2() <= endK) {
+ mainPoints.add(fiveCurveElement.getHYK2());
+ }
+ if (fiveCurveElement.getQZK2() >= startK && fiveCurveElement.getQZK2() <= endK) {
+ mainPoints.add(fiveCurveElement.getQZK2());
+ }
+ if (fiveCurveElement.getYHK2() >= startK && fiveCurveElement.getYHK2() <= endK) {
+ mainPoints.add(fiveCurveElement.getYHK2());
+ }
+ if (fiveCurveElement.getHZK() >= startK && fiveCurveElement.getHZK() <= endK) {
+ mainPoints.add(fiveCurveElement.getHZK());
+ }
+ } else if (jde.isXJDCurveElement()) {
+ XJDCurveElement xjd = XJDCurveElement.dynamic_cast(jde);
+ if (xjd.getZHK() >= startK && xjd.getZHK() <= endK) {
+ mainPoints.add(xjd.getZHK());
+ }
+ if (xjd.getHYK() >= startK && xjd.getHYK() <= endK) {
+ mainPoints.add(xjd.getHYK());
+ }
+ if (xjd.getQZK() >= startK && xjd.getQZK() <= endK) {
+ mainPoints.add(xjd.getQZK());
+ }
+ if (xjd.getYHK() >= startK && xjd.getYHK() <= endK) {
+ mainPoints.add(xjd.getYHK());
+ }
+ if (xjd.getHZK() >= startK && xjd.getHZK() <= endK) {
+ mainPoints.add(xjd.getHZK());
+ }
+ }
+ }
+ } else {
+ for (int i = 0; i < currentRoad.getHorList().size(); i++) {
+ XYCurveElement ce = currentRoad.getHorList().get(i);
+ if (ce.isLineElement()) {
+ if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) {
+ mainPoints.add(ce.getStartPoint().getK());
+ }
+ } else if (ce.isInTransCurveElement()) {
+ if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) {
+ mainPoints.add(ce.getStartPoint().getK());
+ }
+ } else if (ce.isCircleCurveElement()) {
+ if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) {
+ mainPoints.add(ce.getStartPoint().getK());
+ mainPoints.add((ce.getStartPoint().getK() + ce.getEndPoint().getK()) / 2);
+ }
+ } else if (ce.isOutTransCurveElement()) {
+ if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) {
+ mainPoints.add(ce.getStartPoint().getK());
+ }
+ } else if (ce.isOvateCurveElement()) {
+ if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) {
+ mainPoints.add(ce.getStartPoint().getK());
+ }
+ }
+ }
+
+ }
+ return mainPoints;
+ }
+
+// public static McGePoint3d wcsToUcs(McGePoint3d point3d) {
+// return McGePointUtils.wcsToUcs(point3d);
+// }
+//
+// public static McGePoint3d ucsToWcs(McGePoint3d point3d) {
+// return McGePointUtils.ucsToWcs(point3d);
+// }
+
+ public static BasePoint toBasePoint(Coordinate coordinate) {
+ return PointUtils.toBasePoint(coordinate);
+ }
+
+ /**
+ * dp 转成 px
+ * @param dpValue
+ * @return
+ */
+ public static int dip2px(float dpValue) {
+ final float scale = ((App) Utils.getApp()).getResources().getDisplayMetrics().density;
+ return (int) (dpValue * scale + 0.5f);
+ }
+
+ /**
+ * 判断导出文件是否存在
+ * @param filePaths 文件路径
+ */
+ public static boolean isCheckExistFile(String filePaths) {
+ File file = new File(filePaths);
+ return file.exists();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/project/survey/util/DxfUtil.java b/app/src/main/java/com/project/survey/util/DxfUtil.java
new file mode 100644
index 0000000..ddec147
--- /dev/null
+++ b/app/src/main/java/com/project/survey/util/DxfUtil.java
@@ -0,0 +1,135 @@
+package com.project.survey.util;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.annotation.MainThread;
+
+import com.bingce.data.cache.CachedProject;
+import com.bingce.file.FileOperator;
+import com.bingce.surveyor.util.dialog.CustomDialog;
+import com.bingce.surveyor.util.dialog.CustomInputDialog;
+import com.bingce.utils.FileUtil;
+import com.bingce.utils.ThreadPoolUtil;
+import com.hjq.permissions.Permission;
+import com.hjq.permissions.XXPermissions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import blankj.utilcode.util.ToastUtils;
+import cn.liuyanbing.javadxf.AciColor;
+import cn.liuyanbing.javadxf.DxfDocument;
+import cn.liuyanbing.javadxf.Entities.Point;
+import cn.liuyanbing.javadxf.Entities.Text;
+import cn.liuyanbing.javadxf.Exception.DxfException;
+import cn.liuyanbing.javadxf.Header.DxfVersion;
+import cn.liuyanbing.javadxf.Tables.Layer;
+import cn.liuyanbing.javadxf.Vector3;
+
+import com.project.survey.BuildConfig;
+import com.project.survey.R;
+
+public class DxfUtil {
+ /**
+ * 导出dxf文件调用此方法
+ *
+ * @param context
+ */
+ private static List pointSurveyRecordLists;
+
+ public static void exportFormat(Context context, CachedProject currentProject) {
+ exportFormat(context, currentProject, null);
+ }
+
+ public static void exportFormat(Context context, CachedProject currentProject, List pointSurveyRecordList) {
+ if (pointSurveyRecordList != null) {
+ pointSurveyRecordLists = pointSurveyRecordList;
+ }
+ if (XXPermissions.isGranted(context, Permission.MANAGE_EXTERNAL_STORAGE)) {
+ showEditTextDialog(context, FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/");
+ } else {
+ ToastUtils.showShort(context.getString(R.string.open_read_write_permissions));
+ }
+ }
+
+ private static CustomInputDialog.Builder inputBuilder;
+
+ private static void showEditTextDialog(Context context, String filePath) {
+ inputBuilder = new CustomInputDialog.Builder(context);
+ inputBuilder.setTitle(context.getString(R.string.export_dxf_file_name)).setInputHint(context.getString(R.string.file_name)).setButtonConfirm(editText -> {
+ if (TextUtils.isEmpty(editText.trim())) {
+ ToastUtils.showShort(context.getString(R.string.enter_file_name));
+ } else {
+ if (isCheckExistFile(filePath + editText.trim() + ".dxf")) {
+ new CustomDialog.Builder(context).setContent("\"" + filePath + "\""
+ + context.getString(R.string.folder_name_already_exists) + "[" + editText.trim() + ".dxf]"
+ + context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace)
+ , v -> writeTxtToFile(context, filePath, editText.trim())).setButtonCancel(context.getString(R.string.rename)
+ , v -> inputBuilder.create().show()).create().show();
+ } else {
+ writeTxtToFile(context, filePath, editText.trim());
+ }
+ }
+ }).create().show();
+ }
+
+ /**
+ * 导出dxf
+ */
+ public static void writeTxtToFile(Context context, String filePath, String fileName) {
+ //导出数据库的点
+ DxfDocument dxf = new DxfDocument();
+ ThreadPoolUtil.execute(() -> {
+ for (int i = 0; i < pointSurveyRecordLists.size(); i++) {
+ PointSurveyRecord pointSurveyRecord = pointSurveyRecordLists.get(i);
+ Point point1 = new Point(new Vector3(pointSurveyRecord.planeE, pointSurveyRecord.planeN, pointSurveyRecord.planeH));
+ point1.setLayer(new Layer("0"));
+ point1.setColor(new AciColor(30));
+ dxf.AddEntity(point1);
+
+ Text text = new Text(pointSurveyRecordLists.get(i).pointName, new Vector3(pointSurveyRecord.planeE, pointSurveyRecord.planeN, pointSurveyRecord.planeH), 0.4);
+ text.setLayer(new Layer("0"));
+ text.setColor(new AciColor(30));
+ dxf.AddEntity(text);
+ }
+ ThreadPoolUtil.executeInMain(() -> {
+ try {
+ File file = new File(filePath + fileName + ".dxf");
+ if (file.getParentFile() != null && !file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ dxf.Save(file.getPath(), DxfVersion.AutoCad2004);
+ FileUtil.scanFile(context, file);
+ showCompleteDialog(context, file);
+ } catch (DxfException | IOException e) {
+ e.printStackTrace();
+ }
+ });
+ });
+ }
+
+ @MainThread
+ public static void showCompleteDialog(Context context, File file) {
+ new CustomStyleDialog.Builder(context)
+ .setTitle(context.getString(R.string.export_successful))
+ .setContent(file.getPath())
+ .setButtonSample(context.getString(R.string.close))
+ .setButtonCancel(context.getString(R.string.open), v -> FileUtil.openFile(context, file))
+ .setButtonConfirm(context.getString(R.string.send_to), v -> FileOperator.shareFile(context, file, BuildConfig.APPLICATION_ID))
+ .create()
+ .show();
+ }
+
+ /**
+ * 判断导出文件是否重复
+ *
+ * @param filePaths 文件路径
+ */
+ private static boolean isCheckExistFile(String filePaths) {
+ File file = new File(filePaths);
+ return file.exists();
+ }
+}
diff --git a/app/src/main/java/com/project/survey/util/ExcelUtil.java b/app/src/main/java/com/project/survey/util/ExcelUtil.java
new file mode 100644
index 0000000..3fa3e5f
--- /dev/null
+++ b/app/src/main/java/com/project/survey/util/ExcelUtil.java
@@ -0,0 +1,689 @@
+package com.project.survey.util;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+
+import androidx.annotation.MainThread;
+import androidx.annotation.WorkerThread;
+
+import com.bingce.data.cache.CachedProject;
+import com.bingce.file.FileOperator;
+import com.bingce.surveyor.util.dialog.CustomDialog;
+import com.bingce.surveyor.util.dialog.CustomInputDialog;
+import com.bingce.utils.FileUtil;
+import com.bingce.utils.ThreadPoolUtil;
+import com.bingce.utils.Util;
+import com.hjq.permissions.Permission;
+import com.hjq.permissions.XXPermissions;
+import com.project.survey.App;
+import com.project.survey.BuildConfig;
+import com.project.survey.R;
+import com.project.survey.dialog.CustomStyleDialog;
+import com.project.survey.ui.instrument.setupstation.AddResultFormatActivity;
+import com.project.survey.ui.instrument.setupstation.db.PointSurveyRecord;
+import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import blankj.utilcode.util.ToastUtils;
+import blankj.utilcode.util.Utils;
+import jxl.Workbook;
+import jxl.format.Colour;
+import jxl.write.Label;
+import jxl.write.WritableCell;
+import jxl.write.WritableCellFormat;
+import jxl.write.WritableFont;
+import jxl.write.WritableSheet;
+import jxl.write.WritableWorkbook;
+import jxl.write.WriteException;
+import jxl.WorkbookSettings;
+
+
+public class ExcelUtil {
+ public static final int ID_POINT_STAKING = 0;
+ public static final int ID_POINT_COORDINATE = ID_POINT_STAKING + 1;
+ public static final int ID_CONVER_PARAMETER = ID_POINT_COORDINATE + 1;
+ public static final int ID_RESULT_EXPORT_PLANE_POINT_COORDINATE = ID_CONVER_PARAMETER + 1;
+ public static final int ID_RESULT_EXPORT_LATLON_POINT_COORDINATE = ID_RESULT_EXPORT_PLANE_POINT_COORDINATE + 1;
+ public static final int ID_CUSTOM_EXPORT = ID_RESULT_EXPORT_LATLON_POINT_COORDINATE + 1;
+ public static final int ID_LINE_STAKING = ID_CUSTOM_EXPORT + 1;
+ public static final int ID_MIDDLE_SIDE_STAKING = ID_LINE_STAKING + 1;
+ public static final int ID_STAKING_TO_LINE = ID_MIDDLE_SIDE_STAKING + 1;
+ public static final int ID_STAKING_SIDE_COMMON = ID_STAKING_TO_LINE + 1;
+ public static final int ID_CAD_STAKING = ID_STAKING_SIDE_COMMON + 1;
+
+ private static WritableFont arial14font = null;
+ private static WritableCellFormat arial14format = null;
+ private static WritableFont arial10font = null;
+ private static WritableCellFormat arial10format = null;
+ private static WritableFont arial12font = null;
+ private static WritableCellFormat arial12format = null;
+ private final static String UTF8_ENCODING = "UTF-8";
+
+ private final static List topTabsPointCoordinate = Arrays.asList(
+ Utils.getApp().getString(R.string.point_name),
+ Utils.getApp().getString(R.string.point_code),
+ Utils.getApp().getString(R.string.latitude),
+ Utils.getApp().getString(R.string.longitude),
+ Utils.getApp().getString(R.string.altitude),
+ Utils.getApp().getString(R.string.antenna_type),
+ Utils.getApp().getString(R.string.antenna_height),
+ Utils.getApp().getString(R.string.easting),
+ Utils.getApp().getString(R.string.northing),
+ Utils.getApp().getString(R.string.elevation),
+ Utils.getApp().getString(R.string.solution_state),
+ Utils.getApp().getString(R.string.satellite_num),
+ Utils.getApp().getString(R.string.satellite_track_num),
+ Utils.getApp().getString(R.string.pdop),
+ Utils.getApp().getString(R.string.hrms),
+ Utils.getApp().getString(R.string.vrms),
+ Utils.getApp().getString(R.string.diff_delay),
+ Utils.getApp().getString(R.string.remark),
+ Utils.getApp().getString(R.string.acquisition_time),
+ Utils.getApp().getString(R.string.base_station) + "ID",
+ Utils.getApp().getString(R.string.base_station) + Utils.getApp().getString(R.string.latitude),
+ Utils.getApp().getString(R.string.base_station) + Utils.getApp().getString(R.string.longitude),
+ Utils.getApp().getString(R.string.base_station) + Utils.getApp().getString(R.string.distance),
+ Utils.getApp().getString(R.string.tilt_survey));
+
+ private final static List topTabsResultExportPLANE = Arrays.asList(
+ Utils.getApp().getString(R.string.point_name),
+ Utils.getApp().getString(R.string.point_code),
+ Utils.getApp().getString(R.string.easting),
+ Utils.getApp().getString(R.string.northing),
+ Utils.getApp().getString(R.string.elevation));
+
+ private final static List topTabsResultExportLatLon = Arrays.asList(
+ Utils.getApp().getString(R.string.point_name),
+ Utils.getApp().getString(R.string.point_code),
+ Utils.getApp().getString(R.string.latitude),
+ Utils.getApp().getString(R.string.longitude),
+ Utils.getApp().getString(R.string.altitude));
+
+ public static List topTabCustomExport = Arrays.asList();
+
+ /**
+ * 单元格的格式设置 字体大小 颜色 对齐方式、背景颜色等...
+ */
+ private static void format() {
+ try {
+ arial14font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.BOLD);
+ arial14font.setColour(Colour.LIGHT_BLUE);
+ arial14format = new WritableCellFormat(arial14font);
+ arial14format.setAlignment(jxl.format.Alignment.CENTRE);
+ arial14format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
+ arial14format.setBackground(Colour.VERY_LIGHT_YELLOW);
+
+ arial10font = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD);
+ arial10format = new WritableCellFormat(arial10font);
+ arial10format.setAlignment(jxl.format.Alignment.CENTRE);
+ arial10format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
+ arial10format.setBackground(Colour.GRAY_25);
+
+ arial12font = new WritableFont(WritableFont.ARIAL, 10);
+ arial12format = new WritableCellFormat(arial12font);
+ //对齐格式
+ arial10format.setAlignment(jxl.format.Alignment.CENTRE);
+ //设置边框
+ arial12format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
+
+ } catch (WriteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 导出Excel文件调用此方法
+ */
+ public static void exportFormat(int ID_TYPE, Context context, CachedProject currentProject, IExportExcel exportExcel) {
+ exportFormat(ID_TYPE, context, currentProject, null, exportExcel);
+ }
+
+ public static void exportFormat(int ID_TYPE, Context context, CachedProject currentProject, FormatRecord formatRecord, IExportExcel exportExcel) {
+ if (XXPermissions.isGranted(context, Permission.MANAGE_EXTERNAL_STORAGE)) {
+ showEditTextDialog(ID_TYPE, context, currentProject, formatRecord, exportExcel);
+ } else {
+ ToastUtils.showShort(context.getString(R.string.open_read_write_permissions));
+ }
+ }
+
+ private static CustomInputDialog.Builder inputBuilder;
+
+ private static void showEditTextDialog(int ID_TYPE, Context context, CachedProject currentProject, FormatRecord formatRecord, IExportExcel exportExcel) {
+ inputBuilder = new CustomInputDialog.Builder(context);
+ inputBuilder.setTitle(context.getString(R.string.export_excel_file_name)).setInputHint(context.getString(R.string.file_name)).setButtonConfirm(new CustomInputDialog.setOnConfirmClickListener() {
+ @Override
+ public void OnConfirmClick(String editText) {
+ if (TextUtils.isEmpty(editText.trim())) {
+ ToastUtils.showShort(context.getString(R.string.enter_file_name));
+ return;
+ }
+ setExcelInformation(ID_TYPE, editText.trim(), context, currentProject, formatRecord, exportExcel);
+ }
+ }).create().show();
+ }
+
+ public interface IExportExcel {
+ void onExportExcel(String filePaths);
+ }
+
+ /**
+ * 设置excel保存的path、名称
+ */
+ private static String sheetName, filePaths;
+
+ private static void setExcelInformation(int ID_TYPE, String inputFileName, Context context, CachedProject currentProject, FormatRecord formatRecord, IExportExcel exportExcel) {
+ filePaths = FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + inputFileName + ".xls";
+ switch (ID_TYPE) {
+ case ID_POINT_COORDINATE:
+ sheetName = context.getString(R.string.coordinate_points_library) + " " + SystemUtils.getSimpleDateFormat();
+ break;
+ case ID_RESULT_EXPORT_PLANE_POINT_COORDINATE://(E,N,h).xls
+ filePaths = FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + inputFileName + "(E,N,h).xls";
+ sheetName = context.getString(R.string.results_the_export) + " " + SystemUtils.getSimpleDateFormat();
+ break;
+ case ID_RESULT_EXPORT_LATLON_POINT_COORDINATE://(B,L,H).xls
+ filePaths = FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + inputFileName + "(B,L,H).xls";
+ sheetName = context.getString(R.string.results_the_export) + " " + SystemUtils.getSimpleDateFormat();
+ break;
+ case ID_CUSTOM_EXPORT://自定义格式
+ sheetName = context.getString(R.string.results_the_export) + " " + SystemUtils.getSimpleDateFormat();
+ break;
+ }
+ if (isCheckExistFile(filePaths)) {
+ new CustomDialog.Builder(context).setContent("\"" + FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + "\"" + context.getString(R.string.folder_name_already_exists) + "[" + inputFileName + ".xls]" + context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace), new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ThreadPoolUtil.execute(() -> {
+ ExcelUtil.initExcel(filePaths, sheetName, ID_TYPE, formatRecord);
+ exportExcel.onExportExcel(filePaths);
+ });
+ }
+ }).setButtonCancel(context.getString(R.string.rename), new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ inputBuilder.create().show();
+ }
+ }).create().show();
+ } else {
+ ThreadPoolUtil.execute(() -> {
+ ExcelUtil.initExcel(filePaths, sheetName, ID_TYPE, formatRecord);
+ exportExcel.onExportExcel(filePaths);
+ });
+ }
+ }
+
+ /**
+ * 判断导出文件是否重复
+ *
+ * @param filePaths 文件路径
+ */
+ private static boolean isCheckExistFile(String filePaths) {
+ File file = new File(filePaths);
+ return file.exists();
+ }
+
+
+ /**
+ * 初始化Excel表格
+ *
+ * @param filePath 存放excel文件的路径(path/demo.xls)
+ * @param sheetName Excel表格的表名
+ * @param colName excel中包含的列名(可以有多个)
+ */
+ private static List colName;
+
+ private static void initExcel(String filePath, String sheetName, int ID_TYPE, FormatRecord formatRecord) {
+
+ switch (ID_TYPE) {
+ case ID_POINT_COORDINATE:
+ //用于判断是否导出的数据是否显示表格头
+ if (formatRecord != null) {
+ List topCustomTabsPointCoordinate = new ArrayList<>();
+ String[] split = formatRecord.format_content.split(formatRecord.divided_symbols);
+ for (int i = 0; i < split.length; i++) {
+ topCustomTabsPointCoordinate.add(split[i]);
+ }
+ colName = topCustomTabsPointCoordinate;
+ } else {
+ colName = topTabsPointCoordinate;
+ }
+ break;
+ case ID_RESULT_EXPORT_PLANE_POINT_COORDINATE:
+ colName = topTabsResultExportPLANE;
+ break;
+ case ID_RESULT_EXPORT_LATLON_POINT_COORDINATE:
+ colName = topTabsResultExportLatLon;
+ break;
+ case ID_CUSTOM_EXPORT:
+ colName = topTabCustomExport;
+ break;
+ }
+
+ format();
+ WritableWorkbook workbook = null;
+ try {
+ File file = new File(filePath);
+ if (file.getParentFile() != null && !file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ workbook = Workbook.createWorkbook(file);
+ //设置表格的名字
+ WritableSheet sheet = workbook.createSheet(sheetName, 0);
+ if (formatRecord != null) {
+ if (formatRecord.file_header) {
+ //创建标题栏
+ sheet.addCell((WritableCell) new Label(0, 0, filePath, arial14format));
+ for (int col = 0; col < colName.size(); col++) {
+ sheet.addCell(new Label(col, 0, colName.get(col), arial10format));
+ }
+ //设置行高
+ sheet.setRowView(0, 340);
+ }
+ } else {
+ //创建标题栏
+ sheet.addCell((WritableCell) new Label(0, 0, filePath, arial14format));
+ for (int col = 0; col < colName.size(); col++) {
+ sheet.addCell(new Label(col, 0, colName.get(col), arial10format));
+ }
+ //设置行高
+ sheet.setRowView(0, 340);
+ }
+ workbook.write();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (workbook != null) {
+ try {
+ workbook.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+
+ /**
+ * 导出坐标库(新版本)
+ *
+ * @param objList
+ * @param fileName
+ * @param context
+ */
+
+ @WorkerThread
+ public static void exportCoordinator(List objList, String fileName, Context context, FormatRecord formatRecord) {
+// CoordinateSystem coordinateSystem = CachedCurrentCoordinateSystem.currentCoordinateSystem();
+ writeListToExcelNew(objList, fileName, context, formatRecord, pointBaseRecord -> {
+ List regexList = new ArrayList<>();
+ String[] split = formatRecord.format_content.split(formatRecord.divided_symbols);
+ for (int i = 0; i < split.length; i++) {
+ regexList.add(split[i]);
+ }
+
+ List list = new ArrayList<>();
+
+ for (int i = 0; i < regexList.size(); i++) {
+ String s = regexList.get(i);
+ if (s.equals("点名") || s.equals("Point name") || s.equals("№точ.")) {
+ list.add(pointBaseRecord.pointName);
+ } else if (s.equals("编码") || s.equals("Code") || s.equals("Код")) {
+ list.add(pointBaseRecord.code);
+ } else if (s.equals("纬度") || s.equals("Latitude") || s.equals("Широта")) {
+ list.add(convertAngleFormat(formatRecord.angle_format, pointBaseRecord.latitude));
+ } else if (s.equals("经度") || s.equals("Longitude") || s.equals("Долгота")) {
+ list.add(convertAngleFormat(formatRecord.angle_format, pointBaseRecord.longitude));
+ } else if (s.equals("大地高") || s.equals("Geodetic height") || s.equals("Высота")) {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.altitude));
+ } else if (s.equals("天线类型") || s.equals("Antenna type") || s.equals("Тип антенны")) {
+ list.add(pointBaseRecord.antennaTypeName == null ? "" : pointBaseRecord.antennaTypeName);
+ } else if (s.equals("天线高") || s.equals("Antenna height") || s.equals("Высота антенны")) {
+ if (pointBaseRecord.antennaHeight == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.antennaHeight));
+ }
+ } else if (s.equals("北坐标") || s.equals("Northing") || s.equals("Северные координаты.")) {
+ list.add(Util.formatDouble2String(pointBaseRecord.planeN, 6));
+ } else if (s.equals("东坐标") || s.equals("Easting") || s.equals("Восточные координаты.")) {
+ list.add(Util.formatDouble2String(pointBaseRecord.planeE, 6));
+ } else if (s.equals("高程") || s.equals("Elevation") || s.equals("Восточные координаты.")) {
+ list.add(Util.formatDouble2String(pointBaseRecord.planeH, 6));
+ } else if (s.equals("解状态") || s.equals("Solution state") || s.equals("Режим решения.")) {
+ list.add(pointBaseRecord.solutionState);
+ } else if (s.equals("解算卫星") || s.equals("Satellite number") || s.equals("Спутник для вычисления")) {
+ if (pointBaseRecord.satelliteNum == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteNum));
+ }
+ } else if (s.equals("可见卫星") || s.equals("Satellite track num") || s.equals("Видимый спутник")) {
+ if (pointBaseRecord.satelliteTrackNum == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteTrackNum));
+ }
+ } else if (s.equals(context.getString(R.string.pdop))) {
+ if (pointBaseRecord.pdop == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.pdop));
+ }
+ } else if (s.equals(context.getString(R.string.hrms))) {
+ if (pointBaseRecord.hrms == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.hrms));
+ }
+ } else if (s.equals(context.getString(R.string.vrms))) {
+ if (pointBaseRecord.vrms == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.vrms));
+ }
+ } else if (s.equals("差分延迟") || s.equals("Diff age") || s.equals("Дифференциальная задержка")) {
+ if (pointBaseRecord.diffAge == -1) {
+ list.add("");
+ } else {
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.diffAge));
+ }
+ } else if (s.equals("备注") || s.equals("Remark") || s.equals("примечан")) {
+ list.add(pointBaseRecord.remarks);
+ } else if (s.equals("采集时间") || s.equals("Measure time") || s.equals("Время сбора")) {
+ list.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pointBaseRecord.createdAt));
+ } else if (s.equals("惯导测量") || s.equals("Tilt survey") || s.equals("Нормативное измерение")) {
+ if (pointBaseRecord.isTiltEnable) {
+ list.add(context.getString(R.string.yes));
+ } else {
+ list.add(context.getString(R.string.no));
+ }
+ }
+ }
+ return list;
+ });
+ }
+
+ /**
+ * 根据成果导出的格式,经纬度进行转换导出
+ *
+ * @param angle_format_type
+ * @param l
+ * @return
+ */
+ private static String convertAngleFormat(int angle_format_type, double l) {
+ if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D_MS) {
+ //度.分秒
+ return Util.radianToDmsDoubleString(Math.toRadians(l), 6, false);
+ } else if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D_M_S) {
+ //度°分′秒″
+ return Util.radianToDmsString(Math.toRadians(l), 6, true);
+ } else if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D) {
+ //度
+ return Util.formatDouble2String(l, 6);
+ } else {
+ //弧度
+ return Util.formatDouble2String(Math.toRadians(l), 6);
+ }
+ }
+
+ /**
+ * 导出坐标库(老版本)
+ *
+ * @param objList
+ * @param fileName
+ * @param context
+ */
+ @WorkerThread
+ public static void exportCoordinator(List objList, String fileName, Context context) {
+// CoordinateSystem coordinateSystem = CachedCurrentCoordinateSystem.currentCoordinateSystem();
+ writeListToExcel(objList, fileName, context, pointBaseRecord -> {
+ List list = new ArrayList<>();
+ list.add(pointBaseRecord.pointName);
+ list.add(pointBaseRecord.code);
+ list.add(Util.formatDouble2String(pointBaseRecord.latitude, 6));
+ list.add(Util.formatDouble2String(pointBaseRecord.longitude, 6));
+ list.add(Util.formatDouble2String(pointBaseRecord.altitude, 6));
+ list.add(pointBaseRecord.antennaTypeName == null ? "" : pointBaseRecord.antennaTypeName);
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.antennaHeight));
+ list.add(Util.formatDouble2String(pointBaseRecord.planeE, 6));
+ list.add(Util.formatDouble2String(pointBaseRecord.planeN, 6));
+ list.add(Util.formatDouble2String(pointBaseRecord.planeH, 6));
+ list.add(pointBaseRecord.solutionState);
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteNum));
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteTrackNum));
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.pdop));
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.hrms));
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.vrms));
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.diffAge));
+ list.add(pointBaseRecord.remarks);
+ list.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pointBaseRecord.createdAt));
+ list.add(pointBaseRecord.siteId == null ? "" : pointBaseRecord.siteId);
+ String blhLat = Util.radianToDmsDoubleString(Math.toRadians(pointBaseRecord.siteLatitude), 4, true);
+ String blhLon = Util.radianToDmsDoubleString(Math.toRadians(pointBaseRecord.siteLongitude), 4, true);
+ Log.e("radianToDmsString", blhLat + "----" + blhLon);
+ list.add(blhLat);
+ list.add(blhLon);
+ list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.siteDistance2D));
+ if (pointBaseRecord.isTiltEnable) {
+ list.add(context.getString(R.string.yes));
+ } else {
+ list.add(context.getString(R.string.no));
+ }
+ return list;
+ });
+ }
+
+ /**
+ * 导出成果导出(平面坐标)
+ *
+ * @param objList
+ * @param fileName
+ * @param context
+ */
+ public static void exportCoordinatePlane(List objList, String fileName, Context context) {
+ ThreadPoolUtil.execute(() -> {
+ writeListToExcel(objList, fileName, context, planePointBaseRecord -> {
+ List list = new ArrayList<>();
+ list.add(planePointBaseRecord.pointName);
+ list.add(planePointBaseRecord.code);
+ list.add(Util.formatDouble2String(planePointBaseRecord.planeE, 6));
+ list.add(Util.formatDouble2String(planePointBaseRecord.planeN, 6));
+ list.add(Util.formatDouble2String(planePointBaseRecord.planeH, 6));
+ return list;
+ });
+ });
+ }
+
+ /**
+ * 导出成果导出(经纬度坐标)
+ *
+ * @param objList
+ * @param fileName
+ * @param context
+ */
+ public static void exportCoordinateLatlon(List objList, String fileName, Context context) {
+ ThreadPoolUtil.execute(() -> {
+ writeListToExcel(objList, fileName, context, latlonPointBaseRecord -> {
+ List list = new ArrayList<>();
+ list.add(latlonPointBaseRecord.pointName);
+ list.add(latlonPointBaseRecord.code);
+ list.add(Util.formatDouble2String(latlonPointBaseRecord.latitude, 6));
+ list.add(Util.formatDouble2String(latlonPointBaseRecord.longitude, 6));
+ list.add(Util.formatDouble2String(latlonPointBaseRecord.altitude, 6));
+ return list;
+ });
+ });
+ }
+
+ private interface IRecord2StringList {
+ List convert(T t);
+ }
+
+ private static File file;
+
+ private static void writeListToExcel(List objList, String fileName, Context context, IRecord2StringList record2StringList) {
+ if (objList != null && objList.size() > 0) {
+ WritableWorkbook writebook = null;
+ InputStream in = null;
+ try {
+ WorkbookSettings setEncode = new WorkbookSettings();
+ setEncode.setEncoding(UTF8_ENCODING);
+ file = new File(fileName);
+ in = new FileInputStream(file);
+ Workbook workbook = Workbook.getWorkbook(in);
+ writebook = Workbook.createWorkbook(file, workbook);
+ WritableSheet sheet = writebook.getSheet(0);
+
+ for (int j = 0; j < objList.size(); j++) {
+ List list = record2StringList.convert(objList.get(j));
+
+ for (int i = 0; i < list.size(); i++) {
+ sheet.addCell(new Label(i, j + 1, list.get(i), arial12format));
+ if (list.get(i) == null) {
+ //设置列宽
+ sheet.setColumnView(i, 8);
+ } else {
+ if (list.get(i).length() <= 4) {
+ //设置列宽
+ sheet.setColumnView(i, list.get(i).length() + 8);
+ } else {
+ //设置列宽
+ sheet.setColumnView(i, list.get(i).length() + 5);
+ }
+ }
+ }
+ //设置行高
+ sheet.setRowView(j + 1, 350);
+ }
+ writebook.write();
+ workbook.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ ToastUtils.showShort(e.getMessage());
+ } finally {
+ if (writebook != null) {
+ try {
+ writebook.close();
+ ThreadPoolUtil.executeInMain(new Runnable() {
+ @Override
+ public void run() {
+ FileUtil.scanFile(context, file);
+ showCompleteDialog(context, file);
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ ToastUtils.showShort(e.getMessage());
+ }
+
+ }
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ ToastUtils.showShort(e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ private static void writeListToExcelNew(List objList, String fileName, Context context, FormatRecord formatRecord, IRecord2StringList record2StringList) {
+ if (objList != null && objList.size() > 0) {
+ WritableWorkbook writebook = null;
+ InputStream in = null;
+ int x;
+ try {
+ WorkbookSettings setEncode = new WorkbookSettings();
+ setEncode.setEncoding(UTF8_ENCODING);
+ file = new File(fileName);
+ in = new FileInputStream(file);
+ Workbook workbook = Workbook.getWorkbook(in);
+ writebook = Workbook.createWorkbook(file, workbook);
+ WritableSheet sheet = writebook.getSheet(0);
+
+ for (int j = 0; j < objList.size(); j++) {
+ List list = record2StringList.convert(objList.get(j));
+ //用于判断是否导出的数据是否显示表格头 x = j + 1;代表要表格头,x = j;代表不要表格头
+ if (formatRecord != null) {
+ if (formatRecord.file_header) {
+ x = j + 1;
+ } else {
+ x = j;
+ }
+ } else {
+ x = j + 1;
+ }
+ for (int i = 0; i < list.size(); i++) {
+ sheet.addCell(new Label(i, x, list.get(i), arial12format));
+ if (list.get(i) == null) {
+ //设置列宽
+ sheet.setColumnView(i, 8);
+ } else {
+ if (list.get(i).length() <= 4) {
+ //设置列宽
+ sheet.setColumnView(i, list.get(i).length() + 8);
+ } else {
+ //设置列宽
+ sheet.setColumnView(i, list.get(i).length() + 5);
+ }
+ }
+ }
+ //设置行高
+ sheet.setRowView(x, 350);
+ }
+ writebook.write();
+ workbook.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ ToastUtils.showShort(e.getMessage());
+ } finally {
+ if (writebook != null) {
+ try {
+ writebook.close();
+ ThreadPoolUtil.executeInMain(() -> {
+ FileUtil.scanFile(context, file);
+ showCompleteDialog(context, file);
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ ToastUtils.showShort(e.getMessage());
+ }
+
+ }
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ ToastUtils.showShort(e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ @MainThread
+ public static void showCompleteDialog(Context context, File file) {
+ new CustomStyleDialog.Builder(context)
+ .setTitle(context.getString(R.string.export_successful))
+ .setContent(file.getPath())
+ .setButtonSample(context.getString(R.string.close))
+ .setButtonCancel(context.getString(R.string.open), v -> FileUtil.openFile(context, file))
+ .setButtonConfirm(context.getString(R.string.send_to), v -> FileOperator.shareFile(context, file, BuildConfig.APPLICATION_ID))
+ .create()
+ .show();
+ }
+}
diff --git a/app/src/main/java/com/project/survey/util/FormatSuffixesUtils.java b/app/src/main/java/com/project/survey/util/FormatSuffixesUtils.java
new file mode 100644
index 0000000..6d58dd4
--- /dev/null
+++ b/app/src/main/java/com/project/survey/util/FormatSuffixesUtils.java
@@ -0,0 +1,10 @@
+package com.project.survey.util;
+
+public class FormatSuffixesUtils {
+ public static final String formatHDM = ".hdm";
+ public static final String formatKML = ".kml";
+ public static final String formatHTML = ".html";
+ public static final String formatTXT = ".txt";
+ public static final String formatDAT = ".dat";
+ public static final String formatCSV = ".csv";
+}
diff --git a/app/src/main/java/com/project/survey/util/TxtUtil.java b/app/src/main/java/com/project/survey/util/TxtUtil.java
new file mode 100644
index 0000000..1d56578
--- /dev/null
+++ b/app/src/main/java/com/project/survey/util/TxtUtil.java
@@ -0,0 +1,179 @@
+package com.project.survey.util;
+
+import android.app.Activity;
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.annotation.MainThread;
+import androidx.annotation.NonNull;
+import androidx.core.content.PermissionChecker;
+
+import com.bingce.data.cache.CachedProject;
+import com.bingce.file.FileOperator;
+import com.bingce.surveyor.util.dialog.CustomDialog;
+import com.bingce.surveyor.util.dialog.CustomInputDialog;
+import com.bingce.utils.FileUtil;
+import com.bingce.utils.ThreadPoolUtil;
+import com.hjq.permissions.Permission;
+import com.hjq.permissions.XXPermissions;
+import com.project.survey.BuildConfig;
+import com.project.survey.R;
+import com.project.survey.dialog.CustomStyleDialog;
+
+import java.io.File;
+import java.io.RandomAccessFile;
+
+import blankj.utilcode.util.ToastUtils;
+
+public class TxtUtil {
+
+ public static void exportFormat(Context context, String strContent, String format_suffixes, CachedProject currentProject) {
+ exportFormat(context, "", strContent, format_suffixes, currentProject, false);
+ }
+
+ /**
+ * 导出txt文件调用此方法
+ *
+ * @param context
+ * @param strContent 导出内容
+ * @param format_suffixes 格式后缀
+ * @param isFinish 是否关闭当前页面
+ */
+ public static void exportFormat(Context context, String fileName, String strContent, String format_suffixes, CachedProject currentProject, boolean isFinish) {
+ if (XXPermissions.isGranted(context, Permission.MANAGE_EXTERNAL_STORAGE)) {
+ agreePermission(context, fileName, strContent, format_suffixes, currentProject, isFinish);
+ } else {
+ ToastUtils.showShort(context.getString(R.string.open_read_write_permissions));
+ }
+ }
+
+ /**
+ * 同意权限
+ *
+ * @param context
+ * @param fileName
+ * @param strContent
+ * @param format_suffixes
+ * @param currentProject
+ */
+ private static void agreePermission(Context context, String fileName, String strContent, String format_suffixes, CachedProject currentProject, boolean isFinish) {
+ //单独列出导出Html(当结尾和文件名都传过来时,无需弹出编辑文件名弹框。当没传过来的文件名,和正常的编辑文件名一样弹出编辑弹框)
+ if (format_suffixes.equals(FormatSuffixesUtils.formatHTML) && !TextUtils.isEmpty(fileName)) {
+ if (isCheckExistFile(FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + format_suffixes)) {
+ new CustomDialog.Builder(context).setContent("\"" + FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file)
+ + "/" + context.getString(R.string.point_survey) + "/" + "\"" + context.getString(R.string.folder_name_already_exists) + "[" + fileName + format_suffixes + "]"
+ + context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace), v -> writeTxtToFile(context, strContent, FileUtil.getSDPath() + "/"
+ + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/", fileName + format_suffixes, isFinish))
+ .setButtonCancel(context.getString(R.string.rename), v -> inputBuilder.create().show()).create().show();
+ } else {
+ writeTxtToFile(context, strContent, FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/", fileName + format_suffixes, isFinish);
+ }
+ } else {
+ //传过来的点名为空时,弹出编写文件名称弹框
+ showEditTextDialog(context, strContent, FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/", format_suffixes, isFinish);
+ }
+ }
+
+ private static CustomInputDialog.Builder inputBuilder;
+ private static String dialogTitle;
+
+ private static void showEditTextDialog(Context context, String strContent, String filePath, String format_suffixes, boolean isFinish) {
+ inputBuilder = new CustomInputDialog.Builder(context);
+ if (format_suffixes.equals(FormatSuffixesUtils.formatHDM)) {
+ dialogTitle = context.getString(R.string.export_hdm_file_name);
+ } else if (format_suffixes.equals(FormatSuffixesUtils.formatKML)) {
+ dialogTitle = context.getString(R.string.export_kml_file_name);
+ } else if (format_suffixes.equals(FormatSuffixesUtils.formatTXT)) {
+ dialogTitle = context.getString(R.string.export_txt_file_name);
+ } else {
+ dialogTitle = context.getString(R.string.export_excel_file_name);
+ }
+ inputBuilder.setTitle(dialogTitle).setInputHint(context.getString(R.string.file_name)).setButtonConfirm(editText -> {
+ if (TextUtils.isEmpty(editText.trim())) {
+ ToastUtils.showShort(context.getString(R.string.enter_file_name));
+ } else {
+ if (isCheckExistFile(filePath + editText.trim() + format_suffixes)) {
+ new CustomDialog.Builder(context).setContent("\"" + filePath + "\""
+ + context.getString(R.string.folder_name_already_exists) + "[" + editText.trim() + format_suffixes + "]"
+ + context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace)
+ , v -> writeTxtToFile(context, strContent, filePath, editText.trim() + format_suffixes, isFinish))
+ .setButtonCancel(context.getString(R.string.rename), v -> inputBuilder.create().show()).create().show();
+ } else {
+ writeTxtToFile(context, strContent, filePath, editText.trim() + format_suffixes, isFinish);
+ }
+ }
+ }).create().show();
+ }
+
+ /**
+ * 判断权限是否授权
+ *
+ * @param context
+ * @param permissions
+ * @return
+ */
+ public static boolean hasPermission(@NonNull Context context, @NonNull String... permissions) {
+ if (permissions.length == 0) {
+ return false;
+ }
+ for (String per : permissions) {
+ int result = PermissionChecker.checkSelfPermission(context, per);
+ if (result != PermissionChecker.PERMISSION_GRANTED) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ // 将字符串写入到文本文件中
+ public static void writeTxtToFile(Context context, String content, String filePath, String fileName, boolean isFinish) {
+ String strFilePath = filePath + fileName;
+ // 每次写入时,都换行写
+ String strContent = content + "\r\n";
+ try {
+ File file = new File(strFilePath);
+ if (file.getParentFile() != null && !file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ RandomAccessFile raf = new RandomAccessFile(file, "rwd");
+ raf.seek(file.length());
+ raf.write(strContent.getBytes());
+ raf.close();
+ ThreadPoolUtil.executeInMain(() -> {
+ FileUtil.scanFile(context, file);
+ showCompleteDialog(context, file, isFinish);
+ });
+ } catch (Exception e) {
+ ToastUtils.showShort(e.getMessage());
+ }
+ }
+
+ @MainThread
+ public static void showCompleteDialog(Context context, File file, boolean isFinish) {
+ new CustomStyleDialog.Builder(context)
+ .setTitle(context.getString(R.string.export_successful))
+ .setContent(file.getPath())
+ .setButtonSample(context.getString(R.string.close))
+ .setButtonCancel(context.getString(R.string.open), v -> FileUtil.openFile(context, file))
+ .setButtonConfirm(context.getString(R.string.send_to), v -> FileOperator.shareFile(context, file, BuildConfig.APPLICATION_ID))
+ .setButtonCancel(v -> {
+ if (isFinish) {
+ ((Activity) context).finish();
+ }
+ })
+ .create()
+ .show();
+ }
+
+ /**
+ * 判断导出文件是否重复
+ *
+ * @param filePaths 文件路径
+ */
+ private static boolean isCheckExistFile(String filePaths) {
+ File file = new File(filePaths);
+ return file.exists();
+ }
+}
diff --git a/app/src/main/java/com/project/survey/widget/bingce/SyncHorizontalScrollView.kt b/app/src/main/java/com/project/survey/widget/bingce/SyncHorizontalScrollView.kt
new file mode 100644
index 0000000..01493f7
--- /dev/null
+++ b/app/src/main/java/com/project/survey/widget/bingce/SyncHorizontalScrollView.kt
@@ -0,0 +1,45 @@
+package com.project.survey.widget.bingce
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.view.View
+import android.widget.HorizontalScrollView
+
+
+class SyncHorizontalScrollView : HorizontalScrollView {
+ private var mView: View? = null
+
+ constructor(paramContext: Context?) : super(paramContext) {}
+ constructor(paramContext: Context?, paramAttributeSet: AttributeSet?) : super(
+ paramContext,
+ paramAttributeSet
+ ) {
+ }
+
+ override fun onScrollChanged(paramInt1: Int, paramInt2: Int, paramInt3: Int, paramInt4: Int) {
+ super.onScrollChanged(paramInt1, paramInt2, paramInt3, paramInt4)
+ if (mView != null) mView!!.scrollTo(paramInt1, paramInt2)
+ }
+
+ fun setScrollView(paramView: View?) {
+ mView = paramView
+ }
+
+ override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
+ if (intercept) {
+ return true
+ }
+ return super.onInterceptTouchEvent(ev)
+ }
+
+ private var intercept = false
+ fun isIntercept(): Boolean {
+ return intercept
+ }
+
+ fun setIntercept(intercept: Boolean) {
+ this.intercept = intercept
+ }
+}
+
diff --git a/app/src/main/java/com/project/survey/widget/bingce/TouchRelativeLayout.java b/app/src/main/java/com/project/survey/widget/bingce/TouchRelativeLayout.java
new file mode 100644
index 0000000..35b2c1d
--- /dev/null
+++ b/app/src/main/java/com/project/survey/widget/bingce/TouchRelativeLayout.java
@@ -0,0 +1,35 @@
+package com.project.survey.widget.bingce;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.RelativeLayout;
+
+public class TouchRelativeLayout extends RelativeLayout {
+ public TouchRelativeLayout(Context context) {
+ super(context);
+ }
+
+ public TouchRelativeLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public TouchRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ if (intercept){
+ return true;
+ }
+ return super.onInterceptTouchEvent(ev);
+ }
+ private boolean intercept = false;
+ public boolean isIntercept(){
+ return intercept;
+ }
+ public void setIntercept(boolean intercept){
+ this.intercept = intercept;
+ }
+}
diff --git a/app/src/main/res/drawable/icon_format_fixed.xml b/app/src/main/res/drawable/icon_format_fixed.xml
new file mode 100644
index 0000000..2e45b3e
--- /dev/null
+++ b/app/src/main/res/drawable/icon_format_fixed.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/icon_function_delete.xml b/app/src/main/res/drawable/icon_function_delete.xml
new file mode 100644
index 0000000..f1e4e14
--- /dev/null
+++ b/app/src/main/res/drawable/icon_function_delete.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_add_result_format.xml b/app/src/main/res/layout/activity_add_result_format.xml
new file mode 100644
index 0000000..ca55afc
--- /dev/null
+++ b/app/src/main/res/layout/activity_add_result_format.xml
@@ -0,0 +1,260 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_coordinate_points_library.xml b/app/src/main/res/layout/activity_coordinate_points_library.xml
new file mode 100644
index 0000000..1ae1580
--- /dev/null
+++ b/app/src/main/res/layout/activity_coordinate_points_library.xml
@@ -0,0 +1,308 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_edit_coordinate_point.xml b/app/src/main/res/layout/activity_edit_coordinate_point.xml
new file mode 100644
index 0000000..8439ab8
--- /dev/null
+++ b/app/src/main/res/layout/activity_edit_coordinate_point.xml
@@ -0,0 +1,632 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_point_filter.xml b/app/src/main/res/layout/activity_point_filter.xml
new file mode 100644
index 0000000..370a671
--- /dev/null
+++ b/app/src/main/res/layout/activity_point_filter.xml
@@ -0,0 +1,324 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_results_the_export.xml b/app/src/main/res/layout/activity_results_the_export.xml
new file mode 100644
index 0000000..eb08225
--- /dev/null
+++ b/app/src/main/res/layout/activity_results_the_export.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_coordinate_point_library.xml b/app/src/main/res/layout/item_coordinate_point_library.xml
new file mode 100644
index 0000000..82da4a9
--- /dev/null
+++ b/app/src/main/res/layout/item_coordinate_point_library.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_coordinate_point_name_library.xml b/app/src/main/res/layout/item_coordinate_point_name_library.xml
new file mode 100644
index 0000000..b0c53dd
--- /dev/null
+++ b/app/src/main/res/layout/item_coordinate_point_name_library.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_content_style_dialog.xml b/app/src/main/res/layout/layout_content_style_dialog.xml
new file mode 100644
index 0000000..6cb3af8
--- /dev/null
+++ b/app/src/main/res/layout/layout_content_style_dialog.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_dividing_line_theme_gray.xml b/app/src/main/res/layout/layout_dividing_line_theme_gray.xml
new file mode 100644
index 0000000..5d3cc04
--- /dev/null
+++ b/app/src/main/res/layout/layout_dividing_line_theme_gray.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_format_flowlayout.xml b/app/src/main/res/layout/layout_format_flowlayout.xml
new file mode 100644
index 0000000..1bf510f
--- /dev/null
+++ b/app/src/main/res/layout/layout_format_flowlayout.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_format_flowlayout_tag.xml b/app/src/main/res/layout/layout_format_flowlayout_tag.xml
new file mode 100644
index 0000000..c75ddbf
--- /dev/null
+++ b/app/src/main/res/layout/layout_format_flowlayout_tag.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_results_export_item.xml b/app/src/main/res/layout/layout_results_export_item.xml
new file mode 100644
index 0000000..09016e4
--- /dev/null
+++ b/app/src/main/res/layout/layout_results_export_item.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-xxhdpi/icon_calendar_gray.png b/app/src/main/res/mipmap-xxhdpi/icon_calendar_gray.png
new file mode 100644
index 0000000..b7a2da4
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_calendar_gray.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/icon_calendar_green.png b/app/src/main/res/mipmap-xxhdpi/icon_calendar_green.png
new file mode 100644
index 0000000..454b436
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_calendar_green.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/icon_red_delect.png b/app/src/main/res/mipmap-xxhdpi/icon_red_delect.png
new file mode 100644
index 0000000..7ec3d89
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_red_delect.png differ
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 109a590..f1bd361 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -268,4 +268,11 @@
- TB
- PB
+
+ - 查看当前仪器测站
+ - 仪器已设站 * 跳过(仅限正镜)
+ - 仪器已设站 * 手机输入测站(仅限正镜)
+ - 手机设站 * 已知后视设站
+ - 手机设站 * 后方交会设站
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 563822d..6f2ad6d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -55,4 +55,69 @@
Click to load more
Error, please try again
Loading, please wait later
+ .xls
+ .dat
+ .txt
+ .csv
+ 度.分秒
+ 度°分′秒″
+ 度
+ 弧度
+ ,
+ Space
+ Tab
+ Enter
+ \@
+ 新建导出格式
+ 编辑导出格式
+ 格式名称
+ 文件后缀
+ 文件表头
+ 角度格式
+ 分割符号
+ 请输入格式名称
+ 请在待选描述区选择自定义格式描述
+ 编码
+ 大地高
+ 天线类型
+ 北坐标
+ 东坐标
+ 高程
+ 解状态
+ 解算卫星
+ 可见卫星
+ PDOP
+ HRMS
+ VRMS
+ 差分延迟
+ 采集时间
+ 基站
+ 惯导测量
+ 测量时间
+ 批量删除
+ 确定要删除的所有选中的点吗
+ 请选中要批量删除的点
+ 请选择要编辑的格式
+ 系统默认格式,不允许编辑或删除!
+ 请选择要删除的格式
+ 请先新建一条导出格式
+ 地脉app-->打开读写权限]]>
+ 请输入导出Excel文件名
+ 请输入文件名称
+ 坐标点库
+ 成果导出
+ 点测量
+ 重命名
+ 文件夹下已存在名为
+ 的文件,是否替换改文件?
+ 替换
+ 查看样例
+ 打开
+ 当前没有可导出的数据
+ 导入
+ 文件
+ 导出Hdm文件名
+ 导出Kml文件名
+ 导出Txt文件名
+
\ No newline at end of file