Revision 19361
trunk/extensions/extRasterTools-SE/src-test-ui/org/gvsig/rastertools/enhanced/graphics/panels/EcualizationHistogramListener.java | ||
---|---|---|
58 | 58 |
public void actionPerformed(ActionEvent e) { |
59 | 59 |
if(e.getSource() == panel.getMinValue()) { |
60 | 60 |
try { |
61 |
panel.getMinMaxLines().setMin(Double.valueOf(panel.getMinValue().getText()).doubleValue()); |
|
61 |
// panel.getMinMaxLines().setMin(Double.valueOf(panel.getMinValue().getText()).doubleValue());
|
|
62 | 62 |
}catch (NumberFormatException ex) { |
63 | 63 |
|
64 | 64 |
} |
... | ... | |
66 | 66 |
|
67 | 67 |
if(e.getSource() == panel.getMaxValue()) { |
68 | 68 |
try { |
69 |
panel.getMinMaxLines().setMax(Double.valueOf(panel.getMaxValue().getText()).doubleValue()); |
|
69 |
// panel.getMinMaxLines().setMax(Double.valueOf(panel.getMaxValue().getText()).doubleValue());
|
|
70 | 70 |
}catch (NumberFormatException ex) { |
71 | 71 |
|
72 | 72 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/DrawableElement.java | ||
---|---|---|
22 | 22 |
import java.awt.Graphics; |
23 | 23 |
import java.awt.event.MouseEvent; |
24 | 24 |
|
25 |
import org.gvsig.raster.IProcessActions; |
|
26 | 25 |
|
27 |
|
|
28 | 26 |
/** |
29 | 27 |
* Clase base para los gr?ficos a dibujar sobre el canvas |
30 | 28 |
* |
... | ... | |
39 | 37 |
*/ |
40 | 38 |
protected GCanvas canvas = null; |
41 | 39 |
private boolean firstDraw = true; |
42 |
protected IProcessActions actionsManager = null; |
|
43 | 40 |
|
44 | 41 |
/** |
45 | 42 |
* Dibujado del elemento gr?fico desde el GCanvas. Llamar? antes de dibujar a la funci?n firstDrawActions |
... | ... | |
78 | 75 |
public void setColor(Color c) { |
79 | 76 |
this.color = c; |
80 | 77 |
} |
81 |
|
|
78 |
|
|
82 | 79 |
/** |
83 |
* Asigna el gestor de acciones |
|
84 |
* @param actionsManager |
|
85 |
*/ |
|
86 |
public void setActionManager(IProcessActions actionsManager) { |
|
87 |
this.actionsManager = actionsManager; |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 | 80 |
* Metodo que se ejecuta cuando se suelta el raton en el canvas |
92 | 81 |
* @param e |
93 | 82 |
* @return Si no se desea propagar el evento a otros drawables, devolver false. |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/StraightLine.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package org.gvsig.raster.beans.canvas.layers; |
20 | 20 |
|
21 |
import java.awt.BasicStroke; |
|
22 | 21 |
import java.awt.Color; |
23 | 22 |
import java.awt.Cursor; |
24 | 23 |
import java.awt.Graphics; |
25 |
import java.awt.Graphics2D;
|
|
24 |
import java.awt.Image;
|
|
26 | 25 |
import java.awt.Point; |
27 |
import java.awt.Stroke;
|
|
26 |
import java.awt.Toolkit;
|
|
28 | 27 |
import java.awt.event.MouseEvent; |
28 |
import java.awt.image.MemoryImageSource; |
|
29 | 29 |
import java.util.ArrayList; |
30 | 30 |
|
31 | 31 |
import org.gvsig.raster.beans.canvas.DrawableElement; |
... | ... | |
115 | 115 |
g.setColor(color); |
116 | 116 |
g.drawRect((int) valueToPixelX(x) - (width >> 1), (int) valueToPixelY(y) - (width >> 1), (int) width, (int)width); |
117 | 117 |
} |
118 |
|
|
119 |
/** |
|
120 |
* Dibuja el cursor del raton |
|
121 |
* @param g |
|
122 |
*/ |
|
123 |
protected void paintCursor(Graphics g) { |
|
124 |
g.setColor(Color.white); |
|
125 |
g.drawLine(valueToPixelX(x) - 6, valueToPixelY(y), valueToPixelX(x) + 6, valueToPixelY(y)); |
|
126 |
g.drawLine(valueToPixelX(x), valueToPixelY(y) - 6, valueToPixelX(x), valueToPixelY(y) + 6); |
|
127 |
} |
|
118 | 128 |
|
119 | 129 |
/** |
120 | 130 |
* Informa de si el punto pasado por par?metro cae dentro del cuadro o no |
... | ... | |
162 | 172 |
/** |
163 | 173 |
* Lista de cuadrados que intersectan con la recta |
164 | 174 |
*/ |
165 |
private ArrayList listSquare = new ArrayList(); |
|
166 |
private int pointDragged = -1; |
|
175 |
private ArrayList listSquare = new ArrayList(); |
|
176 |
private int pointDragged = -1; |
|
177 |
Cursor transparentCursor = null; |
|
167 | 178 |
|
168 | 179 |
/** |
169 | 180 |
* Constructor. Asigna el color |
170 | 181 |
* @param c |
171 | 182 |
*/ |
172 | 183 |
public StraightLine(Color c) { |
184 |
int[] pixels = new int[16 * 16]; |
|
185 |
Image image = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(16, 16, pixels, 0, 16)); |
|
186 |
transparentCursor = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0, 0), "invisibleCursor"); |
|
187 |
|
|
173 | 188 |
setColor(c); |
174 | 189 |
listSquare.add(new Square(0.0D, 0.0D)); |
175 | 190 |
listSquare.add(new Square(1.0D, 1.0D)); |
... | ... | |
191 | 206 |
// Dibujamos una l?nea desde un punto hasta el siguiente |
192 | 207 |
Square square = null; |
193 | 208 |
Square lastSquare = null; |
194 |
|
|
195 | 209 |
for (int i = 0; i < listSquare.size(); i++) { |
196 | 210 |
lastSquare = square; |
197 | 211 |
square = ((Square) listSquare.get(i)); |
212 |
if (lastSquare != null) |
|
213 |
g.drawLine(lastSquare.getPixelX(), lastSquare.getPixelY(), square.getPixelX(), square.getPixelY()); |
|
214 |
} |
|
215 |
|
|
216 |
// Dibujamos los cuadrados de los puntos |
|
217 |
for (int i = 0; i < listSquare.size(); i++) { |
|
218 |
square = ((Square) listSquare.get(i)); |
|
198 | 219 |
square.setColor(color); |
199 |
// if (canvas.isMouse()) |
|
200 | 220 |
if (pointDragged != i) |
201 | 221 |
square.paint(g); |
202 |
|
|
203 |
if (lastSquare != null) |
|
204 |
g.drawLine(lastSquare.getPixelX(), lastSquare.getPixelY(), square.getPixelX(), square.getPixelY()); |
|
222 |
else |
|
223 |
square.paintCursor(g); |
|
205 | 224 |
} |
206 | 225 |
} |
207 | 226 |
|
... | ... | |
273 | 292 |
public boolean mouseReleased(MouseEvent e) { |
274 | 293 |
pointDragged = -1; |
275 | 294 |
canvas.repaint(); |
295 |
canvas.callDataChanged("line", this); |
|
276 | 296 |
return true; |
277 | 297 |
} |
278 | 298 |
|
... | ... | |
281 | 301 |
*/ |
282 | 302 |
public boolean mouseDragged(MouseEvent e) { |
283 | 303 |
if (pointDragged >= 0) { |
284 |
canvas.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
|
304 |
canvas.setCursor(transparentCursor);
|
|
285 | 305 |
int minX = canvas.getCanvasMinX(); |
286 | 306 |
int minY = canvas.getCanvasMinY(); |
287 | 307 |
int maxX = canvas.getCanvasMaxX(); |
... | ... | |
335 | 355 |
} finally { |
336 | 356 |
// Siempre repintamos |
337 | 357 |
canvas.repaint(); |
358 |
canvas.callDataDragged("line", this); |
|
338 | 359 |
} |
339 | 360 |
return false; |
340 | 361 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/MinMaxLines.java | ||
---|---|---|
35 | 35 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
36 | 36 |
*/ |
37 | 37 |
public class MinMaxLines extends DrawableElement { |
38 |
private int smallLine = 5; |
|
39 |
|
|
40 | 38 |
/** |
41 |
* Representa el borde de separacion para los limites
|
|
39 |
* Representa el borde de separacion para los limites |
|
42 | 40 |
*/ |
43 |
private int border = 2; |
|
44 |
|
|
45 |
private double minPos = 0.0D; |
|
46 |
private double maxPos = 1.0D; |
|
41 |
private int border = 2; |
|
47 | 42 |
|
43 |
private double minPos = 0.0D; |
|
44 |
private double maxPos = 1.0D; |
|
45 |
|
|
48 | 46 |
private boolean minSelected = false; |
49 | 47 |
private boolean maxSelected = false; |
50 | 48 |
/** |
... | ... | |
120 | 118 |
* Inicializamos el punto arrastrado a un valor fuera del array |
121 | 119 |
*/ |
122 | 120 |
public boolean mouseReleased(MouseEvent e) { |
123 |
if (actionsManager != null && (minSelected != false || maxSelected != false ))
|
|
124 |
actionsManager.end(new double[] { getMinDistance(), getMaxDistance() });
|
|
121 |
if (canvas != null && (minSelected != false || maxSelected != false ))
|
|
122 |
canvas.callDataChanged("minmax", this);
|
|
125 | 123 |
minSelected = false; |
126 | 124 |
maxSelected = false; |
127 | 125 |
return true; |
... | ... | |
131 | 129 |
* Cuando se ha pinchado un punto y se arrastra se define aqu? su comportamiento. |
132 | 130 |
*/ |
133 | 131 |
public boolean mouseDragged(MouseEvent e) { |
132 |
if (canvas == null) |
|
133 |
return true; |
|
134 |
|
|
134 | 135 |
if (minSelected) { |
135 | 136 |
minPos = pixelToValue(e.getX()); |
136 | 137 |
if (minPos < 0) |
... | ... | |
140 | 141 |
if (minPos > maxPos) |
141 | 142 |
maxPos = minPos; |
142 | 143 |
canvas.repaint(); |
144 |
canvas.callDataDragged("minmax", this); |
|
143 | 145 |
return false; |
144 | 146 |
} |
145 | 147 |
if (maxSelected) { |
... | ... | |
151 | 153 |
if (maxPos < minPos) |
152 | 154 |
minPos = maxPos; |
153 | 155 |
canvas.repaint(); |
156 |
canvas.callDataDragged("minmax", this); |
|
154 | 157 |
return false; |
155 | 158 |
} |
156 | 159 |
return true; |
... | ... | |
195 | 198 |
public double getMaxDistance() { |
196 | 199 |
return maxPos * 100.0D; |
197 | 200 |
} |
198 |
|
|
199 |
public void setMax(double max) { |
|
200 |
//maxDistance = max |
|
201 |
} |
|
202 |
|
|
203 |
public void setMin(double min) { |
|
204 |
double value = (min * canvas.getCanvasWidth()) / 100; |
|
205 |
|
|
206 |
} |
|
207 |
} |
|
201 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/IGCanvasListener.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 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.beans.canvas; |
|
20 |
|
|
21 |
import java.util.EventListener; |
|
22 |
/** |
|
23 |
* Listener que deben implementar las clases que quieran recibir cambios |
|
24 |
* del GCanvas. |
|
25 |
* |
|
26 |
* @version 28/02/2008 |
|
27 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
28 |
*/ |
|
29 |
public interface IGCanvasListener extends EventListener { |
|
30 |
/** |
|
31 |
* Evento que se dispara cuando el GCanvas cambia el valor de alg?n elemento |
|
32 |
* @param e |
|
33 |
*/ |
|
34 |
public void actionDataChanged(GCanvasEvent e); |
|
35 |
|
|
36 |
/** |
|
37 |
* Evento que se dispara mientras se esta produciendo la acci?n |
|
38 |
* @param e |
|
39 |
*/ |
|
40 |
public void actionDataDragged(GCanvasEvent e); |
|
41 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/GCanvas.java | ||
---|---|---|
21 | 21 |
import java.awt.Color; |
22 | 22 |
import java.awt.Cursor; |
23 | 23 |
import java.awt.Graphics; |
24 |
import java.awt.Graphics2D; |
|
25 |
import java.awt.RenderingHints; |
|
26 | 24 |
import java.awt.event.MouseEvent; |
27 | 25 |
import java.awt.event.MouseListener; |
28 | 26 |
import java.awt.event.MouseMotionListener; |
29 | 27 |
import java.util.ArrayList; |
28 |
import java.util.Iterator; |
|
30 | 29 |
|
31 | 30 |
import javax.swing.JPanel; |
32 | 31 |
/** |
... | ... | |
47 | 46 |
private int y = -1; |
48 | 47 |
private int w = -1; |
49 | 48 |
private int h = -1; |
49 |
|
|
50 |
private ArrayList actionCommandListeners = new ArrayList(); |
|
50 | 51 |
|
51 | 52 |
/** |
52 | 53 |
* Contructor.Inicializa el objeto asignando color de fondo. Considera que el objeto |
... | ... | |
61 | 62 |
} |
62 | 63 |
|
63 | 64 |
/** |
65 |
* A?adir un listener a la lista de eventos |
|
66 |
* @param listener |
|
67 |
*/ |
|
68 |
public void addValueChangedListener(IGCanvasListener listener) { |
|
69 |
if (!actionCommandListeners.contains(listener)) |
|
70 |
actionCommandListeners.add(listener); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Borrar un listener de la lista de eventos |
|
75 |
* @param listener |
|
76 |
*/ |
|
77 |
public void removeValueChangedListener(IGCanvasListener listener) { |
|
78 |
actionCommandListeners.remove(listener); |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* Invocar a los eventos asociados al componente |
|
83 |
*/ |
|
84 |
public void callDataChanged(String key, Object value) { |
|
85 |
Iterator iterator = actionCommandListeners.iterator(); |
|
86 |
while (iterator.hasNext()) { |
|
87 |
IGCanvasListener listener = (IGCanvasListener) iterator.next(); |
|
88 |
listener.actionDataChanged(new GCanvasEvent(this, key, value)); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* Invocar a los eventos asociados al componente |
|
94 |
*/ |
|
95 |
public void callDataDragged(String key, Object value) { |
|
96 |
Iterator iterator = actionCommandListeners.iterator(); |
|
97 |
while (iterator.hasNext()) { |
|
98 |
IGCanvasListener listener = (IGCanvasListener) iterator.next(); |
|
99 |
listener.actionDataDragged(new GCanvasEvent(this, key, value)); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
/** |
|
64 | 104 |
* Asigna un elemento dibujable a la lista |
65 | 105 |
* @param element |
66 | 106 |
*/ |
... | ... | |
81 | 121 |
* Inicializa el fondo y dibuja el gr?fico sobre el canvas. |
82 | 122 |
*/ |
83 | 123 |
public void paint(Graphics g) { |
84 |
Graphics2D g2 = (Graphics2D) g; |
|
85 |
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
86 |
hints.add(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY)); |
|
87 |
g2.setRenderingHints(hints); |
|
88 |
|
|
89 | 124 |
g.setColor(backgroundColor); |
90 | 125 |
g.fillRect(getVisibleRect().x, getVisibleRect().y, getVisibleRect().width, getVisibleRect().height); |
91 | 126 |
for (int i = 0; i < drawableElements.size(); i++) |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/GCanvasEvent.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 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.beans.canvas; |
|
20 |
|
|
21 |
import java.util.EventObject; |
|
22 |
/** |
|
23 |
* Clase que contiene la informaci?n que se produce al dispararse un evento |
|
24 |
* en el GCanvas |
|
25 |
* |
|
26 |
* @version 28/02/2008 |
|
27 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
28 |
*/ |
|
29 |
public class GCanvasEvent extends EventObject { |
|
30 |
private static final long serialVersionUID = 1654248992170060578L; |
|
31 |
private String key; |
|
32 |
private Object value; |
|
33 |
|
|
34 |
public GCanvasEvent(Object source, String key, Object value) { |
|
35 |
super(source); |
|
36 |
this.key = key; |
|
37 |
this.value = value; |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* @return the key |
|
42 |
*/ |
|
43 |
public String getKey() { |
|
44 |
return key; |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* @return the value |
|
49 |
*/ |
|
50 |
public Object getValue() { |
|
51 |
return value; |
|
52 |
} |
|
53 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/enhanced/ui/EnhancedListener.java | ||
---|---|---|
22 | 22 |
import java.awt.event.ActionListener; |
23 | 23 |
|
24 | 24 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
25 |
import org.gvsig.raster.IProcessActions; |
|
25 |
import org.gvsig.raster.beans.canvas.GCanvasEvent; |
|
26 |
import org.gvsig.raster.beans.canvas.IGCanvasListener; |
|
26 | 27 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
28 |
import org.gvsig.raster.beans.canvas.layers.MinMaxLines; |
|
27 | 29 |
import org.gvsig.raster.beans.previewbase.PreviewBasePanel; |
28 | 30 |
import org.gvsig.raster.beans.previewbase.PreviewFiltering; |
29 | 31 |
import org.gvsig.raster.dataset.Params; |
... | ... | |
36 | 38 |
* 21/02/2008 |
37 | 39 |
* @author Nacho Brodin nachobrodin@gmail.com |
38 | 40 |
*/ |
39 |
public class EnhancedListener implements ActionListener, IProcessActions {
|
|
41 |
public class EnhancedListener implements ActionListener, IGCanvasListener {
|
|
40 | 42 |
private SelectorsPanel selector = null; |
41 | 43 |
private GraphicsPanel graphic = null; |
42 | 44 |
private PreviewBasePanel enhancedPanel = null; |
... | ... | |
170 | 172 |
} |
171 | 173 |
} |
172 | 174 |
|
173 |
/**
|
|
174 |
* Gesti?n de los eventos de los objetos gr?ficos.
|
|
175 |
* @param param
|
|
175 |
/* |
|
176 |
* (non-Javadoc)
|
|
177 |
* @see org.gvsig.raster.beans.canvas.IGCanvasListener#actionDataChanged(org.gvsig.raster.beans.canvas.GCanvasEvent)
|
|
176 | 178 |
*/ |
177 |
public void end(Object param) { |
|
178 |
//MixMaxLines |
|
179 |
if(param instanceof double[]) { |
|
180 |
System.out.println(((double[])param)[0] + " " + ((double[])param)[1]); |
|
179 |
public void actionDataChanged(GCanvasEvent e) { |
|
180 |
if (e.getKey().equals("minmax")) { |
|
181 |
MinMaxLines lines = (MinMaxLines) e.getValue(); |
|
182 |
System.out.println("Parado: " + lines.getMinDistance() + " " + lines.getMaxDistance()); |
|
183 |
return; |
|
181 | 184 |
} |
185 |
if (e.getKey().equals("line")) { |
|
186 |
System.out.println("Linea parada"); |
|
187 |
return; |
|
188 |
} |
|
182 | 189 |
} |
183 | 190 |
|
184 |
public void interrupted() { |
|
191 |
/* |
|
192 |
* (non-Javadoc) |
|
193 |
* @see org.gvsig.raster.beans.canvas.IGCanvasListener#actionDataDragged(org.gvsig.raster.beans.canvas.GCanvasEvent) |
|
194 |
*/ |
|
195 |
public void actionDataDragged(GCanvasEvent e) { |
|
196 |
if (e.getKey().equals("minmax")) { |
|
197 |
MinMaxLines lines = (MinMaxLines) e.getValue(); |
|
198 |
System.out.println("Moviendo: " + lines.getMinDistance() + " " + lines.getMaxDistance()); |
|
199 |
return; |
|
200 |
} |
|
201 |
if (e.getKey().equals("line")) { |
|
202 |
System.out.println("Moviendo linea"); |
|
203 |
return; |
|
204 |
} |
|
185 | 205 |
} |
186 |
|
|
187 |
} |
|
206 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/enhanced/graphics/InputHistogram.java | ||
---|---|---|
23 | 23 |
import java.awt.GridBagConstraints; |
24 | 24 |
import java.awt.GridBagLayout; |
25 | 25 |
|
26 |
import javax.swing.JLabel; |
|
27 | 26 |
import javax.swing.JPanel; |
28 | 27 |
|
29 | 28 |
import org.gvsig.raster.beans.canvas.DrawableElement; |
... | ... | |
34 | 33 |
import org.gvsig.raster.beans.canvas.layers.StraightLine; |
35 | 34 |
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation; |
36 | 35 |
import org.gvsig.raster.datastruct.Histogram; |
37 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
38 | 36 |
import org.gvsig.rastertools.enhanced.ui.EnhancedListener; |
39 |
|
|
40 | 37 |
/** |
41 | 38 |
* Componente con el histograma de entrada. |
42 | 39 |
* |
... | ... | |
44 | 41 |
* @author Nacho Brodin nachobrodin@gmail.com |
45 | 42 |
*/ |
46 | 43 |
public class InputHistogram extends HistogramGraphicBase { |
47 |
private static final long serialVersionUID = 1L; |
|
48 |
|
|
44 |
private static final long serialVersionUID = 681848373747974757L; |
|
49 | 45 |
private MinMaxLines minMaxLines = null; |
50 | 46 |
private Color minmaxColor = Color.WHITE; |
51 | 47 |
private DrawableElement dElement = null; |
... | ... | |
66 | 62 |
|
67 | 63 |
dElement = new StraightLine(Color.YELLOW); |
68 | 64 |
this.setLayout(new BorderLayout()); |
69 |
this.add(getNorthPanel(), BorderLayout.NORTH); |
|
70 | 65 |
this.add(getCanvas(), BorderLayout.CENTER); |
71 | 66 |
this.add(getSouthPanel(), BorderLayout.SOUTH); |
72 | 67 |
} |
73 | 68 |
|
74 | 69 |
/* |
75 | 70 |
* (non-Javadoc) |
76 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getNorthPanel() |
|
77 |
*/ |
|
78 |
public JPanel getNorthPanel() { |
|
79 |
if(north == null) { |
|
80 |
north = new JPanel(); |
|
81 |
north.setLayout(new BorderLayout()); |
|
82 |
north.add(getSlider(), BorderLayout.CENTER); |
|
83 |
north.add(new JLabel(RasterToolsUtil.getText(null, "input_hist")), BorderLayout.NORTH); |
|
84 |
} |
|
85 |
return north; |
|
86 |
} |
|
87 |
|
|
88 |
/* |
|
89 |
* (non-Javadoc) |
|
90 | 71 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getSouthPanel() |
91 | 72 |
*/ |
92 | 73 |
public JPanel getSouthPanel() { |
... | ... | |
130 | 111 |
* @param listener |
131 | 112 |
*/ |
132 | 113 |
public void setListener(EnhancedListener listener) { |
133 |
getCanvas(); |
|
134 |
minMaxLines.setActionManager(listener); |
|
114 |
getCanvas().addValueChangedListener(listener); |
|
135 | 115 |
} |
136 |
} |
|
116 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/enhanced/graphics/OutputHistogram.java | ||
---|---|---|
23 | 23 |
import java.awt.GridBagConstraints; |
24 | 24 |
import java.awt.GridBagLayout; |
25 | 25 |
|
26 |
import javax.swing.JLabel; |
|
27 | 26 |
import javax.swing.JPanel; |
28 | 27 |
|
29 | 28 |
import org.gvsig.raster.beans.canvas.GCanvas; |
... | ... | |
31 | 30 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
32 | 31 |
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation; |
33 | 32 |
import org.gvsig.raster.datastruct.Histogram; |
34 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
35 |
|
|
36 | 33 |
/** |
37 | 34 |
* Componente con el histograma de salida. |
38 | 35 |
* |
... | ... | |
57 | 54 |
super.init(); |
58 | 55 |
histogramColor = Color.GREEN; |
59 | 56 |
this.setLayout(new BorderLayout()); |
60 |
this.add(getNorthPanel(), BorderLayout.NORTH); |
|
61 | 57 |
this.add(getCanvas(), BorderLayout.CENTER); |
62 | 58 |
this.add(getSouthPanel(), BorderLayout.SOUTH); |
63 | 59 |
} |
... | ... | |
74 | 70 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getCanvas() |
75 | 71 |
*/ |
76 | 72 |
public GCanvas getCanvas() { |
77 |
if(canvas == null) { |
|
73 |
if (canvas == null) {
|
|
78 | 74 |
GraphicHistogram gHist = new GraphicHistogram(histogramDrawed, histogramColor); |
79 | 75 |
gHist.setType(GraphicHistogram.TYPE_LINE); |
80 |
|
|
76 |
|
|
81 | 77 |
canvas = new GCanvas(Color.BLACK); |
82 | 78 |
canvas.setDrawableElement(new Border(borderColor)); |
83 |
canvas.setDrawableElement(gHist);
|
|
79 |
canvas.setDrawableElement(gHist); |
|
84 | 80 |
} |
85 | 81 |
return canvas; |
86 | 82 |
} |
87 | 83 |
|
88 | 84 |
/* |
89 | 85 |
* (non-Javadoc) |
90 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getNorthPanel() |
|
91 |
*/ |
|
92 |
public JPanel getNorthPanel() { |
|
93 |
if(north == null) { |
|
94 |
north = new JPanel(); |
|
95 |
north.setLayout(new BorderLayout()); |
|
96 |
north.add(getSlider(), BorderLayout.CENTER); |
|
97 |
north.add(new JLabel(RasterToolsUtil.getText(null, "output_hist")), BorderLayout.NORTH); |
|
98 |
} |
|
99 |
return north; |
|
100 |
} |
|
101 |
|
|
102 |
/* |
|
103 |
* (non-Javadoc) |
|
104 | 86 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getSouthPanel() |
105 | 87 |
*/ |
106 | 88 |
public JPanel getSouthPanel() { |
... | ... | |
118 | 100 |
} |
119 | 101 |
return south; |
120 | 102 |
} |
121 |
|
|
122 |
} |
|
103 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/enhanced/graphics/HistogramGraphicBase.java | ||
---|---|---|
276 | 276 |
histogramGray[i] = (double)table[0][i]; |
277 | 277 |
setHistogramDrawed(GRAY); |
278 | 278 |
} |
279 |
|
|
280 | 279 |
} |
281 |
|
|
282 |
/** |
|
283 |
* Obtiene el panel con los combos de selecci?n de gr?fico y bandas |
|
284 |
* @return JPanel |
|
285 |
*/ |
|
286 |
public abstract JPanel getNorthPanel(); |
|
287 | 280 |
|
288 | 281 |
/** |
289 | 282 |
* Obtiene el panel con las entradas de texto para los valores |
Also available in: Unified diff