Index: org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/EnhancedListener.java
===================================================================
--- org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/EnhancedListener.java	(revision 2584)
+++ org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/EnhancedListener.java	(revision 2585)
@@ -25,7 +25,9 @@
 import java.awt.Component;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.geom.Point2D;
 import java.io.File;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.gvsig.fmap.dal.coverage.RasterLocator;
@@ -51,6 +53,7 @@
 import org.gvsig.raster.swing.gcanvas.GraphicHistogram;
 import org.gvsig.raster.swing.gcanvas.IGCanvasListener;
 import org.gvsig.raster.swing.gcanvas.LogaritmicExponentialLine;
+import org.gvsig.raster.swing.gcanvas.MinMaxLines;
 import org.gvsig.raster.swing.gcanvas.SquareRootPowLine;
 import org.gvsig.raster.swing.gcanvas.StraightLine;
 import org.gvsig.raster.tools.app.basic.RasterToolsUtil;
@@ -310,6 +313,46 @@
 	}
 	
 	/**
+	 * Gets the list of points from the stretches
+	 * @param stretch
+	 * @return
+	 */
+	private List<Point2D> getPointListFromStretches(Stretch stretch) {
+		List<Point2D> pointList = new ArrayList<Point2D>();
+		for (int i = 0; i < stretch.getStretchIn().length; i++) {
+			Point2D p = new Point2D.Double(
+				(stretch.getStretchIn()[i] - stretch.getMinValue()) / (stretch.getMaxValue() - stretch.getMinValue()),
+				stretch.getStretchOut()[i] / 255.0D);
+			pointList.add(p);
+		}
+		simplifyPointList(pointList);
+		return pointList;
+	}
+	
+	/**
+	 * Removes the first and the last point if the coordinate X don't change.
+	 * @param pointList
+	 */
+	private void simplifyPointList(List<Point2D> pointList) {
+		int lastPoint = pointList.size() - 1;
+		if(pointList.size() > 1) {
+			if(pointList.get(lastPoint).getX() == 1 && 
+					pointList.get(lastPoint).getY() == 1 && 
+					pointList.get(lastPoint - 1).getY() == 1) {
+				pointList.remove(lastPoint);
+			}
+		}
+
+		if(pointList.size() > 1) {
+			if(pointList.get(0).getX() == 0 && 
+					pointList.get(0).getY() == 0 && 
+					pointList.get(1).getY() == 0) {
+				pointList.remove(0);
+			}
+		}
+	}
+	
+	/**
 	 * En la primera carga se define cada banda en los histogramas, para dejarlo en
 	 * su estado logico.
 	 * @param stretch
@@ -326,6 +369,8 @@
 		if (status == null)
 			return;
 		
+		//MinMaxLines linesLayer = status.getMinMaxLines();
+		
 		GCanvas canvas = RasterSwingLocator.getSwingManager().createGraphicCanvas(Color.white);
 		
 		switch (stretch.getFunctionType()) {
@@ -337,10 +382,11 @@
 				baseFunction = canvas.createStraightLineForGCanvas(
 						((DrawableElement)status.getBaseFunction()).getColor());
 				((StraightLine) baseFunction).clearSquares();
-				for (int i = 0; i < stretch.getStretchIn().length; i++) {
-					((StraightLine) baseFunction).addSquare(
-						(stretch.getStretchIn()[i] - stretch.getMinValue()) / (stretch.getMaxValue() - stretch.getMinValue()),
-						stretch.getStretchOut()[i] / 255.0D);
+				List<Point2D> pointList = getPointListFromStretches(stretch);
+				
+				StraightLine func = ((StraightLine) baseFunction);
+				for (int i = 0; i < pointList.size(); i++) {
+					func.addSquare(pointList.get(i).getX(), pointList.get(i).getY());
 				}
 				break;
 			case 1:
Index: org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/GraphicsPanel.java
===================================================================
--- org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/GraphicsPanel.java	(revision 2584)
+++ org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/ui/GraphicsPanel.java	(revision 2585)
@@ -43,9 +43,9 @@
 import org.gvsig.fmap.dal.coverage.exception.HistogramException;
 import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
 import org.gvsig.fmap.dal.coverage.store.props.HistogramComputer;
+import org.gvsig.i18n.Messages;
 import org.gvsig.raster.fmap.layers.FLyrRaster;
 import org.gvsig.raster.swing.preview.PreviewBasePanelTab;
-import org.gvsig.raster.tools.app.basic.RasterToolsUtil;
 import org.gvsig.raster.tools.app.basic.tool.enhanced.graphics.InputHistogram;
 import org.gvsig.raster.tools.app.basic.tool.enhanced.graphics.OutputHistogram;
 import org.gvsig.tools.locator.LocatorException;
@@ -111,10 +111,10 @@
 	 */
 	private void init() {
 		setLayout(new GridBagLayout());
-		setBorder(javax.swing.BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "histograms"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
+		setBorder(javax.swing.BorderFactory.createTitledBorder(null, Messages.getText("histograms"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
 		GridBagConstraints gridBagConstraints = null;
 
-		JLabel label1 = new JLabel(RasterToolsUtil.getText(null, "input_hist"));
+		JLabel label1 = new JLabel(Messages.getText("input_hist"));
 		gridBagConstraints = new GridBagConstraints();
 		gridBagConstraints.insets = new Insets(4, 4, 4, 4);
 		gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER;
@@ -122,7 +122,7 @@
 		label1.setPreferredSize(new Dimension(150, 14));
 		add(label1, gridBagConstraints);
 		
-		JLabel label2 = new JLabel(RasterToolsUtil.getText(null, "output_hist"));
+		JLabel label2 = new JLabel(Messages.getText("output_hist"));
 		gridBagConstraints = new GridBagConstraints();
 		gridBagConstraints.gridx = 2;
 		gridBagConstraints.gridy = 0;
@@ -235,7 +235,7 @@
 			controls = new JPanel();
 			controls.setLayout(new GridBagLayout());
 			
-			llevels = new JLabel(RasterToolsUtil.getText(null, "levels"));
+			llevels = new JLabel(Messages.getText("levels"));
 			
 			GridBagConstraints gbc = new GridBagConstraints();
 			gbc.weightx = 1;
Index: org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/graphics/HistogramGraphicBase.java
===================================================================
--- org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/graphics/HistogramGraphicBase.java	(revision 2584)
+++ org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/graphics/HistogramGraphicBase.java	(revision 2585)
@@ -24,7 +24,7 @@
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
-import java.util.ArrayList;
+import java.util.List;
 
 import javax.swing.JPanel;
 
@@ -42,7 +42,6 @@
 /**
  * Clase base para los gráficos de histogramas de entrada y salida.
  * 
- * 20/02/2008
  * @author Nacho Brodin nachobrodin@gmail.com
  */
 public abstract class HistogramGraphicBase extends JPanel  {
@@ -54,8 +53,7 @@
 	/**
 	 * Clase para tener guardados los valores de estado de una banda del histograma
 	 * 
-	 * @version 04/03/2008
-	 * @author BorSanZa - Borja Sánchez Zamorano (borja.sanchez@iver.es)
+	 * @author BorSanZa - Borja Sánchez Zamorano 
 	 */
 	public class HistogramStatus {
 		private double[]         histogram        = new double[] { 0, 0, 3, 4, 5, 8, 7, 18, 45, 36, 21, 36, 12, 23, 23, 40, 17, 10, 5, 1, 0, 0, 0 };
@@ -360,7 +358,7 @@
 	 * @param type
 	 */
 	public void setType(int type) {
-		ArrayList<DrawableElement> elements = getCanvas().getDrawableElements(GraphicHistogram.class);
+		List<DrawableElement> elements = getCanvas().getDrawableElements(GraphicHistogram.class);
 		for (int i = 0; i < elements.size(); i++)
 			((GraphicHistogram) elements.get(i)).setType(type);
 	}
Index: org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/graphics/InputHistogram.java
===================================================================
--- org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/graphics/InputHistogram.java	(revision 2584)
+++ org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/graphics/InputHistogram.java	(revision 2585)
@@ -23,7 +23,7 @@
 
 import java.awt.Color;
 import java.awt.Component;
-import java.util.ArrayList;
+import java.util.List;
 
 import javax.swing.JPanel;
 
@@ -42,7 +42,6 @@
 /**
  * Componente con el histograma de entrada.
  * 
- * 20/02/2008
  * @author Nacho Brodin nachobrodin@gmail.com
  */
 public class InputHistogram extends HistogramGraphicBase {
@@ -55,10 +54,6 @@
 		super(hist, lyr, minList, maxList);
 	}
 	
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getCanvas()
-	 */
 	public GCanvas getCanvas() {
 		if(canvas == null) {
 			canvas = RasterSwingLocator.getSwingManager().createGraphicCanvas(Color.BLACK);
@@ -102,7 +97,7 @@
 
 		BaseFunction baseFunction = histogramDrawed.getBaseFunction();
 		
-		ArrayList<DrawableElement> listBaseFunc = canvas.getDrawableElements(BaseFunction.class);
+		List<DrawableElement> listBaseFunc = canvas.getDrawableElements(BaseFunction.class);
 		if(listBaseFunc != null && listBaseFunc.get(0) instanceof DrawableElement)
 			((DrawableElement)listBaseFunc.get(0)).setDrawing(true);
 		
Index: org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/EnhancedTocMenuEntry.java
===================================================================
--- org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/EnhancedTocMenuEntry.java	(revision 2584)
+++ org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/enhanced/EnhancedTocMenuEntry.java	(revision 2585)
@@ -26,13 +26,14 @@
 import org.gvsig.andami.PluginServices;
 import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction;
 import org.gvsig.app.project.documents.view.toc.ITocItem;
+import org.gvsig.fmap.IconThemeHelper;
 import org.gvsig.fmap.dal.coverage.datastruct.BufferHistogram;
 import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.i18n.Messages;
 import org.gvsig.raster.fmap.layers.FLyrRaster;
 import org.gvsig.raster.fmap.layers.ILayerState;
 import org.gvsig.raster.fmap.layers.IRasterLayerActions;
 import org.gvsig.raster.mainplugin.toolbar.IGenericToolBarMenuItem;
-import org.gvsig.raster.tools.app.basic.RasterToolsUtil;
 import org.gvsig.raster.tools.app.basic.raster.process.HistogramProcess;
 import org.gvsig.raster.tools.app.basic.raster.process.IProcessActions;
 import org.gvsig.raster.tools.app.basic.raster.process.StatisticsProcess;
@@ -77,7 +78,7 @@
 	}
 
 	public String getText() {
-		return RasterToolsUtil.getText(this, "enhanced_rad");
+		return Messages.getText("enhanced_rad");
 	}
 
 	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
@@ -119,7 +120,7 @@
 	}
 	
 	public Icon getIcon() {
-		return RasterToolsUtil.getIcon("layer-enhanced");
+		return IconThemeHelper.getImageIcon("layer-enhanced");
 	}
 
 	/**
Index: org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/MinMaxLines.java
===================================================================
--- org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/MinMaxLines.java	(revision 2584)
+++ org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.api/src/main/java/org/gvsig/raster/swing/gcanvas/MinMaxLines.java	(revision 2585)
@@ -26,5 +26,7 @@
  * @author Nacho Brodin (nachobrodin@gmail.com)
  */
 public abstract class  MinMaxLines extends DrawableElement {
+	public abstract void setMinimum(double min);
 	
+	public abstract void setMaximum(double max);
 }
Index: org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultLogaritmicExponentialLine.java
===================================================================
--- org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultLogaritmicExponentialLine.java	(revision 2584)
+++ org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultLogaritmicExponentialLine.java	(revision 2585)
@@ -113,7 +113,6 @@
 	 * ( 0.0 a -1.0) - Funcion exponencial con aproximacion al centro
 	 * (-1.0 a -2.0) - Funcion exponencial con aproximacion al borde
 	 */
-	@SuppressWarnings("unchecked")
 	private void recalcList() {
 		double x, y = 0.0;
 
@@ -216,59 +215,31 @@
 		return false;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mouseMoved(java.awt.event.MouseEvent)
-	 */
 	public boolean mouseMoved(MouseEvent e) {
 		return true;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mousePressed(java.awt.event.MouseEvent)
-	 */
 	public boolean mousePressed(MouseEvent e) {
 		return mouseDragged(e);
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#mouseReleased(java.awt.event.MouseEvent)
-	 */
 	public boolean mouseReleased(MouseEvent e) {
 		setInfoPoint(null);
 		return true;
 	}
 	
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.swing.gcanvas.LogaritmicExponentialLine#isLogaritmical()
-	 */
 	public boolean isLogaritmical() {
 		return (valueFunction > 0.0);
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.swing.gcanvas.LogaritmicExponentialLine#isExponencial()
-	 */
 	public boolean isExponencial() {
 		return (valueFunction < 0.0);
 	}
 	
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#getFunctionType()
-	 */
 	public int getFunctionType() {
 		return 1;
 	}
 	
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.beans.canvas.layers.functions.StraightLine#getValueFunction()
-	 */
 	public double getValueFunction() {
 		return valueFunction;
 	}
Index: org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultStraightLine.java
===================================================================
--- org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultStraightLine.java	(revision 2584)
+++ org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultStraightLine.java	(revision 2585)
@@ -205,7 +205,6 @@
 	 */
 	protected void paint(Graphics g) {
 		super.paint(g);
-
 		g.setColor(color);
 
 		// Dibujamos una línea desde un punto hasta el siguiente
Index: org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultBaseFunction.java
===================================================================
--- org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultBaseFunction.java	(revision 2584)
+++ org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/function/DefaultBaseFunction.java	(revision 2585)
@@ -55,11 +55,11 @@
 	}
 	
 	protected void paint(Graphics g) {
-		List<DrawableElement> elements = canvas.getDrawableElements(DefaultMinMaxLines.class);
+		/*List<DrawableElement> elements = canvas.getDrawableElements(DefaultMinMaxLines.class);
 		if (elements.size() > 0) {
 			DefaultMinMaxLines minMaxLines = (DefaultMinMaxLines) elements.get(0);
 			setMinX(minMaxLines.getMinDistance());
 			setMaxX(minMaxLines.getMaxDistance());
-		}
+		}*/
 	}
 }
\ No newline at end of file
Index: org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/DefaultMinMaxLines.java
===================================================================
--- org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/DefaultMinMaxLines.java	(revision 2584)
+++ org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.swing/org.gvsig.raster.swing.impl/src/main/java/org/gvsig/raster/swing/impl/canvas/layer/DefaultMinMaxLines.java	(revision 2585)
@@ -63,6 +63,14 @@
 		setColor(c);
 	}
 	
+	public void setMinimum(double min) {
+		this.minPos = min;
+	}
+	
+	public void setMaximum(double max) {
+		this.maxPos = max;
+	}
+	
 	private int valueToPixel(double value) {
 		return (int) Math.round(canvas.getCanvasMinX() + border + ((canvas.getCanvasMaxX() - canvas.getCanvasMinX() - (border * 2)) * value));
 	}
@@ -149,19 +157,7 @@
 			if (minPos > maxPos)
 				maxPos = minPos;
 			
-			List<DrawableElement> elements = canvas.getDrawableElements(DefaultBaseFunction.class);
-			if (elements.size() > 0) {
-				DefaultBaseFunction baseFunction = (DefaultBaseFunction) elements.get(0);
-				baseFunction.setMinX(minPos);
-				baseFunction.setMaxX(maxPos);
-			}
-			
-			((Component)canvas).repaint();
-			SwingUtilities.invokeLater(new Runnable() {
-				public void run() {
-					canvas.callDataDragged("minmax", this);
-				}
-			});
+			updateDrawableElements();
 			return false;
 		}
 		if (maxSelected) {
@@ -173,21 +169,28 @@
 			if (maxPos < minPos)
 				minPos = maxPos;
 			
-			((Component)canvas).repaint();
-			SwingUtilities.invokeLater(new Runnable() {
-				public void run() {
-					canvas.callDataDragged("minmax", this);
-				}
-			});
+			updateDrawableElements();
 			return false;
 		}
 		return true;
 	}
 	
-	/*
-	 * (non-Javadoc)
-	 * @see org.gvsig.raster.beans.canvas.DrawableElement#mouseMoved(java.awt.event.MouseEvent)
-	 */
+	private void updateDrawableElements() {
+		List<DrawableElement> elements = canvas.getDrawableElements(DefaultBaseFunction.class);
+		if (elements.size() > 0) {
+			DefaultBaseFunction baseFunction = (DefaultBaseFunction) elements.get(0);
+			baseFunction.setMinX(minPos);
+			baseFunction.setMaxX(maxPos);
+		}
+		
+		((Component)canvas).repaint();
+		SwingUtilities.invokeLater(new Runnable() {
+			public void run() {
+				canvas.callDataDragged("minmax", this);
+			}
+		});
+	}
+	
 	public boolean mouseMoved(MouseEvent e) {
 		if (e.getY() > canvas.getCanvasMinY() && e.getY() < canvas.getCanvasMaxY()) {
 			if (e.getX() >= (valueToPixel(minPos) - 3) &&
