Feature opt_geometryOrProperties cannot be null
This commit is contained in:
+2
-3
@@ -99,10 +99,9 @@ class Feature extends BaseObject {
|
|||||||
this.handleGeometryChanged_, this);
|
this.handleGeometryChanged_, this);
|
||||||
|
|
||||||
if (opt_geometryOrProperties !== undefined) {
|
if (opt_geometryOrProperties !== undefined) {
|
||||||
if (opt_geometryOrProperties instanceof Geometry ||
|
if (opt_geometryOrProperties instanceof Geometry) {
|
||||||
!opt_geometryOrProperties) {
|
|
||||||
|
|
||||||
const geometry = /** @type {?Geometry} */ (opt_geometryOrProperties);
|
const geometry = /** @type {Geometry} */ (opt_geometryOrProperties);
|
||||||
this.setGeometry(geometry);
|
this.setGeometry(geometry);
|
||||||
} else {
|
} else {
|
||||||
/** @type {Object<string, *>} */
|
/** @type {Object<string, *>} */
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class Geometry extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
transform(source, destination) {
|
transform(source, destination) {
|
||||||
/** @type {import("../proj/Projection.js").default} */
|
/** @type {import("../proj/Projection.js").default} */
|
||||||
const sourceProj = getProjection(source);
|
const sourceProj = getProjection(source);
|
||||||
const transformFn = sourceProj.getUnits() == Units.TILE_PIXELS ?
|
const transformFn = sourceProj.getUnits() == Units.TILE_PIXELS ?
|
||||||
function(inCoordinates, outCoordinates, stride) {
|
function(inCoordinates, outCoordinates, stride) {
|
||||||
const pixelExtent = sourceProj.getExtent();
|
const pixelExtent = sourceProj.getExtent();
|
||||||
@@ -260,7 +260,9 @@ class Geometry extends BaseObject {
|
|||||||
* @param {number} y Y.
|
* @param {number} y Y.
|
||||||
* @return {boolean} Contains (x, y).
|
* @return {boolean} Contains (x, y).
|
||||||
*/
|
*/
|
||||||
containsXY = function(x, y) { return false};
|
containsXY(x, y) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ describe('ol.Feature', function() {
|
|||||||
|
|
||||||
it('returns null for null geometry (constructor)', function() {
|
it('returns null for null geometry (constructor)', function() {
|
||||||
const feature = new Feature(null);
|
const feature = new Feature(null);
|
||||||
expect(feature.getGeometry()).to.be(null);
|
expect(feature.getGeometry()).to.be(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns null for null geometry (setGeometry())', function() {
|
it('returns null for null geometry (setGeometry())', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user