Revision 10263

View differences:

trunk/extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSAreaPanel.java
6 6
import java.awt.Rectangle;
7 7
import java.awt.event.ActionEvent;
8 8
import java.awt.event.ActionListener;
9
import java.awt.event.ComponentListener;
10 9
import java.awt.event.FocusAdapter;
11 10
import java.awt.event.FocusEvent;
12 11
import java.awt.event.FocusListener;
......
14 13
import java.awt.event.MouseEvent;
15 14
import java.awt.event.MouseListener;
16 15
import java.awt.geom.Rectangle2D;
17
import java.beans.PropertyChangeEvent;
18
import java.beans.PropertyChangeListener;
19 16
import java.io.Serializable;
20
import java.util.EventListener;
21 17

  
22 18
import javax.swing.ImageIcon;
23 19
import javax.swing.JComboBox;
......
45 41
import com.iver.cit.gvsig.fmap.tools.Behavior.MoveBehavior;
46 42
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
47 43
import com.iver.cit.gvsig.fmap.tools.Behavior.PolygonBehavior;
44
import com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior;
48 45
import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleBehavior;
49 46
import com.iver.cit.gvsig.gui.wizards.WFSWizardData;
50 47
import com.iver.cit.gvsig.project.documents.ProjectDocument;
51 48
import com.iver.cit.gvsig.project.documents.view.gui.View;
52 49
import com.iver.cit.gvsig.project.documents.view.toolListeners.AreaListener;
50
import com.iver.cit.gvsig.project.documents.view.toolListeners.MeasureListener;
53 51
import com.iver.cit.gvsig.project.documents.view.toolListeners.PanListener;
54
import com.iver.cit.gvsig.project.documents.view.toolListeners.RectangleSelectListener;
55 52
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener;
56 53
import com.iver.cit.gvsig.project.documents.view.toolListeners.ZoomInListener;
57 54
import com.iver.cit.gvsig.project.documents.view.toolListeners.ZoomOutListener;
58 55
import com.iver.utiles.stringNumberUtilities.StringNumberUtilities;
59 56

  
60 57
import javax.swing.JButton;
61
import javax.swing.event.ChangeEvent;
62
import javax.swing.event.ChangeListener;
63 58

  
64 59
import org.gvsig.gui.beans.swing.jComboBoxWithImageIconItems.ImageIconItemInfo;
65 60
import org.gvsig.gui.beans.swing.jComboBoxWithImageIconItems.JComboBoxWithImageIconItems;
......
111 106
 *
112 107
 * $Id$
113 108
 * $Log$
114
 * Revision 1.13  2007-02-09 14:22:07  ppiqueras
109
 * Revision 1.14  2007-02-12 11:29:37  ppiqueras
110
 * Mejoras de la interfaz y uso de las herramientas
111
 *
112
 * Revision 1.13  2007/02/09 14:22:07  ppiqueras
115 113
 * Mejoras de funcionalidad
116 114
 *
117 115
 * Revision 1.12  2007/02/09 13:56:56  ppiqueras
......
174 172
	private final Rectangle DEFAULT_ZOOMINANDOUT_JCOMBOBOX_RECTANGLE = new Rectangle(277, 85, 47, 25);
175 173
//	private final Rectangle DEFAULT_ZOOMIN_ICON_BUTTON_RECTANGLE = new Rectangle(297,100,25,25);
176 174
//	private final Rectangle DEFAULT_ZOOMOUT_ICON_BUTTON_RECTANGLE = new Rectangle(324,100,25,25);
177
	private final Rectangle DEFAULT_ZOOMRECTANGLESELECTION_ICON_BUTTON_RECTANGLE = new Rectangle(326, 85, 25, 25);
178
	private final Rectangle DEFAULT_ZOOMPREVIOUS_ICON_BUTTON_RECTANGLE = new Rectangle(353, 85, 25, 25);
179
	private final Rectangle DEFAULT_ZOOMCOMPLETE_ICON_BUTTON_RECTANGLE = new Rectangle(380, 85, 25, 25);
180
	private final Rectangle DEFAULT_ZOOMINANDOUTVIEWCENTERED_JCOMBOBOX_RECTANGLE = new Rectangle(407, 85, 47, 25);
175
//	private final Rectangle DEFAULT_ZOOMRECTANGLESELECTION_ICON_BUTTON_RECTANGLE = new Rectangle(326, 85, 25, 25);
176
	private final Rectangle DEFAULT_ZOOMPREVIOUS_ICON_BUTTON_RECTANGLE = new Rectangle(326, 85, 25, 25);
177
	private final Rectangle DEFAULT_ZOOMCOMPLETE_ICON_BUTTON_RECTANGLE = new Rectangle(353, 85, 25, 25);
178
	private final Rectangle DEFAULT_ZOOMINANDOUTVIEWCENTERED_JCOMBOBOX_RECTANGLE = new Rectangle(380, 85, 47, 25);
179
	private final Rectangle DEFAULT_OTHER_TOOLS_JCOMBOBOX_RECTANGLE = new Rectangle(429, 85, 47, 25);
181 180
	//	private final Rectangle DEFAULT_ZOOMINVIEWCENTERED_ICON_BUTTON_RECTANGLE = new Rectangle(378,100,25,25);
182 181
//	private final Rectangle DEFAULT_ZOOMOUTVIEWCENTERED_ICON_BUTTON_RECTANGLE = new Rectangle(405,100,25,25);
183
	private final Rectangle DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V1 = new Rectangle(277, 85, 25, 25);
184
	private final Rectangle DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V2 = new Rectangle(456, 85, 25, 25);
182
//	private final Rectangle DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V1 = new Rectangle(277, 85, 25, 25);
183
//	private final Rectangle DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V2 = new Rectangle(429, 85, 25, 25);
185 184
//	private final Rectangle DEFAULT_TOOLS_ICON_BUTTON_RECTANGLE = new Rectangle(459,100,25,25);
186 185
	
187 186
	private final int DISABLED_OPERATION = 0;
......
197 196
	private JButton jButtonPan = null;
198 197
//	private JButton jButtonZoomIn = null;
199 198
//	private JButton jButtonZoomOut = null;
200
	private JButton jButtonZoomRectangleSelection = null;
199
//	private JButton jButtonZoomRectangleSelection = null;
201 200
	private JButton jButtonZoomPrevious = null;
202 201
	private JButton jButtonZoomComplete = null;
203 202
//	private JButton jButtonZoomInViewCentered = null;
204 203
//	private JButton jButtonZoomOutViewCentered = null;
205
	private JButton jButtonInfo = null;
204
//	private JButton jButtonInfo = null;
206 205
//	private JButton jButtonTools = null;
207 206
	private JComboBoxWithImageIconItems jComboBoxZoomInAndOut = null;
208 207
	private JComboBoxWithImageIconItems jComboBoxZoomInAndOutViewCentered = null;
208
	private JComboBoxWithImageIconItems jComboBoxOtherTools = null;
209 209
	
210 210
	/* Tool identifier constants */
211 211
	private final String PAN_TOOL = "HAND";
212
	private final String ERASER_TOOL = "ERASER";
213
	private final String ZOOM_IN_TOOL = "ZOOM_IN";
214
	private final String ZOOM_OUT_TOOL = "ZOOM_OUT";
215
	private final String ZOOM_RECTANGLE_SELECTION_TOOL = "ZOOM_RECTANGLE_SELECTION";
216
	private final String ZOOM_PREVIOUS_TOOL = "ZOOM_PREVIOUS";
217
	private final String ZOOM_COMPLETE_TOOL = "ZOOM_COMPLETE";
212
//	private final String ERASER_TOOL = "ERASER";
213
	private final String ZOOM_IN_TOOL = "zoomIn"; // This constant must be 'zoomIn' for a correct operation of the tools 'Zoom In' and 'Zoom In Map Centered'
214
	private final String ZOOM_OUT_TOOL = "zoomOut"; // This constant must be 'zoomOut' for a correct operation of the tools 'Zoom Out' and 'Zoom Out Map Centered'
215
//	private final String ZOOM_RECTANGLE_SELECTION_TOOL = "ZOOM_RECTANGLE_SELECTION";
216
//	private final String ZOOM_PREVIOUS_TOOL = "ZOOM_PREVIOUS";
217
//	private final String ZOOM_COMPLETE_TOOL = "ZOOM_COMPLETE";
218 218
	private final String ZOOM_IN_VIEW_CENTERED_TOOL = "ZOOM_IN_VIEW_CENTERED";
219 219
	private final String ZOOM_OUT_VIEW_CENTERED_TOOL = "ZOOM_OUT_VIEW_CENTERED";
220
	private final String INFO_TOOL = "INFO_TOOL";
220
//	private final String INFO_TOOL = "INFO_TOOL";
221
	private final String MEASURE_DISTANCES_TOOL = "MEASURE_DISTANCES";
222
	private final String MEASURE_AREA_TOOL = "MEASURE_AREA";
221 223
	/* End tool identifier constants */
222 224
	
223 225
	
......
273 275
	 * Write the view coordinates into the coordinates panel
274 276
	 */
275 277
	private void initCoordinates(){
276
		View activeView = 
277
			(View) PluginServices.getMDIManager().getActiveWindow();
278
		Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent();
278
		View activeView = (View) PluginServices.getMDIManager().getActiveWindow();
279
//		Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent();
280
		Rectangle2D r2d = activeView.getMapControl().getViewPort().getExtent();
279 281
		if (r2d != null){
280
			getCoordinatesPanel().setExtent(r2d);
282
//			getCoordinatesPanel().setExtent(r2d);
283
			getCoordinatesPanel().getJTextFieldVertex1X().setText(Double.toString(r2d.getMinX()));
284
			getCoordinatesPanel().getJTextFieldVertex1Y().setText(Double.toString(r2d.getMinY()));
285
			getCoordinatesPanel().getJTextFieldVertex2X().setText(Double.toString(r2d.getMaxX()));
286
			getCoordinatesPanel().getJTextFieldVertex2Y().setText(Double.toString(r2d.getMaxY()));
281 287
		}
282 288
	}
283 289

  
......
344 350
	private void enableCoorderatesRegionOperation() {
345 351
		// Adds associated icons
346 352
		this.add(getJButtonEraser(), null);
347
		this.add(getJButtonInfo(), null);
353
//		this.add(getJButtonInfo(), null);
348 354
		
349 355
		getCoordinatesPanel().setAllTextFieldsEnabled(true);
356
		getCoordinatesPanel().getJRadioButtonGoToArea().setEnabled(true);
350 357
	}
351 358

  
352 359
	/**
......
358 365
//		this.add(getJButtonZoomIn(), null);
359 366
//		this.add(getJButtonZoomOut(), null);
360 367
		this.add(getJComboBoxZoomInAndOut(), null);
361
		this.add(getJButtonZoomRectangleSelection(), null);
368
//		this.add(getJButtonZoomRectangleSelection(), null);
362 369
		this.add(getJButtonZoomPrevious(), null);
363 370
		this.add(getJButtonZoomComplete(), null);
364 371
		this.add(getJComboBoxZoomInAndOutViewCentered(), null);
365
		this.add(getJButtonInfo(), null);	
372
		this.add(getJComboBoxOtherTools(), null);
373
//		this.add(getJButtonInfo(), null);	
366 374
		
367 375
		// Enables the icons
368 376
//		getJButtonPan().setEnabled(true);
......
383 391
		// Removes associated icons
384 392
		this.remove(getJButtonEraser());
385 393
		
386
		if (jButtonInfo != null)
387
			this.remove(jButtonInfo);	
394
//		if (jButtonInfo != null)
395
//			this.remove(jButtonInfo);	
388 396

  
389 397
		getCoordinatesPanel().setAllTextFieldsEnabled(false);
398
		getCoordinatesPanel().getJRadioButtonGoToArea().setEnabled(false);
390 399
	}
391 400

  
392 401
	/**
......
398 407
//		this.add(getJButtonZoomIn(), null);
399 408
//		this.add(getJButtonZoomOut(), null);
400 409
		this.remove(getJComboBoxZoomInAndOut());
401
		this.remove(getJButtonZoomRectangleSelection());
410
//		this.remove(getJButtonZoomRectangleSelection());
402 411
		this.remove(getJButtonZoomPrevious());
403 412
		this.remove(getJButtonZoomComplete());
404 413
		this.remove(getJComboBoxZoomInAndOutViewCentered());
414
		this.remove(getJComboBoxOtherTools());
405 415
		
406
		if (jButtonInfo != null)
407
			this.remove(jButtonInfo);	
416
//		if (jButtonInfo != null)
417
//			this.remove(jButtonInfo);	
408 418

  
409 419
		
410 420
		// Disables the icons
......
482 492
			jComboBoxZoomInAndOut.setBounds(DEFAULT_ZOOMINANDOUT_JCOMBOBOX_RECTANGLE);
483 493
			jComboBoxZoomInAndOut.addImageIconItem(new ImageIconItemInfo("images/ZoomIn.png", new ImageIcon(getClass().getClassLoader().getResource("images/ZoomIn.png")), PluginServices.getText(this, "Zoom_Mas"), ZOOM_IN_TOOL));
484 494
			jComboBoxZoomInAndOut.addImageIconItem(new ImageIconItemInfo("images/ZoomOut.png", new ImageIcon(getClass().getClassLoader().getResource("images/ZoomOut.png")), PluginServices.getText(this, "Zoom_Menos"), ZOOM_OUT_TOOL));
485
			jComboBoxZoomInAndOut.addActionListenerToJComboBox(new ActionListener() {
495
			jComboBoxZoomInAndOut.addActionListener(new ActionListener() {
486 496
				/*
487 497
				 *  (non-Javadoc)
488 498
				 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
......
526 536
//		return jButtonZoomIn;
527 537
//	}
528 538

  
529
	/**
530
	 * This method initializes jButtonZoomRectangleSelection	
531
	 * 	
532
	 * @return javax.swing.JButton	
533
	 */
534
	private JButton getJButtonZoomRectangleSelection() {
535
		if (jButtonZoomRectangleSelection == null) {
536
			jButtonZoomRectangleSelection = new JButton();
537
			jButtonZoomRectangleSelection.setBounds(DEFAULT_ZOOMRECTANGLESELECTION_ICON_BUTTON_RECTANGLE);
538
			jButtonZoomRectangleSelection.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomSeleccion.png")));
539
			jButtonZoomRectangleSelection.setToolTipText(PluginServices.getText(this, "seleccionar_por_rectangulo"));
540
			jButtonZoomRectangleSelection.addMouseListener(new MouseAdapter() {
541
				/*
542
				 * (non-Javadoc)
543
				 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
544
				 */
545
				public void mouseClicked(MouseEvent e) {
546
					getSelectableMapAreaPanel().setTool(ZOOM_RECTANGLE_SELECTION_TOOL);
547
				}
548
			});
549
		}
550
		return jButtonZoomRectangleSelection;
551
	}
539
//	/**
540
//	 * This method initializes jButtonZoomRectangleSelection	
541
//	 * 	
542
//	 * @return javax.swing.JButton	
543
//	 */
544
//	private JButton getJButtonZoomRectangleSelection() {
545
//		if (jButtonZoomRectangleSelection == null) {
546
//			jButtonZoomRectangleSelection = new JButton();
547
//			jButtonZoomRectangleSelection.setBounds(DEFAULT_ZOOMRECTANGLESELECTION_ICON_BUTTON_RECTANGLE);
548
//			jButtonZoomRectangleSelection.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomSeleccion.png")));
549
//			jButtonZoomRectangleSelection.setToolTipText(PluginServices.getText(this, "seleccionar_por_rectangulo"));
550
//			jButtonZoomRectangleSelection.addMouseListener(new MouseAdapter() {
551
//				/*
552
//				 * (non-Javadoc)
553
//				 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
554
//				 */
555
//				public void mouseClicked(MouseEvent e) {
556
//					getSelectableMapAreaPanel().setTool(ZOOM_RECTANGLE_SELECTION_TOOL);
557
//				}
558
//			});
559
//		}
560
//		return jButtonZoomRectangleSelection;
561
//	}
552 562

  
553 563
	/**
554 564
	 * This method initializes jButtonZoomPrevious	
......
670 680
			jComboBoxZoomInAndOutViewCentered.setBounds(DEFAULT_ZOOMINANDOUTVIEWCENTERED_JCOMBOBOX_RECTANGLE);
671 681
			jComboBoxZoomInAndOutViewCentered.addImageIconItem(new ImageIconItemInfo("images/zoommas.png", new ImageIcon(getClass().getClassLoader().getResource("images/zoommas.png")), PluginServices.getText(this, "Zoom_Acercar"), ZOOM_IN_VIEW_CENTERED_TOOL));
672 682
			jComboBoxZoomInAndOutViewCentered.addImageIconItem(new ImageIconItemInfo("images/ZoomOut.png", new ImageIcon(getClass().getClassLoader().getResource("images/zoommenos.png")), PluginServices.getText(this, "Zoom_Alejar"), ZOOM_OUT_VIEW_CENTERED_TOOL));
673
			jComboBoxZoomInAndOutViewCentered.addActionListenerToJComboBox(new ActionListener() {
683
			jComboBoxZoomInAndOutViewCentered.addActionListener(new ActionListener() {
674 684
				/*
675 685
				 *  (non-Javadoc)
676 686
				 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
......
696 706
		}
697 707
		return jComboBoxZoomInAndOutViewCentered;
698 708
	}
699

  
709
	
700 710
	/**
701
	 * This method initializes jButtonInfo	
711
	 * This method initializes jComboBoxOtherTools	
702 712
	 * 	
703
	 * @return javax.swing.JButton	
713
	 * @return 	
704 714
	 */
705
	private JButton getJButtonInfo() {
706
		switch (((ItemOperation)getJComboBoxToolSelection().getSelectedItem()).getOperation()) {
707
			case SELECTION_BY_COORDINATES_OPERATION:
708
				jButtonInfo = new JButton();
709
				jButtonInfo.setBounds(DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V1);
710
				jButtonInfo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Identify.png")));
711
				jButtonInfo.setToolTipText(PluginServices.getText(this, "informacion"));
712
				break;
713
			case SELECTION_BY_AREA_OPERATION:
714
				jButtonInfo = new JButton();
715
				jButtonInfo.setBounds(DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V2);
716
				jButtonInfo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Identify.png")));
717
				jButtonInfo.setToolTipText(PluginServices.getText(this, "informacion"));
718
				break;
719
			case DISABLED_OPERATION: // Do nothing
720
				break;					
715
	private JComboBoxWithImageIconItems getJComboBoxOtherTools() {
716
		if (jComboBoxOtherTools == null) {
717
			jComboBoxOtherTools = new JComboBoxWithImageIconItems();
718
			jComboBoxOtherTools.setBounds(DEFAULT_OTHER_TOOLS_JCOMBOBOX_RECTANGLE);
719
			jComboBoxOtherTools.addImageIconItem(new ImageIconItemInfo("images/Distancia.png", new ImageIcon(getClass().getClassLoader().getResource("images/Distancia.png")), PluginServices.getText(this, "medir_distancias"), MEASURE_DISTANCES_TOOL));
720
			jComboBoxOtherTools.addImageIconItem(new ImageIconItemInfo("images/Poligono16.png", new ImageIcon(getClass().getClassLoader().getResource("images/Poligono16.png")), PluginServices.getText(this, "medir_area"), MEASURE_AREA_TOOL));
721
//			jComboBoxOtherTools.addImageIconItem(new ImageIconItemInfo("images/Identify.png", new ImageIcon(getClass().getClassLoader().getResource("images/Identify.png")), PluginServices.getText(this, "informacion"), INFO_TOOL));
722
			jComboBoxOtherTools.addActionListener(new ActionListener() {
723
				/*
724
				 *  (non-Javadoc)
725
				 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
726
				 */
727
				public void actionPerformed(ActionEvent e) {
728
					JComboBoxWithImageIconItems cb = (JComboBoxWithImageIconItems)e.getSource();
729
					ImageIconItemInfo iiii = (ImageIconItemInfo)cb.getSelectedItem();
730
					getSelectableMapAreaPanel().setTool((String)iiii.getItemValue());
731
			
732
//					if (((String)iiii.getItemValue()).compareTo(ZOOM_IN_VIEW_CENTERED_TOOL) == 0) {
733
//						getSelectableMapAreaPanel().zoomIn();
734
//						//((ProjectDocument)((View)PluginServices.getMDIManager().getActiveWindow()).getModel()).setModified(tre);
735
//					}
736
//					else {
737
//						getSelectableMapAreaPanel().zoomOut();
738
////						((ProjectDocument)vista.getModel()).setModified(true);						
739
//					}
740
//					
741
//					((ProjectDocument)((View)PluginServices.getMDIManager().getActiveWindow()).getModel()).setModified(true);
742
					
743
//						getSelectableMapAreaPanel().setTool((String)iiii.getItemValue());
744
				}
745
	        });
721 746
		}
722

  
723
		return jButtonInfo;
747
		
748
		return jComboBoxOtherTools;
724 749
	}
725 750

  
726 751
//	/**
752
//	 * This method initializes jButtonInfo	
753
//	 * 	
754
//	 * @return javax.swing.JButton	
755
//	 */
756
//	private JButton getJButtonInfo() {
757
//		switch (((ItemOperation)getJComboBoxToolSelection().getSelectedItem()).getOperation()) {
758
//			case SELECTION_BY_COORDINATES_OPERATION:
759
//				jButtonInfo = new JButton();
760
//				jButtonInfo.setBounds(DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V1);
761
//				jButtonInfo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Identify.png")));
762
//				jButtonInfo.setToolTipText(PluginServices.getText(this, "informacion"));
763
//				break;
764
////			case SELECTION_BY_AREA_OPERATION:
765
////				jButtonInfo = new JButton();
766
////				jButtonInfo.setBounds(DEFAULT_INFO_ICON_BUTTON_RECTANGLE_V2);
767
////				jButtonInfo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Identify.png")));
768
////				jButtonInfo.setToolTipText(PluginServices.getText(this, "informacion"));
769
////				break;
770
//			case DISABLED_OPERATION: // Do nothing
771
//				break;					
772
//		}
773
//
774
//		return jButtonInfo;
775
//	}
776

  
777
//	/**
727 778
//	 * This method initializes jButtonTools	
728 779
//	 * 	
729 780
//	 * @return javax.swing.JButton	
......
738 789
//	}
739 790
	
740 791
	/**
792
	 * Refresh map control with the new map context of the active view
793
	 */
794
	public void refreshMapControlWithTheActiveView() {
795
		getSelectableMapAreaPanel().refreshWithTheActiveView();
796
	}
797
	
798
	/**
741 799
	 * Represents an object that stores the necessary information for know each operation of the 'jComboBoxToolSelection'
742 800
	 * 
743 801
	 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
......
1223 1281
//					 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
1224 1282
//					 */
1225 1283
//					public void actionPerformed(ActionEvent e) {
1226
//						
1284
//						System.out.println("Action performed");
1227 1285
//					}
1228 1286
//				});
1229 1287
				
1230 1288
				jRadioButtonGoToArea.addMouseListener(new MouseListener() {
1231 1289

  
1232 1290
					public void mouseClicked(MouseEvent e) {
1233
						if ((validateCoordinate(jTextFieldVertex1X)) && (validateCoordinate(jTextFieldVertex1Y)) && (validateCoordinate(jTextFieldVertex2X)) && (validateCoordinate(jTextFieldVertex2Y))) {
1291
						System.out.println("Mouse clicked");
1292
						if ((validateCoordinate(getJTextFieldVertex1X())) && (validateCoordinate(getJTextFieldVertex1Y())) && (validateCoordinate(getJTextFieldVertex2X())) && (validateCoordinate(getJTextFieldVertex2Y()))) {
1293
//							ViewPort vP = getSelectableMapAreaPanel().getViewPort();
1294
//							if (vP != null) {
1295
//								if (vP.getExtent() != null) {
1296
//									vP.setExtent(new Rectangle2D.Double(new Double(getJTextFieldVertex1X().getText()).doubleValue(),
1297
//										new Double(getJTextFieldVertex1Y().getText()).doubleValue(),
1298
//										new Double(getJTextFieldVertex2X().getText()).doubleValue(),
1299
//										new Double(getJTextFieldVertex2Y().getText()).doubleValue()));
1300
//									a
1301
//									// Refresh the extent
1302
////									getSelectableMapAreaPanel().getMapContext().
1303
//								}
1304
//							}
1305
							
1306
//							View activeView = (View) PluginServices.getMDIManager().getActiveWindow();
1307
//							Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent();
1308
//							Rectangle2D r2d = getViewPort().getExtent();
1234 1309
							ViewPort vP = getSelectableMapAreaPanel().getViewPort();
1235 1310
							if (vP != null) {
1236
								if (vP.getExtent() != null) {
1237
									vP.getExtent().setRect(new Rectangle2D.Double(new Double(getJTextFieldVertex1X().getText()).doubleValue(),
1238
										new Double(getJTextFieldVertex1Y().getText()).doubleValue(),
1239
										new Double(getJTextFieldVertex2X().getText()).doubleValue(),
1240
										new Double(getJTextFieldVertex2Y().getText()).doubleValue()));
1311
								Rectangle2D r2d = vP.getExtent();
1312
								if (r2d != null){
1313
	//								getCoordinatesPanel().setExtent(r2d);
1314
//									getCoordinatesPanel().getJTextFieldVertex1X().setText(Double.toString(r2d.getMinX()));
1315
//									getCoordinatesPanel().getJTextFieldVertex1Y().setText(Double.toString(r2d.getMinY()));
1316
//									getCoordinatesPanel().getJTextFieldVertex2X().setText(Double.toString(r2d.getMaxX()));
1317
//									getCoordinatesPanel().getJTextFieldVertex2Y().setText(Double.toString(r2d.getMaxY()));
1318
									r2d.setRect(Double.parseDouble(getJTextFieldVertex1X().getText()), Double.parseDouble(getJTextFieldVertex1Y().getText()), Math.abs(Double.parseDouble(getJTextFieldVertex2X().getText()) - Double.parseDouble(getJTextFieldVertex1X().getText())), Math.abs(Double.parseDouble(getJTextFieldVertex2Y().getText()) - Double.parseDouble(getJTextFieldVertex1Y().getText())));
1319
									vP.refreshExtent();
1241 1320
								}
1242 1321
							}
1243 1322
						}
......
1276 1355
		 * @param extent
1277 1356
		 */
1278 1357
		public void setExtent(Rectangle2D extent){
1279
			getJTextFieldVertex1X().setText(String.valueOf(extent.getMaxX()));
1280
			getJTextFieldVertex1Y().setText(String.valueOf(extent.getMaxY()));
1281
			getJTextFieldVertex2X().setText(String.valueOf(extent.getMinX()));
1282
			getJTextFieldVertex2Y().setText(String.valueOf(extent.getMinY()));
1358
			getJTextFieldVertex1X().setText(String.valueOf(extent.getMinX()));
1359
			getJTextFieldVertex1Y().setText(String.valueOf(extent.getMinY()));
1360
			getJTextFieldVertex2X().setText(String.valueOf(extent.getMaxX()));
1361
			getJTextFieldVertex2Y().setText(String.valueOf(extent.getMaxY()));
1283 1362
		}
1284 1363
		
1285 1364
		/**
......
1322 1401
	 * 
1323 1402
	 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
1324 1403
	 */
1325
	private class SelectableMapControlAreaPanel extends MapControl {
1404
	private class SelectableMapControlAreaPanel extends MapControl implements Serializable {
1326 1405
		private MouseListener[] mouseListeners;		
1327 1406
		
1328 1407
		public SelectableMapControlAreaPanel() {
......
1369 1448
			this.setTool(PAN_TOOL);
1370 1449
		}
1371 1450
		
1451
		/**
1452
		 * Refresh the active view
1453
		 */
1454
		public void refreshWithTheActiveView() {
1455
			try {
1456
				MapContext mp = ((View) PluginServices.getMDIManager().getActiveWindow()).getMapControl().getMapContext();
1457
				this.setMapContext(mp.cloneFMap());
1458
			} catch (XMLException e) {
1459
				e.printStackTrace();
1460
			}
1461
		}
1462
		
1372 1463
//		public void refresh() {
1373 1464
//			// Gets the active view
1374 1465
//			View view = (View) PluginServices.getMDIManager().getActiveWindow();
......
1593 1684
	        PanListener pl = new PanListener(this);
1594 1685
	        this.addMapTool(PAN_TOOL, new Behavior[]{new MoveBehavior(pl), new MouseMovementBehavior(sbl)});
1595 1686

  
1596
	        // ZOOM RECTANGLE SELECTION
1597
	        RectangleSelectListener rsl = new RectangleSelectListener(this);
1598
	        this.addMapTool(ZOOM_RECTANGLE_SELECTION_TOOL, new Behavior[]{new RectangleBehavior(rsl), new MouseMovementBehavior(sbl)});
1687
	        // MEASURE DISTANCES
1688
	        MeasureListener mli = new MeasureListener(this);
1689
	        this.addMapTool(MEASURE_DISTANCES_TOOL, new Behavior[]{new PolylineBehavior(mli), new MouseMovementBehavior(sbl)});
1599 1690

  
1691
	        // MEASURE AREA
1692
	        AreaListener ali = new AreaListener(this);
1693
	        this.addMapTool(MEASURE_AREA_TOOL, new Behavior[]{new PolygonBehavior(ali), new MouseMovementBehavior(sbl)});
1694
	        
1695
//	        // INFORMATION ABOUT A POINT
1696
//	        InfoListener il = new InfoListener(this);
1697
//	        this.addMapTool(INFO_TOOL, new Behavior[]{new PointBehavior(il), new MouseMovementBehavior(sbl)});
1600 1698

  
1699
//	        // ZOOM RECTANGLE SELECTION
1700
//	        RectangleSelectListener rsl = new RectangleSelectListener(this);
1701
//	        this.addMapTool(ZOOM_RECTANGLE_SELECTION_TOOL, new Behavior[]{new RectangleBehavior(rsl), new MouseMovementBehavior(sbl)});
1702

  
1703

  
1601 1704
//	        // Medir
1602 1705
//
1603 1706
//	        MeasureListener mli = new MeasureListener(this);
......
1646 1749
	        	 */
1647 1750
				public void extentChanged(ExtentEvent e) {
1648 1751
					if (getMapContext().getViewPort().getExtents().hasPrevious()) {
1649
						Rectangle2D r2d = getViewPort().getAdjustedExtent();
1752
//						Rectangle2D r2d = getViewPort().getAdjustedExtent();
1753
						Rectangle2D r2d = getViewPort().getExtent();
1754

  
1650 1755
						if (r2d != null)
1651 1756
							getCoordinatesPanel().setExtent(r2d);
1652 1757
						

Also available in: Unified diff