fix: 修改退出登录后定位信息不显示的问题,修改自动捕捉结束逻辑
This commit is contained in:
parent
dc41a9bba8
commit
1c0e462ea9
@ -886,40 +886,50 @@ public class AutoTakePicture4PoiActivity extends BaseActivity implements View.On
|
||||
}
|
||||
} else { // 在阈值内,但是并非最近的点
|
||||
roadMatchEntity.setMatchCount(0); // 连续匹配个数置为0
|
||||
// 如果当前数据已经被标记为可完成状态,则直接结束当前任务
|
||||
if (roadMatchEntity.getEndMathchTime()>0/*endMatchTime不为0,说明该数据已经匹配到终点*/) {
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
// 更新终点时间为距离终点逐渐变大时的时间
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
}
|
||||
roadMatchEntity.setUnMatchCount(0); // 有匹配的数据,则连续未匹配个数归0(即使不是最近的数据,在阈值内即认为可匹配,未匹配点数也置为0)
|
||||
|
||||
double currentEndDistance = currentPoint.distance(GeometryTools.createGeometry(roadMatchEntity.getePoint())); // 当前距离终点的距离
|
||||
// 记录本次的匹配距离,如果本次匹配距离大于上一次,且上一次匹配终点时间不为0(说明已经提前匹配到终点了),则结束匹配,否则继续等待匹配,设置过EndMathchTime的数据即为可以结束匹配的数据,下一次如果未匹配,也可以结束
|
||||
if (roadMatchEntity.getEndMathchTime()>0/*endMatchTime不为0,说明该数据已经匹配到终点*/&¤tEndDistance>roadMatchEntity.getLastEndDistance()) {
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
// 更新终点时间为距离终点逐渐变大时的时间
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
}
|
||||
// 匹配距离超过指定阈值,认为该条数据可完成,记录当前位置与终点的距离,当距离从小变大时,完成该任务
|
||||
if (roadMatchEntity.getMatchPointList().size()>=2&&roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER) {
|
||||
double currentEndDistance = currentPoint.distance(GeometryTools.createGeometry(roadMatchEntity.getePoint())); // 当前位置距离终点的距离
|
||||
// 匹配距离超过指定阈值,并且当前位置距离终点认为该条数据可完成,记录当前位置与终点的距离
|
||||
if (roadMatchEntity.getMatchPointList().size()>=2
|
||||
&&roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER /*匹配长度超过阈值*/
|
||||
&¤tEndDistance<=MATCH_START_BUFFER_DISTANCE/*与终点距离在阈值范围内*/) {
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
// 匹配到终点后,记录该条数据的最新一次匹配距离,当下一次匹配距离大于当前距离,则认为该数据完全匹配,结束匹配
|
||||
roadMatchEntity.setLastEndDistance(currentEndDistance);
|
||||
}
|
||||
//=============如果在匹配范围内,但是该数据并非最近的点,不需要记录匹配,也无需增加未匹配点的个数
|
||||
} else { // 无法匹配
|
||||
// 更新连续无法匹配的点位个数
|
||||
roadMatchEntity.setUnMatchCount(roadMatchEntity.getUnMatchCount()+1);
|
||||
// 有未匹配的数据,连续匹配个数也归0
|
||||
roadMatchEntity.setMatchCount(0);// 设置连续匹配的数据个数为0
|
||||
roadMatchEntity.getUnMatchPointList().add(new MyCoordinate(currentPoint.getX(), currentPoint.getY()));
|
||||
// 当连续未匹配个数大于等于20个时,该任务被认为可以结束(舍弃或完成-需根据匹配到的数据长度与任务长度做对比)
|
||||
if (roadMatchEntity.getUnMatchCount()>=UNMATCH_BUFFER_MIDDLE_BUFFER) { // 连续未匹配大于阈值时
|
||||
List<MyCoordinate> matchPointList = roadMatchEntity.getMatchPointList();
|
||||
if (matchPointList == null || matchPointList.size()<2) { // 已匹配的点位不足2个,无法计算长度,直接放弃该任务
|
||||
unMatchList.add(roadMatchEntity);
|
||||
} else {
|
||||
if (roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER) { // 已匹配距离与任务长度距离比例超过指定阈值,该任务可完成
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
} else {
|
||||
// 如果当前任务已经被标记为可完成,直接结束该任务
|
||||
if (roadMatchEntity.getEndMathchTime()>0/*endMatchTime不为0,说明该数据已经匹配到终点*/) {
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
// 更新终点时间为距离终点逐渐变大时的时间
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
} else {
|
||||
// 更新连续无法匹配的点位个数
|
||||
roadMatchEntity.setUnMatchCount(roadMatchEntity.getUnMatchCount()+1);
|
||||
// 有未匹配的数据,连续匹配个数也归0
|
||||
roadMatchEntity.setMatchCount(0);// 设置连续匹配的数据个数为0
|
||||
roadMatchEntity.getUnMatchPointList().add(new MyCoordinate(currentPoint.getX(), currentPoint.getY()));
|
||||
// 当连续未匹配个数大于等于20个时,该任务被认为可以结束(舍弃或完成-需根据匹配到的数据长度与任务长度做对比)
|
||||
if (roadMatchEntity.getUnMatchCount()>=UNMATCH_BUFFER_MIDDLE_BUFFER) { // 连续未匹配大于阈值时
|
||||
List<MyCoordinate> matchPointList = roadMatchEntity.getMatchPointList();
|
||||
if (matchPointList == null || matchPointList.size()<2) { // 已匹配的点位不足2个,无法计算长度,直接放弃该任务
|
||||
unMatchList.add(roadMatchEntity);
|
||||
} else {
|
||||
if (roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER) { // 已匹配距离与任务长度距离比例超过指定阈值,该任务可完成
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
} else {
|
||||
unMatchList.add(roadMatchEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
private int satelliteCount; // 卫星颗数
|
||||
private static double MATCH_START_BUFFER_DISTANCE=50e-5; // 匹配起点用到的buffer距离,此处5米使用简易判断
|
||||
private static double MATCH_BUFFER_DISTANCE=30e-5; // 匹配途经点用到的buffer距离,此处5米使用简易判断
|
||||
private static float /*UNMATCH_GIVE_UP_DISTANCE_BUFFER = 0.2f*//*放弃的距离匹配阈值*//*, */MATCH_CONFIRM_FINISH_BUFFER=0.75f/*完全匹配的距离阈值*/;
|
||||
private static float /*UNMATCH_GIVE_UP_DISTANCE_BUFFER = 0.2f*//*放弃的距离匹配阈值*//*, */MATCH_CONFIRM_FINISH_BUFFER=0.8f/*完全匹配的距离阈值*/;
|
||||
private static int /*UNMATCH_BUFFER_START_BUFFER = 5*//*匹配开始后连续未匹配的个数*//*,*/ UNMATCH_BUFFER_MIDDLE_BUFFER = 20/*匹配过程中连续未匹配的个数*/;
|
||||
// private static float UNMATCH_COUNT_BUFFER = UNMATCH_GIVE_UP_DISTANCE_BUFFER/(1-UNMATCH_GIVE_UP_DISTANCE_BUFFER);
|
||||
private final String tmpPicFoldPath = Constant.PICTURE_FOLDER+"/tmp";
|
||||
@ -938,40 +938,50 @@ public class AutoTakePictureActivity extends BaseActivity implements View.OnClic
|
||||
}
|
||||
} else { // 在阈值内,但是并非最近的点
|
||||
roadMatchEntity.setMatchCount(0); // 连续匹配个数置为0
|
||||
// 如果当前数据已经被标记为可完成状态,则直接结束当前任务
|
||||
if (roadMatchEntity.getEndMathchTime()>0/*endMatchTime不为0,说明该数据已经匹配到终点*/) {
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
// 更新终点时间为距离终点逐渐变大时的时间
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
}
|
||||
roadMatchEntity.setUnMatchCount(0); // 有匹配的数据,则连续未匹配个数归0(即使不是最近的数据,在阈值内即认为可匹配,未匹配点数也置为0)
|
||||
|
||||
double currentEndDistance = currentPoint.distance(GeometryTools.createGeometry(roadMatchEntity.getePoint())); // 当前距离终点的距离
|
||||
// 记录本次的匹配距离,如果本次匹配距离大于上一次,且上一次匹配终点时间不为0(说明已经提前匹配到终点了),则结束匹配,否则继续等待匹配,设置过EndMathchTime的数据即为可以结束匹配的数据,下一次如果未匹配,也可以结束
|
||||
if (roadMatchEntity.getEndMathchTime()>0/*endMatchTime不为0,说明该数据已经匹配到终点*/&¤tEndDistance>roadMatchEntity.getLastEndDistance()) {
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
// 更新终点时间为距离终点逐渐变大时的时间
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
}
|
||||
// 匹配距离超过指定阈值,认为该条数据可完成,记录当前位置与终点的距离,当距离从小变大时,完成该任务
|
||||
if (roadMatchEntity.getMatchPointList().size()>=2&&roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER) {
|
||||
double currentEndDistance = currentPoint.distance(GeometryTools.createGeometry(roadMatchEntity.getePoint())); // 当前位置距离终点的距离
|
||||
// 匹配距离超过指定阈值,并且当前位置距离终点认为该条数据可完成,记录当前位置与终点的距离
|
||||
if (roadMatchEntity.getMatchPointList().size()>=2
|
||||
&&roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER /*匹配长度超过阈值*/
|
||||
&¤tEndDistance<=MATCH_START_BUFFER_DISTANCE/*与终点距离在阈值范围内*/) {
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
// 匹配到终点后,记录该条数据的最新一次匹配距离,当下一次匹配距离大于当前距离,则认为该数据完全匹配,结束匹配
|
||||
roadMatchEntity.setLastEndDistance(currentEndDistance);
|
||||
}
|
||||
//=============如果在匹配范围内,但是该数据并非最近的点,不需要记录匹配,也无需增加未匹配点的个数
|
||||
} else { // 无法匹配
|
||||
// 更新连续无法匹配的点位个数
|
||||
roadMatchEntity.setUnMatchCount(roadMatchEntity.getUnMatchCount()+1);
|
||||
// 有未匹配的数据,连续匹配个数也归0
|
||||
roadMatchEntity.setMatchCount(0);// 设置连续匹配的数据个数为0
|
||||
roadMatchEntity.getUnMatchPointList().add(new MyCoordinate(currentPoint.getX(), currentPoint.getY()));
|
||||
// 当连续未匹配个数大于等于20个时,该任务被认为可以结束(舍弃或完成-需根据匹配到的数据长度与任务长度做对比)
|
||||
if (roadMatchEntity.getUnMatchCount()>=UNMATCH_BUFFER_MIDDLE_BUFFER) { // 连续未匹配大于阈值时
|
||||
List<MyCoordinate> matchPointList = roadMatchEntity.getMatchPointList();
|
||||
if (matchPointList == null || matchPointList.size()<2) { // 已匹配的点位不足2个,无法计算长度,直接放弃该任务
|
||||
unMatchList.add(roadMatchEntity);
|
||||
} else {
|
||||
if (roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER) { // 已匹配距离与任务长度距离比例超过指定阈值,该任务可完成
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
} else {
|
||||
// 如果当前任务已经被标记为可完成,直接结束该任务
|
||||
if (roadMatchEntity.getEndMathchTime()>0/*endMatchTime不为0,说明该数据已经匹配到终点*/) {
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
// 更新终点时间为距离终点逐渐变大时的时间
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
} else {
|
||||
// 更新连续无法匹配的点位个数
|
||||
roadMatchEntity.setUnMatchCount(roadMatchEntity.getUnMatchCount()+1);
|
||||
// 有未匹配的数据,连续匹配个数也归0
|
||||
roadMatchEntity.setMatchCount(0);// 设置连续匹配的数据个数为0
|
||||
roadMatchEntity.getUnMatchPointList().add(new MyCoordinate(currentPoint.getX(), currentPoint.getY()));
|
||||
// 当连续未匹配个数大于等于20个时,该任务被认为可以结束(舍弃或完成-需根据匹配到的数据长度与任务长度做对比)
|
||||
if (roadMatchEntity.getUnMatchCount()>=UNMATCH_BUFFER_MIDDLE_BUFFER) { // 连续未匹配大于阈值时
|
||||
List<MyCoordinate> matchPointList = roadMatchEntity.getMatchPointList();
|
||||
if (matchPointList == null || matchPointList.size()<2) { // 已匹配的点位不足2个,无法计算长度,直接放弃该任务
|
||||
unMatchList.add(roadMatchEntity);
|
||||
} else {
|
||||
if (roadMatchEntity.getMatchedLength()/roadMatchEntity.getLength()>=MATCH_CONFIRM_FINISH_BUFFER) { // 已匹配距离与任务长度距离比例超过指定阈值,该任务可完成
|
||||
roadMatchEntity.setEndMathchTime(System.currentTimeMillis());
|
||||
finishEntityMap.put(roadMatchEntity.getId(), roadMatchEntity);
|
||||
} else {
|
||||
unMatchList.add(roadMatchEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("点击了退出登录的按钮 ,");
|
||||
Intent intent = new Intent(getContext(), LoginActivity.class);
|
||||
startActivity(intent);
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
requireActivity().finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,6 @@ import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.AutoTakePicture4PoiActivity;
|
||||
import com.navinfo.outdoor.activity.AutoTakePicture4PoiVideoActivity;
|
||||
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.WebActivity;
|
||||
|
||||
@ -3,8 +3,9 @@ package com.navinfo.outdoor.http;
|
||||
public class HttpInterface {
|
||||
// public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP
|
||||
public static final String IP0 = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
|
||||
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP2 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String IP4 = "http://10.130.23.166/dtxb/jinshan/m4";//心榕给的测试地址
|
||||
public static final String USER_PATH = "/user/";//我的
|
||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
||||
|
||||
@ -45,11 +45,14 @@ public class LocationLifeCycle implements DefaultLifecycleObserver {
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
startTencentLocation();
|
||||
}
|
||||
|
||||
public void startTencentLocation() {
|
||||
// 开启腾讯定位
|
||||
TalentLocationUtils.getInstance(mContext).startLocation(mContext);
|
||||
if (!TalentLocationUtils.getInstance(mContext).isLocationStart()) {
|
||||
TalentLocationUtils.getInstance(mContext).startLocation(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopTencentLocation() {
|
||||
|
||||
@ -83,6 +83,10 @@ public class TalentLocationUtils implements TencentLocationListener {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLocationStart() {
|
||||
return isLocationStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实现位置监听
|
||||
* @param tencentLocation location
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user