Fix issue with observers.
This commit is contained in:
parent
bcfc8dac3d
commit
89b6bc5819
@ -169,7 +169,6 @@ public class MainWindow extends JFrame {
|
||||
}
|
||||
|
||||
spPanel.setEnabled(false);
|
||||
launchShortestPathThread(spAlgorithm);
|
||||
|
||||
if (evt.isGraphicVisualizationEnabled()) {
|
||||
spAlgorithm.addObserver(new ShortestPathGraphicObserver(drawing));
|
||||
@ -177,6 +176,8 @@ public class MainWindow extends JFrame {
|
||||
if (evt.isTextualVisualizationEnabled()) {
|
||||
spAlgorithm.addObserver(new ShortestPathTextObserver(printStream));
|
||||
}
|
||||
|
||||
launchShortestPathThread(spAlgorithm);
|
||||
}
|
||||
});
|
||||
spPanel.setVisible(false);
|
||||
@ -285,6 +286,9 @@ public class MainWindow extends JFrame {
|
||||
threadTimer.stop();
|
||||
threadPanel.setVisible(false);
|
||||
currentThread.setThread(null);
|
||||
if (spPanel.isVisible()) {
|
||||
spPanel.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void displayShortestPathSolution(ShortestPathSolution solution) {
|
||||
|
@ -194,7 +194,7 @@ public class ShortestPathPanel extends JPanel {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Non-private roads allowed for motorcars";
|
||||
return "Only non-private roads allowed for motorcars";
|
||||
}
|
||||
} });
|
||||
arcFilterSelect.setBackground(Color.WHITE);
|
||||
|
@ -154,6 +154,7 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
this.points = points;
|
||||
this.origin = origin;
|
||||
this.destination = destination;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -217,7 +218,7 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
|
||||
@Override
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
this.width = Math.max(2, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -228,7 +229,6 @@ public class BasicDrawing extends JPanel implements Drawing {
|
||||
|
||||
@Override
|
||||
public void addPoint(Point point) {
|
||||
this.width = 5;
|
||||
int x = BasicDrawing.this.projx(point.getLongitude()) - this.width / 2;
|
||||
int y = BasicDrawing.this.projy(point.getLatitude()) - this.width / 2;
|
||||
this.graphics.fillOval(x, y, this.width, this.width);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.insa.graphics.drawing.components;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
@ -173,6 +174,8 @@ public class MapZoomControls {
|
||||
g.drawImage(zoomOut, xoffset, yoffset, observer);
|
||||
zoomOutRect.setBounds(xoffset, yoffset, DEFAULT_HEIGHT, DEFAULT_HEIGHT);
|
||||
|
||||
g.setStroke(new BasicStroke(1));
|
||||
|
||||
// Draw ticks
|
||||
xoffset += DEFAULT_HEIGHT + 2;
|
||||
g.setColor(ZOOM_TICK_COLOR);
|
||||
|
Loading…
Reference in New Issue
Block a user