Commit a9293114 authored by Teemu's avatar Teemu
Browse files

Lisäsin reset-napin

parent cf75857c
......@@ -88,6 +88,10 @@ public class MapDialog extends JFrame {
MapDialog.this.updateImage();
}
}
if (e.getSource() == MapDialog.this.resetB) {
MapDialog.this.setCoordinates(-180, 180, -90, 90);
MapDialog.this.updateImage();
}
} // actionPerformed(ActionEvent)
} // class ButtonListener
......@@ -121,6 +125,7 @@ public class MapDialog extends JFrame {
private JButton rightB = new JButton(">");
private JButton upB = new JButton("^");
private JButton downB = new JButton("v");
private JButton resetB = new JButton("Reset");
private JButton zoomInB = new JButton("+");
......@@ -157,6 +162,7 @@ public class MapDialog extends JFrame {
this.downB.addActionListener(bl);
this.zoomInB.addActionListener(bl);
this.zoomOutB.addActionListener(bl);
this.resetB.addActionListener(bl);
// Timer for delaying image updates when resizing the window
this.resizeTimer = new Timer(250, new ActionListener() {
......@@ -181,6 +187,7 @@ public class MapDialog extends JFrame {
this.populateLayerList();
this.leftPanel.add(this.refreshB);
this.leftPanel.add(this.resetB);
this.leftPanel.add(Box.createVerticalStrut(20));
this.leftPanel.add(this.leftB);
this.leftPanel.add(this.rightB);
......@@ -273,5 +280,22 @@ public class MapDialog extends JFrame {
this.southernLatitude += southDelta;
this.northernLatitude += northDelta;
} // updateCoordinates(int, int, int, int)
/**
* Updates the map focus coordinates according to the raw positions provided.
*
* @param west western longitude.
* @param east eastern longitude.
* @param south southern latitude.
* @param north northern latitude.
*/
private synchronized void setCoordinates(int west, int east, int south, int north) {
this.westernLongitude = west;
this.easternLongitude = east;
this.southernLatitude = south;
this.northernLatitude = north;
} // setCoordinates(int, int, int, int)
// Käyttöliittymän komponentit
} // MapDialog
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment