package ac.essex.gp.nodes.shape;

import ac.essex.gp.params.NodeParams;
import ac.essex.gp.params.RangeTypes;
import ac.essex.gp.util.DataStack;
import ac.essex.gp.tree.Terminal;

/**
 * Finds the pixel closest to the point of the shape's Center of gravity
 *
 * @author Olly Oechsle, University of Essex, Date: 15-Mar-2007
 * @version 1.0
 */
public class ClosestPixelToCog extends Terminal {

    public int getReturnType() {
        return NodeParams.NUMBER;
    }

    public double execute(DataStack data) {
        data.usesImaging = true;
        data.value = data.shape.getClosestPixelToCog();
        return debugger.record(data.value);
    }

    public String toJava() {
        return "shape.getClosestPixelToCog()";
    }

    public int getDefaultRangeType() {
        return RangeTypes.RANGE_PERCENTAGE;
    }        

}
