Revision 11131
trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSAreaPanel.java | ||
---|---|---|
107 | 107 |
* |
108 | 108 |
* $Id$ |
109 | 109 |
* $Log$ |
110 |
* Revision 1.27 2007-03-15 13:32:44 ppiqueras |
|
110 |
* Revision 1.28 2007-04-11 12:04:58 ppiqueras |
|
111 |
* Bug corregido: al pulsar "Aplicar" en el wizard de WFS, despu?s de haber seleccionado un ?rea distinta, se debe actualizar el ?rea visible del wizard con la de la vista activa. |
|
112 |
* |
|
113 |
* Revision 1.27 2007/03/15 13:32:44 ppiqueras |
|
111 | 114 |
* -Corregido bug de excepci?n que se lanzaba cuando se filtraba y no se pod?a cargar la capa. |
112 | 115 |
* - Mejorada la interfaz |
113 | 116 |
* |
... | ... | |
196 | 199 |
* |
197 | 200 |
*/ |
198 | 201 |
|
202 |
|
|
199 | 203 |
/** |
200 | 204 |
* This panel allows user to select the area he/she wants to get in the view. |
201 | 205 |
* There are two options to do this: |
202 | 206 |
* - Indicating the coordinates of the top-left and down-right corners |
203 |
* - Selecting the area with the mouse
|
|
207 |
* - Selecting the area with some visual tool
|
|
204 | 208 |
* |
205 | 209 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
206 | 210 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
... | ... | |
805 | 809 |
public void setUserHasntDefineAnArea() { |
806 | 810 |
hasUserDefinedAnArea = false; |
807 | 811 |
} |
812 |
|
|
813 |
/** |
|
814 |
* Updates the current area information with the area of the active view |
|
815 |
*/ |
|
816 |
public void updateWFSArea() { |
|
817 |
this.getSelectableMapAreaPanel().disableAllMouseListeners(); |
|
818 |
|
|
819 |
// To prevent that events that take place (are produced) could be a nuisance to the load of the layers |
|
820 |
this.getSelectableMapAreaPanel().getMapContext().beginAtomicEvent(); |
|
808 | 821 |
|
822 |
try { |
|
823 |
MapContext mapContext = this.getSelectableMapAreaPanel().getMapContext(); |
|
824 |
|
|
825 |
// Removes all layers in the view area |
|
826 |
int numberOfLayers = mapContext.getLayers().getLayersCount(); |
|
827 |
int i; |
|
828 |
|
|
829 |
for (i = (numberOfLayers-1); i >= 0; i--) { |
|
830 |
mapContext.getLayers().removeLayer(i); |
|
831 |
} |
|
832 |
|
|
833 |
// Adds the extent of the viewport of the current active view |
|
834 |
View view = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
835 |
ViewPort vP = view.getMapControl().getMapContext().getViewPort(); |
|
836 |
|
|
837 |
// Update extent |
|
838 |
Rectangle2D r2D = vP.getExtent(); |
|
839 |
|
|
840 |
if (r2D == null) { |
|
841 |
// End To prevent that events that take place(are produced) could be a nuisance to the load of the layers |
|
842 |
this.getSelectableMapAreaPanel().getMapContext().endAtomicEvent(); |
|
843 |
|
|
844 |
// No tools enabled |
|
845 |
getJComboBoxToolSelection().setSelectedIndex(0); |
|
846 |
|
|
847 |
return; |
|
848 |
} |
|
849 |
|
|
850 |
getCoordinatesPanel().updateCoordinates(r2D); |
|
851 |
mapContext.getViewPort().setExtent(r2D); |
|
852 |
|
|
853 |
// Adds the active layers of the current active view |
|
854 |
MapContext mC = view.getMapControl().getMapContext(); |
|
855 |
|
|
856 |
numberOfLayers = mC.getLayers().getLayersCount(); |
|
857 |
|
|
858 |
for (i = (numberOfLayers-1); i >= 0; i--) { |
|
859 |
mapContext.getLayers().addLayer(mC.getLayers().getLayer(i).cloneLayer()); |
|
860 |
} |
|
861 |
|
|
862 |
// If has to enable all listeners of all tools on the view area |
|
863 |
if (((ItemOperation)this.getJComboBoxToolSelection().getSelectedItem()).getOperation() == SELECTION_BY_AREA_OPERATION) |
|
864 |
this.getSelectableMapAreaPanel().enableAllMouseListeners(); |
|
865 |
|
|
866 |
// End To prevent that events that take place(are produced) could be a nuisance to the load of the layers |
|
867 |
this.getSelectableMapAreaPanel().getMapContext().endAtomicEvent(); |
|
868 |
|
|
869 |
// Refresh the view |
|
870 |
this.getSelectableMapAreaPanel().getViewPort().refreshExtent(); |
|
871 |
} catch (Exception e) { |
|
872 |
e.printStackTrace(); |
|
873 |
|
|
874 |
// End To prevent that events that take place(are produced) could be a nuisance to the load of the layers |
|
875 |
this.getSelectableMapAreaPanel().getMapContext().endAtomicEvent(); |
|
876 |
|
|
877 |
// No tools enabled |
|
878 |
getJComboBoxToolSelection().setSelectedIndex(0); |
|
879 |
return; |
|
880 |
} |
|
881 |
} |
|
882 |
|
|
809 | 883 |
/** |
810 | 884 |
* Represents an object that stores the necessary information for know each operation of the 'jComboBoxToolSelection' |
811 | 885 |
* |
... | ... | |
904 | 978 |
private boolean hasChanged_v1Y; |
905 | 979 |
private boolean hasChanged_v2X; |
906 | 980 |
private boolean hasChanged_v2Y; |
907 |
private short last_Coordinate_that_Loose_the_Focus; // 0 -> any; 1 -> V1X; 2 -> V1Y; 3 -> V2X; 4 -> V2Y |
|
908 | 981 |
private String previous_Coordinate_Value[]; |
909 | 982 |
|
910 | 983 |
private short current_coordinate_with_focus; |
... | ... | |
936 | 1009 |
this.last_Coordinates[1] = ""; |
937 | 1010 |
this.last_Coordinates[2] = ""; |
938 | 1011 |
this.last_Coordinates[3] = ""; |
939 |
this.last_Coordinate_that_Loose_the_Focus = 0; |
|
940 | 1012 |
this.previous_Coordinate_Value = new String[4]; |
941 | 1013 |
|
942 | 1014 |
// By default no coordinates have changed |
... | ... | |
2157 | 2229 |
/* Sets a clone of the current active view map context to this MapControl */ |
2158 | 2230 |
try { |
2159 | 2231 |
MapContext mp = ((View) PluginServices.getMDIManager().getActiveWindow()).getMapControl().getMapContext(); |
2232 |
|
|
2160 | 2233 |
this.setMapContext(mp.cloneFMap()); |
2161 | 2234 |
ViewPort vP = this.getViewPort(); |
2162 | 2235 |
|
... | ... | |
2181 | 2254 |
* Refresh the active view |
2182 | 2255 |
*/ |
2183 | 2256 |
public void refreshWithTheActiveView() { |
2184 |
try { |
|
2257 |
try {
|
|
2185 | 2258 |
MapContext mp = ((View) PluginServices.getMDIManager().getActiveWindow()).getMapControl().getMapContext(); |
2186 | 2259 |
this.setMapContext(mp.cloneFMap()); |
2187 | 2260 |
ViewPort vP = this.getViewPort(); |
Also available in: Unified diff