From 5f977e6774a35658c83ec56bbb9f3b5feb4bbfc2 Mon Sep 17 00:00:00 2001 From: pauls Date: Fri, 1 Apr 2022 13:10:26 +0200 Subject: [PATCH] Adding passage numbers --- build.gradle | 6 +++- .../com/insa/coliffimo/MainController.java | 4 +-- .../insa/coliffimo/router/RouterRunnable.java | 35 ++++++++++--------- .../leaflet/markers/DeliveryMarker.kt | 4 ++- .../coliffimo/leaflet/markers/PickupMarker.kt | 4 ++- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index ed3aed3..dbeba16 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { } group 'com.insa' -version '1.0.7' +version '1.0.8' repositories { mavenCentral() @@ -85,6 +85,10 @@ java { modularity.inferModulePath = true } +manifest { + attributes('Main-Class': 'com.insa.coliffimo.Application') +} + distZip { archiveName("Coliffimo-${javafx.platform.classifier}.zip") } diff --git a/src/main/java/com/insa/coliffimo/MainController.java b/src/main/java/com/insa/coliffimo/MainController.java index be2d8e6..ad4a2e2 100644 --- a/src/main/java/com/insa/coliffimo/MainController.java +++ b/src/main/java/com/insa/coliffimo/MainController.java @@ -129,11 +129,11 @@ public void processItinerary() { public void addPoint(LatLong marker) { if (!firstAdded) { - mapView.addMarker(marker, "Temp pickup", new PickupMarker("#555555"), 1, "Temp pickup", "temp-pickup"); + mapView.addMarker(marker, "Temp pickup", new PickupMarker("#555555", 0), 1, "Temp pickup", "temp-pickup"); firstCoordinate = marker; firstAdded = true; } else { - mapView.addMarker(marker, "Temp delivery", new DeliveryMarker("#555555"), 1, "Temp delivery", "temp-delivery"); + mapView.addMarker(marker, "Temp delivery", new DeliveryMarker("#555555", 0), 1, "Temp delivery", "temp-delivery"); additionalLocalMarkers.addShipments(firstCoordinate, marker); topPane.getChildren().add(itiProgress); new Thread(new RouterRunnable(planningResource, mapView, rootPane, topPane, collapseRightPanelButton, buttonHandler, additionalLocalMarkers.getShipments())).start(); diff --git a/src/main/java/com/insa/coliffimo/router/RouterRunnable.java b/src/main/java/com/insa/coliffimo/router/RouterRunnable.java index 08f492e..0c31c1d 100644 --- a/src/main/java/com/insa/coliffimo/router/RouterRunnable.java +++ b/src/main/java/com/insa/coliffimo/router/RouterRunnable.java @@ -133,7 +133,7 @@ public void run() { scrollPane = new ScrollPane(); scrollPane.setContent(rightPane); rootPane.setRight(scrollPane); - topPane.getChildren().remove(topPane.getChildren().size()-1); + topPane.getChildren().remove(topPane.getChildren().size() - 1); }); } @@ -164,7 +164,7 @@ private void initMapView(RouteInfo route) { shipment.getPickupLocation().getCoordinate().getX() + ", " + shipment.getPickupLocation().getCoordinate().getY() + "

" + "Arrivée : " + pickupTime.format(timeFormat) + "

" + - "Départ : " + pickupTime.plusSeconds((long) (shipment.getPickupServiceTime()/1000)).format(timeFormat); + "Départ : " + pickupTime.plusSeconds((long) (shipment.getPickupServiceTime() / 1000)).format(timeFormat); LocalTime deliveryTime = departureTime.plusSeconds((long) activityTime(route.tourActivities.get(0), shipment.getDeliveryLocation().getId())); int deliveryOrder = activityOrder(route.tourActivities.get(0), shipment.getDeliveryLocation().getId()); @@ -172,14 +172,14 @@ private void initMapView(RouteInfo route) { shipment.getDeliveryLocation().getCoordinate().getX() + ", " + shipment.getDeliveryLocation().getCoordinate().getY() + "

" + "Arrivée : " + deliveryTime.format(timeFormat) + "

" + - "Départ : " + deliveryTime.plusSeconds((long) (shipment.getDeliveryServiceTime()/1000)).format(timeFormat); + "Départ : " + deliveryTime.plusSeconds((long) (shipment.getDeliveryServiceTime() / 1000)).format(timeFormat); mapView.addMarker(from(shipment.getPickupLocation()), "Pickup", new PickupMarker(hex, pickupOrder), 1, pickupLabel, "pickup" + idMarker); mapView.addMarker(from(shipment.getDeliveryLocation()), "Delivery", new DeliveryMarker(hex, deliveryOrder), 1, deliveryLabel, "delivery" + idMarker); k++; } double lastRouteTime = 0.0; - for (Instruction instruction : route.instructionLists.get(route.instructionLists.size()-1)){ - lastRouteTime += instruction.getTime()/1000.0; + for (Instruction instruction : route.instructionLists.get(route.instructionLists.size() - 1)) { + lastRouteTime += instruction.getTime() / 1000.0; } TourActivity lastTourActivity = route.tourActivities.get(0).getActivities().get(route.tourActivities.get(0).getActivities().size() - 1); double timeAtLastPoint = lastTourActivity.getArrTime(); @@ -191,17 +191,18 @@ private void initMapView(RouteInfo route) { } } System.out.println(lastRouteTime); - String depotLabel = "Dépôt

Départ "+ - departureTime.format(timeFormat)+ - "

Arrivée "+ - departureTime.plusSeconds((long) timeAtLastPoint / 1000).plusSeconds((long) (lastDeliveryTime/1000)).plusSeconds((long) lastRouteTime).format(timeFormat); + String depotLabel = "Dépôt

Départ " + + departureTime.format(timeFormat) + + "

Arrivée " + + departureTime.plusSeconds((long) timeAtLastPoint / 1000).plusSeconds((long) (lastDeliveryTime / 1000)).plusSeconds((long) lastRouteTime).format(timeFormat); mapView.addMarker(from(vehicle.getStartLocation()), "Start/Arrival", new DepotMarker("#000000"), 1, depotLabel, "0"); } private void initRightPane() { rightPane = new VBox(); rightPane.getStyleClass().add("vbox"); - if (!buttonHandler) this.collapseRightPanelButton.addEventHandler(MouseEvent.MOUSE_RELEASED, collapseRightPanel()); + if (!buttonHandler) + this.collapseRightPanelButton.addEventHandler(MouseEvent.MOUSE_RELEASED, collapseRightPanel()); } private void initInstructionBlocPane() { @@ -451,19 +452,19 @@ private LatLong from(Location location) { return new LatLong(location.getCoordinate().getX(), location.getCoordinate().getY()); } - private double activityTime(TourActivities tourActivity, String id){ - for (TourActivity a : tourActivity.getActivities()){ - if (a.getLocation().getId().equals(id)){ - return a.getArrTime()/1000; + private double activityTime(TourActivities tourActivity, String id) { + for (TourActivity a : tourActivity.getActivities()) { + if (a.getLocation().getId().equals(id)) { + return a.getArrTime() / 1000; } } return 0.0; } - private int activityOrder(TourActivities tourActivity, String id){ + private int activityOrder(TourActivities tourActivity, String id) { int i = 1; - for (TourActivity a : tourActivity.getActivities()){ - if (a.getLocation().getId().equals(id)){ + for (TourActivity a : tourActivity.getActivities()) { + if (a.getLocation().getId().equals(id)) { return i; } i++; diff --git a/src/main/kotlin/com/insa/coliffimo/leaflet/markers/DeliveryMarker.kt b/src/main/kotlin/com/insa/coliffimo/leaflet/markers/DeliveryMarker.kt index 4d3d821..84c8ef7 100644 --- a/src/main/kotlin/com/insa/coliffimo/leaflet/markers/DeliveryMarker.kt +++ b/src/main/kotlin/com/insa/coliffimo/leaflet/markers/DeliveryMarker.kt @@ -1,6 +1,6 @@ package com.insa.coliffimo.leaflet.markers -class DeliveryMarker(color: String) : CustomMarker() { +class DeliveryMarker(color: String, positionNumber: Int) : CustomMarker() { override val iconName: String = divIcon( """ @@ -10,6 +10,8 @@ class DeliveryMarker(color: String) : CustomMarker() { + + $positionNumber """.trimIndent() ) diff --git a/src/main/kotlin/com/insa/coliffimo/leaflet/markers/PickupMarker.kt b/src/main/kotlin/com/insa/coliffimo/leaflet/markers/PickupMarker.kt index 95cbc07..4a6c424 100644 --- a/src/main/kotlin/com/insa/coliffimo/leaflet/markers/PickupMarker.kt +++ b/src/main/kotlin/com/insa/coliffimo/leaflet/markers/PickupMarker.kt @@ -1,6 +1,6 @@ package com.insa.coliffimo.leaflet.markers -class PickupMarker(color: String) : CustomMarker() { +class PickupMarker(color: String, positionNumber: Int) : CustomMarker() { override val iconName: String = divIcon( """ @@ -9,6 +9,8 @@ class PickupMarker(color: String) : CustomMarker() { + + $positionNumber """.trimIndent() )