Revision 20057 trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/beans/canvas/layers/functions/LogaritmicExponentialLine.java

View differences:

LogaritmicExponentialLine.java
50 50
	 */
51 51
	private double baseExp = 6.0;
52 52
	
53
	private double perc = 1.0;
53
	private double valueFunction = 1.0;
54 54
	
55 55
	/**
56 56
	 * Constructor. Asigna el color y establece la posicion de la funcion.
......
62 62
		super(c);
63 63
		setShowSquares(false);
64 64

  
65
		perc = point;
65
		valueFunction = point;
66 66
		recalcList();
67 67
	}
68 68

  
......
106 106
	private void recalcList() {
107 107
		double x, y = 0.0;
108 108

  
109
		setInfoPoint(new Double(perc));
109
		setInfoPoint(new Double(valueFunction));
110 110

  
111 111
		this.listSquare.clear();
112 112

  
......
114 114
			x = ((double) i) / num;
115 115

  
116 116
			// Aproximacion al centro de una funcion logaritmica
117
			if (perc >= 0.0 && perc <= 1.0) {
117
			if (valueFunction >= 0.0 && valueFunction <= 1.0) {
118 118
				y = logFunction(x);
119
				y = x + ((y - x) * perc);
119
				y = x + ((y - x) * valueFunction);
120 120
			}
121 121

  
122 122
			// Aproximacion al borde de una funcion logaritmica
123
			if (perc > 1.0 && perc <= 2.0) {
123
			if (valueFunction > 1.0 && valueFunction <= 2.0) {
124 124
				y = logFunction(x);
125
				y = y + ((1.0 - y) * (perc - 1.0));
125
				y = y + ((1.0 - y) * (valueFunction - 1.0));
126 126
			}
127 127

  
128 128
			// Aproximacion al centro de una funcion exponencial
129
			if (perc >= -1.0 && perc < 0.0) {
129
			if (valueFunction >= -1.0 && valueFunction < 0.0) {
130 130
				y = expFunction(x);
131
				y = x - ((x - y) * Math.abs(perc));
131
				y = x - ((x - y) * Math.abs(valueFunction));
132 132
			}
133 133

  
134 134
			// Aproximacion al borde de una funcion exponencial
135
			if (perc >= -2.0 && perc < -1.0) {
135
			if (valueFunction >= -2.0 && valueFunction < -1.0) {
136 136
				y = expFunction(x);
137
				y = y * (1.0 - (Math.abs(perc) - 1.0));
137
				y = y * (1.0 - (Math.abs(valueFunction) - 1.0));
138 138
			}
139 139

  
140 140
			if (y < 0.0)
......
181 181
		if (y >= x) {
182 182
			y2 = logFunction(x);
183 183
			if (y < y2)
184
				perc = (y - x) / (y2 - x);
184
				valueFunction = (y - x) / (y2 - x);
185 185
			else
186
				perc = ((y - y2) / (1.0 - y2)) + 1.0;
186
				valueFunction = ((y - y2) / (1.0 - y2)) + 1.0;
187 187
		} else {
188 188
			y2 = expFunction(x);
189 189
			
190 190
			if (y > y2)
191
				perc = -Math.abs((y - x) / (y2 - x));
191
				valueFunction = -Math.abs((y - x) / (y2 - x));
192 192
			else
193
				perc = -Math.abs((y2 - y) / y2)  - 1.0;
193
				valueFunction = -Math.abs((y2 - y) / y2)  - 1.0;
194 194
		}
195 195
		
196
		if (perc > 2.0)
197
			perc = 2.0;
198
		if (perc < -2.0)
199
			perc = -2.0;
196
		if (valueFunction > 2.0)
197
			valueFunction = 2.0;
198
		if (valueFunction < -2.0)
199
			valueFunction = -2.0;
200 200
		
201 201
		recalcList();
202 202
		canvas.repaint();
......
231 231
	 * @return
232 232
	 */
233 233
	public boolean isLogaritmical() {
234
		return (perc > 0.0);
234
		return (valueFunction > 0.0);
235 235
	}
236 236

  
237 237
	/**
......
239 239
	 * @return
240 240
	 */
241 241
	public boolean isExponencial() {
242
		return (perc < 0.0);
242
		return (valueFunction < 0.0);
243 243
	}
244
	
245
	/*
246
	 * (non-Javadoc)
247
	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#getFunctionType()
248
	 */
249
	public int getFunctionType() {
250
		return 1;
251
	}
252
	
253
	/*
254
	 * (non-Javadoc)
255
	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#getValueFunction()
256
	 */
257
	public double getValueFunction() {
258
		return valueFunction;
259
	}
244 260
}

Also available in: Unified diff