elements-class-enum.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * iGeom by LInE
  3. * Definitions of ID to Geometric Objects
  4. * www.matematica.br/igeom
  5. * ./app/core/enums/elements-class-enum.js
  6. * @version 2020/11/02: Implemented Line instersection
  7. */
  8. export const ELEMENTS_CLASS = {
  9. NONE: -1,
  10. POINT: 0,
  11. INTERSECTION_POINT: 1,
  12. CIRCUMFERENCE: 3,
  13. LINE: 4,
  14. LINE_SEGMENT: 6,
  15. MIDDLE_POINT: 13
  16. // TO: PONTO = 0;
  17. // TO: PONTO_INTERSECAO = 1;
  18. // TO: PONTO_SOBRE = 2;
  19. // TO: CIRCUNFERENCIA = 3;
  20. // TO: RETA = 4;
  21. // TO: SEMIRETA = 5;
  22. // TO: SEGMENTO = 6;
  23. // TO: MED_DISTANCIA = 7; // Script: MEDIDA = 7
  24. // TO: MED_AREA = 8;
  25. // TO: PARALELA = 9;
  26. // TO: PERPENDICULAR = 10;
  27. // TO: MED_ARCO = 11;
  28. // TO: MED_EXPR = 12;
  29. // TO: PONTO_MEDIO = 13;
  30. // TO: CIRC_RAIO = 14;
  31. // TO: POLIGONO = 15;
  32. // TO: PONTO_SOBRE_DIST = 16;
  33. // TO: LOCUS = 17;
  34. // TO: MED_TEXTO = 20; // para textos
  35. // TO: CIRCUNFERENCIA_INT = 21; // [11/01/2006] estava 56, mas este num. e de rotacao
  36. };
  37. // @param {number} code
  38. export function fromCodeToClass(code) {
  39. switch (code) {
  40. case 0:
  41. return ELEMENTS_CLASS.POINT;
  42. case 1:
  43. return ELEMENTS_CLASS.INTERSECTION_POINT;
  44. case 6:
  45. return ELEMENTS_CLASS.LINE_SEGMENT;
  46. case 3:
  47. return ELEMENTS_CLASS.CIRCUMFERENCE;
  48. case 4:
  49. return ELEMENTS_CLASS.LINE;
  50. default:
  51. console.error("Tipo não suportado" + "\"" + code + "\"", code)
  52. return ELEMENTS_CLASS.POINT;
  53. }
  54. }