MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / contains

Method contains

src/common/commontypes/Bounds.js:429–451  ·  view source on GitHub ↗

* @function Bounds.prototype.contains * @description 判断传入的 x,y 坐标值是否在范围内。 * @example * var bounds = new Bounds(-50,-50,40,40); * //isContains = true * var isContains = bounds.contains(40,40,true); * @param {number} x - x 坐标值。 * @param {number} y - y 坐标值。 * @pa

(x, y, inclusive)

Source from the content-addressed store, hash-verified

427 * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
428 */
429 contains(x, y, inclusive) {
430 //set default
431 if (inclusive == null) {
432 inclusive = true;
433 }
434
435 if (x == null || y == null) {
436 return false;
437 }
438
439 //x = Util.toFloat(x);
440 //y = Util.toFloat(y);
441
442 var contains = false;
443 if (inclusive) {
444 contains = ((x >= this.left) && (x <= this.right) &&
445 (y >= this.bottom) && (y <= this.top));
446 } else {
447 contains = ((x > this.left) && (x < this.right) &&
448 (y > this.bottom) && (y < this.top));
449 }
450 return contains;
451 }
452
453 /**
454 * @function Bounds.prototype.intersectsBounds

Callers 15

containsLonLatMethod · 0.95
containsPixelMethod · 0.95
containsBoundsMethod · 0.95
MapVLayerSpec.jsFile · 0.45
BoundsSpec.jsFile · 0.45
BaseTypesSpec.jsFile · 0.45
setInfoMethod · 0.45
LFunction · 0.45
EFunction · 0.45
kFunction · 0.45
jquery.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected