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