Revision 14071

View differences:

trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/legend/ColorTableLegend.java
23 23
import org.gvsig.raster.datastruct.ColorItem;
24 24
import org.gvsig.raster.datastruct.ColorTable;
25 25
import org.gvsig.raster.util.MathUtils;
26
import org.gvsig.raster.util.RasterToolsUtil;
27
import org.gvsig.raster.util.RasterUtilities;
28 26

  
29 27
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
30 28
import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol;
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/layers/FLyrRasterSE.java
90 90
import com.iver.cit.gvsig.fmap.layers.layerOperations.StringXMLItem;
91 91
import com.iver.cit.gvsig.fmap.layers.layerOperations.XMLItem;
92 92
import com.iver.cit.gvsig.fmap.rendering.ILegend;
93
import com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent;
94 93
import com.iver.cit.gvsig.project.documents.view.gui.IView;
95 94
import com.iver.cit.gvsig.project.documents.view.gui.View;
96 95
import com.iver.utiles.NotExistInXMLEntity;
......
346 345
			return;
347 346
		
348 347
		enableStopped();
349
		//callLegendChanged(null);
348
		callLegendChanged(null);
350 349
		
351 350
		if (isWithinScale(scale)) {
352 351

  
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/properties/dialog/ButtonsPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.gui.properties.dialog;
20

  
21
import java.awt.FlowLayout;
22

  
23
import javax.swing.JButton;
24
import javax.swing.JPanel;
25
/**
26
 * Panel con los controles de bot?n de aplicar, aceptar y cancelar.
27
 * 
28
 * @author Nacho Brodin (nachobrodin@gmail.com)
29
 */
30
public class ButtonsPanel extends JPanel {
31
	private static final long serialVersionUID = -5111153508681932951L;
32
	private JButton           bAccept          = null;
33
	private JButton           bApply           = null;
34
	private JButton           bCancel          = null;
35
	private int               sizePanelY       = 30;
36

  
37
	/**
38
	 * This method initializes
39
	 */
40
	public ButtonsPanel() {
41
		super();
42
		initialize();
43
	}
44

  
45
	/**
46
	 * This method initializes this
47
	 */
48
	private void initialize() {
49
		FlowLayout flowLayout = new FlowLayout();
50
		flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
51
		flowLayout.setHgap(2);
52
		flowLayout.setVgap(2);
53
		this.setLayout(flowLayout);
54
		this.setPreferredSize(new java.awt.Dimension(0, sizePanelY));
55
		this.add(getAccept(), null);
56
		this.add(getApply(), null);
57
		this.add(getCancel(), null);
58

  
59
	}
60

  
61
	/**
62
	 * This method initializes jButton
63
	 * @return javax.swing.JButton
64
	 */
65
	public JButton getAccept() {
66
		if (bAccept == null) {
67
			bAccept = new JButton();
68
			bAccept.setText("Aceptar");
69
		}
70
		return bAccept;
71
	}
72

  
73
	/**
74
	 * This method initializes jButton1
75
	 * @return javax.swing.JButton
76
	 */
77
	public JButton getApply() {
78
		if (bApply == null) {
79
			bApply = new JButton();
80
			bApply.setText("Aplicar");
81
		}
82
		return bApply;
83
	}
84

  
85
	/**
86
	 * This method initializes jButton2
87
	 * @return javax.swing.JButton
88
	 */
89
	public JButton getCancel() {
90
		if (bCancel == null) {
91
			bCancel = new JButton();
92
			bCancel.setText("Cancelar");
93
		}
94
		return bCancel;
95
	}
96
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/properties/dialog/PropertiesRasterRegistrableDialog.java
21 21
import java.awt.BorderLayout;
22 22
import java.util.TreeMap;
23 23

  
24
import javax.swing.JPanel;
24
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
25
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
25 26

  
26 27
import com.iver.andami.PluginServices;
27 28
import com.iver.andami.ui.mdiManager.IWindow;
......
31 32
/**
32 33
 * @author Nacho Brodin (nachobrodin@gmail.com)
33 34
 */
34
public class PropertiesRasterRegistrableDialog extends JPanel implements IWindow, IWindowListener {
35
public class PropertiesRasterRegistrableDialog extends DefaultButtonsPanel implements IWindow, IWindowListener {
35 36
	private static final long   serialVersionUID = -2920327107654323732L;
36 37
	private RegistrableTabPanel registrable      = null;
37
	private ButtonsPanel        buttons          = null;
38 38
	private TreeMap             params           = new TreeMap();
39 39
	/**
40 40
	 * Nombre de la capa. Usado para destruir la ventana al eliminar la capa
......
47 47
	 * @throws EmptyTabsException 
48 48
	 */
49 49
	public PropertiesRasterRegistrableDialog(FLayer lyr, String lyrName) throws EmptyTabsException {
50
		super(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
50 51
		this.layerName = lyrName;
51 52
		registrable = new RegistrableTabPanel(lyr);
52
		buttons = new ButtonsPanel();
53 53
		new PropertiesRasterListener(this);
54 54
		initialize();
55 55
	}
......
57 57
	private void initialize() {
58 58
		this.setLayout(new BorderLayout());
59 59
		add(registrable, BorderLayout.CENTER);
60
		add(buttons, BorderLayout.SOUTH);
61 60
	}
62 61

  
63 62
	/**
......
96 95
	}
97 96

  
98 97
	/**
99
	 * Get buttons panel
100
	 * @return ButtonsPanel
101
	 */
102
	public ButtonsPanel getButtonsPanel() {
103
		return buttons;
104
	}
105

  
106
	/**
107 98
	 * Get registrable panel
108 99
	 * @return RegistrableTabPanel
109 100
	 */
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/properties/dialog/PropertiesRasterListener.java
18 18
 */
19 19
package org.gvsig.raster.gui.properties.dialog;
20 20

  
21
import java.awt.event.ActionEvent;
22
import java.awt.event.ActionListener;
21
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
22
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
23
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
23 24
/**
24 25
 * Clase que maneja los eventos del dialogo de Propiedades.
25 26
 * 
26 27
 * @author Nacho Brodin (nachobrodin@gmail.com)
27 28
 */
28
public class PropertiesRasterListener implements ActionListener {
29
public class PropertiesRasterListener implements ButtonsPanelListener {
29 30

  
30 31
	private PropertiesRasterRegistrableDialog 	dialog = null;
31 32

  
32 33
	public PropertiesRasterListener(PropertiesRasterRegistrableDialog dialog){
33 34
		this.dialog = dialog;
34
		dialog.getButtonsPanel().getAccept().addActionListener(this);
35
		dialog.getButtonsPanel().getApply().addActionListener(this);
36
		dialog.getButtonsPanel().getCancel().addActionListener(this);
35
		dialog.addButtonPressedListener(this);
37 36
	}
38 37

  
39
	public void actionPerformed(ActionEvent e) {
40
		if(e.getSource().equals(dialog.getButtonsPanel().getAccept())){
41
			dialog.getRegistrablePanel().acceptSelectedTab();
42
			dialog.close();
38
	public void actionButtonPressed(ButtonsPanelEvent e) {
39
		switch (e.getButton()) {
40
			case ButtonsPanel.BUTTON_ACCEPT:
41
				dialog.getRegistrablePanel().acceptSelectedTab();
42
				dialog.close();
43
				break;
44
			case ButtonsPanel.BUTTON_APPLY:
45
				dialog.getRegistrablePanel().applySelectedTab();
46
				break;
47
			case ButtonsPanel.BUTTON_CANCEL:
48
				dialog.getRegistrablePanel().cancelSelectedTab();
49
				dialog.close();
50
				break;
43 51
		}
44

  
45
		if(e.getSource().equals(dialog.getButtonsPanel().getApply()))
46
			dialog.getRegistrablePanel().applySelectedTab();
47

  
48
		if(e.getSource().equals(dialog.getButtonsPanel().getCancel())){
49
			dialog.getRegistrablePanel().cancelSelectedTab();
50
			dialog.close();
51
		}
52 52
	}
53 53
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/rasterresolution/ZoomPixelCursorListener.java
32 32

  
33 33
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
34 34
import com.iver.andami.messages.NotificationManager;
35
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
36 35
import com.iver.cit.gvsig.fmap.MapControl;
37 36
import com.iver.cit.gvsig.fmap.ViewPort;
38 37
import com.iver.cit.gvsig.fmap.layers.FLayer;
......
48 47
 * @author Nacho Brodin (nachobrodin@gmail.com)
49 48
 */
50 49
public class ZoomPixelCursorListener implements PointListener {
51
	private final Image 	img = new ImageIcon(MapControl.class.getResource(
52
											"images/ZoomPixelCursor.gif")).getImage();
53
	private Cursor 			cur = Toolkit.getDefaultToolkit().createCustomCursor(	img,
54
																					new Point(16, 16), "");
50
	private final Image img = new ImageIcon(MapControl.class.getResource("images/ZoomPixelCursor.gif")).getImage();
51
	private Cursor      cur = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(16, 16), "");
55 52
	private MapControl 		mapCtrl;
56 53

  
57

  
58 54
	/**
59 55
	 * Constructor. Asigna el MapControl
60 56
	 * @param mc
......
69 65
	 */
70 66
	public void point(PointEvent event) throws BehaviorException {
71 67
		Point2D pReal = mapCtrl.getMapContext().getViewPort().toMapPoint(event.getPoint());
72
		//Point imagePoint = new Point((int) event.getPoint().getX(), (int) event.getPoint().getY());
68
		// Point imagePoint = new Point((int) event.getPoint().getX(), (int)
69
		// event.getPoint().getY());
73 70
		ViewPort v = mapCtrl.getMapContext().getViewPort();
74 71

  
75 72
		FLayer[] actives = mapCtrl.getMapContext().getLayers().getActives();
......
80 77
			NotificationManager.addError("Error al obtener el extent", e1);
81 78
		}
82 79

  
83
		ArrayList attr = ((FLyrRasterSE)actives[0]).getAttributes();
80
		ArrayList attr = ((FLyrRasterSE) actives[0]).getAttributes();
84 81
		int width = 0, height = 0;
85
		for (int i=0; i<attr.size(); i++) {
86
			Object[] a = (Object []) attr.get(i);
82
		for (int i = 0; i < attr.size(); i++) {
83
			Object[] a = (Object[]) attr.get(i);
87 84
			if (a[0].toString().equals("Width"))
88
				width = ((Integer)a[1]).intValue();
85
				width = ((Integer) a[1]).intValue();
89 86
			if (a[0].toString().equals("Height"))
90
				height = ((Integer)a[1]).intValue();
87
				height = ((Integer) a[1]).intValue();
91 88
		}
92 89

  
90
		if (ext != null && width != 0 && height != 0) {
93 91

  
94
		if(	ext != null &&
95
				width != 0 &&
96
				height != 0){
97

  
98 92
			double wcOriginCenterX = pReal.getX();
99 93
			double wcOriginCenterY = pReal.getY();
100 94

  
101
			//Hallamos la relaci?n entre el pixel y las WC a partir de la imagen de la capa
102
			double relacionPixelWcWidth =  (ext.getMaxX() - ext.getMinX())/width;
103
			double relacionPixelWcHeight = (ext.getMaxY() - ext.getMinY())/height;
104
			//double desplazamientoX = ext.getMinX();
105
			//double desplazamientoY = ext.getMinY();
95
			// Hallamos la relaci?n entre el pixel y las WC a partir de la imagen de
96
			// la capa
97
			double relacionPixelWcWidth = (ext.getMaxX() - ext.getMinX()) / width;
98
			double relacionPixelWcHeight = (ext.getMaxY() - ext.getMinY()) / height;
99
			// double desplazamientoX = ext.getMinX();
100
			// double desplazamientoY = ext.getMinY();
106 101

  
107
			double wcOriginX = wcOriginCenterX - ((v.getImageWidth()*relacionPixelWcWidth)/2);
108
			double wcOriginY = wcOriginCenterY - ((v.getImageHeight()*relacionPixelWcHeight)/2);
102
			double wcOriginX = wcOriginCenterX - ((v.getImageWidth() * relacionPixelWcWidth) / 2);
103
			double wcOriginY = wcOriginCenterY - ((v.getImageHeight() * relacionPixelWcHeight) / 2);
109 104

  
110 105
			double wcDstMinX = wcOriginX;
111 106
			double wcDstMinY = wcOriginY;
112
			double wcDstMaxX = wcDstMinX + (v.getImageWidth()*relacionPixelWcWidth);
113
			double wcDstMaxY = wcDstMinY + (v.getImageHeight()*relacionPixelWcHeight);
107
			double wcDstMaxX = wcDstMinX + (v.getImageWidth() * relacionPixelWcWidth);
108
			double wcDstMaxY = wcDstMinY + (v.getImageHeight() * relacionPixelWcHeight);
114 109

  
115 110
			double wcDstWidth = wcDstMaxX - wcDstMinX;
116 111
			double wcDstHeight = wcDstMaxY - wcDstMinY;
......
134 129
		return false;
135 130
	}
136 131

  
132
	/*
133
	 * (non-Javadoc)
134
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
135
	 */
137 136
	public void pointDoubleClick(PointEvent event) throws BehaviorException {
138
		// TODO Auto-generated method stub
139

  
140 137
	}
141

  
142
}
138
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/filter/FilterListener.java
57 57
import org.gvsig.raster.grid.filter.RasterFilterList;
58 58
import org.gvsig.raster.grid.filter.RasterFilterListManager;
59 59
import org.gvsig.raster.grid.render.Rendering;
60
import org.gvsig.rastertools.RasterModule;
61 60
import org.gvsig.rastertools.filter.ui.FilterPanel;
62 61

  
63 62
import com.iver.andami.PluginServices;
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/roi/ui/listener/DrawMouseViewListener.java
1 1
package org.gvsig.rastertools.roi.ui.listener;
2 2

  
3 3
import java.awt.Cursor;
4
import java.awt.Image;
5
import java.awt.Point;
6
import java.awt.Toolkit;
7 4
import java.awt.geom.Point2D;
8 5

  
9
import javax.swing.ImageIcon;
10

  
11 6
import org.gvsig.fmap.raster.grid.roi.VectorialROI;
12 7
import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
13 8
import org.gvsig.rastertools.roi.ui.ROIManagerPanel;
14 9

  
15
import com.iver.cit.gvsig.fmap.MapControl;
16 10
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
17 11
import com.iver.cit.gvsig.fmap.core.IGeometry;
18 12
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
......
23 17
import com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener;
24 18

  
25 19
public class DrawMouseViewListener implements PolylineListener, PointListener {
26
	
27
	private ROIManagerPanel 	roiManagerPanel 	= null;
28
	private VectorialROI 		roi 				= null;
20
	private ROIManagerPanel roiManagerPanel = null;
21
	private VectorialROI    roi             = null;
29 22

  
30 23
	public DrawMouseViewListener(ROIManagerPanel roiManagerPanel) {
31 24
		this.roiManagerPanel = roiManagerPanel;
......
33 26

  
34 27
	public void pointFixed(MeasureEvent event) throws BehaviorException {
35 28
		// TODO Auto-generated method stub
36

  
37 29
	}
38 30

  
39 31
	public void points(MeasureEvent event) throws BehaviorException {
......
91 83
		}
92 84
	}
93 85

  
86
	/*
87
	 * (non-Javadoc)
88
	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
89
	 */
94 90
	public void pointDoubleClick(PointEvent event) throws BehaviorException {	
95 91
	}
96

  
97
}
92
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/control/BandSetupListener.java
37 37
import org.gvsig.raster.hierarchy.IRasterProperties;
38 38
import org.gvsig.raster.hierarchy.IRasterRendering;
39 39
import org.gvsig.raster.util.RasterToolsUtil;
40
import org.gvsig.rastertools.RasterModule;
41 40
import org.gvsig.rastertools.properties.panels.BandSetupPanel;
42 41

  
43 42
import com.hardcode.driverManager.DriverLoadException;
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/histogram/ui/HistogramDialog.java
27 27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
28 28
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
29 29
import org.gvsig.raster.hierarchy.IHistogramable;
30
import org.gvsig.raster.util.RasterToolsUtil;
31
import org.gvsig.raster.util.RasterUtilities;
32 30

  
33 31
import com.iver.andami.PluginServices;
34 32
import com.iver.andami.ui.mdiManager.IWindow;
35 33
import com.iver.andami.ui.mdiManager.WindowInfo;
36
import com.iver.cit.gvsig.fmap.layers.FLayer;
37 34
/**
38 35
 * <code>HistogramDialog</code>. Creaci?n de la ventana de histograma para gvSIG.
39 36
 *
......
140 137
	public String getLayerName() {
141 138
		return layerName;
142 139
	}
143

  
144 140
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/selectrasterlayer/SelectImageListener.java
28 28
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
29 29
import com.iver.andami.PluginServices;
30 30
import com.iver.andami.messages.NotificationManager;
31
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
32 31
import com.iver.cit.gvsig.fmap.MapControl;
33 32
import com.iver.cit.gvsig.fmap.ViewPort;
34 33
import com.iver.cit.gvsig.fmap.layers.FLayer;
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/cutting/CuttingTocMenuEntry.java
104 104
		if (!(fLayer instanceof FLyrRasterSE))
105 105
			return;
106 106

  
107
		CuttingDialog cuttingDialog = new CuttingDialog(435, 280);
107
		CuttingDialog cuttingDialog = new CuttingDialog(420, 290);
108 108
		cuttingDialog.setLayer(fLayer);
109 109
		PluginServices.getMDIManager().addWindow(cuttingDialog);
110 110
	}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/cutting/ui/CuttingPanel.java
20 20

  
21 21
import java.awt.BorderLayout;
22 22
import java.awt.Dimension;
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25
import java.awt.Insets;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
28
import java.awt.event.ItemEvent;
29
import java.awt.event.ItemListener;
30
import java.io.File;
31 23
import java.util.ArrayList;
32 24

  
33
import javax.swing.JButton;
34
import javax.swing.JCheckBox;
35
import javax.swing.JFileChooser;
36
import javax.swing.JLabel;
25
import javax.swing.BorderFactory;
37 26
import javax.swing.JPanel;
38 27
import javax.swing.JTabbedPane;
39
import javax.swing.JTextField;
40 28

  
41 29
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
42
import org.gvsig.gui.beans.buttonbar.ButtonBarContainer;
43 30
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
44
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
45
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
46
import org.gvsig.gui.beans.coordinatespanel.CoordinatesPanel;
47 31
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
48
import org.gvsig.gui.beans.table.TableContainer;
49
import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
50
import org.gvsig.raster.dataset.IRasterDataSource;
51 32
import org.gvsig.raster.hierarchy.IRasterGeoOperations;
52 33
import org.gvsig.raster.hierarchy.IRasterOperations;
53 34
import org.gvsig.raster.util.RasterToolsUtil;
54
import org.gvsig.rastertools.RasterModule;
35
import org.gvsig.rastertools.cutting.panels.CuttingCoordinatesPanel;
36
import org.gvsig.rastertools.cutting.panels.CuttingOptionsPanel;
37
import org.gvsig.rastertools.cutting.panels.CuttingResolutionPanel;
38
import org.gvsig.rastertools.cutting.panels.CuttingSelectionPanel;
55 39
import org.gvsig.rastertools.cutting.ui.listener.CuttingMouseViewListener;
56 40
import org.gvsig.rastertools.cutting.ui.listener.CuttingPanelListener;
57 41

  
58 42
import com.iver.andami.PluginServices;
59
import com.iver.andami.messages.NotificationManager;
60 43
import com.iver.andami.ui.mdiManager.IWindow;
61
import com.iver.cit.gvsig.addlayer.fileopen.FileOpenWizard;
62 44
import com.iver.cit.gvsig.fmap.MapControl;
63 45
import com.iver.cit.gvsig.fmap.layers.FLayer;
64 46
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior;
......
72 54
 * @version 17/04/2007
73 55
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
74 56
 */
75
public class CuttingPanel extends DefaultButtonsPanel implements ItemListener, ActionListener {
57
public class CuttingPanel extends DefaultButtonsPanel {
76 58
	private static final long serialVersionUID = 3078196473228467834L;
77 59

  
78
	private int                  wPanel               = 400;
60
	private CuttingDialog           cuttingDialog        = null;
79 61

  
80
	private CuttingDialog        cuttingDialog        = null;
62
	private JTabbedPane             jTabbedPane1         = null;
81 63

  
82
	private CoordinatesPanel     coordinatesPixel     = null;
83
	private CoordinatesPanel     coordinatesReales    = null;
84
	private ButtonBarContainer   buttonBarContainer   = null;
85
	private JPanel               pSelection           = null;
86
	private JPanel               jOptions             = null;
87
	private JPanel               jPNameFile           = null;
88
	private TableContainer       tSelection           = null;
89
	private ResolutionPanel      pResolution          = null;
90
	private JCheckBox            jCheckBox            = null;
91
	private JCheckBox            jCheckLoadLayerInToc = null;
92
	private JCheckBox            jCheckSaveFile       = null;
93
	private JTextField           filenameTextField    = null;
94
	private JTabbedPane          jTabbedPane1         = null;
95
	private JPanel               jPNameDirectory      = null;
96
	private JTextField           directoryTextField   = null;
97
	private JButton              jBChooseDirectory    = null;
98
	private JLabel               jLabelDirectory      = null;
64
	private CuttingCoordinatesPanel coordinatesPanel     = null;
65
	private CuttingResolutionPanel  resolutionPanel      = null;
66
	private CuttingSelectionPanel   selectionPanel       = null;
67
	private CuttingOptionsPanel     optionsPanel         = null;
99 68

  
100
	private FLayer               fLayer               = null;
69
	private FLayer                  fLayer               = null;
101 70

  
102 71
	/**
103
   * Valores reales para el ancho, alto y tama?o de celda. Esto es necesario
104
   * porque en la caja de texto se guardan con decimales recortados y cuando se
105
   * pide el valor se devuelven completos.
106
   */
107
	private double               realWidth, realHeight;
72
	 * Valores reales para el ancho, alto y tama?o de celda. Esto es necesario
73
	 * porque en la caja de texto se guardan con decimales recortados y cuando se
74
	 * pide el valor se devuelven completos.
75
	 */
76
	private double                  realWidth, realHeight;
108 77

  
109 78
	/**
110
   * Relaci?n entre el ancho y alto en pixeles de la imagen
111
   */
112
	private double               relWidthHeight       = 0;
79
	 * Relaci?n entre el ancho y alto en pixeles de la imagen
80
	 */
81
	private double                  relWidthHeight       = 0;
113 82

  
114 83
	/**
115
   * Valores reales para el tama?o de la ventana. Esto es necesario porque en la
116
   * caja de texto se guardan con decimales recortados y cuando se pide el valor
117
   * se devuelven completos.
118
   */
119
	private double               wcUlx, wcUly, wcLrx, wcLry;
120
	private double               pxMinX, pxMinY, pxMaxX, pxMaxY;
84
	 * Valores reales para el tama?o de la ventana. Esto es necesario porque en la
85
	 * caja de texto se guardan con decimales recortados y cuando se pide el valor
86
	 * se devuelven completos.
87
	 */
88
	private double                  wcUlx, wcUly, wcLrx, wcLry;
89
	private double                  pxMinX, pxMinY, pxMaxX, pxMaxY;
121 90

  
122
	private CuttingPanelListener cuttingPanelListener = null;
91
	private CuttingPanelListener    cuttingPanelListener = null;
123 92

  
124 93
	/**
125
   * Herramienta seleccionada en el momento de la apertura del dialogo
126
   */
127
	private String               lastTool             = null;
128
	private MapControl           mapControl           = null;
129
	private String               viewName             = null;
94
	 * Herramienta seleccionada en el momento de la apertura del dialogo
95
	 */
96
	private String                  lastTool             = null;
97
	private MapControl              mapControl           = null;
98
	private String                  viewName             = null;
130 99

  
131 100
	/**
132 101
	 * Crea un nuevo <code>CuttingPanel</code>
......
136 105
		super(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
137 106

  
138 107
		this.cuttingDialog = cuttingDialog;
108

  
139 109
		initialize();
140
		cuttingPanelListener = new CuttingPanelListener(this);
141 110

  
142
		getCoordinatesPixel().addValueChangedListener(cuttingPanelListener);
143
		getCoordinatesReales().addValueChangedListener(cuttingPanelListener);
111
		getResolutionPanel().getCCellSize().addValueChangedListener(getCuttingPanelListener());
112
		getResolutionPanel().getCWidth().addValueChangedListener(getCuttingPanelListener());
113
		getResolutionPanel().getCHeight().addValueChangedListener(getCuttingPanelListener());
114
		getResolutionPanel().getButtonRestore().addActionListener(getCuttingPanelListener());
144 115

  
145
		getPResolution().getCCellSize().addValueChangedListener(cuttingPanelListener);
146
		getPResolution().getCWidth().addValueChangedListener(cuttingPanelListener);
147
		getPResolution().getCHeight().addValueChangedListener(cuttingPanelListener);
148

  
149
		getButtonBarContainer().getButton(0).addActionListener(cuttingPanelListener);
150
		getButtonBarContainer().getButton(1).addActionListener(cuttingPanelListener);
151

  
152
		this.addButtonPressedListener(cuttingPanelListener);
116
		addButtonPressedListener(getCuttingPanelListener());
153 117
	}
118
	
119
	/**
120
	 * Crea en caso de no existir y devuelve la clase encargada de recoger los
121
	 * eventos
122
	 * @return
123
	 */
124
	private CuttingPanelListener getCuttingPanelListener() {
125
		if (cuttingPanelListener == null) {
126
			cuttingPanelListener = new CuttingPanelListener(this);
127
		}
128
		return cuttingPanelListener;
129
	}
154 130

  
155 131
	/**
156 132
	 * Obtener el <code>CuttingDialog</code> asociado a este objeto.
......
161 137
	}
162 138

  
163 139
	/**
164
	 * Especificar el nombre de la nueva capa para el recuadro de texto asign?ndo
165
	 * en cada llamada un nombre consecutivo.
166
	 */
167
	public void setNewLayerText() {
168
		filenameTextField.setText("NewLayer_" + RasterModule.layerCount);
169
		RasterModule.layerCount++;
170
	}
171

  
172
	/**
173 140
	 * Obtener la capa de un raster.
174 141
	 * @return
175 142
	 */
......
199 166
				new RectangleBehavior(cuttingMouseListener), new MouseMovementBehavior(sbl)
200 167
			}
201 168
		);
169
		
170
		getSelectionPanel().setLayer(fLayer);
202 171

  
203
		// Rellenar el arbol de bandas
204
		IRasterDataSource mDataset = ((FLyrRasterSE) fLayer).getDataSource();
205
		for (int i = 0; i < mDataset.getDatasetCount(); i++) {
206
			String fName = mDataset.getDataset(i)[0].getFName();
207
			String bandName = new File(fName).getName();
208

  
209
			if (mDataset.getDataset(i)[0].getBandCount() > 1) {
210
				for (int b = 0; b < mDataset.getDataset(i)[0].getBandCount(); b++) {
211
					Object row[] = { new Boolean(true),
212
							new String("B" + (b + 1) + " - " + bandName) };
213
					try {
214
						getTSelection().addRow(row);
215
					} catch (NotInitializeException e) {
216
						NotificationManager.addError("Error a?adiendo fila a la tabla.", e);
217
					}
218
				}
219
			} else {
220
				Object row[] = { new Boolean(true), new String("B - " + bandName) };
221
				try {
222
					getTSelection().addRow(row);
223
				} catch (NotInitializeException e) {
224
					NotificationManager.addError("Error a?adiendo fila a la tabla.", e);
225
				}
226
			}
227
		}
228

  
229 172
		// Obtener la extension completa de la capa
230 173

  
231 174
		if(fLayer instanceof IRasterGeoOperations && fLayer instanceof IRasterOperations) {
232
			cuttingPanelListener.setAffineTransform(((IRasterGeoOperations)fLayer).getAffineTransform());
233
			cuttingPanelListener.setDimension(new Dimension((int)((IRasterOperations)fLayer).getPxWidth(), (int)((IRasterOperations)fLayer).getPxHeight()));
175
			getCuttingPanelListener().setAffineTransform(((IRasterGeoOperations)fLayer).getAffineTransform());
176
			getCuttingPanelListener().setDimension(new Dimension((int)((IRasterOperations)fLayer).getPxWidth(), (int)((IRasterOperations)fLayer).getPxHeight()));
234 177
		} else {
235 178
			RasterToolsUtil.messageBoxError("Error obteniendo el extent.", this);
236 179
			return;
......
241 184
		for (int i = 0; i < attr.size(); i++) {
242 185
			Object[] a = (Object[]) attr.get(i);
243 186
			if (a[0].toString().equals("Width"))
244
				cuttingPanelListener.setWidthPx(((Integer) a[1]).intValue());
187
				getCuttingPanelListener().setWidthPx(((Integer) a[1]).intValue());
245 188
			if (a[0].toString().equals("Height"))
246
				cuttingPanelListener.setHeightPx(((Integer) a[1]).intValue());
189
				getCuttingPanelListener().setHeightPx(((Integer) a[1]).intValue());
247 190
		}
248 191
	}
249 192

  
......
287 230
	 * This method initializes this
288 231
	 */
289 232
	private void initialize() {
233
		JPanel jPanel = null;
290 234
		jTabbedPane1 = new JTabbedPane();
235
		
236
		jTabbedPane1.addTab(PluginServices.getText(this, "coordenadas_recorte"), getCoordinatesPanel());
291 237

  
292
		JPanel jpanel1 = new JPanel();
293
		jpanel1.setLayout(new GridBagLayout());
238
		jPanel = new JPanel();
239
		jPanel.setLayout(new BorderLayout());
240
		jPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
241
		jPanel.add(getResolutionPanel());
242
		jTabbedPane1.addTab(PluginServices.getText(this, "resolucion_espacial"), jPanel);
294 243

  
295
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
296
		gridBagConstraints.gridx = 0;
297
		gridBagConstraints.gridy = 0;
298
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
299
		gridBagConstraints.weightx = 1.0;
300
		gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 5);
301
		jpanel1.add(getCoordinatesPixel(), gridBagConstraints);
244
		jTabbedPane1.addTab(PluginServices.getText(this, "seleccion_bandas"), getSelectionPanel());
302 245

  
303
		gridBagConstraints = new GridBagConstraints();
304
		gridBagConstraints.gridx = 0;
305
		gridBagConstraints.gridy = 1;
306
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
307
		gridBagConstraints.weightx = 1.0;
308
		gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5);
309
		jpanel1.add(getCoordinatesReales(), gridBagConstraints);
246
		jPanel = new JPanel();
247
		jPanel.setLayout(new BorderLayout());
248
		jPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
249
		jPanel.add(getOptionsPanel());
250
		jTabbedPane1.addTab(PluginServices.getText(this, "otras_opciones"), jPanel);
310 251

  
311
		gridBagConstraints = new GridBagConstraints();
312
		gridBagConstraints.gridx = 0;
313
		gridBagConstraints.gridy = 2;
314
		gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
315
		gridBagConstraints.insets = new java.awt.Insets(2, 5, 5, 5);
316
		jpanel1.add(getButtonBarContainer(), gridBagConstraints);
317

  
318
		jTabbedPane1.addTab(PluginServices.getText(this, "coordenadas_recorte"), jpanel1);
319
		jTabbedPane1.addTab(PluginServices.getText(this, "resolucion_espacial"), getPResolution());
320
		jTabbedPane1.addTab(PluginServices.getText(this, "seleccion_bandas"), getPSelection());
321
		jTabbedPane1.addTab(PluginServices.getText(this, "otras_opciones"), getJOptions());
322

  
323 252
		setLayout(new BorderLayout());
324 253
		add(jTabbedPane1, BorderLayout.CENTER);
325

  
326
		setNewLayerText();
327 254
	}
328 255

  
329
	/**
330
	 * This method initializes jPanel
331
	 *
332
	 * @return javax.swing.JPanel
333
	 */
334
	public CoordinatesPanel getCoordinatesPixel() {
335
		if (coordinatesPixel == null) {
336
			coordinatesPixel = new CoordinatesPanel();
337
			coordinatesPixel.setParameters(	PluginServices.getText(this, "coordenadas_pixel"),
338
										PluginServices.getText(this, "sup_izq"),
339
										"X" ,"Y",
340
										PluginServices.getText(this, "inf_der"),
341
										"X", "Y");
256
	public CuttingCoordinatesPanel getCoordinatesPanel() {
257
		if (coordinatesPanel == null) {
258
			coordinatesPanel = new CuttingCoordinatesPanel(getCuttingPanelListener());
342 259
		}
343
		return coordinatesPixel;
260
		return coordinatesPanel;
344 261
	}
345

  
262
	
346 263
	/**
347
	 * This method initializes jPanel1
348
	 *
349
	 * @return javax.swing.JPanel
350
	 */
351
	public CoordinatesPanel getCoordinatesReales() {
352
		if (coordinatesReales == null) {
353
			coordinatesReales = new CoordinatesPanel();
354
			coordinatesReales.setParameters(	PluginServices.getText(this, "coordenadas_reales"),
355
										PluginServices.getText(this, "sup_izq"),
356
										"X" ,"Y",
357
										PluginServices.getText(this, "inf_der"),
358
										"X", "Y");
359
		}
360
		return coordinatesReales;
361
	}
362

  
363
	/**
364
	 * This method initializes jButton
365
	 *
366
	 * @return javax.swing.JButton
367
	 */
368
	public ButtonBarContainer getButtonBarContainer() {
369
		if (buttonBarContainer == null) {
370
			buttonBarContainer = new ButtonBarContainer();
371
			buttonBarContainer.setPreferredSize(new java.awt.Dimension(wPanel - 4, 32));
372
			buttonBarContainer.addButton("fullExtent.png", PluginServices.getText(this, "fullExtent"), 0);
373
			buttonBarContainer.addButton("selectTool.png", PluginServices.getText(this, "select_tool"), 1);
374
			buttonBarContainer.setButtonAlignment("right");
375
			buttonBarContainer.setComponentBorder(false);
376
		}
377
		return buttonBarContainer;
378
	}
379

  
380
	/**
381 264
	 * This method initializes jPanel
382 265
	 *
383 266
	 * @return javax.swing.JPanel
384 267
	 */
385
	public ResolutionPanel getPResolution() {
386
		if (pResolution == null) {
387
			pResolution = new ResolutionPanel();
388
			pResolution.setPreferredSize(new java.awt.Dimension(wPanel, 120));
389
			pResolution.validate();
268
	public CuttingResolutionPanel getResolutionPanel() {
269
		if (resolutionPanel == null) {
270
			resolutionPanel = new CuttingResolutionPanel();
271
			resolutionPanel.validate();
390 272
		}
391
		return pResolution;
273
		return resolutionPanel;
392 274
	}
393 275

  
394 276
	/**
......
396 278
	 *
397 279
	 * @return javax.swing.JPanel
398 280
	 */
399
	private JPanel getPSelection() {
400
		if (pSelection == null) {
401
			pSelection = new JPanel();
402
			pSelection.setLayout(new BorderLayout());
403
			pSelection.setPreferredSize(new java.awt.Dimension(wPanel, 120));
404
			pSelection.add(getTSelection(), BorderLayout.CENTER);
405

  
281
	public CuttingSelectionPanel getSelectionPanel() {
282
		if (selectionPanel == null) {
283
			selectionPanel = new CuttingSelectionPanel();
406 284
		}
407
		return pSelection;
285
		return selectionPanel;
408 286
	}
409 287

  
410 288
	/**
411
	 * Obtiene la tabla de selecci?n de bandas
412
	 * @return Tabla de selecci?n de bandas
413
	 */
414
	public TableContainer getTSelection() {
415
		if (tSelection == null) {
416
			String[] columnNames = {PluginServices.getText(this, "bandas"), PluginServices.getText(this, "nombre")};
417
			int[] columnWidths = {75, 305};
418
			tSelection = new TableContainer(columnNames, columnWidths);
419
			tSelection.setModel("CheckBoxModel");
420
			tSelection.setControlVisible(false);
421
			tSelection.initialize();
422
		}
423

  
424
		return tSelection;
425
	}
426

  
427
	/**
428 289
	 * This method initializes jOptions
429 290
	 *
430 291
	 * @return javax.swing.JPanel
431 292
	 */
432
	private JPanel getJOptions() {
433
		if (jOptions == null) {
434
			jOptions = new JPanel();
435
			jOptions.setLayout(new GridBagLayout());
436
			jOptions.add(getJPNameFile(), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
437
					GridBagConstraints.CENTER, GridBagConstraints.BOTH,
438
					new Insets(0, 0, 5, 5), 0, 0));
439
			jOptions.add(getCbOneLyrPerBand(), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
440
					GridBagConstraints.CENTER, GridBagConstraints.BOTH,
441
					new Insets(0, 0, 5, 5), 0, 0));
442
			jOptions.add(getCbLoadLayerInToc(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
443
					GridBagConstraints.CENTER, GridBagConstraints.BOTH,
444
					new Insets(0, 0, 5, 5), 0, 0));
445
			jOptions.add(getCbSaveFile(), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
446
					GridBagConstraints.CENTER, GridBagConstraints.BOTH,
447
					new Insets(0, 0, 5, 5), 0, 0));
448
			jOptions.add(getJPNameDirectory(), new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
449
					GridBagConstraints.CENTER, GridBagConstraints.BOTH,
450
					new Insets(0, 0, 5, 5), 0, 0));
451
			jOptions.setPreferredSize(new java.awt.Dimension(wPanel, 135));
293
	public CuttingOptionsPanel getOptionsPanel() {
294
		if (optionsPanel == null) {
295
			optionsPanel = new CuttingOptionsPanel();
452 296
		}
453
		return jOptions;
297
		return optionsPanel;
454 298
	}
455 299

  
456 300
	/**
457
	 * This method initializes jPNameFile
458
	 *
459
	 * @return javax.swing.JPanel
460
	 */
461
	private JPanel getJPNameFile() {
462
		if (jPNameFile == null) {
463
			jPNameFile = new JPanel();
464
			jPNameFile.add(new JLabel(PluginServices.getText(this, "nombre_capas") + ":"));
465
			jPNameFile.add(getFilenameTextField());
466
		}
467
		return jPNameFile;
468
	}
469

  
470
	private JButton getJBChooseDirectory() {
471
		if (jBChooseDirectory == null) {
472
			jBChooseDirectory = new JButton(PluginServices.getText(this, "cambiar_ruta"));
473
			jBChooseDirectory.setEnabled(false);
474
		}
475
		return jBChooseDirectory;
476
	}
477
	/**
478
	 * This method initializes jPNameFile
479
	 *
480
	 * @return javax.swing.JPanel
481
	 */
482
	private JPanel getJPNameDirectory() {
483
		if (jPNameDirectory == null) {
484
			jPNameDirectory = new JPanel();
485
			jPNameDirectory.add(getJLabelDirectory());
486
			jPNameDirectory.add(getDirectoryTextField());
487
			jPNameDirectory.add(getJBChooseDirectory());
488
			getJBChooseDirectory().addActionListener(this);
489
		}
490
		return jPNameDirectory;
491
	}
492

  
493
	private JLabel getJLabelDirectory() {
494
		if (jLabelDirectory == null) {
495
			jLabelDirectory = new JLabel(PluginServices.getText(this, "ruta") + ":");
496
			jLabelDirectory.setEnabled(false);
497
		}
498
		return jLabelDirectory;
499
	}
500

  
501
	/**
502
	 * This method initializes filenameTextField
503
	 *
504
	 * @return javax.swing.JTextField
505
	 */
506
	public JTextField getFilenameTextField() {
507
		if (filenameTextField == null) {
508
			filenameTextField = new JTextField();
509
			filenameTextField.setPreferredSize(new Dimension(150, filenameTextField.getPreferredSize().height));
510
		}
511
		return filenameTextField;
512
	}
513

  
514
	/**
515
	 * This method initializes filenameTextField
516
	 *
517
	 * @return javax.swing.JTextField
518
	 */
519
	public JTextField getDirectoryTextField() {
520
		if (directoryTextField == null) {
521
			directoryTextField = new JTextField();
522
			directoryTextField.setText(FileOpenWizard.getLastPath());
523
			directoryTextField.setEditable(false);
524
			directoryTextField.setEnabled(false);
525
			directoryTextField.setPreferredSize(new Dimension(200, directoryTextField.getPreferredSize().height));
526
		}
527
		return directoryTextField;
528
	}
529

  
530
	/**
531
	 * This method initializes jCheckSaveFile
532
	 *
533
	 * @return javax.swing.JCheckBox
534
	 */
535
	public JCheckBox getCbSaveFile() {
536
		if (jCheckSaveFile == null) {
537
			jCheckSaveFile = new JCheckBox();
538
			jCheckSaveFile.setText(PluginServices.getText(this, "guardar_en_disco"));
539
			jCheckSaveFile.addItemListener(this);
540
		}
541
		return jCheckSaveFile;
542
	}
543

  
544
	/**
545
	 * This method initializes jCheckBox
546
	 *
547
	 * @return javax.swing.JCheckBox
548
	 */
549
	public JCheckBox getCbOneLyrPerBand() {
550
		if (jCheckBox == null) {
551
			jCheckBox = new JCheckBox();
552
			jCheckBox.setText(PluginServices.getText(this, "crear_1_capa_por_banda"));
553
		}
554
		return jCheckBox;
555
	}
556

  
557
	/**
558
	 * This method initializes jCheckLoadLayerInToc
559
	 *
560
	 * @return javax.swing.JCheckBox
561
	 */
562
	public JCheckBox getCbLoadLayerInToc() {
563
		if (jCheckLoadLayerInToc == null) {
564
			jCheckLoadLayerInToc = new JCheckBox();
565
			jCheckLoadLayerInToc.setText(PluginServices.getText(this, "cargar_en_toc"));
566
			jCheckLoadLayerInToc.setSelected(true);
567
			jCheckLoadLayerInToc.setEnabled(false);
568
			jCheckLoadLayerInToc.addItemListener(this);
569
		}
570
		return jCheckLoadLayerInToc;
571
	}
572

  
573
	/**
574 301
	 * Asigna el valor del campo "Ancho" a partir del double que lo representa
575 302
	 * y con el n?mero de decimales que se especifica en el par?metro dec
576 303
	 * @param width Ancho
......
578 305
	 */
579 306
	public void setWidthText(double width, int dec) {
580 307
		realWidth = width;
581
		getPResolution().setWidthText(width, dec);
308
		getResolutionPanel().setWidthText(width, dec);
582 309
	}
583 310

  
584 311
	/**
......
597 324
	 */
598 325
	public void setHeightText(double height, int dec) {
599 326
		realHeight = height;
600
		getPResolution().setHeightText(height, dec);
327
		getResolutionPanel().setHeightText(height, dec);
601 328
	}
602 329

  
603 330
	/**
......
607 334
	 * @param dec N?mero de decimales
608 335
	 */
609 336
	public void setCellSizeText(double cellSize, int dec) {
610
		getPResolution().setCellSizeText(cellSize, dec);
337
		getResolutionPanel().setCellSizeText(cellSize, dec);
611 338
	}
612 339

  
613 340
	/**
......
623 350
		wcUly = uly;
624 351
		wcLrx = lrx;
625 352
		wcLry = lry;
626
 		setCoordReal(getCoord(ulx, uly, lrx, lry, dec));
353
 		getCoordinatesPanel().setCoordReal(getCoord(ulx, uly, lrx, lry, dec));
627 354
	}
628 355

  
629 356
	/**
......
664 391
	}
665 392

  
666 393
	/**
667
	 * Asigna los valores de las coordenadas reales.
668
	 * @param values
669
	 */
670
	private void setCoordReal(String[] values) {
671
		getCoordinatesReales().setValues(values);
672
	}
673

  
674
	/**
675 394
	 * Asigna las coordenadas pixel a partir de n?meros en coma flotante.
676 395
	 * @param minx coordenada m?nima de X
677 396
	 * @param miny coordenada m?nima de Y
......
684 403
		pxMinY = miny;
685 404
		pxMaxX = maxx;
686 405
		pxMaxY = maxy;
687
		setCoordPixel(getCoord(minx, miny, maxx, maxy, dec));
406
		getCoordinatesPanel().setCoordPixel(getCoord(minx, miny, maxx, maxy, dec));
688 407
	}
689 408

  
690 409
	/**
691
	 * Asigna los valores de las coordenadas p?xel.
692
	 * @return
693
	 */
694
	private void setCoordPixel(String[] values) {
695
		getCoordinatesPixel().setValues(values);
696
	}
697

  
698
	/**
699 410
	 * Asigna la relaci?n entre el ancho y alto de la imagen de salida
700 411
	 * @param rel
701 412
	 */
......
806 517
	public double getHeightText() {
807 518
		return realHeight;
808 519
	}
809

  
810
	/**
811
	 * Cada vez que cambia un checkbox de cargar en toc o guardar en fichero, nos
812
	 * aseguramos de que no pueden estar las dos opciones desmarcadas
813
	 */
814
	public void itemStateChanged(ItemEvent e) {
815
		getCbLoadLayerInToc().setEnabled(true);
816
		getCbSaveFile().setEnabled(true);
817
		if (getCbLoadLayerInToc().isSelected() && !getCbSaveFile().isSelected())
818
			getCbLoadLayerInToc().setEnabled(false);
819
		if (!getCbLoadLayerInToc().isSelected() && getCbSaveFile().isSelected())
820
			getCbSaveFile().setEnabled(false);
821

  
822
		getJBChooseDirectory().setEnabled(getCbSaveFile().isSelected());
823
		getDirectoryTextField().setEnabled(getCbSaveFile().isSelected());
824
		getJLabelDirectory().setEnabled(getCbSaveFile().isSelected());
520
	
521
	
522
	double textWidth, textHeight, cellSize;
523
	public void saveStatusText() {
524
		textWidth = getWidthText();
525
		textHeight = getHeightText();
526
		cellSize = getResolutionPanel().getCellSizeText();
825 527
	}
826

  
827
	/**
828
	 * Accion que sucede cuando se pulsa el boton de cambiar directorio
829
	 */
830
	public void actionPerformed(ActionEvent e) {
831

  
832
		JFileChooser chooser = new JFileChooser(FileOpenWizard.getLastPath());
833
		chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
834
		chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_directorio"));
835

  
836
		if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
837
			return;
838
		String path = chooser.getSelectedFile().toString();
839
		FileOpenWizard.setLastPath(path);
840
		getDirectoryTextField().setText(path);
528
	
529
	public void restoreStatusText() {
530
    setWidthText(textWidth, 0);
531
    setHeightText(textHeight, 0);
532
		getResolutionPanel().setCellSizeText(cellSize, 4);
841 533
	}
842 534
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/cutting/ui/listener/CuttingMouseViewListener.java
127 127
		cuttingPanel.setHeightText(Math.abs(maxY - minY), 0);
128 128
		cuttingPanel.setCellSizeText(((maxX - minX) / dim.getX()), 4);
129 129
		cuttingPanel.setRelWidthHeight((double) (Math.abs(maxX - minX) / Math.abs(maxY - minY)));
130
		cuttingPanel.saveStatusText();
130 131
		
131 132
		if (currentTool != null)
132 133
			mapControl.setTool(currentTool);
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/cutting/ui/listener/CuttingPanelListener.java
42 42
import org.gvsig.gui.beans.datainput.DataInputContainerListener;
43 43
import org.gvsig.gui.beans.incrementabletask.IncrementableTask;
44 44
import org.gvsig.gui.beans.table.models.CheckBoxModel;
45
import org.gvsig.raster.dataset.IRasterDataSource;
46 45
import org.gvsig.raster.datastruct.Extent;
47 46
import org.gvsig.raster.util.RasterUtilities;
48
import org.gvsig.rastertools.RasterModule;
49 47
import org.gvsig.rastertools.cutting.CuttingProcess;
50 48
import org.gvsig.rastertools.cutting.WriterBufferServer;
49
import org.gvsig.rastertools.cutting.panels.CuttingCoordinatesPanel;
50
import org.gvsig.rastertools.cutting.panels.CuttingOptionsPanel;
51
import org.gvsig.rastertools.cutting.panels.CuttingResolutionPanel;
52
import org.gvsig.rastertools.cutting.panels.CuttingSelectionPanel;
51 53
import org.gvsig.rastertools.cutting.ui.CuttingPanel;
52 54

  
53 55
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
......
74 76
  private int             heightPx     = 0;
75 77

  
76 78
  /**
77
   * Crea un nuevo <code>CuttingPanelListener</code> con el
78
   * <code>CuttingPanel</code> asociado
79
   *
80
   * @param panel
81
   */
82
  public CuttingPanelListener(CuttingPanel panel) {
83
    this.cuttingPanel = panel;
84
  }
79
	 * Crea un nuevo <code>CuttingPanelListener</code> con el
80
	 * <code>CuttingPanel</code> asociado
81
	 * @param panel
82
	 */
83
	public CuttingPanelListener(CuttingPanel cuttingPanel) {
84
		this.cuttingPanel = cuttingPanel;
85
	}
85 86

  
86 87
  /**
87
   * Asigna la matriz de transformaci?n entre puntos en coordenadas del raster
88
   * y puntos en coordenadas reales.
89
   * @param AffineTransform
90
   */
88
	 * Asigna la matriz de transformaci?n entre puntos en coordenadas del raster y
89
	 * puntos en coordenadas reales.
90
	 * @param AffineTransform
91
	 */
91 92
  public void setAffineTransform(AffineTransform at) {
92 93
    this.at = at;
93 94
  }
......
107 108
  public void actionPerformed(ActionEvent e) {
108 109
    // Bot?n de selecci?n del extent completo
109 110
    // Modificamos las coordenadas reales y recalculamos las coordenadas pixel
110
    if (e.getSource() == getCuttingPanel().getButtonBarContainer().getButton(0)) {
111
    if (e.getSource() == getResolutionPanel().getButtonRestore()) {
112
      getCuttingPanel().restoreStatusText();
113
    }
114

  
115
    // Bot?n de selecci?n del extent completo
116
    // Modificamos las coordenadas reales y recalculamos las coordenadas pixel
117
    if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(0)) {
111 118
      Point2D ulPx = new Point2D.Double(0, 0);
112 119
      Point2D lrPx = new Point2D.Double(dim.width, dim.height);
113 120

  
......
128 135
      getCuttingPanel().setHeightText(Math.abs(maxY - minY), 0);
129 136
      getCuttingPanel().setCellSizeText(((lrWc.getX() - ulWc.getX()) / dim.width), 4);
130 137
      getCuttingPanel().setRelWidthHeight((double) (dim.getWidth() / dim.getHeight()));
138
      getCuttingPanel().saveStatusText();
131 139

  
132 140
      return;
133 141
    }
134 142

  
135 143
    // Bot?n de selecci?n de la herramienta de seleccionar desde la vista
136
    if (e.getSource() == getCuttingPanel().getButtonBarContainer().getButton(1)) {
144
    if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(1)) {
137 145
      getCuttingPanel().selectToolButton();
138 146
      return;
139 147
    }
......
146 154
   */
147 155
  private void eventJTextField(CoordinatesEvent e) {
148 156
    try {
149
    	if (e.getSource() == getCuttingPanel().getCoordinatesPixel()) {
157
    	if (e.getSource() == getCoordinatesPanel().getCoordinatesPixel()) {
150 158
				if (e.getName().equals("11"))
151 159
					getCuttingPanel().setCoorPixelFromDouble(
152
							Double.valueOf(getCuttingPanel().getCoordinatesPixel().getValue11()).doubleValue(),
160
							Double.valueOf(getCoordinatesPanel().getCoordinatesPixel().getValue11()).doubleValue(),
153 161
							getCuttingPanel().getPxMinY(),
154 162
							getCuttingPanel().getPxMaxX(),
155 163
							getCuttingPanel().getPxMaxY(),
......
157 165
				if (e.getName().equals("12"))
158 166
					getCuttingPanel().setCoorPixelFromDouble(
159 167
							getCuttingPanel().getPxMinX(),
160
							Double.valueOf(getCuttingPanel().getCoordinatesPixel().getValue12()).doubleValue(),
168
							Double.valueOf(getCoordinatesPanel().getCoordinatesPixel().getValue12()).doubleValue(),
161 169
							getCuttingPanel().getPxMaxX(),
162 170
							getCuttingPanel().getPxMaxY(),
163 171
							3);
......
165 173
					getCuttingPanel().setCoorPixelFromDouble(
166 174
							getCuttingPanel().getPxMinX(),
167 175
							getCuttingPanel().getPxMinY(),
168
							Double.valueOf(getCuttingPanel().getCoordinatesPixel().getValue21()).doubleValue(),
176
							Double.valueOf(getCoordinatesPanel().getCoordinatesPixel().getValue21()).doubleValue(),
169 177
							getCuttingPanel().getPxMaxY(),
170 178
							3);
171 179
				if (e.getName().equals("22"))
......
173 181
							getCuttingPanel().getPxMinX(),
174 182
							getCuttingPanel().getPxMinY(),
175 183
							getCuttingPanel().getPxMaxX(),
176
							Double.valueOf(getCuttingPanel().getCoordinatesPixel().getValue22()).doubleValue(),
184
							Double.valueOf(getCoordinatesPanel().getCoordinatesPixel().getValue22()).doubleValue(),
177 185
							3);
178 186
			}
179 187

  
180
    	if (e.getSource() == getCuttingPanel().getCoordinatesReales()) {
188
    	if (e.getSource() == getCoordinatesPanel().getCoordinatesReales()) {
181 189
        Extent ex = getMapWindow();
182 190
        if (ex == null)
183 191
        	return;
184 192

  
185 193
				if (e.getName().equals("11"))
186 194
					getCuttingPanel().setCoorRealFromDouble(
187
							Double.valueOf(getCuttingPanel().getCoordinatesReales().getValue11()).doubleValue(),
195
							Double.valueOf(getCoordinatesPanel().getCoordinatesReales().getValue11()).doubleValue(),
188 196
							ex.getULY(),
189 197
							ex.getLRX(),
190 198
							ex.getLRY(),
......
192 200
				if (e.getName().equals("12"))
193 201
					getCuttingPanel().setCoorRealFromDouble(
194 202
							ex.getULX(),
195
							Double.valueOf(getCuttingPanel().getCoordinatesReales().getValue12()).doubleValue(),
203
							Double.valueOf(getCoordinatesPanel().getCoordinatesReales().getValue12()).doubleValue(),
196 204
							ex.getLRX(),
197 205
							ex.getLRY(),
198 206
							6);
......
200 208
					getCuttingPanel().setCoorRealFromDouble(
201 209
							ex.getULX(),
202 210
							ex.getULY(),
203
							Double.valueOf(getCuttingPanel().getCoordinatesReales().getValue21()).doubleValue(),
211
							Double.valueOf(getCoordinatesPanel().getCoordinatesReales().getValue21()).doubleValue(),
204 212
							ex.getLRY(),
205 213
							6);
206 214
				if (e.getName().equals("22"))
......
208 216
							ex.getULX(),
209 217
							ex.getULY(),
210 218
							ex.getLRX(),
211
							Double.valueOf(getCuttingPanel().getCoordinatesReales().getValue22()).doubleValue(),
219
							Double.valueOf(getCoordinatesPanel().getCoordinatesReales().getValue22()).doubleValue(),
212 220
							6);
213 221
    	}
214 222
		} catch (NumberFormatException ex1) {
......
223 231
   * @deprecated Ya no es necesario con el nuevo componente
224 232
   */
225 233
  private boolean isFieldsFill() {
226
    if (getCuttingPanel().getCoordinatesPixel().getValue11().equals("") ||
227
        getCuttingPanel().getCoordinatesPixel().getValue12().equals("") ||
228
        getCuttingPanel().getCoordinatesPixel().getValue21().equals("") ||
229
        getCuttingPanel().getCoordinatesPixel().getValue22().equals("") ||
230
        getCuttingPanel().getCoordinatesReales().getValue11().equals("") ||
231
        getCuttingPanel().getCoordinatesReales().getValue12().equals("") ||
232
        getCuttingPanel().getCoordinatesReales().getValue21().equals("") ||
233
        getCuttingPanel().getCoordinatesReales().getValue22().equals(""))
234
    if (getCoordinatesPanel().getCoordinatesPixel().getValue11().equals("") ||
235
    		getCoordinatesPanel().getCoordinatesPixel().getValue12().equals("") ||
236
        getCoordinatesPanel().getCoordinatesPixel().getValue21().equals("") ||
237
        getCoordinatesPanel().getCoordinatesPixel().getValue22().equals("") ||
238
        getCoordinatesPanel().getCoordinatesReales().getValue11().equals("") ||
239
        getCoordinatesPanel().getCoordinatesReales().getValue12().equals("") ||
240
        getCoordinatesPanel().getCoordinatesReales().getValue21().equals("") ||
241
        getCoordinatesPanel().getCoordinatesReales().getValue22().equals(""))
234 242
      return false;
235 243
    return true;
236 244
  }
......
285 293

  
286 294
          //Comprobamos si la selecci?n est? fuera del ?rea
287 295
          if(isOutside(ulPx, lrPx)) {
288
            cuttingPanel.setCoorPixelFromDouble(0, 0, 0, 0, 0);
289
            cuttingPanel.setWidthText(0, 0);
290
            cuttingPanel.setHeightText(0, 0);
291
            cuttingPanel.setCellSizeText(0, 0);
292
            cuttingPanel.setRelWidthHeight(0);
293
            cuttingPanel.setCoorRealFromDouble(0, 0, 0, 0, 0);
296
          	getCuttingPanel().setCoorPixelFromDouble(0, 0, 0, 0, 0);
297
          	getCuttingPanel().setWidthText(0, 0);
298
          	getCuttingPanel().setHeightText(0, 0);
299
          	getCuttingPanel().setCellSizeText(0, 0);
300
          	getCuttingPanel().setRelWidthHeight(0);
301
          	getCuttingPanel().setCoorRealFromDouble(0, 0, 0, 0, 0);
294 302
            return;
295 303
          }
296 304

  
......
317 325
          at.transform(ulPx, ulWc);
318 326
          at.transform(new Point2D.Double(lrPx.getX(), lrPx.getY()), lrWc);
319 327

  
320
          cuttingPanel.setCoorRealFromDouble(ulWc.getX(), ulWc.getY(), lrWc.getX(), lrWc.getY(), 3);
321
          cuttingPanel.setCoorPixelFromDouble(ulPx.getX(), ulPx.getY(), lrPx.getX(), lrPx.getY(), 3);
322
          cuttingPanel.setWidthText(Math.abs(ulPx.getX() - lrPx.getX()), 0);
323
          cuttingPanel.setHeightText(Math.abs(ulPx.getY() - lrPx.getY()), 0);
324
          cuttingPanel.setCellSizeText((Math.abs(lrWc.getX() - ulWc.getX()) / dim.getX()), 4);
325
          cuttingPanel.setRelWidthHeight((double) (Math.abs(ulPx.getX() - lrPx.getX()) / Math.abs(ulPx.getY() - lrPx.getY())));
328
          getCuttingPanel().setCoorRealFromDouble(ulWc.getX(), ulWc.getY(), lrWc.getX(), lrWc.getY(), 3);
329
          getCuttingPanel().setCoorPixelFromDouble(ulPx.getX(), ulPx.getY(), lrPx.getX(), lrPx.getY(), 3);
330
          getCuttingPanel().setWidthText(Math.abs(ulPx.getX() - lrPx.getX()), 0);
331
          getCuttingPanel().setHeightText(Math.abs(ulPx.getY() - lrPx.getY()), 0);
332
          getCuttingPanel().setCellSizeText((Math.abs(lrWc.getX() - ulWc.getX()) / dim.getX()), 4);
333
          getCuttingPanel().setRelWidthHeight((double) (Math.abs(ulPx.getX() - lrPx.getX()) / Math.abs(ulPx.getY() - lrPx.getY())));
326 334
        } else {
327 335
          Extent mapWindow = getMapWindow();
328 336
          if (mapWindow == null)
......
343 351
          Point2D dim = new Point2D.Double(this.dim.width, this.dim.height);
344 352

  
345 353
          //Comprobamos si la selecci?n est? fuera del ?rea
346
          if(isOutside(ulPx, lrPx)) {
347
            cuttingPanel.setCoorPixelFromDouble(0, 0, 0, 0, 0);
348
            cuttingPanel.setWidthText(0, 0);
349
            cuttingPanel.setHeightText(0, 0);
350
            cuttingPanel.setCellSizeText(0, 0);
351
            cuttingPanel.setRelWidthHeight(0);
352
            cuttingPanel.setCoorRealFromDouble(0, 0, 0, 0, 0);
353
            return;
354
          }
355
          //Ajustamos los puntos al ?rea en pixeles del raster
354
          if (isOutside(ulPx, lrPx)) {
355
						getCuttingPanel().setCoorPixelFromDouble(0, 0, 0, 0, 0);
356
						getCuttingPanel().setWidthText(0, 0);
357
						getCuttingPanel().setHeightText(0, 0);
358
						getCuttingPanel().setCellSizeText(0, 0);
359
						getCuttingPanel().setRelWidthHeight(0);
360
						getCuttingPanel().setCoorRealFromDouble(0, 0, 0, 0, 0);
361
						return;
362
					}
363
          // Ajustamos los puntos al ?rea en pixeles del raster
356 364
          RasterUtilities.adjustToPixelSize(pointList, dim);
357 365

  
358 366
          double minX = Math.min(ulPx.getX(), lrPx.getX());
......
366 374
          at.transform(new Point2D.Double(minX, minY), ulWc);
367 375
          at.transform(new Point2D.Double(maxX, maxY), lrWc);
368 376

  
369
          cuttingPanel.setCoorRealFromDouble(ulWc.getX(), ulWc.getY(), lrWc.getX(), lrWc.getY(), 3);
370
          cuttingPanel.setCoorPixelFromDouble(minX, minY, maxX, maxY, 3);
371
          cuttingPanel.setWidthText(Math.abs(ulPx.getX() - lrPx.getX()), 0);
372
          cuttingPanel.setHeightText(Math.abs(ulPx.getY() - lrPx.getY()), 0);
373
          cuttingPanel.setCellSizeText(((maxX - minX) / dim.getX()), 4);
374
          cuttingPanel.setRelWidthHeight((double) (Math.abs(ulPx.getX() - lrPx.getX()) / Math.abs(ulPx.getY() - lrPx.getY())));
377
					getCuttingPanel().setCoorRealFromDouble(ulWc.getX(), ulWc.getY(), lrWc.getX(), lrWc.getY(), 3);
378
					getCuttingPanel().setCoorPixelFromDouble(minX, minY, maxX, maxY, 3);
379
					getCuttingPanel().setWidthText(Math.abs(ulPx.getX() - lrPx.getX()), 0);
380
					getCuttingPanel().setHeightText(Math.abs(ulPx.getY() - lrPx.getY()), 0);
381
					getCuttingPanel().setCellSizeText(((maxX - minX) / dim.getX()), 4);
382
					getCuttingPanel().setRelWidthHeight((double) (Math.abs(ulPx.getX() - lrPx.getX()) / Math.abs(ulPx.getY() - lrPx.getY())));
375 383
        }
376 384
      } catch (NumberFormatException ex) {
377 385
        return;
......
440 448
    // Bot?n de Aplicar
441 449
    if (e.getButton() == ButtonsPanel.BUTTON_APPLY) {
442 450
      accept();
443
      getCuttingPanel().setNewLayerText();
451
      getCuttingPanel().getOptionsPanel().setNewLayerText();
444 452
    }
445 453

  
446 454
    // Bot?n de Cerrar
......
471 479
  private CuttingPanel getCuttingPanel() {
472 480
    return cuttingPanel;
473 481
  }
482
  
483
  private CuttingCoordinatesPanel getCoordinatesPanel() {
484
		return getCuttingPanel().getCoordinatesPanel();
485
	}
486
	
487
	private CuttingResolutionPanel getResolutionPanel() {
488
		return getCuttingPanel().getResolutionPanel();
489
	}
490
	
491
	private CuttingOptionsPanel getOptionsPanel() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff