Skip to content

Commit

Permalink
new Feature: qc button to reverse direction of MTL
Browse files Browse the repository at this point in the history
  • Loading branch information
mg4gh committed Feb 11, 2024
1 parent bec658d commit 2dfbde0
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- new Feature: qc button to reverse direction of MTL
- remove FSRemainings, logically replaced by FSTrackDetails
- replace menu animation timeout with menu animation duration setting
- new Feature: track details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void composeQuickControls(MGMapActivity activity, ControlView coView) {
createQC(activity, FSRouting.class,qcss[3],"routingSave",gos.get(0)).setId(R.id.mi_routing_save);
createQC(activity, FSMarker.class,qcss[3],"markerEdit",gos.get(0)).setId(R.id.mi_marker_edit);
createQC(activity, FSRouting.class,qcss[3],"routingHint",gos.get(0)).setId(R.id.mi_routing_hint);
createQC(activity, FSControl.class,qcss[3],"empty",gos.get(0)).setId(R.id.mi_marker_empty2);
createQC(activity, FSMarker.class,qcss[3],"reverse",gos.get(0)).setId(R.id.mi_marker_reverse);
createQC(activity, FSRouting.class,qcss[3],"matching",gos.get(0)).setId(R.id.mi_map_mathching);
createQC(activity, FSControl.class,qcss[3],"empty",gos.get(0)).setId(R.id.mi_marker_empty3);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class FSMarker extends FeatureService {
private final Pref<Boolean> prefMtlVisibility = getPref(R.string.FSMarker_pref_MTL_visibility, false);
private final Pref<Boolean> triggerHideMtl = new Pref<>(false);
private final Pref<Boolean> triggerHideAll = getPref(R.string.FSATL_pref_hideAll, false);
private final Pref<Boolean> triggerReverseMtl = new Pref<>(false);

final MGMapApplication.TrackLogObservable<WriteableTrackLog> markerTrackLogObservable = getApplication().markerTrackLogObservable;

Expand Down Expand Up @@ -86,6 +87,7 @@ public FSMarker(MGMapActivity mmActivity) {
triggerHideMtl.addObserver(hideMarkerTrackObserver);
triggerHideAll.addObserver(hideMarkerTrackObserver);
prefEditMarkerTrack.setValue(false);
triggerReverseMtl.addObserver((e)->createMarkerTrackLog(markerTrackLogObservable.getTrackLog(), true));
}

private final Runnable ttHide = () -> prefEditMarkerTrack.setValue(false);
Expand Down Expand Up @@ -115,6 +117,11 @@ public ExtendedTextView initQuickControl(ExtendedTextView etv, String info) {
etv.setPrAction(triggerHideMtl);
etv.setDisabledData(prefMtlVisibility,R.drawable.hide_mtl_dis);
etv.setHelp(r(R.string.FSMarker_qcHideMtl_Help));
} else if ("reverse".equals(info)){
etv.setData(R.drawable.marker_reverse);
etv.setPrAction(triggerReverseMtl);
etv.setDisabledData(prefMtlVisibility,R.drawable.marker_reverse_dis);
etv.setHelp(r(R.string.FSMarker_qcHideMtl_Help));
}
return etv;
}
Expand Down Expand Up @@ -156,8 +163,11 @@ private void checkStartStopMCL(){
}
}


public void createMarkerTrackLog(TrackLog trackLog){
createMarkerTrackLog(trackLog, false);
}

public void createMarkerTrackLog(TrackLog trackLog, boolean reverse){
String name = trackLog.getName();
name = name.endsWith("_MarkerTrack")?name:(name+"_MarkerTrack");
WriteableTrackLog mtl = new WriteableTrackLog(name);
Expand All @@ -168,7 +178,7 @@ public void createMarkerTrackLog(TrackLog trackLog){
for (TrackLogSegment segment : trackLog.getTrackLogSegments()){
mtl.startSegment(segment.getStatistic().getTStart());
for (int i = 0; i<segment.size(); i++){
PointModel pm = segment.get(i);
PointModel pm = segment.get(reverse? segment.size()-(i+1) : i);
PointModel npm;
if (pm instanceof TrackLogPoint) {
npm = new TrackLogPoint((TrackLogPoint) pm);
Expand Down
40 changes: 40 additions & 0 deletions mgmap/src/main/res/drawable/marker_reverse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@



<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="32.0"
android:viewportWidth="32.0">


<path
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:pathData="
M5,4 a3,3,0 1 0 0.001,0
M8,7 l14,0
M22,7 l-3,-3, l3,3, l-3,3
M27,4 a3,3,0 1 0 0.001,0
M5,22 a3,3,0 1 0 0.001,0
M10,25 l14,0
M10,25 l3,-3, l-3,3, l3,3
M27,22 a3,3,0 1 0 0.001,0
" />



<path
android:strokeColor="#FFFFFFFF"
android:strokeWidth="2"
android:pathData="
M15,12 l0,7 m-3,-3 l3,3 l3,-3
" />



</vector>
40 changes: 40 additions & 0 deletions mgmap/src/main/res/drawable/marker_reverse_dis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@



<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="32.0"
android:viewportWidth="32.0">


<path
android:strokeColor="#FFC0C0C0"
android:strokeWidth="2"
android:pathData="
M5,4 a3,3,0 1 0 0.001,0
M8,7 l14,0
M22,7 l-3,-3, l3,3, l-3,3
M27,4 a3,3,0 1 0 0.001,0
M5,22 a3,3,0 1 0 0.001,0
M10,25 l14,0
M10,25 l3,-3, l-3,3, l3,3
M27,22 a3,3,0 1 0 0.001,0
" />



<path
android:strokeColor="#FFC0C0C0"
android:strokeWidth="2"
android:pathData="
M15,12 l0,7 m-3,-3 l3,3 l3,-3
" />



</vector>
1 change: 1 addition & 0 deletions mgmap/src/main/res/values/fsmarker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
<string name="FSMarker_qcEditMarkerTrack_Help2">on tap: switch edit mode off</string>

<string name="FSMarker_qcHideMtl_Help">Hide marker track log</string>
<string name="FSMarker_qcReverseMtl_Help">Reverse direction</string>
</resources>
2 changes: 1 addition & 1 deletion mgmap/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<item type="id" name="mi_marker_empty1" />
<item type="id" name="mi_marker_edit" />
<item type="id" name="mi_routing_hint" />
<item type="id" name="mi_marker_empty2" />
<item type="id" name="mi_marker_reverse" />
<item type="id" name="mi_map_mathching" />
<item type="id" name="mi_marker_empty3" />

Expand Down
4 changes: 2 additions & 2 deletions mgmap/version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Automatically updated File - do not edit manually
#Fri Feb 09 20:09:28 CET 2024
BUILD_NBR=45
#Sun Feb 11 11:02:47 CET 2024
BUILD_NBR=46
VERSION_CODE=20

0 comments on commit 2dfbde0

Please sign in to comment.