summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-04-10 14:08:20 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2023-04-10 14:08:20 +0200
commitc9dfd2e261c938c42bfa9527fa2786e8d3cdeb79 (patch)
tree0a20b550c00335ea25933c262b40988053269ac4
parent06d28253b7a8c63131a7ced8731c7ec2de5f2d83 (diff)
dont show stacked stops of at the same address
-rw-r--r--lib/RoutingExample.dart20
-rw-r--r--lib/config/defaults.dart2
2 files changed, 15 insertions, 7 deletions
diff --git a/lib/RoutingExample.dart b/lib/RoutingExample.dart
index 8aabb32..7f4444f 100644
--- a/lib/RoutingExample.dart
+++ b/lib/RoutingExample.dart
@@ -259,12 +259,15 @@ class RoutingExample {
}
// if address is double planned and there is a stop before this one.
- bool shouldShowPinOnMap(DestinationPin taskToCheck) {
- for (int i = _parcelNumberPins.length - 1; i >= 0; i--) {
+ bool shouldDoublePlannedAddressBeVisible(DestinationPin taskToCheck) {
+ if (!taskToCheck.isDoublePlannedAddress) return true;
+ for (int i = routeSectionCursor; i < _parcelNumberPins.length; i++) {
var item = _parcelNumberPins[i];
- if (!item.isDoublePlannedAddress) continue;
- if (item == taskToCheck) return true;
- if (item.coords == taskToCheck.coords && item == taskToCheck) {
+
+ if (item == taskToCheck) {
+ return true; // first one of the double planned addresses is visible.
+ }
+ if (item.coords == taskToCheck.coords) {
return false;
}
}
@@ -446,7 +449,6 @@ class RoutingExample {
void updateHighlightedRouteSections({bool force = false}) {
int maxPins = 300;
- print('cursor ' + routeSectionCursor.toString());
for (int i = _parcelNumberPins.length - 1; i >= 0; i--) {
DestinationPin pin = _parcelNumberPins.elementAt(i);
@@ -461,6 +463,12 @@ class RoutingExample {
bool forceUpdateThisPin =
force && (i > routeSectionCursor - 3 && i < routeSectionCursor + 3);
+ if (!shouldDoublePlannedAddressBeVisible(pin)) {
+ pin.pin?.unpin();
+ pin.pin = null;
+ continue;
+ }
+
if (i > routeSectionCursor + 1 && i < routeSectionCursor + maxPins) {
if (forceUpdateThisPin) {
pin.pin?.unpin();
diff --git a/lib/config/defaults.dart b/lib/config/defaults.dart
index f629861..71e457e 100644
--- a/lib/config/defaults.dart
+++ b/lib/config/defaults.dart
@@ -1,4 +1,4 @@
-String program_version = '0.12 [08/02/2023]';
+String program_version = '0.13 [10/04/2023]';
bool debug_mode = false;
class ShiftType {