Revision 19945
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/functions/ExponentialLine.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.beans.canvas.layers.functions; |
|
20 |
|
|
21 |
import java.awt.Color; |
|
22 |
import java.awt.Graphics; |
|
23 |
|
|
24 |
import org.gvsig.raster.beans.canvas.GCanvas; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* Representa una linea con incremento exponencial. |
|
29 |
* |
|
30 |
* 14-oct-2007 |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public class ExponentialLine extends BaseFunction { |
|
34 |
int[] xPoints = null; |
|
35 |
int[] yPoints = null; |
|
36 |
|
|
37 |
/** |
|
38 |
* Constructor. Asigna el color |
|
39 |
* @param c |
|
40 |
*/ |
|
41 |
public ExponentialLine(Color c) { |
|
42 |
setColor(c); |
|
43 |
} |
|
44 |
|
|
45 |
/* |
|
46 |
* (non-Javadoc) |
|
47 |
* @see org.gvsig.gui.beans.canvas.DrawableElement#firstDraw() |
|
48 |
*/ |
|
49 |
public void firstDrawActions() { |
|
50 |
xPoints = new int[canvas.getCanvasWidth()]; |
|
51 |
yPoints = new int[canvas.getCanvasHeight()]; |
|
52 |
double pos = Math.log(canvas.getCanvasMinY()); |
|
53 |
double max = Math.log(canvas.getCanvasMaxY()); |
|
54 |
double increase = (max - pos) / canvas.getCanvasHeight(); |
|
55 |
for (int i = canvas.getCanvasMinY(); i < canvas.getCanvasMaxY(); i++) { |
|
56 |
try { |
|
57 |
//yPoints[i] = value - (int)(value * Math.exp((double)i / 64) / Math.exp(3)); |
|
58 |
yPoints[i - canvas.getCanvasMinY()] = canvas.getCanvasHeight() - (int)Math.round(Math.exp(pos)); |
|
59 |
xPoints[i - canvas.getCanvasMinX()] = i; |
|
60 |
//System.out.println(xPoints[i] + " " + yPoints[i]); |
|
61 |
//System.out.println(Math.exp((double)i/85)); |
|
62 |
System.out.println(xPoints[i - canvas.getCanvasMinX()] + " : " + pos + " : " + yPoints[i - canvas.getCanvasMinY()]); |
|
63 |
pos += increase; |
|
64 |
} catch(ArrayIndexOutOfBoundsException e) {} |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Dibujado de la l?nea de incremento exponencial sobre el canvas. |
|
70 |
*/ |
|
71 |
protected void paint(Graphics g) { |
|
72 |
super.paint(g); |
|
73 |
g.setColor(color); |
|
74 |
g.drawPolyline(xPoints, yPoints, xPoints.length); |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* Asigna el objeto JComponent donde se pintan los elementos. Inicializa los puntos |
|
79 |
* de inicio y fin de l?nea y asigna los listener |
|
80 |
* @param canvas |
|
81 |
*/ |
|
82 |
public void setCanvas(GCanvas canvas) { |
|
83 |
super.setCanvas(canvas); |
|
84 |
} |
|
85 |
|
|
86 |
public void firstActions() {} |
|
87 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/functions/LogaritmicLine.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.beans.canvas.layers.functions; |
|
20 |
|
|
21 |
import java.awt.Color; |
|
22 |
import java.awt.Graphics; |
|
23 |
|
|
24 |
import org.gvsig.raster.beans.canvas.GCanvas; |
|
25 |
|
|
26 |
/** |
|
27 |
* Representa una linea con incremento logaritmico. |
|
28 |
* |
|
29 |
* 14-oct-2007 |
|
30 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
31 |
*/ |
|
32 |
public class LogaritmicLine extends BaseFunction { |
|
33 |
|
|
34 |
int[] xPoints = null; |
|
35 |
int[] yPoints = null; |
|
36 |
|
|
37 |
/** |
|
38 |
* Constructor. Asigna el color |
|
39 |
* @param c |
|
40 |
*/ |
|
41 |
public LogaritmicLine(Color c) { |
|
42 |
setColor(c); |
|
43 |
} |
|
44 |
|
|
45 |
/* |
|
46 |
* (non-Javadoc) |
|
47 |
* @see org.gvsig.gui.beans.canvas.DrawableElement#firstDraw() |
|
48 |
*/ |
|
49 |
public void firstDrawActions() { |
|
50 |
int value = Math.min(canvas.getCanvasWidth(), canvas.getCanvasHeight()); |
|
51 |
xPoints = new int[value]; |
|
52 |
yPoints = new int[value]; |
|
53 |
int pos = 0; |
|
54 |
for (int i = canvas.getCanvasMinY(); i < canvas.getCanvasMaxY(); i++) { |
|
55 |
yPoints[pos] = value - (int)(value * Math.log(1 + pos) / Math.log(value + 1)); |
|
56 |
xPoints[pos] = i; |
|
57 |
//System.out.println(xPoints[pos] + " " + yPoints[pos]); |
|
58 |
pos ++; |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Dibujado de las l?nea de incremento logaritmico sobre el canvas |
|
64 |
*/ |
|
65 |
protected void paint(Graphics g) { |
|
66 |
super.paint(g); |
|
67 |
g.setColor(color); |
|
68 |
g.drawPolyline(xPoints, yPoints, xPoints.length); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* Asigna el objeto JComponent donde se pintan los elementos. Inicializa los puntos |
|
73 |
* de inicio y fin de l?nea y asigna los listener |
|
74 |
* @param canvas |
|
75 |
*/ |
|
76 |
public void setCanvas(GCanvas canvas) { |
|
77 |
super.setCanvas(canvas); |
|
78 |
} |
|
79 |
|
|
80 |
public void firstActions() {} |
|
81 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/functions/StraightLine.java | ||
---|---|---|
52 | 52 |
private double y = 0.0D; |
53 | 53 |
private int width = 6; |
54 | 54 |
private Color color = Color.WHITE; |
55 |
private int border = 2; |
|
56 | 55 |
|
57 | 56 |
|
58 | 57 |
/** |
... | ... | |
158 | 157 |
return (int) Math.round(canvas.getCanvasMinX() + border + ((canvas.getCanvasMaxX() - canvas.getCanvasMinX() - (border * 2)) * value)); |
159 | 158 |
} |
160 | 159 |
|
161 |
private double pixelToValueX(int pixel) { |
|
162 |
double value = ((double) (pixel - canvas.getCanvasMinX() - border) / (double) (canvas.getCanvasMaxX() - canvas.getCanvasMinX() - (border * 2.0D))); |
|
163 |
|
|
164 |
value = (value - minx) / (maxx - minx); |
|
165 |
|
|
166 |
return value; |
|
167 |
} |
|
168 |
|
|
169 | 160 |
private int valueToPixelY(double value) { |
170 | 161 |
value = 1.0D - value; |
171 | 162 |
return (int) Math.round(canvas.getCanvasMinY() + border + ((canvas.getCanvasMaxY() - canvas.getCanvasMinY() - (border * 2)) * value)); |
172 | 163 |
} |
173 | 164 |
|
174 |
private double pixelToValueY(int pixel) { |
|
175 |
double div = (double) (canvas.getCanvasMaxY() - canvas.getCanvasMinY() - (border * 2.0D)); |
|
176 |
if (div == 0.0D) |
|
177 |
return 0.0D; |
|
178 |
|
|
179 |
return (1.0D - ((double) (pixel - canvas.getCanvasMinY() - border) / div)); |
|
180 |
} |
|
181 | 165 |
} |
182 | 166 |
|
183 | 167 |
/** |
184 | 168 |
* Lista de cuadrados que intersectan con la recta |
185 | 169 |
*/ |
186 |
protected ArrayList listSquare = new ArrayList(); |
|
187 |
private int pointDragged = -1; |
|
188 |
Cursor transparentCursor = null; |
|
170 |
protected ArrayList listSquare = new ArrayList(); |
|
171 |
private int pointDragged = -1; |
|
172 |
private Cursor transparentCursor = null; |
|
173 |
private boolean showSquares = true; |
|
174 |
private int border = 2; |
|
189 | 175 |
|
190 | 176 |
/** |
191 | 177 |
* Constructor. Asigna el color |
... | ... | |
229 | 215 |
} |
230 | 216 |
|
231 | 217 |
// Dibujamos los cuadrados de los puntos |
232 |
for (int i = 0; i < listSquare.size(); i++) { |
|
233 |
square = ((Square) listSquare.get(i)); |
|
234 |
square.setColor(color); |
|
235 |
if (pointDragged != i) |
|
236 |
square.paint(g); |
|
237 |
else |
|
238 |
square.paintCursor(g); |
|
218 |
if (showSquares) { |
|
219 |
for (int i = 0; i < listSquare.size(); i++) { |
|
220 |
square = ((Square) listSquare.get(i)); |
|
221 |
square.setColor(color); |
|
222 |
if (pointDragged != i) |
|
223 |
square.paint(g); |
|
224 |
else |
|
225 |
square.paintCursor(g); |
|
226 |
} |
|
239 | 227 |
} |
240 | 228 |
|
241 | 229 |
if (pointDragged != -1) { |
... | ... | |
496 | 484 |
|
497 | 485 |
public void firstActions() {} |
498 | 486 |
public void firstDrawActions() {} |
487 |
|
|
488 |
/** |
|
489 |
* @param showSquares the showSquares to set |
|
490 |
*/ |
|
491 |
public void setShowSquares(boolean showSquares) { |
|
492 |
this.showSquares = showSquares; |
|
493 |
} |
|
494 |
|
|
495 |
protected double pixelToValueX(int pixel) { |
|
496 |
double value = ((double) (pixel - canvas.getCanvasMinX() - border) / (double) (canvas.getCanvasMaxX() - canvas.getCanvasMinX() - (border * 2.0D))); |
|
497 |
|
|
498 |
value = (value - minx) / (maxx - minx); |
|
499 |
|
|
500 |
return value; |
|
501 |
} |
|
502 |
|
|
503 |
protected double pixelToValueY(int pixel) { |
|
504 |
double div = (double) (canvas.getCanvasMaxY() - canvas.getCanvasMinY() - (border * 2.0D)); |
|
505 |
if (div == 0.0D) |
|
506 |
return 0.0D; |
|
507 |
|
|
508 |
return (1.0D - ((double) (pixel - canvas.getCanvasMinY() - border) / div)); |
|
509 |
} |
|
499 | 510 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/functions/LogaritmicExponentialLine.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.beans.canvas.layers.functions; |
|
20 |
|
|
21 |
import java.awt.Color; |
|
22 |
import java.awt.Cursor; |
|
23 |
import java.awt.event.MouseEvent; |
|
24 |
import java.util.ArrayList; |
|
25 |
|
|
26 |
import org.gvsig.raster.beans.canvas.layers.InfoLayer; |
|
27 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
28 |
/** |
|
29 |
* Representa una funcion con posibilidad de arrastre para las funciones |
|
30 |
* logaritmicas y exponenciales. Con el raton se puede pasar de una a otra |
|
31 |
* directamente. |
|
32 |
* |
|
33 |
* Las formas mas logicas de uso seria pasandole: |
|
34 |
* 1.0: Para una funcion logaritmica |
|
35 |
* -1.0: Para una funcion exponencial |
|
36 |
* 0.0: Para una funcion lineal |
|
37 |
* |
|
38 |
* @version 02/04/2008 |
|
39 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
40 |
*/ |
|
41 |
public class LogaritmicExponentialLine extends StraightLine { |
|
42 |
/** |
|
43 |
* Numero de puntos que contiene esta funci?n |
|
44 |
*/ |
|
45 |
double num = 50.0; |
|
46 |
|
|
47 |
/** |
|
48 |
* Constructor. Asigna el color y establece la posicion de la funcion. |
|
49 |
* Los valores normales son 1.0 para logaritmica y -1.0 para exponencial. |
|
50 |
* El rango va desde -2.0 hasta 2.0. Siendo 0.0 una funcion lineal. |
|
51 |
* @param c |
|
52 |
*/ |
|
53 |
public LogaritmicExponentialLine(Color c, double point) { |
|
54 |
super(c); |
|
55 |
setShowSquares(false); |
|
56 |
|
|
57 |
recalcList(point); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Actualiza la barra informativa para saber en que estado se encuentra el |
|
62 |
* componente. |
|
63 |
* Cuando el porcentaje es mayor a 0 siempre estamos en la Logaritmica |
|
64 |
* Cuando el porcentaje es menor a 0 siempre estamos en la exponencial |
|
65 |
* @param perc |
|
66 |
*/ |
|
67 |
private void setInfoPoint(Double perc) { |
|
68 |
if (canvas != null) { |
|
69 |
ArrayList list = canvas.getDrawableElements(InfoLayer.class); |
|
70 |
if (list.size() > 0) { |
|
71 |
InfoLayer infoLayer = (InfoLayer) list.get(0); |
|
72 |
|
|
73 |
if (perc == null) { |
|
74 |
infoLayer.setStatusLeft(null); |
|
75 |
infoLayer.setStatusRight(null); |
|
76 |
canvas.repaint(); |
|
77 |
return; |
|
78 |
} |
|
79 |
|
|
80 |
if (perc.doubleValue() > 0.0) |
|
81 |
infoLayer.setStatusLeft(RasterToolsUtil.getText(this, "logarithmical")); |
|
82 |
else |
|
83 |
infoLayer.setStatusLeft(RasterToolsUtil.getText(this, "exponential")); |
|
84 |
infoLayer.setStatusRight(""); |
|
85 |
} |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Recalcula todos los puntos de la funcion |
|
91 |
* Posibles rangos para perc: |
|
92 |
* ( 0.0 a 1.0) - Funcion logaritmica con aproximacion al centro |
|
93 |
* ( 1.0 a 2.0) - Funcion logaritmica con aproximacion al borde |
|
94 |
* ( 0.0 a -1.0) - Funcion exponencial con aproximacion al centro |
|
95 |
* (-1.0 a -2.0) - Funcion exponencial con aproximacion al borde |
|
96 |
* |
|
97 |
* @param perc |
|
98 |
*/ |
|
99 |
private void recalcList(double perc) { |
|
100 |
double x, y; |
|
101 |
|
|
102 |
setInfoPoint(new Double(perc)); |
|
103 |
|
|
104 |
if (perc > 2.0) perc = 2.0; |
|
105 |
if (perc < -2.0) perc = -2.0; |
|
106 |
|
|
107 |
this.listSquare.clear(); |
|
108 |
this.listSquare.add(new Square(0.0, 0.0)); |
|
109 |
do { |
|
110 |
// Aproximacion al centro de una funcion logaritmica |
|
111 |
if (perc >= 0 && perc <= 1.0) { |
|
112 |
for (int i = 1; i < num; i++) { |
|
113 |
x = i / num; |
|
114 |
y = Math.log10(1.0 + (i * 99.0 / num)) / 2.0; |
|
115 |
|
|
116 |
y = x + ((y - x) * perc); |
|
117 |
|
|
118 |
this.listSquare.add(new Square(x, y)); |
|
119 |
} |
|
120 |
break; |
|
121 |
} |
|
122 |
// Aproximacion al borde de una funcion logaritmica |
|
123 |
if (perc >= 1.0 && perc <= 2.0) { |
|
124 |
for (int i = 1; i < num; i++) { |
|
125 |
x = i / num; |
|
126 |
y = Math.log10(1.0 + (i * 99.0 / num)) / 2.0; |
|
127 |
|
|
128 |
y = y + ((1.0 - y) * (perc - 1.0)); |
|
129 |
|
|
130 |
this.listSquare.add(new Square(x, y)); |
|
131 |
} |
|
132 |
break; |
|
133 |
} |
|
134 |
// Aproximacion al centro de una funcion exponencial |
|
135 |
if (perc >= -1.0 && perc <= 0.0) { |
|
136 |
for (int i = 1; i < num; i++) { |
|
137 |
x = i / num; |
|
138 |
double b = 6.0; |
|
139 |
y = (Math.exp(((i - 1.0) / num) * b) - 1.0) / (Math.exp(b) - 1.0); |
|
140 |
|
|
141 |
y = x - ((x - y) * Math.abs(perc)); |
|
142 |
|
|
143 |
this.listSquare.add(new Square(x, y)); |
|
144 |
} |
|
145 |
break; |
|
146 |
} |
|
147 |
// Aproximacion al borde de una funcion exponencial |
|
148 |
if (perc >= -2.0 && perc <= -1.0) { |
|
149 |
for (int i = 1; i < num; i++) { |
|
150 |
x = i / num; |
|
151 |
double b = 6.0; |
|
152 |
y = (Math.exp(((i - 1.0) / num) * b) - 1.0) / (Math.exp(b) - 1.0); |
|
153 |
|
|
154 |
y = y * (1.0 - (Math.abs(perc) - 1.0)); |
|
155 |
|
|
156 |
this.listSquare.add(new Square(x, y)); |
|
157 |
} |
|
158 |
break; |
|
159 |
} |
|
160 |
} while (false); |
|
161 |
this.listSquare.add(new Square(1.0, 1.0)); |
|
162 |
} |
|
163 |
|
|
164 |
/* (non-Javadoc) |
|
165 |
* @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mouseDragged(java.awt.event.MouseEvent) |
|
166 |
*/ |
|
167 |
public boolean mouseDragged(MouseEvent e) { |
|
168 |
if (canvas.getCursor().getType() != Cursor.DEFAULT_CURSOR) |
|
169 |
return true; |
|
170 |
|
|
171 |
double x = pixelToValueX(e.getX()); |
|
172 |
double y = pixelToValueY(e.getY()); |
|
173 |
|
|
174 |
double perc = 0.0; |
|
175 |
|
|
176 |
// Localizamos el punto del raton para pasar un porcentaje correcto y que |
|
177 |
// asi coincida la funcion con el raton |
|
178 |
if (y >= x) { |
|
179 |
double y2 = Math.log10(1.0 + (x * 99.0)) / 2.0; |
|
180 |
if (y < y2) |
|
181 |
perc = (y - x) / (y2 - x); |
|
182 |
else |
|
183 |
perc = ((y - y2) / (1.0 - y2)) + 1.0; |
|
184 |
} else { |
|
185 |
double y2 = 1.0 - (Math.log10(1.0 + ((1.0 - x) * 99.0)) / 2.0); |
|
186 |
y2 = (Math.exp(x * 6.0) - 1.0) / (Math.exp(6.0) - 1.0); |
|
187 |
|
|
188 |
if (y > y2) |
|
189 |
perc = -Math.abs((y - x) / (y2 - x)); |
|
190 |
else |
|
191 |
perc = -Math.abs((y2 - y) / y2) - 1.0; |
|
192 |
} |
|
193 |
|
|
194 |
recalcList(perc); |
|
195 |
canvas.repaint(); |
|
196 |
canvas.callDataDragged("line", this); |
|
197 |
return false; |
|
198 |
} |
|
199 |
|
|
200 |
/* (non-Javadoc) |
|
201 |
* @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mouseMoved(java.awt.event.MouseEvent) |
|
202 |
*/ |
|
203 |
public boolean mouseMoved(MouseEvent e) { |
|
204 |
return true; |
|
205 |
} |
|
206 |
|
|
207 |
/* (non-Javadoc) |
|
208 |
* @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mousePressed(java.awt.event.MouseEvent) |
|
209 |
*/ |
|
210 |
public boolean mousePressed(MouseEvent e) { |
|
211 |
return mouseDragged(e); |
|
212 |
} |
|
213 |
|
|
214 |
/* (non-Javadoc) |
|
215 |
* @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mouseReleased(java.awt.event.MouseEvent) |
|
216 |
*/ |
|
217 |
public boolean mouseReleased(MouseEvent e) { |
|
218 |
setInfoPoint(null); |
|
219 |
return true; |
|
220 |
} |
|
221 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/enhanced/ui/EnhancedListener.java | ||
---|---|---|
198 | 198 |
|
199 | 199 |
} |
200 | 200 |
if(((String)selectorsPanel.getEnhancedType().getSelectedItem()).equals("Logaritmic")) { |
201 |
|
|
201 |
graphicsPanel.getInputHistogram().setFunction(GraphicHistogram.FUNCTION_LOGARIT); |
|
202 |
updatePreview(); |
|
202 | 203 |
} |
203 | 204 |
if(((String)selectorsPanel.getEnhancedType().getSelectedItem()).equals("Exponential")) { |
204 |
|
|
205 |
graphicsPanel.getInputHistogram().setFunction(GraphicHistogram.FUNCTION_EXPONENT); |
|
206 |
updatePreview(); |
|
205 | 207 |
} |
206 | 208 |
if(((String)selectorsPanel.getEnhancedType().getSelectedItem()).equals("Equalization")) { |
207 | 209 |
int[] renderBands = enhancedDialog.getLayer().getRender().getRenderBands(); |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/enhanced/graphics/InputHistogram.java | ||
---|---|---|
27 | 27 |
import org.gvsig.raster.beans.canvas.layers.MinMaxLines; |
28 | 28 |
import org.gvsig.raster.beans.canvas.layers.functions.BaseFunction; |
29 | 29 |
import org.gvsig.raster.beans.canvas.layers.functions.DensitySlicingLine; |
30 |
import org.gvsig.raster.beans.canvas.layers.functions.LogaritmicExponentialLine; |
|
30 | 31 |
import org.gvsig.raster.beans.canvas.layers.functions.StraightLine; |
31 | 32 |
import org.gvsig.raster.datastruct.Histogram; |
32 | 33 |
import org.gvsig.rastertools.enhanced.ui.EnhancedListener; |
... | ... | |
100 | 101 |
if (!baseFunction.getClass().equals(StraightLine.class)) |
101 | 102 |
baseFunction = new StraightLine(histogramDrawed.getBaseFunction().getColor()); |
102 | 103 |
break; |
104 |
case GraphicHistogram.FUNCTION_LOGARIT: |
|
105 |
baseFunction = new LogaritmicExponentialLine(histogramDrawed.getBaseFunction().getColor(), 1.0); |
|
106 |
break; |
|
107 |
case GraphicHistogram.FUNCTION_EXPONENT: |
|
108 |
baseFunction = new LogaritmicExponentialLine(histogramDrawed.getBaseFunction().getColor(), -1.0); |
|
109 |
break; |
|
103 | 110 |
} |
104 | 111 |
|
105 | 112 |
histogramDrawed.setBaseFunction(baseFunction); |
trunk/extensions/extRasterTools-SE/src-test-ui/org/gvsig/raster/beans/canvas/GCanvasTest.java | ||
---|---|---|
25 | 25 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
26 | 26 |
import org.gvsig.raster.beans.canvas.layers.InfoLayer; |
27 | 27 |
import org.gvsig.raster.beans.canvas.layers.MinMaxLines; |
28 |
import org.gvsig.raster.beans.canvas.layers.functions.BaseFunction; |
|
29 |
import org.gvsig.raster.beans.canvas.layers.functions.StraightLine; |
|
28 |
import org.gvsig.raster.beans.canvas.layers.functions.LogaritmicExponentialLine; |
|
30 | 29 |
import org.gvsig.rastertools.TestUI; |
31 | 30 |
/** |
32 | 31 |
* Test para comprobar el funcionamiento basico de un GCanvas |
... | ... | |
37 | 36 |
public class GCanvasTest implements IGCanvasListener { |
38 | 37 |
private TestUI jFrame = null; |
39 | 38 |
private GCanvas component = null; |
40 |
private BaseFunction line = null;
|
|
39 |
private LogaritmicExponentialLine line = null;
|
|
41 | 40 |
private MinMaxLines minMaxLines = null; |
42 | 41 |
private InfoLayer infoLayer = null; |
43 | 42 |
|
... | ... | |
51 | 50 |
GraphicHistogram gHistR = new GraphicHistogram(histR, Color.RED); |
52 | 51 |
gHistR.setType(GraphicHistogram.TYPE_FILL); |
53 | 52 |
|
54 |
line = new StraightLine(Color.YELLOW);
|
|
53 |
line = new LogaritmicExponentialLine(Color.YELLOW, -1.0);
|
|
55 | 54 |
//line = new ExponentialLine(Color.YELLOW); |
56 | 55 |
//line = new LogaritmicLine(Color.YELLOW); |
57 | 56 |
DrawableElement border = new Border(Color.WHITE); |
Also available in: Unified diff