elements-class-enum.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // TYPE of objects in iGeom
  9. // * PONTO = 0;
  10. // * PONTO_INTERSECAO = 1;
  11. // * PONTO_SOBRE = 2;
  12. // * CIRCUNFERENCIA = 3;
  13. // * RETA = 4;
  14. // * SEMIRETA = 5;
  15. // * SEGMENTO = 6;
  16. // * MED_DISTANCIA = 7; // Script: MEDIDA = 7
  17. // * MED_AREA = 8;
  18. // * PARALELA = 9;
  19. // * PERPENDICULAR = 10;
  20. // * MED_ARCO = 11;
  21. // * MED_EXPR = 12;
  22. // * PONTO_MEDIO = 13;
  23. // * CIRC_RAIO = 14;
  24. // * POLIGONO = 15;
  25. // * PONTO_SOBRE_DIST = 16;
  26. // * LOCUS = 17;
  27. // * MED_TEXTO = 20; // para textos
  28. // * CIRCUNFERENCIA_INT = 21; // [11/01/2006] estava 56, mas este num. e de rotacao
  29. export const ELEMENTS_CLASS = {
  30. NONE: -1,
  31. POINT: 0,
  32. INTERSECTION_POINT: 1,
  33. CIRCUMFERENCE: 3,
  34. LINE: 4,
  35. LINE_SEGMENT: 6,
  36. MIDDLE_POINT: 13
  37. };
  38. // Function to analyse the item TYPE (type of object: Point,...)
  39. // @calledby app/core/parser/file-parser.js!parseObjectLine (object_line)
  40. // @param {number} code
  41. export function fromCodeToClass (code) {
  42. //D console.trace();
  43. //D console.log("elements-class-enum.js!fromCodeToClass(" + code + ")");
  44. switch (code) {
  45. case 0: // type of object is Point
  46. return ELEMENTS_CLASS.POINT;
  47. case 1: // intersection point
  48. return ELEMENTS_CLASS.INTERSECTION_POINT;
  49. case 6: // segment
  50. return ELEMENTS_CLASS.LINE_SEGMENT;
  51. case 3: // circumference
  52. return ELEMENTS_CLASS.CIRCUMFERENCE;
  53. case 4: // line
  54. return ELEMENTS_CLASS.LINE;
  55. case 13: // mippoint
  56. return ELEMENTS_CLASS.MIDDLE_POINT;
  57. default:
  58. console.error("Type \"" + code + "\" is not yet implemented!");
  59. return ELEMENTS_CLASS.POINT;
  60. }
  61. }