Skip to content

Commit

Permalink
Adding passage numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
PeredurOmega committed Apr 1, 2022
1 parent 0eda008 commit 5f977e6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group 'com.insa'
version '1.0.7'
version '1.0.8'

repositories {
mavenCentral()
Expand Down Expand Up @@ -85,6 +85,10 @@ java {
modularity.inferModulePath = true
}

manifest {
attributes('Main-Class': 'com.insa.coliffimo.Application')
}

distZip {
archiveName("Coliffimo-${javafx.platform.classifier}.zip")
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/insa/coliffimo/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
35 changes: 18 additions & 17 deletions src/main/java/com/insa/coliffimo/router/RouterRunnable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down Expand Up @@ -164,22 +164,22 @@ private void initMapView(RouteInfo route) {
shipment.getPickupLocation().getCoordinate().getX() + ", " +
shipment.getPickupLocation().getCoordinate().getY() + "</p><p>" +
"Arrivée : " + pickupTime.format(timeFormat) + "</p><p>" +
"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());
String deliveryLabel = "Delivery</p><p>" +
shipment.getDeliveryLocation().getCoordinate().getX() + ", " +
shipment.getDeliveryLocation().getCoordinate().getY() + "</p><p>" +
"Arrivée : " + deliveryTime.format(timeFormat) + "</p><p>" +
"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();
Expand All @@ -191,17 +191,18 @@ private void initMapView(RouteInfo route) {
}
}
System.out.println(lastRouteTime);
String depotLabel = "Dépôt</p><p>Départ "+
departureTime.format(timeFormat)+
"</p><p>Arrivée "+
departureTime.plusSeconds((long) timeAtLastPoint / 1000).plusSeconds((long) (lastDeliveryTime/1000)).plusSeconds((long) lastRouteTime).format(timeFormat);
String depotLabel = "Dépôt</p><p>Départ " +
departureTime.format(timeFormat) +
"</p><p>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() {
Expand Down Expand Up @@ -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++;
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
"""
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.388 25">
Expand All @@ -10,6 +10,8 @@ class DeliveryMarker(color: String) : CustomMarker() {
<path d="M9.939,6.991a2.642,2.642,0,0,0-3.268,3.277H3.993a.752.752,0,0,1-.813-.809q0-2.2,0-4.394a.659.659,0,0,1,.084-.306c.19-.346.4-.683.592-1.026a.425.425,0,0,1,.4-.233q2.3,0,4.6,0a.424.424,0,0,1,.4.232c.2.349.407.694.6,1.043a.521.521,0,0,1,.073.236c.006.636,0,1.273,0,1.909C9.946,6.94,9.942,6.961,9.939,6.991Z" style="fill:#fff"/>
<path style="fill:$color" d="M6.671,10.268H3.993a.752.752,0,0,1-.813-.809q0-2.2,0-4.394a.659.659,0,0,1,.084-.306c.19-.346.4-.683.592-1.026a.424.424,0,0,1,.4-.233q2.3,0,4.605,0a.424.424,0,0,1,.4.232c.2.349.407.694.6,1.043a.521.521,0,0,1,.073.236c.006.636,0,1.273,0,1.909,0,.02,0,.041-.007.071a2.642,2.642,0,0,0-3.268,3.277ZM9.1,5c0-.012,0-.021,0-.025-.129-.225-.256-.449-.389-.671a.131.131,0,0,0-.1-.039q-2.056,0-4.111,0a.169.169,0,0,0-.119.073c-.09.137-.169.282-.251.424C4.1,4.833,4.053,4.908,4,5Zm-2.528.763c-.35,0-.7,0-1.048,0-.068,0-.093.019-.091.089,0,.192,0,.384,0,.576,0,.064.021.086.085.086q1.043,0,2.085,0c.063,0,.087-.021.086-.085,0-.189,0-.377,0-.566,0-.079-.022-.1-.1-.1C7.252,5.76,6.913,5.758,6.574,5.758Z"/>
<path d="M7.932,9.526l.506-.509.574.582c.164-.169.32-.328.476-.487l.472-.483.378.38c.15.151.15.15,0,.3L9.1,10.55a.5.5,0,0,0-.06.09Z" style="fill:#fff"/>
<circle cx="11.3" cy="3" r="3" style="fill:$color"></circle>
<text x="9.9" y="4.5" font-family="Roboto" "="" font-size="5" style="color:#fff;stroke: white;stroke-width: 0.4px;">$positionNumber</text>
</svg>
""".trimIndent()
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
"""
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.388 25">
Expand All @@ -9,6 +9,8 @@ class PickupMarker(color: String) : CustomMarker() {
<path style="fill:$color" d="M7.244,8.127a.813.813,0,0,1-.756-.569q-.278-.918-.543-1.839a.789.789,0,0,1,.524-.977q1.149-.36,2.3-.707a.778.778,0,0,1,.976.5c.2.624.381,1.252.557,1.882a.786.786,0,0,1-.551.962c-.452.146-.908.281-1.363.421-.291.09-.581.181-.874.268C7.427,8.1,7.335,8.109,7.244,8.127Zm.085-2.8c.076.241.146.467.222.691a.091.091,0,0,0,.078.045q.506-.154,1.008-.32a.1.1,0,0,0,.047-.086c-.06-.207-.124-.412-.194-.615A.1.1,0,0,0,8.4,4.993C8.05,5.1,7.7,5.214,7.329,5.331Z"/>
<path style="fill:$color" d="M10.985,7.808l.24.76c-.068.024-.126.047-.184.065l-4.147,1.3a1.2,1.2,0,0,1-1.551-.8Q4.759,7.31,4.19,5.478c-.032-.1-.068-.124-.17-.085-.174.065-.354.113-.53.172-.069.023-.107.015-.13-.065-.056-.192-.12-.382-.184-.573-.02-.06-.024-.1.053-.127.475-.149.948-.3,1.436-.456.015.039.031.075.042.112Q5.4,6.65,6.094,8.845a.406.406,0,0,0,.595.31l4.2-1.32Z"/>
<path style="fill:$color" d="M6.87,12a.8.8,0,1,1,.8-.8A.8.8,0,0,1,6.87,12Z"/>
<circle cx="11.3" cy="3" r="3" style="fill:$color"></circle>
<text x="9.9" y="4.5" font-family="Roboto" "="" font-size="5" style="color:#fff;stroke: white;stroke-width: 0.4px;">$positionNumber</text>
</svg>
""".trimIndent()
)
Expand Down

0 comments on commit 5f977e6

Please sign in to comment.