Quellcode durchsuchen

Update 'src/app/core/application/identifier.js'

Fix ID numbering and read of GEO with 3 straight lines (not fineshed!)
Indentation and new methods, the second is important in reading GEO
+ getIdentifierNumber (): new
+ setIdentifierNumber (id): new
  called by 'app/core/models/objects/generic-object.js' to updat ID during GEO reading files (otherwise, after read the next object will receive the ID=1)
leo vor 2 Jahren
Ursprung
Commit
59fe66df3c
1 geänderte Dateien mit 26 neuen und 5 gelöschten Zeilen
  1. 26 5
      src/app/core/application/identifier.js

+ 26 - 5
src/app/core/application/identifier.js

@@ -1,9 +1,30 @@
+// iGeomJS
+// LInE
+// Identifier manages the number of objects
+
 export class Identifier {
-  constructor() {
+
+  // Start counter
+  constructor () {
     this.number = 1;
-  }
-  next() {
+    }
+
+  // @calledby app/core/models/objects/generic-object.js: constructor(id): if .. this.id = identifier.next();
+  next () {
     return this.number++;
+    }
+
+  // Help in debug process
+  getIdentifierNumber () {
+    return this.number;
+    }
+
+  // Necessary when reading GEO file
+  //  @calledby app/core/models/objects/generic-object.js: constructor(id): else { this.id = id; identifier.setIdentifierNumber(id+1); }
+  setIdentifierNumber (id) {
+    this.number = id;
+    }
+
   }
-}
-export const identifier = new Identifier();
+
+export const identifier = new Identifier();