Browse Source

Rename variable

customisations
alemart 10 months ago
parent
commit
7fce0e1b29
1 changed files with 11 additions and 10 deletions
  1. 11
    10
      src/trackers/image-tracker/reference-image-database.ts

+ 11
- 10
src/trackers/image-tracker/reference-image-database.ts View File

53
  */
53
  */
54
 export class ReferenceImageDatabase implements Iterable<ReferenceImage>
54
 export class ReferenceImageDatabase implements Iterable<ReferenceImage>
55
 {
55
 {
56
-    /** Image database */
57
-    private _database: ReferenceImageDatabaseEntry[];
56
+    /** Entries */
57
+    private _entries: ReferenceImageDatabaseEntry[];
58
 
58
 
59
     /** Maximum number of entries */
59
     /** Maximum number of entries */
60
     private _capacity: number;
60
     private _capacity: number;
73
     constructor()
73
     constructor()
74
     {
74
     {
75
         this._capacity = DEFAULT_CAPACITY;
75
         this._capacity = DEFAULT_CAPACITY;
76
-        this._database = [];
76
+        this._entries = [];
77
         this._locked = false;
77
         this._locked = false;
78
         this._busy = false;
78
         this._busy = false;
79
     }
79
     }
83
      */
83
      */
84
     get count(): number
84
     get count(): number
85
     {
85
     {
86
-        return this._database.length;
86
+        return this._entries.length;
87
     }
87
     }
88
 
88
 
89
     /**
89
     /**
113
      */
113
      */
114
     *[Symbol.iterator](): Iterator<ReferenceImage>
114
     *[Symbol.iterator](): Iterator<ReferenceImage>
115
     {
115
     {
116
-        const ref = this._database.map(entry => entry.referenceImage);
116
+        const ref = this._entries.map(entry => entry.referenceImage);
117
         yield* ref;
117
         yield* ref;
118
     }
118
     }
119
 
119
 
157
             throw new IllegalArgumentError(`Can't add reference image "${referenceImage.name}" to the database: invalid image`);
157
             throw new IllegalArgumentError(`Can't add reference image "${referenceImage.name}" to the database: invalid image`);
158
 
158
 
159
         // check for duplicate names
159
         // check for duplicate names
160
-        if(this._database.find(entry => entry.referenceImage.name === referenceImage.name) !== undefined)
160
+        if(this._entries.find(entry => entry.referenceImage.name === referenceImage.name) !== undefined)
161
             throw new IllegalArgumentError(`Can't add reference image "${referenceImage.name}" to the database: found duplicated name`);
161
             throw new IllegalArgumentError(`Can't add reference image "${referenceImage.name}" to the database: found duplicated name`);
162
 
162
 
163
         // load the media and add the reference image to the database
163
         // load the media and add the reference image to the database
164
+        Utils.log(`Loading reference image "${referenceImage.name}"...`);
164
         this._busy = true;
165
         this._busy = true;
165
         return Speedy.load(referenceImage.image).then(media => {
166
         return Speedy.load(referenceImage.image).then(media => {
166
             this._busy = false;
167
             this._busy = false;
167
-            this._database.push({
168
+            this._entries.push({
168
                 referenceImage: Object.freeze({
169
                 referenceImage: Object.freeze({
169
                     ...referenceImage,
170
                     ...referenceImage,
170
                     name: referenceImage.name || generateUniqueName()
171
                     name: referenceImage.name || generateUniqueName()
194
      */
195
      */
195
     _findMedia(name: string): SpeedyMedia
196
     _findMedia(name: string): SpeedyMedia
196
     {
197
     {
197
-        for(let i = 0; i < this._database.length; i++) {
198
-            if(this._database[i].referenceImage.name === name)
199
-                return this._database[i].media;
198
+        for(let i = 0; i < this._entries.length; i++) {
199
+            if(this._entries[i].referenceImage.name === name)
200
+                return this._entries[i].media;
200
         }
201
         }
201
 
202
 
202
         throw new IllegalArgumentError(`Can't find reference image "${name}"`);
203
         throw new IllegalArgumentError(`Can't find reference image "${name}"`);

Loading…
Cancel
Save