/*
 * iGeom by LInE
 * Definitions of ID to Geometric Objects
 * www.matematica.br/igeom
 * ./app/core/enums/elements-class-enum.js
 * @version 2020/11/02: Implemented Line instersection
 */

export const ELEMENTS_CLASS = {
  NONE: -1,
  POINT: 0,
  INTERSECTION_POINT: 1,
  CIRCUMFERENCE: 3,
  LINE: 4,
  LINE_SEGMENT: 6,
  MIDDLE_POINT: 13
  // TO: PONTO                      =   0;
  // TO: PONTO_INTERSECAO           =   1;
  // TO: PONTO_SOBRE                =   2;
  // TO: CIRCUNFERENCIA             =   3;
  // TO: RETA                       =   4;
  // TO: SEMIRETA                   =   5;
  // TO: SEGMENTO                   =   6;
  // TO: MED_DISTANCIA              =   7; //  Script: MEDIDA = 7
  // TO: MED_AREA                   =   8;
  // TO: PARALELA                   =   9;
  // TO: PERPENDICULAR              =  10;
  // TO: MED_ARCO                   =  11;
  // TO: MED_EXPR                   =  12;
  // TO: PONTO_MEDIO                =  13;
  // TO: CIRC_RAIO                  =  14;
  // TO: POLIGONO                   =  15;
  // TO: PONTO_SOBRE_DIST           =  16;
  // TO: LOCUS                      =  17;
  // TO: MED_TEXTO                  =  20;  // para textos
  // TO: CIRCUNFERENCIA_INT         =  21; // [11/01/2006] estava 56, mas este num. e de rotacao
};

// @param {number} code
export function fromCodeToClass(code) {
  switch (code) {
    case 0:
      return ELEMENTS_CLASS.POINT;
    case 1:
      return ELEMENTS_CLASS.INTERSECTION_POINT;
    case 6:
      return ELEMENTS_CLASS.LINE_SEGMENT;
    case 3:
      return ELEMENTS_CLASS.CIRCUMFERENCE;
    case 4:
      return ELEMENTS_CLASS.LINE;
    default:
      console.error("Tipo não suportado" + "\"" + code + "\"", code)
      return ELEMENTS_CLASS.POINT;
  }

}