Revision 149
org.gvsig.wfs.app/trunk/org.gvsig.wfs.app/org.gvsig.wfs.app.mainplugin/src/main/java/org/gvsig/wfs/gui/panels/WFSAreaPanel.java | ||
---|---|---|
19 | 19 |
import java.awt.event.MouseMotionListener; |
20 | 20 |
import java.awt.event.MouseWheelListener; |
21 | 21 |
import java.awt.geom.Rectangle2D; |
22 |
import java.util.Stack; |
|
22 | 23 |
|
23 | 24 |
import javax.swing.AbstractButton; |
24 | 25 |
import javax.swing.JButton; |
... | ... | |
32 | 33 |
import javax.swing.SwingConstants; |
33 | 34 |
|
34 | 35 |
import org.cresques.cts.IProjection; |
36 |
|
|
35 | 37 |
import org.gvsig.andami.PluginServices; |
36 | 38 |
import org.gvsig.andami.messages.NotificationManager; |
37 | 39 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
... | ... | |
54 | 56 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
55 | 57 |
import org.gvsig.fmap.geom.primitive.Envelope; |
56 | 58 |
import org.gvsig.fmap.geom.primitive.Surface; |
57 |
import org.gvsig.fmap.mapcontext.ExtentHistory; |
|
58 | 59 |
import org.gvsig.fmap.mapcontext.MapContext; |
59 | 60 |
import org.gvsig.fmap.mapcontext.ViewPort; |
60 | 61 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
... | ... | |
132 | 133 |
private final int DISABLED_OPERATION = 0; |
133 | 134 |
private final int SELECTION_BY_COORDINATES_OPERATION = 1; |
134 | 135 |
private final int SELECTION_BY_AREA_OPERATION = 2; |
135 |
// private Rectangle2D lastExtentValid = null; |
|
136 |
private ExtentHistory previousExtentValids = null; |
|
136 |
private Stack<Rectangle2D> previousExtentValids = null; |
|
137 | 137 |
|
138 | 138 |
private WFSServerExplorer serverExplorer = null; |
139 | 139 |
private AreaCoordinatesPanel coordinatesPanel = null; |
... | ... | |
189 | 189 |
ViewPort viewPort = ((IView) wi).getMapControl().getViewPort(); |
190 | 190 |
Envelope envelope = viewPort.getAdjustedEnvelope(); |
191 | 191 |
if (envelope != null){ |
192 |
previousExtentValids.put(new Rectangle2D.Double(envelope.getMinimum(0),
|
|
192 |
previousExtentValids.push(new Rectangle2D.Double(envelope.getMinimum(0),
|
|
193 | 193 |
envelope.getMinimum(1), |
194 | 194 |
envelope.getMaximum(0)-envelope.getMaximum(0), |
195 | 195 |
envelope.getMaximum(1)-envelope.getMinimum(1))); |
... | ... | |
204 | 204 |
* Removes all registered extents |
205 | 205 |
*/ |
206 | 206 |
public void clearCoordinates() { |
207 |
while (previousExtentValids.hasPrevious()) { |
|
208 |
previousExtentValids.removePrev(); |
|
209 |
} |
|
207 |
previousExtentValids.clear(); |
|
208 |
// while (!previousExtentValids.ishasPrevious()) { |
|
209 |
// previousExtentValids.removePrev(); |
|
210 |
// } |
|
210 | 211 |
} |
211 | 212 |
|
212 | 213 |
/** |
... | ... | |
1836 | 1837 |
JOptionPane.showMessageDialog(null, PluginServices.getText(null, PluginServices.getText(this, "invalid_coordinates") + ": " + v1.getMessage()), PluginServices.getText(null, "warning"), JOptionPane.WARNING_MESSAGE); |
1837 | 1838 |
|
1838 | 1839 |
// Restore the previous valid extent |
1839 |
if (previousExtentValids.hasPrevious()) {
|
|
1840 |
Rectangle2D previousExtent = previousExtentValids.removePrev();
|
|
1840 |
if (!previousExtentValids.isEmpty()) {
|
|
1841 |
Rectangle2D previousExtent = previousExtentValids.pop();
|
|
1841 | 1842 |
setCoordinates(previousExtent); |
1842 | 1843 |
|
1843 |
if (!previousExtentValids.hasPrevious()) {
|
|
1844 |
if (previousExtentValids.isEmpty()) {
|
|
1844 | 1845 |
setApplicable(false); |
1845 | 1846 |
} |
1846 | 1847 |
|
1847 |
previousExtentValids.put(previousExtent);
|
|
1848 |
previousExtentValids.push(previousExtent);
|
|
1848 | 1849 |
} |
1849 | 1850 |
|
1850 | 1851 |
return false; |
... | ... | |
1858 | 1859 |
JOptionPane.showMessageDialog(null, PluginServices.getText(null, PluginServices.getText(this, "invalid_coordinates") + ": " + v2.getMessage()), PluginServices.getText(null, "warning"), JOptionPane.WARNING_MESSAGE); |
1859 | 1860 |
|
1860 | 1861 |
// Restore the previous valid extent |
1861 |
if (previousExtentValids.hasPrevious()) {
|
|
1862 |
Rectangle2D previousExtent = previousExtentValids.removePrev();
|
|
1862 |
if (!previousExtentValids.isEmpty()) {
|
|
1863 |
Rectangle2D previousExtent = previousExtentValids.pop();
|
|
1863 | 1864 |
setCoordinates(previousExtent); |
1864 | 1865 |
|
1865 |
if (!previousExtentValids.hasPrevious()) {
|
|
1866 |
if (previousExtentValids.isEmpty()) {
|
|
1866 | 1867 |
setApplicable(false); |
1867 | 1868 |
} |
1868 | 1869 |
|
1869 |
previousExtentValids.put(previousExtent);
|
|
1870 |
previousExtentValids.push(previousExtent);
|
|
1870 | 1871 |
} |
1871 | 1872 |
|
1872 | 1873 |
return false; |
1873 | 1874 |
} |
1874 | 1875 |
else { |
1875 | 1876 |
// Once has been validated -> allow apply with the new extent, and save it |
1876 |
if (previousExtentValids.hasPrevious()) {
|
|
1877 |
Rectangle2D previousExtent = previousExtentValids.removePrev();
|
|
1877 |
if (!previousExtentValids.isEmpty()) {
|
|
1878 |
Rectangle2D previousExtent = previousExtentValids.pop();
|
|
1878 | 1879 |
if (! areEqual(previousExtent, getExtent())) { |
1879 |
previousExtentValids.put(previousExtent);
|
|
1880 |
previousExtentValids.put(getExtent());
|
|
1880 |
previousExtentValids.push(previousExtent);
|
|
1881 |
previousExtentValids.push(getExtent());
|
|
1881 | 1882 |
setApplicable(true); |
1882 | 1883 |
} |
1883 | 1884 |
else { |
1884 |
previousExtentValids.put(previousExtent);
|
|
1885 |
previousExtentValids.push(previousExtent);
|
|
1885 | 1886 |
} |
1886 | 1887 |
} |
1887 | 1888 |
else { |
1888 |
previousExtentValids.put(getExtent());
|
|
1889 |
previousExtentValids.push(getExtent());
|
|
1889 | 1890 |
setApplicable(true); |
1890 | 1891 |
} |
1891 | 1892 |
|
... | ... | |
2249 | 2250 |
gridBagConstraints.weightx = 1.0; |
2250 | 2251 |
northPanel.add(getEnablingJCheckBox(), gridBagConstraints); |
2251 | 2252 |
|
2252 |
previousExtentValids = new ExtentHistory();
|
|
2253 |
previousExtentValids = new Stack<Rectangle2D>();
|
|
2253 | 2254 |
initCoordinates(); |
2254 | 2255 |
|
2255 | 2256 |
add(northPanel, java.awt.BorderLayout.NORTH); |
Also available in: Unified diff