Просмотр исходного кода

Update 'src/app/core/parser/file-parser.js'

Only added explaining comments.
leo 2 месяцев назад
Родитель
Сommit
66fdb67094
1 измененных файлов с 10 добавлено и 9 удалено
  1. 10 9
      src/app/core/parser/file-parser.js

+ 10 - 9
src/app/core/parser/file-parser.js

@@ -106,10 +106,11 @@ export class FileParser {
       key = parseInt(prop_info[0]);
       if (prop_info[1] == undefined) continue;
       if (key == TYPE) { // TYPE = 0
+        // TYPE = {0 => Point; 1=>IntersectionPoint; 2=>PointOver; 3=>Circumference; 4=>StraightLine; 5=>Ray; 6=>Segment; ... },
         type = prop_info[1];
         str2Debug += "TYPE=" + key + ": " + type + ", "; //D13
         map.set("type", ObjectClass.fromCodeToClass(parseInt(type)));
-      } else if (key == ID) {
+      } else if (key == ID) { // ID = 0
         id = prop_info[1];
         value_id = parseInt(id);
         str2Debug += "ID=" + key + ": " + (value_id+0) + ", "; //D13 "value_id+0" to identify error in "integer"
@@ -138,18 +139,18 @@ export class FileParser {
         //DD console.log("file-parser.js: DEFINITION: " + aux); //D_
         map.set("param", definition_param_list);
         str2Debug += "), "; //D13
-      } else if (key == LIST) {
+      } else if (key == LIST) { // LIST = 3
         str2Debug += "LIST=" + key + ": ("; //D13
         id_list = [];
         array_list = prop_info[1].trim().split(" ");
         for (const i in array_list) {
           const id1 = array_list[i];
-        str2Debug += id1 + ", "; //D13
+          str2Debug += id1 + ", "; //D13
           id_list.push(id1);
           }
         str2Debug += "), "; //D13
         map.set("deps", id_list);
-      } else if (key == LABEL) {
+      } else if (key == LABEL) { // LABEL = 4
         str2Debug += "LABEL=" + key + ": ("; //D13
         label_param_list = [];
         const list = prop_info[1].trim().split(" ");
@@ -165,11 +166,11 @@ export class FileParser {
           }
         str2Debug += "), "; //D13
         map.set("label", label_param_list);
-      } else if (key == DEFINED) {
+      } else if (key == DEFINED) { // DEFINED = 6
         defined_value = prop_info[1];
         str2Debug += "DEFINED=" + key + ": " + defined_value + ", "; //D13
         map.set("defined", parseInt(defined_value));
-      } else if (key == COLOR) {
+      } else if (key == COLOR) { // COLOR = 5
         color_value = prop_info[1];
         str2Debug += "COLOR=" + key + ": " + color_value + ", "; //D13
         let number = Number(color_value);
@@ -179,7 +180,7 @@ export class FileParser {
         const g = (number >> 8) & 0xff;
         const b = number & 0xff;
         map.set("color", { alpha: alpha, r: r, g: g, b: b });
-      } else if (key == HIDDEN) {
+      } else if (key == HIDDEN) { // HIDDEN = 7
         hidden_value = prop_info[1];
         str2Debug += "HIDDEN=" + key + ": " + hidden_value + ", "; //D13
         if (hidden_value) // optional: if empty do not insert this property
@@ -202,12 +203,12 @@ export class FileParser {
         if (count_pix>0) // optional: if empty do not insert this property
           map.set("position", pixel_position);
         console.log("file-parser.js!parseObjectLine(): PIXEL=" + PIXEL + ", count_pix=" + count_pix);
-      } else if (key == FONT) {
+      } else if (key == FONT) { // FONT = 9
         font_param_list = prop_info[1].trim().split(" ");
         if (font_param_list && font_param_list.length>0) // optional: if empty do not insert this property
           map.set("font", font_param_list);
         str2Debug += "FONT=" + key + ": " + font_param_list + ", "; //D13
-      } else if (key == LABEL_COLOR) {
+      } else if (key == LABEL_COLOR) { // LABEL_COLOR = 10
         label_color_value = prop_info[1];
         str2Debug += "LABEL_COLOR=" + key + ": (" + label_color_value + "="; //D13
         let number = Number(label_color_value);