new SuperMap.Bounds(left, bottom, right, top, array)
| Name | Type | Description | 
|---|---|---|
| left | number | 可选 左边界,注意考虑宽度,理论上小于 right 值。 | 
| bottom | number | 可选 下边界。考虑高度,理论上小于 top 值。 | 
| right | number | 可选 右边界。 | 
| top | number | 可选 上边界。 | 
| array | Array.<number> | 可选 [left, bottom, right, top],如果同时传多个参数,则使用左下右上组成的数组。 | 
Example
var bounds = new SuperMap.Bounds();
bounds.extend(new SuperMap.LonLat(4,5));
bounds.extend(new SuperMap.LonLat(5,6));
bounds.toBBOX(); // returns 4,5,5,6Members
- 
    bottomnumber
- 
    
    最小的垂直坐标系。 
- 
    centerLonLatSuperMap.LonLat
- 
    
    bounds 的地图空间的中心点。用 getCenterLonLat() 获得。 
- 
    leftnumber
- 
    
    最小的水平坐标系。 
- 
    namestring
- 
    
    验证信息前缀,name=value 部分的 name 部分。 - Default Value: 'token'
 
rightnumber
最大的水平坐标系。
topnumber
最大的垂直坐标系。
valuestring
访问受安全限制的服务时用于通过安全认证的验证信息。
Methods
- 
    SuperMap.Bounds.fromArray(bbox, reverseAxisOrder){SuperMap.Bounds}common/commontypes/Bounds.js, line 688
- 
    
    
    通过边界框数组创建 Bounds。 Name Type Default Description bboxArray.<float> 边界值数组。(e.g. [5,42,10,45])。 reverseAxisOrderboolean false 可选 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。 Returns:Type Description SuperMap.Bounds 返回根据传入的数组创建的新的边界对象。 Examplevar bounds = SuperMap.Bounds.fromArray([-180,-90,100,80]);
- 
    SuperMap.Bounds.fromSize(size){SuperMap.Bounds}common/commontypes/Bounds.js, line 703
- 
    
    
    通过传入的边界大小来创建新的边界。 Name Type Description sizeSuperMap.Size 传入的边界大小。 Returns:Type Description SuperMap.Bounds 返回根据传入的边界大小的创建新的边界。 Examplevar bounds = SuperMap.Bounds.fromSize(new SuperMap.Size(20,10));
- 
    SuperMap.Bounds.fromString(str, reverseAxisOrder){SuperMap.Bounds}common/commontypes/Bounds.js, line 673
- 
    
    
    通过字符串参数创建新的 bounds 的构造函数。 Name Type Default Description strstring 边界字符串,用逗号隔开(e.g. "5,42,10,45")。 reverseAxisOrderboolean false 可选 是否反转轴顺序。 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。 Returns:Type Description SuperMap.Bounds 返回给定的字符串创建的新的边界对象。 Examplevar bounds = SuperMap.Bounds.fromString("-180,-90,100,80");
- 
    SuperMap.Bounds.oppositeQuadrant(quadrant){string}common/commontypes/Bounds.js, line 718
- 
    
    
    反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。 Name Type Description quadrantstring 代表象限的字符串,如:"tl"。 Returns:Type Description string 反转后的象限。 
- 
    add(x, y){SuperMap.Bounds}common/commontypes/Bounds.js, line 289
- 
    
    
    在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。 Name Type Description xfloat 传入坐标点的 x 坐标。 yfloat 传入坐标点的 y 坐标。 Returns:Type Description SuperMap.Bounds 返回一个新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。 Examplevar bounds1 = new SuperMap.Bounds(-50,-50,40,40); //bounds2 是新的 bounds var bounds2 = bounds.add(20,10);
- 
    clone(){SuperMap.Bounds}common/commontypes/Bounds.js, line 67
- 
    
    
    复制当前 bounds 对象。 Returns:Type Description SuperMap.Bounds 返回一个克隆的 bounds。 Examplevar bounds1 = new SuperMap.Bounds(-180,-90,180,90); var bounds2 = bounds1.clone();
- 
    contains(x, y, inclusive){boolean}common/commontypes/Bounds.js, line 417
- 
    
    
    判断传入的 x,y 坐标值是否在范围内。 Name Type Default Description xfloat 传入的 x 坐标值。 yfloat 传入的 y 坐标值。 inclusiveboolean true 可选 是否包含边界。 Returns:Type Description boolean 传入的 x,y 坐标是否在当前范围内。 Examplevar bounds = new SuperMap.Bounds(-50,-50,40,40); //isContains = true var isContains = bounds.contains(40,40,true);
- 
    containsBounds(bounds, partial, inclusive){boolean}common/commontypes/Bounds.js, line 533
- 
    
    
    判断目标边界是否被当前边界包含在内。 Name Type Default Description boundsSuperMap.Bounds 目标边界。 partialboolean false 可选 目标边界的任意部分都包含在当前边界中则被认为是包含关系。 如果设为 false,整个目标边界全部被包含在当前边界范围内。 inclusiveboolean true 可选 边缘共享被视为包含。 Returns:Type Description boolean 传入的边界被当前边界包含。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); var isContains = bounds.containsBounds( new SuperMap.Bounds(-170,-90,100,80),true,true );
- 
    containsLonLat(ll, options){boolean}common/commontypes/Bounds.js, line 354
- 
    
    
    判断传入的坐标是否在范围内。 Name Type Description llSuperMap.LonLat | Object <SuperMap.LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。 optionsObject 可选参数。 Name Type Default Description inclusiveboolean true 可选 是否包含边界。 worldBoundsSuperMap.Bounds 可选 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds), 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。 Returns:Type Description boolean 传入坐标是否包含在范围内。 Examplevar bounds1 = new SuperMap.Bounds(-50,-50,40,40); //isContains1 = true //这里的第二个参数可以直接为 boolean 类型,也就是inclusive var isContains1 = bounds.containsLonLat(new SuperMap.LonLat(40,40),true); //(40,40)在范围内,同样(40+360,40)也在范围内 var bounds2 = new SuperMap.Bounds(-50,-50,40,40); //isContains2 = true; var isContains2 = bounds2.containsLonLat( new SuperMap.LonLat(400,40), { inclusive:true, //全球的范围 worldBounds: new SuperMap.Bounds(-180,-90,180,90) } );
- 
    containsPixel(px, inclusive){boolean}common/commontypes/Bounds.js, line 402
- 
    
    
    判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。 Name Type Default Description pxSuperMap.Pixel 提供的像素参数。 inclusiveboolean true 可选 是否包含边界。 Returns:Type Description boolean 传入的 pixel 在当前边界范围之内。 Examplevar bounds = new SuperMap.Bounds(-50,-50,40,40); //isContains = true var isContains = bounds.containsPixel(new SuperMap.Pixel(40,40),true);
- 
    destroy()common/commontypes/Bounds.js, line 656
- 
    
    
    销毁此对象。 销毁后此对象的所有属性为 null,而不是初始值。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); bounds.destroy();
- 
    determineQuadrant(lonlat){string}common/commontypes/Bounds.js, line 563
- 
    
    
    判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。 Name Type Description lonlatSuperMap.LonLat 传入的坐标对象。 Returns:Type Description string 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); //str = "tr"; var str = bounds.determineQuadrant( new SuperMap.LonLat(20,20) );
- 
    equals(bounds){boolean}common/commontypes/Bounds.js, line 80
- 
    
    
    判断两个 bounds 对象是否相等。 Name Type Description boundsSuperMap.Bounds 需要进行计较的 bounds。 Returns:Type Description boolean 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。 Examplevar bounds1 = new SuperMap.Bounds(-180,-90,180,90); var bounds2 = new SuperMap.Bounds(-180,-90,180,90); var isEquals = bounds1.equals(bounds2);
- 
    extend(object)common/commontypes/Bounds.js, line 308
- 
    
    
    在当前 bounds 上扩展 bounds,支持 point,lanlat 和 bounds。扩展后的 bounds 的范围是两者的结合。 Name Type Description objectSuperMap.Geometry.Point | SuperMap.LonLat | SuperMap.Bounds 可以是 point、lonlat 和 bounds。 Examplevar bounds1 = new SuperMap.Bounds(-50,-50,40,40); //bounds 改变 bounds.extend(new SuperMap.LonLat(50,60));
- 
    getCenterLonLat(){SuperMap.LonLat}common/commontypes/Bounds.js, line 237
- 
    
    
    获取地理格式的范围中心点。 Returns:Type Description SuperMap.LonLat 返回当前地理范围的中心点。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); var lonlat = bounds.getCenterLonLat();
- 
    getCenterPixel(){SuperMap.Pixel}common/commontypes/Bounds.js, line 224
- 
    
    
    获取像素格式的范围中心点。 Returns:Type Description SuperMap.Pixel 返回像素格式的当前范围的中心点。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); var pixel = bounds.getCenterPixel();
- 
    getHeight(){float}common/commontypes/Bounds.js, line 199
- 
    
    
    获取 bounds 的高度。 Returns:Type Description float 返回边界高度(top 减去 bottom)。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); //height = 170; var height = bounds.getHeight();
- 
    getSize(){SuperMap.Size}common/commontypes/Bounds.js, line 212
- 
    
    
    获取边框大小。 Returns:Type Description SuperMap.Size 返回边框大小。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); var size = bounds.getSize();
- 
    getValue(){string}common/commontypes/Credential.js, line 52
- 
    
    
    获取 value。 Returns:Type Description string 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。 Examplevar credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token"); //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.."; var str = credential.getValue();
- 
    getWidth(){float}common/commontypes/Bounds.js, line 186
- 
    
    
    获取 bounds 的宽度。 Returns:Type Description float 获取当前 bounds 的宽度(right 减去 left)。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); //width = 280; var width = bounds.getWidth();
- 
    intersectsBounds(bounds, options){boolean}common/commontypes/Bounds.js, line 453
- 
    
    
    判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意 边缘相交或者一个边界包含了另外一个就认为这两个边界相交。 Name Type Description boundsSuperMap.Bounds 目标边界。 optionsObject 参数。 Name Type Default Description inclusiveboolean true 可选 边缘重合也看成相交。如果是false, 两个边界范围没有重叠部分仅仅是在边缘相接(重合), 这种情况被认为没有相交。 worldBoundsSuperMap.Bounds 可选 提供了 worldBounds 参数, 如果他们相交时 是在全球范围内, 两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。 Returns:Type Description boolean 传入的 bounds 对象与当前 bounds 相交。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); var isIntersects = bounds.intersectsBounds( new SuperMap.Bounds(-170,-90,120,80) );
- 
    scale(ratio, origin){SuperMap.Bounds}common/commontypes/Bounds.js, line 254
- 
    
    
    按照比例扩大/缩小出一个新的 bounds。 Name Type Default Description ratiofloat 1 可选 需要扩大的比例。 originSuperMap.Pixel | SuperMap.LonLat 可选 扩大时的基准点,默认为当前 bounds 的中心点。 Returns:Type Description SuperMap.Bounds 返回通过 ratio、origin 计算得到的新的边界范围。 Examplevar bounds = new SuperMap.Bounds(-50,-50,40,40); var bounds2 = bounds.scale(2);
- 
    toArray(reverseAxisOrder){Array.<number>}common/commontypes/Bounds.js, line 113
- 
    
    
    边界对象的数组表示形式。 Name Type Default Description reverseAxisOrderboolean false 可选 是否反转轴顺序。 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。 Returns:Type Description Array.<number> left, bottom, right, top 数组。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); //array1 = [-180,-90,100,80]; var array1 = bounds.toArray(); //array1 = [-90,-180,80,100]; var array2 = bounds.toArray(true);
- 
    toBBOX(decimal, reverseAxisOrder){string}common/commontypes/Bounds.js, line 134
- 
    
    
    取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。 Name Type Default Description decimalinteger 6 可选 边界方位坐标的有效数字个数。 reverseAxisOrderboolean false 可选 是否是反转轴顺序。 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。 Returns:Type Description string 边界对象的字符串表示形式,如:"5,42,10,45"。 Examplevar bounds = new SuperMap.Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555); //str1 = "-1.123457,-1.765432,1.444444,1.555556"; var str1 = bounds.toBBOX(); //str2 = "-1.1,-1.8,1.4,1.6"; var str2 = bounds.toBBOX(1); //str2 = "-1.8,-1.1,1.6,1.4"; var str2 = bounds.toBBOX(1,true);
- 
    toGeometry(){SuperMap.Geometry.Polygon}common/commontypes/Bounds.js, line 166
- 
    
    
    基于当前边界范围创建一个新的多边形对象。 Returns:Type Description SuperMap.Geometry.Polygon 基于当前 bounds 坐标创建的新的多边形。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); //SuperMap.Geometry.Polygon对象 var geo = bounds.toGeometry();
- 
    toServerJSONObject(){Object}common/commontypes/Bounds.js, line 636
- 
    
    
    转换成对应的 JSON 格式对象。 Returns:Type Description Object 返回 JSON 格式的 Object 对象。 Examplevar bounds = new SuperMap.Bounds(-180,-90,100,80); var obj = bounds.toServerJSONObject();
- 
    toString(){string}common/commontypes/Bounds.js, line 101
- 
    
    
    返回此对象的字符串形式。 Returns:Type Description string 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。 Examplevar bounds = new SuperMap.Bounds(-180,-90,180,90); var str = bounds.toString();
- 
    wrapDateLine(maxExtent, options){SuperMap.Bounds}common/commontypes/Bounds.js, line 586
- 
    
    
    将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。 Name Type Description maxExtentSuperMap.Bounds 最大的边界范围(一般是全球范围)。 optionsObject 可选选项参数。 Name Type Default Description leftTolerancefloat 0 可选 left 允许的误差。 rightTolerancefloat 0 可选 right 允许的误差。 Returns:Type Description SuperMap.Bounds 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界, 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动, 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。 Examplevar bounds = new SuperMap.Bounds(380,-40,400,-20); var maxExtent = new SuperMap.Bounds(-180,-90,100,80); //新的bounds var newBounds = bounds.wrapDateLine(maxExtent);