Revision 22741

View differences:

trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/stretch/StretchData.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.rastertools.vectorizacion.stretch;
20

  
21
import java.util.Observable;
22

  
23
/**
24
 * Modelo de datos para la selecci?n de tramos
25
 * 
26
 * 05/08/2008
27
 * @author Nacho Brodin nachobrodin@gmail.com
28
 */
29
public class StretchData extends Observable {
30

  
31
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/stretch/ui/StretchPanel.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.rastertools.vectorizacion.stretch.ui;
20

  
21
import java.awt.Color;
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.util.Observable;
29
import java.util.Observer;
30

  
31
import javax.swing.JList;
32
import javax.swing.JPanel;
33

  
34
import org.gvsig.raster.beans.canvas.DrawableElement;
35
import org.gvsig.raster.beans.canvas.GCanvas;
36
import org.gvsig.raster.beans.canvas.GCanvasEvent;
37
import org.gvsig.raster.beans.canvas.IGCanvasListener;
38
import org.gvsig.raster.beans.canvas.layers.Border;
39
import org.gvsig.raster.beans.previewbase.IUserPanelInterface;
40
import org.gvsig.raster.beans.stretchselector.StretchSelectorPanel;
41
import org.gvsig.raster.util.BasePanel;
42
import org.gvsig.raster.util.RasterToolsUtil;
43
import org.gvsig.rastertools.vectorizacion.stretch.StretchData;
44

  
45
/**
46
 * Panel con los controles de creaci?n de tramos con distancia variable.
47
 * 
48
 * 09/06/2008
49
 * @author Nacho Brodin nachobrodin@gmail.com
50
 */
51
public class StretchPanel extends BasePanel implements ActionListener, IUserPanelInterface, Observer, IGCanvasListener {
52
	private static final long             serialVersionUID       = 1L;
53
	private StretchSelectorPanel          stretchSelectorPanel   = null;
54
	private GCanvas                       canvas                 = null;
55
	private JList                         list                   = null;
56
	
57
	/**
58
	 *Inicializa componentes gr?ficos y traduce
59
	 */
60
	public StretchPanel() {
61
		init();
62
		translate();
63
	}
64
	
65
	/*
66
	 * (non-Javadoc)
67
	 * @see org.gvsig.raster.util.BasePanel#translate()
68
	 */
69
	protected void translate() {
70
		//getRealCoordinates().setTitlePanel(getText(this, "coordenadas_reales"));
71
		//getPixelCoordinates().setTitlePanel(getText(this, "coordenadas_pixel"));
72
	}
73
	
74
	/**
75
	 * Inicializaci?n de los componentes gr?ficos
76
	 */
77
	protected void init() {
78
		setLayout(new GridBagLayout());
79

  
80
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
81
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
82
		gridBagConstraints.gridwidth = 2;
83
		gridBagConstraints.weightx = 1.0;
84
		
85
		add(getStretchSelectorPanel(), gridBagConstraints);
86
		
87
		gridBagConstraints.weighty = 1.0;
88
		gridBagConstraints.gridwidth = 1;
89
		gridBagConstraints.gridy = 1;
90
		gridBagConstraints.fill = GridBagConstraints.BOTH;
91
		gridBagConstraints.insets = new Insets(5, 5, 5, 5);
92
		add(getCanvas(), gridBagConstraints);
93
		
94
		gridBagConstraints.gridx = 1;
95
		gridBagConstraints.fill = GridBagConstraints.VERTICAL;
96
		add(getList(), gridBagConstraints);	
97
	}
98
	
99
	/**
100
	 * Construye el gr?fico con las capas para mover las
101
	 * l?neas.
102
	 * @return
103
	 */
104
	public GCanvas getCanvas() {
105
		if(canvas == null) {
106
			canvas = new GCanvas(Color.BLACK);
107
			DrawableElement border = new Border(Color.WHITE);
108
			canvas.addDrawableElement(border);
109
			//canvas.addDrawableElement(gHistR);
110
			//canvas.addDrawableElement(minMaxLines);
111
			canvas.addValueChangedListener(this);
112
		}
113
		return canvas;
114
	}
115
	
116
	/**
117
	 * Obtiene el componente con la lista de tramos.
118
	 * @return JList
119
	 */
120
	public JList getList() {
121
		if(list == null) {
122
			list = new JList();
123
			list.setSize(30, 500);
124
		}
125
		return list;
126
	}
127
	
128
	/**
129
	 * Obtiene el panel con el selector de tramos.
130
	 * @return
131
	 */
132
	public StretchSelectorPanel getStretchSelectorPanel() {
133
		if(stretchSelectorPanel == null)
134
			stretchSelectorPanel = new StretchSelectorPanel();
135
		return stretchSelectorPanel;
136
	}
137
		
138
	public void actionPerformed(ActionEvent e) {
139
	}
140

  
141
	/*
142
	 * (non-Javadoc)
143
	 * @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getTitle()
144
	 */
145
	public String getTitle() {
146
		return RasterToolsUtil.getText(this, "stretch");
147
	}
148
	
149
	/**
150
	 * Actualiza los valores de los paneles cuando los datos de ClippingData varian
151
	 * @param o 
152
	 * @param arg
153
	 */
154
	public void update(Observable o, Object arg) {
155
		if(!(o instanceof StretchData))
156
			return;
157
		StretchData data = (StretchData)o;
158
		
159
		setEnableValueChangedEvent(false);
160
		
161
		setEnableValueChangedEvent(true);
162
	}
163

  
164
	/*
165
	 * (non-Javadoc)
166
	 * @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getPanel()
167
	 */
168
	public JPanel getPanel() {
169
		return this;
170
	}
171

  
172
	public void actionDataChanged(GCanvasEvent e) {
173
	}
174

  
175
	public void actionDataDragged(GCanvasEvent e) {
176
	}
177
}

Also available in: Unified diff