• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ngageoint / geopackage-js / 3847620801

pending completion
3847620801

push

github

Christopher Caldwell
another batch of test case updates and fixes

3185 of 7992 branches covered (39.85%)

Branch coverage included in aggregate %.

662 of 662 new or added lines in 46 files covered. (100.0%)

14090 of 20348 relevant lines covered (69.25%)

621.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.4
/lib/features/user/manualFeatureQuery.ts
1
import { Projection } from '@ngageoint/projections-js';
2
import { BoundingBox } from '../../boundingBox';
1✔
3
import { ColumnValues } from '../../dao/columnValues';
4
import { SQLUtils } from '../../db/sqlUtils';
1✔
5
import { FeatureDao } from './featureDao';
6
import { FeatureResultSet } from './featureResultSet';
7
import { ManualFeatureQueryResults } from './manualFeatureQueryResults';
1✔
8
import { DBValue } from '../../db/dbValue';
9
import { GeometryEnvelope } from '@ngageoint/simple-features-js';
10
import { FeatureRow } from './featureRow';
11
import { GeometryTransform } from '@ngageoint/simple-features-proj-js';
1✔
12

13
/**
14
 * Performs manual brute force queries against feature rows. See
15
 * {@link FeatureIndexManager} for performing indexed queries.
16
 */
17
export class ManualFeatureQuery {
1✔
18

19
        /**
20
         * Feature DAO
21
         */
22
        private readonly featureDao: FeatureDao;
23

24
        /**
25
         * Query single chunk limit
26
         */
27
        protected chunkLimit = 1000;
50✔
28

29
        /**
30
         * Query range tolerance
31
         */
32
        protected tolerance = .00000000000001;
50✔
33

34
        /**
35
         * Constructor
36
         * @param featureDao feature DAO
37
         */
38
        public constructor(featureDao: FeatureDao) {
39
                this.featureDao = featureDao;
50✔
40
        }
41

42
        /**
43
         * Get the feature DAO
44
         * @return feature DAO
45
         */
46
        public getFeatureDao(): FeatureDao {
1✔
47
                return this.featureDao;
×
48
        }
49

50
        /**
51
         * Get the SQL query chunk limit
52
         * @return chunk limit
53
         */
54
        public getChunkLimit(): number {
1✔
55
                return this.chunkLimit;
×
56
        }
57

58
        /**
59
         * Set the SQL query chunk limit
60
         * @param chunkLimit chunk limit
61
         */
62
        public setChunkLimit(chunkLimit: number): void {
1✔
63
                this.chunkLimit = chunkLimit;
×
64
        }
65

66
        /**
67
         * Get the query range tolerance
68
         * @return query range tolerance
69
         */
70
        public getTolerance(): number {
1✔
71
                return this.tolerance;
×
72
        }
73

74
        /**
75
         * Set the query range tolerance
76
         * @param tolerance query range tolerance
77
         */
78
        public setTolerance(tolerance: number): void {
1✔
79
                this.tolerance = tolerance;
×
80
        }
81

82
        /**
83
         * Query
84
         * @param where
85
         * @param whereArgs
86
         * @param join
87
         * @param groupBy
88
         * @param having
89
         * @param orderBy
90
         * @param limit
91
         * @param offset
92
         */
93
        public query(where?: string, whereArgs?: any[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): FeatureResultSet {
1✔
94
                return this.featureDao.query(where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
95
        }
96

97
        /**
98
         * Query
99
         * @param distinct
100
         * @param where
101
         * @param whereArgs
102
         * @param join
103
         * @param groupBy
104
         * @param having
105
         * @param orderBy
106
         * @param limit
107
         * @param offset
108
         */
109
        public queryWithDistinct(distinct: boolean, where?: string, whereArgs?: any[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): FeatureResultSet {
1✔
110
                return this.featureDao.queryWithDistinct(distinct, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
111
        }
112

113
        /**
114
         * Query
115
         * @param columns
116
         * @param where
117
         * @param whereArgs
118
         * @param join
119
         * @param groupBy
120
         * @param having
121
         * @param orderBy
122
         * @param limit
123
         * @param offset
124
         */
125
        public queryWithColumns(columns: string[], where?: string, whereArgs?: any[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): FeatureResultSet {
1✔
126
                return this.featureDao.queryWithColumns(columns, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
127
        }
128

129
        /**
130
         * Query
131
         * @param distinct
132
         * @param columns
133
         * @param where
134
         * @param whereArgs
135
         * @param join
136
         * @param groupBy
137
         * @param having
138
         * @param orderBy
139
         * @param limit
140
         * @param offset
141
         */
142
        public queryWithDistinctAndColumns(distinct = false, columns: string[] = this.featureDao.getColumnNames(), where?: string, whereArgs?: any[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): FeatureResultSet {
1!
143
                return this.featureDao.queryWithDistinctAndColumns(distinct, columns, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
144
        }
145

146

147
        /**
148
         * Count of feature rows
149
         * @param where
150
         * @param whereArgs
151
         * @param join
152
         * @param groupBy
153
         * @param having
154
         * @param orderBy
155
         * @param limit
156
         * @param offset
157
         */
158
        public count(where?: string, whereArgs?: [] | DBValue[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): number {
1✔
159
                return this.countWithDistinctAndColumns(undefined, undefined, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
160
        }
161

162
        /**
163
         * Count of feature rows
164
         * @param distinct
165
         * @param where
166
         * @param whereArgs
167
         * @param join
168
         * @param groupBy
169
         * @param having
170
         * @param orderBy
171
         * @param limit
172
         * @param offset
173
         */
174
        public countWithDistinct(distinct = false, where?: string, whereArgs?: [] | DBValue[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): number {
1!
175
                return this.countWithDistinctAndColumns(distinct, undefined, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
176
        }
177

178
        /**
179
         * Count of feature rows
180
         * @param columns
181
         * @param where
182
         * @param whereArgs
183
         * @param join
184
         * @param groupBy
185
         * @param having
186
         * @param orderBy
187
         * @param limit
188
         * @param offset
189
         */
190
        public countWithColumns(columns: string[] = this.featureDao.getColumnNames(), where?: string, whereArgs?: [] | DBValue[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): number {
1!
191
                return this.countWithDistinctAndColumns(undefined, columns, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
192
        }
193

194
        /**
195
         * Count of feature rows
196
         * @param distinct
197
         * @param columns
198
         * @param where
199
         * @param whereArgs
200
         * @param join
201
         * @param groupBy
202
         * @param having
203
         * @param orderBy
204
         * @param limit
205
         * @param offset
206
         */
207
        public countWithDistinctAndColumns(distinct = false, columns: string[] = this.featureDao.getColumnNames(), where?: string, whereArgs?: [] | DBValue[], join?: string, groupBy?: string, having?: string, orderBy?: string, limit?: number, offset?: number): number {
1!
208
                return this.featureDao.countWithDistinctAndColumns(distinct, columns, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
209
        }
210

211
        /**
212
         * Get the count of features with non null geometries
213
         *
214
         * @return count
215
         */
216
        public countWithGeometries(): number {
1✔
217
                return this.featureDao.count(SQLUtils.quoteWrap(this.featureDao.getGeometryColumnName()) + " IS NOT NULL");
×
218
        }
219

220
        /**
221
         * Get a count of results
222
         *
223
         * @param distinct
224
         * @param column count column name
225
         * @return count
226
         */
227
        public countColumn(distinct = false, column: string): number {
1!
228
                return this.featureDao.countColumn(distinct, column, undefined, undefined);
×
229
        }
230

231
        /**
232
         * Query for features
233
         * @param fieldValues field values
234
         * @return feature results
235
         */
236
        public queryWithFieldValues(fieldValues: ColumnValues): FeatureResultSet {
1✔
237
                return this.queryWithFieldValuesAndDistinctAndColumns(undefined, undefined, fieldValues);
×
238
        }
239

240
        /**
241
         * Query for features
242
         * @param distinct distinct rows
243
         * @param fieldValues field values
244
         * @return feature results
245
         */
246
        public queryWithFieldValuesAndDistinct(distinct: boolean, fieldValues: ColumnValues): FeatureResultSet {
1✔
247
                return this.queryWithFieldValuesAndDistinctAndColumns(distinct, undefined, fieldValues);
×
248
        }
249

250
        /**
251
         * Query for features
252
         * @param columns columns
253
         * @param fieldValues field values
254
         * @return feature results
255
         */
256
        public queryWithFieldValuesAndColumns(columns: string[], fieldValues: ColumnValues): FeatureResultSet {
1✔
257
                return this.queryWithFieldValuesAndDistinctAndColumns(undefined, columns, fieldValues);
×
258
        }
259

260
        /**
261
         * Query for features
262
         * @param distinct distinct rows
263
         * @param columns columns
264
         * @param fieldValues field values
265
         * @return feature results
266
         */
267
        public queryWithFieldValuesAndDistinctAndColumns(distinct: boolean, columns: string[], fieldValues: ColumnValues): FeatureResultSet {
1✔
268
                const where: string = this.featureDao.buildWhereWithFields(fieldValues);
×
269
                const whereArgs: any[] = this.featureDao.buildWhereArgs(fieldValues);
×
270
                return this.featureDao.queryInWithDistinctAndColumns(distinct, columns, where, whereArgs);
×
271
        }
272

273
        /**
274
         * Count features
275
         * @param distinct distinct column values
276
         * @param column count column name
277
         * @param fieldValues field values
278
         * @return count
279
         */
280
        public countWithFieldValues(distinct: boolean = false, column: string, fieldValues: ColumnValues): number {
1!
281
                const where: string = this.featureDao.buildWhereWithFields(fieldValues);
×
282
                const whereArgs: any[] = this.featureDao.buildWhereArgs(fieldValues);
×
283
                return this.featureDao.countColumn(distinct, column, where, whereArgs);
×
284
        }
285

286
        /**
287
         * Manually build the bounds of the feature table
288
         * @return bounding box
289
         */
290
        public getBoundingBox(): BoundingBox {
1✔
291
                let envelope = null;
×
292
                let offset: number = 0;
×
293
                let hasResults = true;
×
294
                const columns: string[] = [this.featureDao.getGeometryColumnName()];
×
295
                while (hasResults) {
×
296
                        hasResults = false;
×
297
                        const resultSet = this.featureDao.queryForChunkWithColumns(columns, undefined, undefined, undefined, undefined, undefined, this.chunkLimit, offset);
×
298
                        while (resultSet.moveToNext()) {
×
299
                                hasResults = true;
×
300
                                const featureRow = resultSet.getRow();
×
301
                                const featureEnvelope = featureRow.getGeometryEnvelope();
×
302
                                if (featureEnvelope != null) {
×
303
                                        if (envelope == null) {
×
304
                                                envelope = featureEnvelope;
×
305
                                        } else {
306
                                                envelope = envelope.union(featureEnvelope);
×
307
                                        }
308
                                }
309
                        }
310
                        offset += this.chunkLimit;
×
311
                }
312
                let boundingBox = null;
×
313
                if (envelope != null) {
×
314
                        boundingBox = new BoundingBox(envelope);
×
315
                }
316
                return boundingBox;
×
317
        }
318

319
        /**
320
         * Manually build the bounds of the feature table in the provided projection
321
         * @param projection desired projection
322
         * @return bounding box
323
         */
324
        public getBoundingBoxWithProjection(projection: Projection): BoundingBox {
1✔
325
                let boundingBox = this.getBoundingBox();
×
326
                if (boundingBox != null && projection != null) {
×
327
                        const projectionTransform = GeometryTransform.create(this.featureDao.getProjection(), projection);
×
328
                        boundingBox = boundingBox.transform(projectionTransform);
×
329
                }
330
                return boundingBox;
×
331
        }
332

333
        /**
334
         * Manually query for rows within the bounding box
335
         * @param boundingBox bounding box
336
         * @return results
337
         */
338
        public queryWithBoundingBox(boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
339
                return this.queryWithGeometryEnvelope(boundingBox.buildEnvelope());
×
340
        }
341

342
        /**
343
         * Manually query for rows within the bounding box
344
         * @param distinct distinct rows
345
         * @param boundingBox bounding box
346
         * @return results
347
         */
348
        public queryWithBoundingBoxAndDistinct(distinct: boolean, boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
349
                return this.queryWithGeometryEnvelopeAndDistinct(distinct, boundingBox.buildEnvelope());
×
350
        }
351

352
        /**
353
         * Manually query for rows within the bounding box
354
         * @param columns columns
355
         * @param boundingBox bounding box
356
         * @return results
357
         */
358
        public queryWithBoundingBoxAndColumns(columns: string[], boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
359
                return this.queryWithGeometryEnvelopeAndColumns(columns, boundingBox.buildEnvelope());
×
360
        }
361

362
        /**
363
         * Manually query for rows within the bounding box
364
         * @param distinct distinct rows
365
         * @param columns columns
366
         * @param boundingBox bounding box
367
         * @return results
368
         */
369
        public queryWithBoundingBoxAndDistinctAndColumns(distinct: boolean, columns: string[], boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
370
                return this.queryWithGeometryEnvelopeAndDistinctAndColumns(distinct, columns, boundingBox.buildEnvelope());
×
371
        }
372

373
        /**
374
         * Manually count the rows within the bounding box
375
         * @param boundingBox bounding box
376
         * @return count
377
         */
378
        public countWithBoundingBox(boundingBox: BoundingBox): number {
1✔
379
                return this.countWithGeometryEnvelope(boundingBox.buildEnvelope());
×
380
        }
381

382
        /**
383
         * Manually query for rows within the bounding box
384
         * @param boundingBox bounding box
385
         * @param fieldValues field values
386
         * @return results
387
         */
388
        public queryWithBoundingBoxAndFieldValues(boundingBox: BoundingBox, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
389
                return this.queryWithGeometryEnvelopeAndFieldValues(boundingBox.buildEnvelope(), fieldValues);
×
390
        }
391

392
        /**
393
         * Manually query for rows within the bounding box
394
         * @param distinct distinct rows
395
         * @param boundingBox bounding box
396
         * @param fieldValues field values
397
         * @return results
398
         */
399
        public queryWithBoundingBoxAndFieldValuesAndDistinct(distinct: boolean, boundingBox: BoundingBox, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
400
                return this.queryWithGeometryEnvelopeAndFieldValuesAndDistinct(distinct, boundingBox.buildEnvelope(), fieldValues);
×
401
        }
402

403
        /**
404
         * Manually query for rows within the bounding box
405
         * @param columns columns
406
         * @param boundingBox bounding box
407
         * @param fieldValues field values
408
         * @return results
409
         */
410
        public queryWithBoundingBoxAndFieldValuesAndColumns(columns: string[], boundingBox: BoundingBox, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
411
                return this.queryWithGeometryEnvelopeAndFieldValuesAndColumns(columns, boundingBox.buildEnvelope(), fieldValues);
×
412
        }
413

414
        /**
415
         * Manually query for rows within the bounding box
416
         * @param distinct distinct rows
417
         * @param columns columns
418
         * @param boundingBox bounding box
419
         * @param fieldValues field values
420
         * @return results
421
         */
422
        public queryWithBoundingBoxAndFieldValuesAndDistinctAndColumns(distinct: boolean, columns: string[], boundingBox: BoundingBox, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
423
                return this.queryWithGeometryEnvelopeAndFieldValuesAndDistinctAndColumns(distinct, columns, boundingBox.buildEnvelope(), fieldValues);
×
424
        }
425

426
        /**
427
         * Manually count the rows within the bounding box
428
         * @param boundingBox bounding box
429
         * @param fieldValues field values
430
         * @return count
431
         */
432
        public countWithBoundingBoxAndFieldValues(boundingBox: BoundingBox, fieldValues: ColumnValues): number {
1✔
433
                return this.countWithGeometryEnvelopeAndFieldValues(boundingBox.buildEnvelope(), fieldValues);
×
434
        }
435

436
        /**
437
         * Manually query for rows within the bounding box in the provided
438
         * projection
439
         * @param boundingBox bounding box
440
         * @param projection: Projection
441
         * @return results
442
         */
443
        public queryWithBoundingBoxAndProjection(boundingBox: BoundingBox, projection: Projection): ManualFeatureQueryResults {
1✔
444
                return this.queryWithBoundingBoxAndProjectionAndDistinctAndColumns(undefined, undefined, boundingBox, projection);
×
445
        }
446

447
        /**
448
         * Manually query for rows within the bounding box in the provided
449
         * projection
450
         * @param distinct distinct rows
451
         * @param boundingBox bounding box
452
         * @param projection: Projection
453
         * @return results
454
         */
455
        public queryWithBoundingBoxAndProjectionAndDistinct(distinct: boolean, boundingBox: BoundingBox, projection: Projection): ManualFeatureQueryResults {
1✔
456
                return this.queryWithBoundingBoxAndProjectionAndDistinctAndColumns(distinct, undefined, boundingBox, projection);
×
457
        }
458

459
        /**
460
         * Manually query for rows within the bounding box in the provided
461
         * projection
462
         * @param columns columns
463
         * @param boundingBox bounding box
464
         * @param projection: Projection
465
         * @return results
466
         */
467
        public queryWithBoundingBoxAndProjectionAndColumns(columns: string[], boundingBox: BoundingBox, projection: Projection): ManualFeatureQueryResults {
1✔
468
                return this.queryWithBoundingBoxAndProjectionAndDistinctAndColumns(undefined, columns, boundingBox, projection);
×
469
        }
470

471
        /**
472
         * Manually query for rows within the bounding box in the provided
473
         * projection
474
         * @param distinct distinct rows
475
         * @param columns columns
476
         * @param boundingBox bounding box
477
         * @param projection: Projection
478
         * @return results
479
         */
480
        public queryWithBoundingBoxAndProjectionAndDistinctAndColumns(distinct: boolean, columns: string[], boundingBox: BoundingBox, projection: Projection): ManualFeatureQueryResults {
1✔
481
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
482
                return this.queryWithBoundingBoxAndDistinctAndColumns(distinct, columns, featureBoundingBox);
×
483
        }
484

485
        /**
486
         * Manually count the rows within the bounding box in the provided projection
487
         * @param boundingBox bounding box
488
         * @param projection: Projection
489
         * @return count
490
         */
491
        public countWithBoundingBoxAndProjection(boundingBox: BoundingBox, projection: Projection): number {
1✔
492
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
493
                return this.countWithBoundingBox(featureBoundingBox);
×
494
        }
495

496
        /**
497
         * Manually query for rows within the bounding box in the provided
498
         * projection
499
         * @param boundingBox bounding box
500
         * @param projection: Projection
501
         * @param fieldValues field values
502
         * @return results
503
         */
504
        public queryWithBoundingBoxAndProjectionAndFieldValues(boundingBox: BoundingBox, projection: Projection, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
505
                return this.queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(undefined, undefined, boundingBox, projection, fieldValues);
×
506
        }
507

508
        /**
509
         * Manually query for rows within the bounding box in the provided
510
         * projection
511
         * @param distinct distinct rows
512
         * @param boundingBox bounding box
513
         * @param projection: Projection
514
         * @param fieldValues field values
515
         * @return results
516
         */
517
        public queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinct(distinct: boolean, boundingBox: BoundingBox, projection: Projection, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
518
                return this.queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(distinct, undefined, boundingBox, projection, fieldValues);
×
519
        }
520

521
        /**
522
         * Manually query for rows within the bounding box in the provided
523
         * projection
524
         * @param columns columns
525
         * @param boundingBox bounding box
526
         * @param projection: Projection
527
         * @param fieldValues field values
528
         * @return results
529
         */
530
        public queryWithBoundingBoxAndProjectionAndFieldValuesAndColumns(columns: string[], boundingBox: BoundingBox, projection: Projection, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
531
                return this.queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(undefined, columns, boundingBox, projection, fieldValues);
×
532
        }
533

534
        /**
535
         * Manually query for rows within the bounding box in the provided
536
         * projection
537
         * @param distinct distinct rows
538
         * @param columns columns
539
         * @param boundingBox bounding box
540
         * @param projection: Projection
541
         * @param fieldValues field values
542
         * @return results
543
         */
544
        public queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(distinct: boolean, columns: string[], boundingBox: BoundingBox, projection: Projection, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
545
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
546
                return this.queryWithBoundingBoxAndFieldValuesAndDistinctAndColumns(distinct, columns, featureBoundingBox, fieldValues);
×
547
        }
548

549
        /**
550
         * Manually count the rows within the bounding box in the provided
551
         * projection
552
         * @param boundingBox bounding box
553
         * @param projection: Projection
554
         * @param fieldValues field values
555
         * @return count
556
         */
557
        public countWithBoundingBoxAndProjectionAndFieldValues(boundingBox: BoundingBox, projection: Projection, fieldValues: ColumnValues): number {
1✔
558
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
559
                return this.countWithBoundingBoxAndFieldValues(featureBoundingBox, fieldValues);
×
560
        }
561

562
        /**
563
         * Manually query for rows within the bounding box in the provided
564
         * projection
565
         * @param boundingBox bounding box
566
         * @param projection: Projection
567
         * @param where where clause
568
         * @param whereArgs where arguments
569
         * @return results
570
         */
571
        public queryWhereWithBoundingBoxAndProjection(boundingBox: BoundingBox, projection: Projection, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
572
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
573
                return this.queryWhereWithBoundingBox(featureBoundingBox, where, whereArgs);
×
574
        }
575

576
        /**
577
         * Manually query for rows within the bounding box in the provided
578
         * projection
579
         * @param distinct distinct rows
580
         * @param boundingBox bounding box
581
         * @param projection: Projection
582
         * @param where where clause
583
         * @param whereArgs where arguments
584
         * @return results
585
         */
586
        public queryWhereWithBoundingBoxAndProjectionAndDistinct(distinct: boolean, boundingBox: BoundingBox, projection: Projection, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
587
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
588
                return this.queryWhereWithBoundingBoxAndDistinct(distinct, featureBoundingBox, where, whereArgs);
×
589
        }
590

591
        /**
592
         * Manually query for rows within the bounding box in the provided
593
         * projection
594
         * @param columns columns
595
         * @param boundingBox bounding box
596
         * @param projection: Projection
597
         * @param where where clause
598
         * @param whereArgs where arguments
599
         * @return results
600
         */
601
        public queryWhereWithBoundingBoxAndProjectionAndColumns(columns: string[], boundingBox: BoundingBox, projection: Projection, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
602
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
603
                return this.queryWhereWithBoundingBoxAndColumns(columns, featureBoundingBox, where, whereArgs);
×
604
        }
605

606
        /**
607
         * Manually query for rows within the bounding box in the provided
608
         * projection
609
         * @param distinct distinct rows
610
         * @param columns columns
611
         * @param boundingBox bounding box
612
         * @param projection: Projection
613
         * @param where where clause
614
         * @param whereArgs where arguments
615
         * @return results
616
         */
617
        public queryWhereWithBoundingBoxAndProjectionAndDistinctAndColumns(distinct: boolean, columns: string[], boundingBox: BoundingBox, projection: Projection, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
618
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
619
                return this.queryWhereWithBoundingBoxAndDistinctAndColumns(distinct, columns, featureBoundingBox, where, whereArgs);
×
620
        }
621

622
        /**
623
         * Manually count the rows within the bounding box in the provided
624
         * projection
625
         * @param boundingBox bounding box
626
         * @param projection: Projection
627
         * @param where where clause
628
         * @param whereArgs where arguments
629
         * @return count
630
         */
631
        public countWhereWithBoundingBoxAndProjection(boundingBox: BoundingBox, projection: Projection, where: string, whereArgs: any[]): number {
1✔
632
                const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
633
                return this.countWhereWithBoundingBox(featureBoundingBox, where, whereArgs);
×
634
        }
635

636
        /**
637
         * Manually query for rows within the geometry envelope
638
         * @param envelope geometry envelope
639
         * @return results
640
         */
641
        public queryWithGeometryEnvelope(envelope: GeometryEnvelope): ManualFeatureQueryResults {
1✔
642
                return this.queryWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
643
        }
644

645
        /**
646
         * Manually query for rows within the geometry envelope
647
         * @param envelope geometry envelope
648
         * @param distinct distinct rows
649
         * @return results
650
         */
651
        public queryWithGeometryEnvelopeAndDistinct(distinct: boolean, envelope: GeometryEnvelope): ManualFeatureQueryResults {
1✔
652
                return this.queryWithBoundsAndDistinct(distinct, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
653
        }
654

655
        /**
656
         * Manually query for rows within the geometry envelope
657
         * @param envelope geometry envelope
658
         * @param columns columns
659
         * @return results
660
         */
661
        public queryWithGeometryEnvelopeAndColumns(columns: string[], envelope: GeometryEnvelope): ManualFeatureQueryResults {
1✔
662
                return this.queryWithBoundsAndColumns(columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
663
        }
664

665
        /**
666
         * Manually query for rows within the geometry envelope
667
         * @param envelope geometry envelope
668
         * @param distinct distinct rows
669
         * @param columns columns
670
         * @return results
671
         */
672
        public queryWithGeometryEnvelopeAndDistinctAndColumns(distinct: boolean, columns: string[], envelope: GeometryEnvelope): ManualFeatureQueryResults {
1✔
673
                return this.queryWithBoundsAndDistinctAndColumns(distinct, columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
674
        }
675

676
        /**
677
         * Manually count the rows within the geometry envelope
678
         * @param envelope geometry envelope
679
         * @param where where clause
680
         * @param whereArgs where args
681
         * @return count
682
         */
683
        public countWithGeometryEnvelope(envelope: GeometryEnvelope, where?: string, whereArgs?: any[]): number {
1✔
684
                return this.countWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
685
        }
686
        
687
        /**
688
         * Manually query for rows within the geometry envelope
689
         * @param envelope geometry envelope
690
         * @param fieldValues field values
691
         * @return results
692
         */
693
        public queryWithGeometryEnvelopeAndFieldValues(envelope: GeometryEnvelope, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
694
                return this.queryWithBoundsAndFieldValues(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
695
        }
696

697
        /**
698
         * Manually query for rows within the geometry envelope
699
         * @param distinct distinct rows
700
         * @param envelope geometry envelope
701
         * @param fieldValues field values
702
         * @return results
703
         */
704
        public queryWithGeometryEnvelopeAndFieldValuesAndDistinct(distinct: boolean, envelope: GeometryEnvelope, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
705
                return this.queryWithBoundsAndFieldValuesAndDistinct(distinct, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
706
        }
707

708
        /**
709
         * Manually query for rows within the geometry envelope
710
         * @param columns columns
711
         * @param envelope geometry envelope
712
         * @param fieldValues field values
713
         * @return results
714
         */
715
        public queryWithGeometryEnvelopeAndFieldValuesAndColumns(columns: string[], envelope: GeometryEnvelope, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
716
                return this.queryWithBoundsAndFieldValuesAndColumns(columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
717
        }
718

719
        /**
720
         * Manually query for rows within the geometry envelope
721
         *
722
         * @param distinct distinct rows
723
         * @param columns columns
724
         * @param envelope geometry envelope
725
         * @param fieldValues field values
726
         * @return results
727
         */
728
        public queryWithGeometryEnvelopeAndFieldValuesAndDistinctAndColumns(distinct: boolean, columns: string[], envelope: GeometryEnvelope, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
729
                return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(distinct, columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
730
        }
731

732
        /**
733
         * Manually count the rows within the geometry envelope
734
         * @param envelope geometry envelope
735
         * @param fieldValues field values
736
         * @return count
737
         */
738
        public countWithGeometryEnvelopeAndFieldValues(envelope: GeometryEnvelope, fieldValues: ColumnValues): number {
1✔
739
                return this.countWithBoundsAndFieldValues(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
740
        }
741

742
        /**
743
         * Manually query for rows within the bounding box
744
         * @param boundingBox bounding box
745
         * @param where where clause
746
         * @param whereArgs where arguments
747
         * @return results
748
         */
749
        public queryWhereWithBoundingBox(boundingBox: BoundingBox, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
750
                return this.queryWhereWithGeometryEnvelope(boundingBox.buildEnvelope(), where, whereArgs);
×
751
        }
752

753
        /**
754
         * Manually query for rows within the bounding box
755
         * @param distinct distinct rows
756
         * @param boundingBox bounding box
757
         * @param where where clause
758
         * @param whereArgs where arguments
759
         * @return results
760
         */
761
        public queryWhereWithBoundingBoxAndDistinct(distinct: boolean, boundingBox: BoundingBox, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
762
                return this.queryWhereWithGeometryEnvelopeAndDistinct(distinct, boundingBox.buildEnvelope(), where, whereArgs);
×
763
        }
764

765
        /**
766
         * Manually query for rows within the bounding box
767
         * @param columns columns
768
         * @param boundingBox bounding box
769
         * @param where where clause
770
         * @param whereArgs where arguments
771
         * @return results
772
         */
773
        public queryWhereWithBoundingBoxAndColumns(columns: string[], boundingBox: BoundingBox, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
774
                return this.queryWhereWithGeometryEnvelopeAndColumns(columns, boundingBox.buildEnvelope(), where, whereArgs);
×
775
        }
776

777
        /**
778
         * Manually query for rows within the bounding box
779
         * @param distinct distinct rows
780
         * @param columns columns
781
         * @param boundingBox bounding box
782
         * @param where where clause
783
         * @param whereArgs where arguments
784
         * @return results
785
         */
786
        public queryWhereWithBoundingBoxAndDistinctAndColumns(distinct: boolean, columns: string[], boundingBox: BoundingBox, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
787
                return this.queryWhereWithGeometryEnvelopeAndDistinctAndColumns(distinct, columns, boundingBox.buildEnvelope(), where, whereArgs);
×
788
        }
789

790
        /**
791
         * Manually query for rows within the geometry envelope
792
         * @param envelope geometry envelope
793
         * @param where where clause
794
         * @param whereArgs where arguments
795
         * @return results
796
         */
797
        public queryWhereWithGeometryEnvelope(envelope: GeometryEnvelope, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
798
                return this.queryWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
799
        }
800

801
        /**
802
         * Manually query for rows within the geometry envelope
803
         * @param distinct distinct rows
804
         * @param envelope geometry envelope
805
         * @param where where clause
806
         * @param whereArgs where arguments
807
         * @return results
808
         */
809
        public queryWhereWithGeometryEnvelopeAndDistinct(distinct: boolean, envelope: GeometryEnvelope, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
810
                return this.queryWithBoundsAndDistinct(distinct, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
811
        }
812

813
        /**
814
         * Manually query for rows within the geometry envelope
815
         * @param columns columns
816
         * @param envelope geometry envelope
817
         * @param where where clause
818
         * @param whereArgs where arguments
819
         * @return results
820
         */
821
        public queryWhereWithGeometryEnvelopeAndColumns(columns: string[], envelope: GeometryEnvelope, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
822
                return this.queryWithBoundsAndColumns(columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
823
        }
824

825
        /**
826
         * Manually query for rows within the geometry envelope
827
         * @param distinct distinct rows
828
         * @param columns columns
829
         * @param envelope geometry envelope
830
         * @param where where clause
831
         * @param whereArgs where arguments
832
         * @return results
833
         */
834
        public queryWhereWithGeometryEnvelopeAndDistinctAndColumns(distinct: boolean, columns: string[], envelope: GeometryEnvelope, where: string, whereArgs: any[]): ManualFeatureQueryResults {
1✔
835
                return this.queryWithBoundsAndDistinctAndColumns(distinct, columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
836
        }
837

838
        /**
839
         * Manually count the rows within the bounding box
840
         * @param boundingBox bounding box
841
         * @param where where clause
842
         * @param whereArgs where arguments
843
         * @return count
844
         */
845
        public countWhereWithBoundingBox(boundingBox: BoundingBox, where: string, whereArgs: any[]): number {
1✔
846
                return this.countWhereWithGeometryEnvelope(boundingBox.buildEnvelope(), where, whereArgs);
×
847
        }
848

849
        /**
850
         * Manually count the rows within the geometry envelope
851
         *
852
         * @param envelope geometry envelope
853
         * @param where where clause
854
         * @param whereArgs where arguments
855
         * @return count
856
         */
857
        public countWhereWithGeometryEnvelope(envelope: GeometryEnvelope, where: string, whereArgs: any[]): number {
1✔
858
                return this.countWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
859
        }
860

861
        /**
862
         * Manually query for rows within the bounds
863
         * @param distinct distinct rows
864
         * @param columns columns
865
         * @param minX min x
866
         * @param minY min y
867
         * @param maxX max x
868
         * @param maxY max y
869
         * @return results
870
         */
871
        public queryWithinBounds(minX: number, minY: number, maxX: number, maxY: number): ManualFeatureQueryResults {
1✔
872
                return this.queryWithBounds(minX, minY, maxX, maxY);
×
873
        }
874

875
        /**
876
         * Manually query for rows within the bounds
877
         * @param distinct distinct rows
878
         * @param minX min x
879
         * @param minY min y
880
         * @param maxX max x
881
         * @param maxY max y
882
         * @return results
883
         */
884
        public queryWithinBoundsWithDistinct(distinct = false, minX: number, minY: number, maxX: number, maxY: number): ManualFeatureQueryResults {
1!
885
                return this.queryWithBoundsAndDistinct(distinct, minX, minY, maxX, maxY);
×
886
        }
887

888
        /**
889
         * Manually query for rows within the bounds
890
         * @param columns columns
891
         * @param minX min x
892
         * @param minY min y
893
         * @param maxX max x
894
         * @param maxY max y
895
         * @return results
896
         */
897
        public queryWithinBoundWithColumns(columns: string[] = [], minX: number, minY: number, maxX: number, maxY: number): ManualFeatureQueryResults {
1!
898
                return this.queryWithBoundsAndColumns(columns, minX, minY, maxX, maxY);
×
899
        }
900

901
        /**
902
         * Manually query for rows within the bounds
903
         * @param distinct distinct rows
904
         * @param columns columns
905
         * @param minX min x
906
         * @param minY min y
907
         * @param maxX max x
908
         * @param maxY max y
909
         * @return results
910
         */
911
        public queryWithinBoundsWithDistinctAndColumns(distinct = false, columns: string[] = [], minX: number, minY: number, maxX: number, maxY: number): ManualFeatureQueryResults {
1!
912
                return this.queryWithBoundsAndDistinctAndColumns(distinct, columns, minX, minY, maxX, maxY);
×
913
        }
914

915
        /**
916
         * Manually count the rows within the bounds
917
         * @param minX min x
918
         * @param minY min y
919
         * @param maxX max x
920
         * @param maxY max y
921
         * @return count
922
         */
923
        public countWithinBounds(minX: number, minY: number, maxX: number, maxY: number): number {
1✔
924
                return this.queryWithinBounds(minX, minY, maxX, maxY).count();
×
925
        }
926

927
        /**
928
         * Manually query for rows within the bounds
929
         * @param minX min x
930
         * @param minY min y
931
         * @param maxX max x
932
         * @param maxY max y
933
         * @param fieldValues field values
934
         * @return results
935
         */
936
        public queryWithBoundsAndFieldValues(minX: number, minY: number, maxX: number, maxY: number, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
937
                return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(undefined, undefined, minX, minY, maxX, maxY, fieldValues);
×
938
        }
939

940
        /**
941
         * Manually query for rows within the bounds
942
         * @param distinct distinct rows
943
         * @param minX min x
944
         * @param minY min y
945
         * @param maxX max x
946
         * @param maxY max y
947
         * @param fieldValues field values
948
         * @return results
949
         */
950
        public queryWithBoundsAndFieldValuesAndDistinct(distinct: boolean, minX: number, minY: number, maxX: number, maxY: number, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
951
                return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(distinct, undefined, minX, minY, maxX, maxY, fieldValues);
×
952

953
        }
954

955
        /**
956
         * Manually query for rows within the bounds
957
         * @param columns columns
958
         * @param minX min x
959
         * @param minY min y
960
         * @param maxX max x
961
         * @param maxY max y
962
         * @param fieldValues field values
963
         * @return results
964
         */
965
        public queryWithBoundsAndFieldValuesAndColumns(columns: string[], minX: number, minY: number, maxX: number, maxY: number, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
966
                return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(undefined, columns, minX, minY, maxX, maxY, fieldValues);
×
967
        }
968

969
        /**
970
         * Manually query for rows within the bounds
971
         * @param distinct distinct rows
972
         * @param columns columns
973
         * @param minX min x
974
         * @param minY min y
975
         * @param maxX max x
976
         * @param maxY max y
977
         * @param fieldValues field values
978
         * @return results
979
         */
980
        public queryWithBoundsAndFieldValuesAndDistinctAndColumns(distinct: boolean, columns: string[], minX: number, minY: number, maxX: number, maxY: number, fieldValues: ColumnValues): ManualFeatureQueryResults {
1✔
981
                const where = this.featureDao.buildWhereWithFields(fieldValues);
×
982
                const whereArgs = this.featureDao.buildWhereArgsWithValues(fieldValues);
×
983
                return this.queryWithBoundsAndDistinctAndColumns(distinct, columns, minX, minY, maxX, maxY, where, whereArgs);
×
984
        }
985

986
        /**
987
         * Manually count the rows within the bounds
988
         * @param minX min x
989
         * @param minY min y
990
         * @param maxX max x
991
         * @param maxY max y
992
         * @param fieldValues field values
993
         * @return count
994
         */
995
        public countWithBoundsAndFieldValues(minX: number, minY: number, maxX: number, maxY: number, fieldValues: ColumnValues): number {
1✔
996
                const where = this.featureDao.buildWhereWithFields(fieldValues);
×
997
                const whereArgs = this.featureDao.buildWhereArgsWithValues(fieldValues);
×
998
                return this.countWithBounds(minX, minY, maxX, maxY, where, whereArgs);
×
999
        }
1000

1001
        /**
1002
         * Manually query for rows within the bounds
1003
         * @param minX min x
1004
         * @param minY min y
1005
         * @param maxX max x
1006
         * @param maxY max y
1007
         * @param where where clause
1008
         * @param whereArgs where args
1009
         * @return results
1010
         */
1011
        public queryWithBounds(minX: number, minY: number, maxX: number, maxY: number, where: string = undefined, whereArgs: any[] = undefined): ManualFeatureQueryResults {
1!
1012
                return this.queryWithBoundsAndDistinctAndColumns(undefined, undefined, minX, minY, maxX, maxY, where, whereArgs);
×
1013
        }
1014

1015
        /**
1016
         * Manually query for rows within the bounds
1017
         * @param distinct distinct rows
1018
         * @param minX min x
1019
         * @param minY min y
1020
         * @param maxX max x
1021
         * @param maxY max y
1022
         * @param where where clause
1023
         * @param whereArgs where args
1024
         * @return results
1025
         */
1026
        public queryWithBoundsAndDistinct(distinct: boolean, minX: number, minY: number, maxX: number, maxY: number, where: string = undefined, whereArgs: any[] = undefined): ManualFeatureQueryResults {
1!
1027
                return this.queryWithBoundsAndDistinctAndColumns(distinct, undefined, minX, minY, maxX, maxY, where, whereArgs);
×
1028
        }
1029

1030
        /**
1031
         * Manually query for rows within the bounds
1032
         * @param columns columns
1033
         * @param minX min x
1034
         * @param minY min y
1035
         * @param maxX max x
1036
         * @param maxY max y
1037
         * @param where where clause
1038
         * @param whereArgs where args
1039
         * @return results
1040
         */
1041
        public queryWithBoundsAndColumns(columns: string[], minX: number, minY: number, maxX: number, maxY: number, where: string = undefined, whereArgs: any[] = undefined): ManualFeatureQueryResults {
1!
1042
                return this.queryWithBoundsAndDistinctAndColumns(undefined, columns, minX, minY, maxX, maxY, where, whereArgs);
×
1043
        }
1044

1045
  /**
1046
         * Manually query for rows within the bounds
1047
         * @param distinct distinct rows
1048
         * @param columns columns
1049
         * @param minX min x
1050
         * @param minY min y
1051
         * @param maxX max x
1052
         * @param maxY max y
1053
         * @param where where clause
1054
         * @param whereArgs where args
1055
         * @return results
1056
         */
1057
        public queryWithBoundsAndDistinctAndColumns(distinct: boolean, columns: string[], minX: number, minY: number, maxX: number, maxY: number, where: string = undefined, whereArgs: any[] = undefined): ManualFeatureQueryResults {
1!
1058
                let featureIds = [];
×
1059

1060
                let offset = 0;
×
1061
                let hasResults = true;
×
1062

1063
                minX -= this.tolerance;
×
1064
                maxX += this.tolerance;
×
1065
                minY -= this.tolerance;
×
1066
                maxY += this.tolerance;
×
1067

1068
                let queryColumns = this.featureDao.getIdAndGeometryColumnNames();
×
1069

1070
                while (hasResults) {
×
1071
                        hasResults = false;
×
1072

1073
                        let resultSet = this.featureDao.queryForChunkWithDistinctAndColumns(distinct, queryColumns, where, whereArgs, undefined, undefined, undefined, this.chunkLimit, offset);
×
1074

1075
                        while (resultSet.moveToNext()) {
×
1076
                                hasResults = true;
×
1077

1078
                                const featureRow = resultSet.getRow();
×
1079
                                const envelope = featureRow.getGeometryEnvelope();
×
1080
                                if (envelope != null) {
×
1081
                                        const minXMax = Math.max(minX, envelope.minX);
×
1082
                                        const maxXMin = Math.min(maxX, envelope.maxX);
×
1083
                                        const minYMax = Math.max(minY, envelope.minY);
×
1084
                                        const maxYMin = Math.min(maxY, envelope.maxY);
×
1085

1086
                                        if (minXMax <= maxXMin && minYMax <= maxYMin) {
×
1087
                                                featureIds.push(featureRow.getId());
×
1088
                                        }
1089

1090
                                }
1091
                        }
1092
                        offset += this.chunkLimit;
×
1093
                }
1094

1095
                return new ManualFeatureQueryResults(this.featureDao, featureIds, columns);
×
1096
        }
1097

1098
        /**
1099
         * Manually count the rows within the bounds
1100
         * @param minX min x
1101
         * @param minY min y
1102
         * @param maxX max x
1103
         * @param maxY max y
1104
         * @param where where clause
1105
         * @param whereArgs where args
1106
         * @return count
1107
         */
1108
        public countWithBounds(minX: number, minY: number, maxX: number, maxY: number, where?: string, whereArgs?: any[]): number {
1✔
1109
                return this.queryWithBounds(minX, minY, maxX, maxY, where, whereArgs).count();
×
1110
        }
1111

1112
        /**
1113
         * Query for features, starting at the offset and returning no more than the
1114
         * limit
1115
         * @param fieldValues field values
1116
         * @param orderBy order by
1117
         * @param limit chunk limit
1118
         * @param offset chunk query offset
1119
         * @return feature results
1120
         */
1121
        public queryForChunkWithFieldValues(fieldValues: ColumnValues, orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1122
                return this.queryForChunkWithFieldValuesAndDistinctAndColumns(undefined, undefined, fieldValues, orderBy, limit, offset);
×
1123
        }
1124

1125
        /**
1126
         * Query for features, starting at the offset and returning no more than the
1127
         * limit
1128
         * @param distinct distinct rows
1129
         * @param fieldValues field values
1130
         * @param orderBy order by
1131
         * @param limit chunk limit
1132
         * @param offset chunk query offset
1133
         * @return feature results
1134
         */
1135
        public queryForChunkWithFieldValuesAndDistinct(distinct: boolean, fieldValues: ColumnValues, orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1136
                return this.queryForChunkWithFieldValuesAndDistinctAndColumns(distinct, undefined, fieldValues, orderBy, limit, offset);
×
1137
        }
1138

1139
        /**
1140
         * Query for features, starting at the offset and returning no more than the
1141
         * limit
1142
         * @param columns columns
1143
         * @param fieldValues field values
1144
         * @param orderBy order by
1145
         * @param limit chunk limit
1146
         * @param offset chunk query offset
1147
         * @return feature results
1148
         */
1149
        public queryForChunkWithFieldValuesAndColumns(columns: string[], fieldValues: ColumnValues, orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1150
                return this.queryForChunkWithFieldValuesAndDistinctAndColumns(undefined, columns, fieldValues, orderBy, limit, offset);
×
1151
        }
1152

1153
        /**
1154
         * Query for features, starting at the offset and returning no more than the
1155
         * limit
1156
         * @param distinct distinct rows
1157
         * @param columns columns
1158
         * @param fieldValues field values
1159
         * @param orderBy order by
1160
         * @param limit chunk limit
1161
         * @param offset chunk query offset
1162
         * @return feature results
1163
         */
1164
        public queryForChunkWithFieldValuesAndDistinctAndColumns(distinct: boolean, columns: string[], fieldValues: ColumnValues, orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1165
                const where = this.featureDao.buildWhereWithFields(fieldValues);
×
1166
                const whereArgs = this.featureDao.buildWhereArgsWithValues(fieldValues);
×
1167
                return this.featureDao.queryForChunkWithDistinctAndColumns(distinct, columns, where, whereArgs, undefined, undefined, orderBy, limit, offset);
×
1168
        }
1169

1170
        /**
1171
         * Query for features, starting at the offset and returning no more than the limit
1172
         * @param where where clause
1173
         * @param whereArgs where arguments
1174
         * @param orderBy order by
1175
         * @param limit chunk limit
1176
         * @param offset chunk query offset
1177
         * @return feature results
1178
         */
1179
        public queryForChunk(where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1180
                return this.featureDao.queryForChunk(where, whereArgs, undefined, undefined, orderBy, limit, offset);
×
1181
        }
1182

1183
        /**
1184
         * Query for features, starting at the offset and returning no more than the limit
1185
         * @param distinct distinct rows
1186
         * @param where where clause
1187
         * @param whereArgs where arguments
1188
         * @param orderBy order by
1189
         * @param limit chunk limit
1190
         * @param offset chunk query offset
1191
         * @return feature results
1192
         */
1193
        public queryForChunkWithDistinct(distinct: boolean, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1194
                return this.featureDao.queryForChunkWithDistinct(distinct, where, whereArgs, undefined, undefined, orderBy, limit, offset);
×
1195
        }
1196

1197
        /**
1198
         * Query for features, starting at the offset and returning no more than the limit
1199
         * @param columns columns
1200
         * @param where where clause
1201
         * @param whereArgs where arguments
1202
         * @param orderBy order by
1203
         * @param limit chunk limit
1204
         * @param offset chunk query offset
1205
         * @return feature results
1206
         */
1207
        public queryForChunkWithColumns(columns: string[], where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1208
                return this.featureDao.queryForChunkWithColumns(columns, where, whereArgs, undefined, undefined, orderBy, limit, offset);
×
1209
        }
1210

1211
        /**
1212
         * Query for features, starting at the offset and returning no more than the limit
1213
         * @param distinct distinct rows
1214
         * @param columns columns
1215
         * @param where where clause
1216
         * @param whereArgs where arguments
1217
         * @param orderBy order by
1218
         * @param limit chunk limit
1219
         * @param offset chunk query offset
1220
         * @return feature results
1221
         */
1222
        public queryForChunkWithDistinctAndColumns(distinct: boolean, columns: string[], where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): FeatureResultSet {
1✔
1223
                return this.featureDao.queryForChunkWithDistinctAndColumns(distinct, columns, where, whereArgs, undefined, undefined, orderBy, limit, offset);
×
1224
        }
1225

1226
        /**
1227
         * Manually query for rows within the geometry envelope, starting at the
1228
         * offset and returning no more than the limit
1229
         * <p>
1230
         * WARNING: This method must iterate from the 0 offset each time, is
1231
         * extremely inefficient, and not recommended for use
1232
         * @param envelope geometry envelope
1233
         * @param where where clause
1234
         * @param whereArgs where arguments
1235
         * @param orderBy order by
1236
         * @param limit chunk limit
1237
         * @param offset chunk query offset
1238
         * @return results
1239
         */
1240
        public queryForChunkWithGeometryEnvelope(envelope: GeometryEnvelope, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1241
                return this.queryForChunkWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs, orderBy, limit, offset);
×
1242
        }
1243

1244
        /**
1245
         * Manually query for rows within the geometry envelope, starting at the
1246
         * offset and returning no more than the limit
1247
         * <p>
1248
         * WARNING: This method must iterate from the 0 offset each time, is
1249
         * extremely inefficient, and not recommended for use
1250
         * @param distinct distinct rows
1251
         * @param envelope geometry envelope
1252
         * @param where where clause
1253
         * @param whereArgs where arguments
1254
         * @param orderBy order by
1255
         * @param limit chunk limit
1256
         * @param offset chunk query offset
1257
         * @return results
1258
         */
1259
        public queryForChunkWithGeometryEnvelopeAndDistinct(distinct: boolean, envelope: GeometryEnvelope, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1260
                return this.queryForChunkWithBoundsAndDistinct(distinct, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs, orderBy, limit, offset);
×
1261
        }
1262

1263
        /**
1264
         * Manually query for rows within the geometry envelope, starting at the
1265
         * offset and returning no more than the limit
1266
         * <p>
1267
         * WARNING: This method must iterate from the 0 offset each time, is
1268
         * extremely inefficient, and not recommended for use
1269
         * @param columns columns
1270
         * @param envelope geometry envelope
1271
         * @param where where clause
1272
         * @param whereArgs where arguments
1273
         * @param orderBy order by
1274
         * @param limit chunk limit
1275
         * @param offset chunk query offset
1276
         * @return results
1277
         */
1278
        public queryForChunkWithGeometryEnvelopeAndColumns(columns: string[], envelope: GeometryEnvelope, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1279
                return this.queryForChunkWithBoundsAndColumns(columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs, orderBy, limit, offset);
×
1280
        }
1281

1282
        /**
1283
         * Manually query for rows within the geometry envelope, starting at the
1284
         * offset and returning no more than the limit
1285
         * <p>
1286
         * WARNING: This method must iterate from the 0 offset each time, is
1287
         * extremely inefficient, and not recommended for use
1288
         * @param distinct distinct rows
1289
         * @param columns columns
1290
         * @param envelope geometry envelope
1291
         * @param where where clause
1292
         * @param whereArgs where arguments
1293
         * @param orderBy order by
1294
         * @param limit chunk limit
1295
         * @param offset chunk query offset
1296
         * @return results
1297
         */
1298
        public queryForChunkWithGeometryEnvelopeAndDistinctAndColumns(distinct: boolean, columns: string[], envelope: GeometryEnvelope, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1299
                return this.queryForChunkWithBoundsAndDistinctAndColumns(distinct, columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs, orderBy, limit, offset);
×
1300
        }
1301

1302
        /**
1303
         * Manually query for rows within the bounds, starting at the offset and
1304
         * returning no more than the limit
1305
         * <p>
1306
         * WARNING: This method must iterate from the 0 offset each time, is
1307
         * extremely inefficient, and not recommended for use
1308
         * @param minX min x
1309
         * @param minY min y
1310
         * @param maxX max x
1311
         * @param maxY max y
1312
         * @param where where clause
1313
         * @param whereArgs where args
1314
         * @param orderBy order by
1315
         * @param limit chunk limit
1316
         * @param offset chunk query offset
1317
         * @return results
1318
         */
1319
        public queryForChunkWithBounds(minX: number, minY: number, maxX: number, maxY: number, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1320
                return this.queryForChunkWithBoundsAndDistinctAndColumns(undefined, undefined, minX, minY, maxX, maxY, where, whereArgs, orderBy, limit, offset);
×
1321
        }
1322

1323
        /**
1324
         * Manually query for rows within the bounds, starting at the offset and
1325
         * returning no more than the limit
1326
         * <p>
1327
         * WARNING: This method must iterate from the 0 offset each time, is
1328
         * extremely inefficient, and not recommended for use
1329
         * @param distinct distinct rows
1330
         * @param minX min x
1331
         * @param minY min y
1332
         * @param maxX max x
1333
         * @param maxY max y
1334
         * @param where where clause
1335
         * @param whereArgs where args
1336
         * @param orderBy order by
1337
         * @param limit chunk limit
1338
         * @param offset chunk query offset
1339
         * @return results
1340
         */
1341
        public queryForChunkWithBoundsAndDistinct(distinct: boolean, minX: number, minY: number, maxX: number, maxY: number, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1342
                return this.queryForChunkWithBoundsAndDistinctAndColumns(distinct, undefined, minX, minY, maxX, maxY, where, whereArgs, orderBy, limit, offset);
×
1343
        }
1344

1345
        /**
1346
         * Manually query for rows within the bounds, starting at the offset and
1347
         * returning no more than the limit
1348
         * <p>
1349
         * WARNING: This method must iterate from the 0 offset each time, is
1350
         * extremely inefficient, and not recommended for use
1351
         * @param columns columns
1352
         * @param minX min x
1353
         * @param minY min y
1354
         * @param maxX max x
1355
         * @param maxY max y
1356
         * @param where where clause
1357
         * @param whereArgs where args
1358
         * @param orderBy order by
1359
         * @param limit chunk limit
1360
         * @param offset chunk query offset
1361
         * @return results
1362
         */
1363
        public queryForChunkWithBoundsAndColumns(columns: string[], minX: number, minY: number, maxX: number, maxY: number, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1364
                return this.queryForChunkWithBoundsAndDistinctAndColumns(undefined, columns, minX, minY, maxX, maxY, where, whereArgs, orderBy, limit, offset);
×
1365
        }
1366

1367
        /**
1368
         * Manually query for rows within the bounds, starting at the offset and
1369
         * returning no more than the limit
1370
         * <p>
1371
         * WARNING: This method must iterate from the 0 offset each time, is
1372
         * extremely inefficient, and not recommended for use
1373
         * @param distinct distinct rows
1374
         * @param columns columns
1375
         * @param minX min x
1376
         * @param minY min y
1377
         * @param maxX max x
1378
         * @param maxY max y
1379
         * @param where where clause
1380
         * @param whereArgs where args
1381
         * @param orderBy order by
1382
         * @param limit chunk limit
1383
         * @param offset chunk query offset
1384
         * @return results
1385
         */
1386
        public queryForChunkWithBoundsAndDistinctAndColumns(distinct: boolean, columns: string[], minX: number, minY: number, maxX: number, maxY: number, where: string, whereArgs: any[], orderBy: string, limit: number, offset: number): ManualFeatureQueryResults {
1✔
1387
                let index = 0;
×
1388
                let featureIds = [];
×
1389

1390
                let localOffset = 0;
×
1391
                let hasResults = true;
×
1392

1393
                minX -= this.tolerance;
×
1394
                maxX += this.tolerance;
×
1395
                minY -= this.tolerance;
×
1396
                maxY += this.tolerance;
×
1397

1398
                const queryColumns = this.featureDao.getIdAndGeometryColumnNames();
×
1399

1400
                while (hasResults) {
×
1401

1402
                        hasResults = false;
×
1403

1404
                        const resultSet: FeatureResultSet = this.featureDao.queryForChunkWithDistinctAndColumns(distinct, queryColumns, where, whereArgs, undefined, undefined, orderBy, this.chunkLimit, localOffset);
×
1405
                        while (resultSet.moveToNext()) {
×
1406
                                hasResults = true;
×
1407

1408
                                const featureRow: FeatureRow = resultSet.getRow();
×
1409
                                const envelope: GeometryEnvelope = featureRow.getGeometryEnvelope();
×
1410
                                if (envelope != null) {
×
1411
                                        const minXMax = Math.max(minX, envelope.minX);
×
1412
                                        const maxXMin = Math.min(maxX, envelope.maxX);
×
1413
                                        const minYMax = Math.max(minY, envelope.minY);
×
1414
                                        const maxYMin = Math.min(maxY, envelope.maxY);
×
1415

1416
                                        if (minXMax <= maxXMin && minYMax <= maxYMin) {
×
1417
                                                if (offset <= index) {
×
1418
                                                        featureIds.push(featureRow.getId());
×
1419
                                                        if (featureIds.length >= limit) {
×
1420
                                                                break;
×
1421
                                                        }
1422
                                                }
1423
                                                index++;
×
1424
                                        }
1425

1426
                                }
1427
                        }
1428

1429
                        localOffset += this.chunkLimit;
×
1430
                }
1431

1432
                return new ManualFeatureQueryResults(this.featureDao, featureIds, columns);
×
1433
        }
1434

1435
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc