* @function Bounds.prototype.extend * @description 在当前 bounds 上扩展 bounds,支持 point,lonlat 和 bounds。扩展后的 bounds 的范围是两者的结合。 * @example * var bounds1 = new Bounds(-50,-50,40,40); * //bounds 改变 * bounds.extend(new LonLat(50,60)); * @param {GeometryPoint|LonLat|Bounds} object
(object)
| 315 | * @param {GeometryPoint|LonLat|Bounds} object - 可以是 point、lonlat 和 bounds。 |
| 316 | */ |
| 317 | extend(object) { |
| 318 | var bounds = null; |
| 319 | if (object) { |
| 320 | // clear cached center location |
| 321 | switch (object.CLASS_NAME) { |
| 322 | case "SuperMap.LonLat": |
| 323 | bounds = new Bounds(object.lon, object.lat, |
| 324 | object.lon, object.lat); |
| 325 | break; |
| 326 | case "SuperMap.Geometry.Point": |
| 327 | bounds = new Bounds(object.x, object.y, |
| 328 | object.x, object.y); |
| 329 | break; |
| 330 | |
| 331 | case "SuperMap.Bounds": |
| 332 | bounds = object; |
| 333 | break; |
| 334 | } |
| 335 | |
| 336 | if (bounds) { |
| 337 | this.centerLonLat = null; |
| 338 | if ((this.left == null) || (bounds.left < this.left)) { |
| 339 | this.left = bounds.left; |
| 340 | } |
| 341 | if ((this.bottom == null) || (bounds.bottom < this.bottom)) { |
| 342 | this.bottom = bounds.bottom; |
| 343 | } |
| 344 | if ((this.right == null) || (bounds.right > this.right)) { |
| 345 | this.right = bounds.right; |
| 346 | } |
| 347 | if ((this.top == null) || (bounds.top > this.top)) { |
| 348 | this.top = bounds.top; |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * @function Bounds.prototype.containsLonLat |
no outgoing calls
no test coverage detected