Procházet zdrojové kódy

Update 'src/app/core/enums/elements-class-enum.js'

Fixes to read GEO file with midpoint.
Changed some comments, introduced new ones.
In "export function fromCodeToClass (code)", was missing important case!
case 13: return ELEMENTS_CLASS.MIDDLE_POINT;
leo před 2 roky
rodič
revize
3050e46cca
1 změnil soubory, kde provedl 38 přidání a 30 odebrání
  1. 38 30
      src/app/core/enums/elements-class-enum.js

+ 38 - 30
src/app/core/enums/elements-class-enum.js

@@ -6,6 +6,27 @@
  * @version 2020/11/02: Implemented Line instersection
  */
 
+// TYPE of objects in iGeom
+// * PONTO                      =   0;
+// * PONTO_INTERSECAO           =   1;
+// * PONTO_SOBRE                =   2;
+// * CIRCUNFERENCIA             =   3;
+// * RETA                       =   4;
+// * SEMIRETA                   =   5;
+// * SEGMENTO                   =   6;
+// * MED_DISTANCIA              =   7; //  Script: MEDIDA = 7
+// * MED_AREA                   =   8;
+// * PARALELA                   =   9;
+// * PERPENDICULAR              =  10;
+// * MED_ARCO                   =  11;
+// * MED_EXPR                   =  12;
+// * PONTO_MEDIO                =  13;
+// * CIRC_RAIO                  =  14;
+// * POLIGONO                   =  15;
+// * PONTO_SOBRE_DIST           =  16;
+// * LOCUS                      =  17;
+// * MED_TEXTO                  =  20;  // para textos
+// * CIRCUNFERENCIA_INT         =  21; // [11/01/2006] estava 56, mas este num. e de rotacao
 export const ELEMENTS_CLASS = {
   NONE: -1,
   POINT: 0,
@@ -14,44 +35,31 @@ export const ELEMENTS_CLASS = {
   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
-};
+  };
 
+
+// Function to analyse the item TYPE (type of object: Point,...)
+// @calledby app/core/parser/file-parser.js!parseObjectLine (object_line)
 // @param {number} code
-export function fromCodeToClass(code) {
+export function fromCodeToClass (code) {
+  //D console.trace();
+  console.log("elements-class-enum.js!fromCodeToClass(" + code + ")");
   switch (code) {
-    case 0:
+    case 0: // type of object is Point
       return ELEMENTS_CLASS.POINT;
-    case 1:
+    case 1: // intersection point
       return ELEMENTS_CLASS.INTERSECTION_POINT;
-    case 6:
+    case 6: // segment
       return ELEMENTS_CLASS.LINE_SEGMENT;
-    case 3:
+    case 3: // circumference
       return ELEMENTS_CLASS.CIRCUMFERENCE;
-    case 4:
+    case 4: // line
       return ELEMENTS_CLASS.LINE;
+    case 13: // mippoint
+      return ELEMENTS_CLASS.MIDDLE_POINT;
     default:
-      console.error("Tipo não suportado" + "\"" + code + "\"", code)
+      console.error("Type \"" + code + "\" is not yet implemented!");
       return ELEMENTS_CLASS.POINT;
-  }
+    }
 
-}
+  }