|
@@ -163,7 +163,7 @@ public class MainWindow extends JFrame {
|
163
|
163
|
this.currentPalette = this.basicPalette;
|
164
|
164
|
|
165
|
165
|
wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
|
166
|
|
- "Weakly-Connected Components", new String[]{}, false, false);
|
|
166
|
+ "Weakly-Connected Components", new String[] {}, false, false);
|
167
|
167
|
wccPanel.addStartActionListener(new ActionListener() {
|
168
|
168
|
@Override
|
169
|
169
|
public void actionPerformed(ActionEvent e) {
|
|
@@ -208,7 +208,7 @@ public class MainWindow extends JFrame {
|
208
|
208
|
});
|
209
|
209
|
|
210
|
210
|
spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
|
211
|
|
- new String[]{ "Origin", "Destination" }, true, true);
|
|
211
|
+ new String[] { "Origin", "Destination" }, true, true);
|
212
|
212
|
spPanel.addStartActionListener(new ActionListener() {
|
213
|
213
|
@Override
|
214
|
214
|
public void actionPerformed(ActionEvent e) {
|
|
@@ -261,12 +261,12 @@ public class MainWindow extends JFrame {
|
261
|
261
|
});
|
262
|
262
|
|
263
|
263
|
cpPanel = new AlgorithmPanel(
|
264
|
|
- this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{ "Origin Car",
|
|
264
|
+ this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car",
|
265
|
265
|
"Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
|
266
|
266
|
true, true);
|
267
|
267
|
|
268
|
268
|
psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling",
|
269
|
|
- new String[]{ "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
|
|
269
|
+ new String[] { "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
|
270
|
270
|
true);
|
271
|
271
|
|
272
|
272
|
// add algorithm panels
|
|
@@ -463,7 +463,10 @@ public class MainWindow extends JFrame {
|
463
|
463
|
}
|
464
|
464
|
}
|
465
|
465
|
|
|
466
|
+ Runnable runnable = null;
|
|
467
|
+
|
466
|
468
|
if (isMapView && mfile != null) {
|
|
469
|
+ final File mfileFinal = mfile;
|
467
|
470
|
// It is a mapview drawing and the file was found, so:
|
468
|
471
|
// 1. We create the drawing if necessary.
|
469
|
472
|
if (drawing != mapViewDrawing) {
|
|
@@ -473,16 +476,17 @@ public class MainWindow extends JFrame {
|
473
|
476
|
mainPanel.setDividerLocation(oldLocation);
|
474
|
477
|
notifyDrawingLoaded(basicDrawing, mapViewDrawing);
|
475
|
478
|
drawing.clear();
|
476
|
|
- ((MapViewDrawing) drawing).drawGraph(mfile);
|
|
479
|
+ isNewGraph = true;
|
477
|
480
|
}
|
478
|
|
- else if (isNewGraph) {
|
|
481
|
+ if (isNewGraph) {
|
479
|
482
|
drawing.clear();
|
480
|
|
- ((MapViewDrawing) drawing).drawGraph(mfile);
|
481
|
|
- }
|
482
|
|
- else {
|
483
|
|
- drawing.clearOverlays();
|
|
483
|
+ runnable = new Runnable() {
|
|
484
|
+ public void run() {
|
|
485
|
+ ((MapViewDrawing) drawing).drawGraph(mfileFinal);
|
|
486
|
+ notifyRedrawRequest();
|
|
487
|
+ }
|
|
488
|
+ };
|
484
|
489
|
}
|
485
|
|
- notifyRedrawRequest();
|
486
|
490
|
|
487
|
491
|
}
|
488
|
492
|
else if (!isMapView || (isMapView && mfile == null && isNewGraph)) {
|
|
@@ -492,18 +496,25 @@ public class MainWindow extends JFrame {
|
492
|
496
|
mainPanel.setLeftComponent(basicDrawing);
|
493
|
497
|
mainPanel.setDividerLocation(oldLocation);
|
494
|
498
|
notifyDrawingLoaded(mapViewDrawing, basicDrawing);
|
495
|
|
- this.currentPalette = palette;
|
496
|
|
- drawing.clear();
|
497
|
|
- drawing.drawGraph(graph, palette);
|
|
499
|
+ isNewGraph = true;
|
498
|
500
|
}
|
499
|
|
- else if (isNewGraph || palette != this.currentPalette) {
|
|
501
|
+ if (isNewGraph || palette != this.currentPalette) {
|
500
|
502
|
this.currentPalette = palette;
|
501
|
503
|
drawing.clear();
|
502
|
|
- drawing.drawGraph(graph, palette);
|
503
|
|
- }
|
504
|
|
- else {
|
505
|
|
- drawing.clearOverlays();
|
|
504
|
+ runnable = new Runnable() {
|
|
505
|
+ public void run() {
|
|
506
|
+ drawing.drawGraph(graph, palette);
|
|
507
|
+ notifyRedrawRequest();
|
|
508
|
+ }
|
|
509
|
+ };
|
506
|
510
|
}
|
|
511
|
+ }
|
|
512
|
+
|
|
513
|
+ if (runnable != null) {
|
|
514
|
+ launchThread(runnable, false);
|
|
515
|
+ }
|
|
516
|
+ else {
|
|
517
|
+ drawing.clearOverlays();
|
507
|
518
|
notifyRedrawRequest();
|
508
|
519
|
}
|
509
|
520
|
|
|
@@ -696,12 +707,7 @@ public class MainWindow extends JFrame {
|
696
|
707
|
drawGraphItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
697
|
708
|
@Override
|
698
|
709
|
public void actionPerformed(ActionEvent e) {
|
699
|
|
- launchThread(new Runnable() {
|
700
|
|
- @Override
|
701
|
|
- public void run() {
|
702
|
|
- drawGraph(BasicDrawing.class, basicPalette);
|
703
|
|
- }
|
704
|
|
- });
|
|
710
|
+ drawGraph(BasicDrawing.class, basicPalette);
|
705
|
711
|
}
|
706
|
712
|
}));
|
707
|
713
|
graphLockItems.add(drawGraphItem);
|
|
@@ -710,12 +716,7 @@ public class MainWindow extends JFrame {
|
710
|
716
|
drawGraphBWItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
711
|
717
|
@Override
|
712
|
718
|
public void actionPerformed(ActionEvent e) {
|
713
|
|
- launchThread(new Runnable() {
|
714
|
|
- @Override
|
715
|
|
- public void run() {
|
716
|
|
- drawGraph(BasicDrawing.class, blackAndWhitePalette);
|
717
|
|
- }
|
718
|
|
- });
|
|
719
|
+ drawGraph(BasicDrawing.class, blackAndWhitePalette);
|
719
|
720
|
}
|
720
|
721
|
}));
|
721
|
722
|
graphLockItems.add(drawGraphBWItem);
|
|
@@ -725,12 +726,7 @@ public class MainWindow extends JFrame {
|
725
|
726
|
drawGraphMapsforgeItem.addActionListener(baf.createBlockingAction(new ActionListener() {
|
726
|
727
|
@Override
|
727
|
728
|
public void actionPerformed(ActionEvent e) {
|
728
|
|
- launchThread(new Runnable() {
|
729
|
|
- @Override
|
730
|
|
- public void run() {
|
731
|
|
- drawGraph(MapViewDrawing.class);
|
732
|
|
- }
|
733
|
|
- });
|
|
729
|
+ drawGraph(MapViewDrawing.class);
|
734
|
730
|
}
|
735
|
731
|
}));
|
736
|
732
|
graphLockItems.add(drawGraphMapsforgeItem);
|