getExtent() return getEmpty() for invalid extents
This commit is contained in:
@@ -8,7 +8,12 @@ import {
|
||||
compose as composeTransform,
|
||||
create as createTransform,
|
||||
} from '../transform.js';
|
||||
import {createEmpty, getHeight, returnOrUpdate} from '../extent.js';
|
||||
import {
|
||||
containsExtent,
|
||||
createEmpty,
|
||||
getHeight,
|
||||
returnOrUpdate,
|
||||
} from '../extent.js';
|
||||
import {get as getProjection, getTransform} from '../proj.js';
|
||||
import {memoizeOne} from '../functions.js';
|
||||
import {transform2D} from './flat/transform.js';
|
||||
@@ -170,6 +175,11 @@ class Geometry extends BaseObject {
|
||||
getExtent(opt_extent) {
|
||||
if (this.extentRevision_ != this.getRevision()) {
|
||||
this.extent_ = this.computeExtent(this.extent_);
|
||||
if (
|
||||
!containsExtent([-Infinity, -Infinity, Infinity, Infinity], this.extent_)
|
||||
) {
|
||||
this.extent_ = createEmpty();
|
||||
}
|
||||
this.extentRevision_ = this.getRevision();
|
||||
}
|
||||
return returnOrUpdate(this.extent_, opt_extent);
|
||||
|
||||
Reference in New Issue
Block a user