mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
issue #144 - replace deprecated methods
This commit is contained in:
parent
c083b74ea7
commit
600087fd33
48 changed files with 398 additions and 379 deletions
|
|
@ -310,15 +310,15 @@ public class AlgorithmEventsRecorder implements RuinListener, IterationStartsLis
|
|||
private void addJob(Job job) {
|
||||
if(job instanceof Service){
|
||||
Service service = (Service)job;
|
||||
addNode(service.getId(), service.getCoord());
|
||||
addNode(service.getId(), service.getLocation().getCoordinate());
|
||||
markService(service);
|
||||
}
|
||||
else if(job instanceof Shipment){
|
||||
Shipment shipment = (Shipment)job;
|
||||
String fromNodeId = getFromNodeId(shipment);
|
||||
addNode(fromNodeId, shipment.getPickupCoord());
|
||||
addNode(fromNodeId, shipment.getPickupLocation().getCoordinate());
|
||||
String toNodeId = getToNodeId(shipment);
|
||||
addNode(toNodeId,shipment.getDeliveryCoord());
|
||||
addNode(toNodeId,shipment.getDeliveryLocation().getCoordinate());
|
||||
markShipment(shipment);
|
||||
if(renderShipments) {
|
||||
Edge e = graph.addEdge("shipment_" + fromNodeId + "_" + toNodeId, fromNodeId, toNodeId, true);
|
||||
|
|
|
|||
|
|
@ -505,21 +505,21 @@ public class GraphStreamViewer {
|
|||
|
||||
private void renderShipment(Graph g, Shipment shipment, Label label, boolean renderShipments) {
|
||||
|
||||
Node n1 = g.addNode(makeId(shipment.getId(),shipment.getPickupLocationId()));
|
||||
Node n1 = g.addNode(makeId(shipment.getId(),shipment.getPickupLocation().getId()));
|
||||
if(label.equals(Label.ID)) n1.addAttribute("ui.label", shipment.getId());
|
||||
n1.addAttribute("x", shipment.getPickupCoord().getX());
|
||||
n1.addAttribute("y", shipment.getPickupCoord().getY());
|
||||
n1.addAttribute("x", shipment.getPickupLocation().getCoordinate().getX());
|
||||
n1.addAttribute("y", shipment.getPickupLocation().getCoordinate().getY());
|
||||
n1.setAttribute("ui.class", "pickup");
|
||||
|
||||
Node n2 = g.addNode(makeId(shipment.getId(),shipment.getDeliveryLocationId()));
|
||||
Node n2 = g.addNode(makeId(shipment.getId(),shipment.getDeliveryLocation().getId()));
|
||||
if(label.equals(Label.ID)) n2.addAttribute("ui.label", shipment.getId());
|
||||
n2.addAttribute("x", shipment.getDeliveryCoord().getX());
|
||||
n2.addAttribute("y", shipment.getDeliveryCoord().getY());
|
||||
n2.addAttribute("x", shipment.getDeliveryLocation().getCoordinate().getX());
|
||||
n2.addAttribute("y", shipment.getDeliveryLocation().getCoordinate().getY());
|
||||
n2.setAttribute("ui.class", "delivery");
|
||||
|
||||
if(renderShipments){
|
||||
Edge s = g.addEdge(shipment.getId(), makeId(shipment.getId(),shipment.getPickupLocationId()),
|
||||
makeId(shipment.getId(),shipment.getDeliveryLocationId()), true);
|
||||
Edge s = g.addEdge(shipment.getId(), makeId(shipment.getId(),shipment.getPickupLocation().getId()),
|
||||
makeId(shipment.getId(),shipment.getDeliveryLocation().getId()), true);
|
||||
s.addAttribute("ui.class", "shipment");
|
||||
}
|
||||
|
||||
|
|
@ -535,10 +535,10 @@ public class GraphStreamViewer {
|
|||
}
|
||||
|
||||
private void renderService(Graph g, Service service, Label label) {
|
||||
Node n = g.addNode(makeId(service.getId(),service.getLocationId()));
|
||||
Node n = g.addNode(makeId(service.getId(),service.getLocation().getId()));
|
||||
if(label.equals(Label.ID)) n.addAttribute("ui.label", service.getId());
|
||||
n.addAttribute("x", service.getCoord().getX());
|
||||
n.addAttribute("y", service.getCoord().getY());
|
||||
n.addAttribute("x", service.getLocation().getCoordinate().getX());
|
||||
n.addAttribute("y", service.getLocation().getCoordinate().getY());
|
||||
if(service.getType().equals("pickup")) n.setAttribute("ui.class", "pickup");
|
||||
if(service.getType().equals("delivery")) n.setAttribute("ui.class", "delivery");
|
||||
}
|
||||
|
|
@ -576,7 +576,7 @@ public class GraphStreamViewer {
|
|||
}
|
||||
for(TourActivity act : route.getActivities()){
|
||||
Job job = ((JobActivity) act).getJob();
|
||||
String currIdentifier = makeId(job.getId(),act.getLocationId());
|
||||
String currIdentifier = makeId(job.getId(),act.getLocation().getId());
|
||||
if(label.equals(Label.ACTIVITY)){
|
||||
Node actNode = g.getNode(currIdentifier);
|
||||
actNode.addAttribute("ui.label", act.getName());
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 Stefan Schroeder
|
||||
*
|
||||
* Copyright (C) 2014 Stefan Schroeder
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
|
|
@ -470,15 +470,15 @@ public class Plotter {
|
|||
if(route.isEmpty()) continue;
|
||||
XYSeries series = new XYSeries(counter, false, true);
|
||||
|
||||
Coordinate startCoord = locations.getCoord(route.getStart().getLocationId());
|
||||
Coordinate startCoord = locations.getCoord(route.getStart().getLocation().getId());
|
||||
series.add(startCoord.getX()*scalingFactor, startCoord.getY()*scalingFactor);
|
||||
|
||||
for(TourActivity act : route.getTourActivities().getActivities()){
|
||||
Coordinate coord = locations.getCoord(act.getLocationId());
|
||||
Coordinate coord = locations.getCoord(act.getLocation().getId());
|
||||
series.add(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
|
||||
}
|
||||
|
||||
Coordinate endCoord = locations.getCoord(route.getEnd().getLocationId());
|
||||
Coordinate endCoord = locations.getCoord(route.getEnd().getLocation().getId());
|
||||
series.add(endCoord.getX()*scalingFactor, endCoord.getY()*scalingFactor);
|
||||
|
||||
coll.addSeries(series);
|
||||
|
|
@ -507,8 +507,8 @@ public class Plotter {
|
|||
shipmentSeries = new XYSeries(sCounter, false, true);
|
||||
sCounter++;
|
||||
}
|
||||
shipmentSeries.add(shipment.getPickupCoord().getX()*scalingFactor, shipment.getPickupCoord().getY()*scalingFactor);
|
||||
shipmentSeries.add(shipment.getDeliveryCoord().getX()*scalingFactor, shipment.getDeliveryCoord().getY()*scalingFactor);
|
||||
shipmentSeries.add(shipment.getPickupLocation().getCoordinate().getX()*scalingFactor, shipment.getPickupLocation().getCoordinate().getY()*scalingFactor);
|
||||
shipmentSeries.add(shipment.getDeliveryLocation().getCoordinate().getX()*scalingFactor, shipment.getDeliveryLocation().getCoordinate().getY()*scalingFactor);
|
||||
coll.addSeries(shipmentSeries);
|
||||
}
|
||||
return coll;
|
||||
|
|
@ -517,13 +517,13 @@ public class Plotter {
|
|||
private void addJob(XYSeries activities, Job job) {
|
||||
if(job instanceof Shipment){
|
||||
Shipment s = (Shipment)job;
|
||||
XYDataItem dataItem = new XYDataItem(s.getPickupCoord().getX()*scalingFactor, s.getPickupCoord().getY()*scalingFactor);
|
||||
XYDataItem dataItem = new XYDataItem(s.getPickupLocation().getCoordinate().getX()*scalingFactor, s.getPickupLocation().getCoordinate().getY()*scalingFactor);
|
||||
activities.add(dataItem);
|
||||
addLabel(s, dataItem);
|
||||
markItem(dataItem,Activity.PICKUP, job);
|
||||
containsPickupAct = true;
|
||||
|
||||
XYDataItem dataItem2 = new XYDataItem(s.getDeliveryCoord().getX()*scalingFactor, s.getDeliveryCoord().getY()*scalingFactor);
|
||||
XYDataItem dataItem2 = new XYDataItem(s.getDeliveryLocation().getCoordinate().getX()*scalingFactor, s.getDeliveryLocation().getCoordinate().getY()*scalingFactor);
|
||||
activities.add(dataItem2);
|
||||
addLabel(s, dataItem2);
|
||||
markItem(dataItem2,Activity.DELIVERY, job);
|
||||
|
|
@ -531,7 +531,7 @@ public class Plotter {
|
|||
}
|
||||
else if(job instanceof Pickup){
|
||||
Pickup service = (Pickup)job;
|
||||
Coordinate coord = service.getCoord();
|
||||
Coordinate coord = service.getLocation().getCoordinate();
|
||||
XYDataItem dataItem = new XYDataItem(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
|
||||
activities.add(dataItem);
|
||||
addLabel(service, dataItem);
|
||||
|
|
@ -540,7 +540,7 @@ public class Plotter {
|
|||
}
|
||||
else if(job instanceof Delivery){
|
||||
Delivery service = (Delivery)job;
|
||||
Coordinate coord = service.getCoord();
|
||||
Coordinate coord = service.getLocation().getCoordinate();
|
||||
XYDataItem dataItem = new XYDataItem(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
|
||||
activities.add(dataItem);
|
||||
addLabel(service, dataItem);
|
||||
|
|
@ -549,7 +549,7 @@ public class Plotter {
|
|||
}
|
||||
else if(job instanceof Service){
|
||||
Service service = (Service)job;
|
||||
Coordinate coord = service.getCoord();
|
||||
Coordinate coord = service.getLocation().getCoordinate();
|
||||
XYDataItem dataItem = new XYDataItem(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
|
||||
activities.add(dataItem);
|
||||
addLabel(service, dataItem);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue