package yi.iu.processor.clc;

import yi.util.config.*;

public class CLCConfig implements Configurable{

  /**
   * Singleton instance
   */
  private static CLCConfig m_singleton = null;

//  public int MIN_LINE_NUM_4_INTERRELATIONSHIP = 5;

  public int    LOG_LEVEL = 3;

  /**
   * Maximum weight of a line.  Gernerally the weight of a line is its length.
   */
  public double MAX_LINE_WEIGHT = 1.5;

  public double NORMAL_LINE_LENGTH = 15;



  /**
   * Minimum line length for a line to be considered in consistent line cluster
   */
  public double MIN_QUALIFIED_LINE_LEN = 5;

  /**
   * Minimum total line length of a consistent line cluster (if the total line
   * length of the lines in a clc is less than this criterion, this clc will be
   * discarded).  The value is normalized by the max(image_width, image_height)
   */
  public double MIN_QUALIFIED_CLC_LINE_LEN_SUM = 0.2;

  public String[] getParameterNames() {
    return new String[] {
      "MIN_LINE_NUM_4_INTERRELATIONSHIP",
      "MIN_QUALIFIED_LINE_LEN",
      "MIN_QUALIFIED_CLC_LINE_LEN_SUM",
      "MAX_LINE_WEIGHT"
    };
  }

  private CLCConfig() {

    Configuration.configParameters(this);
  }

  public static CLCConfig getSingleton() {
    if (m_singleton == null) m_singleton = new CLCConfig();
    return m_singleton;
  }

  public static double getMinQualifiedLineLen() {
    return getSingleton().MIN_QUALIFIED_LINE_LEN;
  }

  public static double getMinQualifiedCLCLineLenSum(int image_width, int image_height) {
    return getSingleton().MIN_QUALIFIED_CLC_LINE_LEN_SUM * Math.min(image_width, image_height);
  }

  public static double getMaxLineWeight() {
    return getSingleton().MAX_LINE_WEIGHT;
  }

  public static double getNormalLineLength() {
    return getSingleton().NORMAL_LINE_LENGTH;
  }


}