このクラスの例は、空間範囲を表します。left, bottom, right, topデータが保存されます。すべての値はnullで初期化され、使用する前に、配置したことを確認しなければなりません。
使用例:
bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(4,5));
bounds.extend(new OpenLayers.LonLat(5,6));
bounds.toBBOX(); // returns 4,5,5,6
|
Table of Contents
|
コンストラクター
OpenLayers. Bounds
境界インスタンスを作成します。
パラメータ
- left 境界の左座標。注:幅を計算のため、rightより小さい。
- bottom 境界の下座標。注:高を計算のため、topより小さい。
- right 境界の右座標
- top 境界の上座標
メソッド
toString
toString:function()
戻り値
{String} 例:”left-bottom=(5,42) right-top=(10,45)”
toArray
toArray: function()
戻り値
{Array} left, bottom, right, topのような配列。
toBBOX
toBBOX:function( decimal )
パラメータ
- decimal {Integer} 有効数字の桁数です。ディフォルトは6。
戻り値
{String} 例:”5,42,10,45”
toGeometry
toGeometry: function()
この境界オブジェクトをベースにして、ポリゴンインスタンスを作成します。
戻り値
{OpenLayers.Geometry.Polygon} ポリゴンオブジェクト。
getWidth
getWidth:function()
戻り値
{Float} 境界の幅。
getHeight
getHeight:function()
戻り値
{Float} 境界の高さ。
getSize
getSize:function()
戻り値
{OpenLayers.Size} サイズオブジェクト。
getCenterPixel
getCenterPixel:function()
戻り値
{OpenLayers.Pixel} ピクセル中心座標。
getCenterLonLat
getCenterLonLat:function()
戻り値
{OpenLayers.LonLat} ワールド中心座標。
add
add:function( x, y )
パラメータ
- x {Float}
- y {Float}
戻り値
{OpenLayers.Bounds} 渡されたxとy値によって移動された新しい境界を返します。
extend
extend:function( object )
point、lonlat或いはboundsを含まれるオブジェクトより、このインスタンスを拡張します。
注:left < right 且つ bottom < top.
パラメータ
- object {Object} LonLat, Point或いは Bounds
containsLonLat
containsLonLat:function( ll, inclusive )
パラメータ
- ll {OpenLayers.LonLat}
- inclusive {Boolean} 境界線が含むかどうか。ディフォルトはtrue。
戻り値
{Boolean} 渡された座標は、この境界の中にあるかどうか。
containsPixel
containsPixel:function( px, inclusive )
パラメータ
- px {OpenLayers.Pixel}
- inclusive {Boolean} 境界線が含むかどうか。ディフォルトはtrue。
戻り値
{Boolean} 渡された座標は、この境界の中にあるかどうか。
contains
contains:function( x, y, inclusive )
パラメータ
- x {Float}
- y {Float}
- inclusive {Boolean} 境界線が含むかどうか。ディフォルトはtrue。
戻り値
{Boolean} 渡された座標は、この境界の中にあるかどうか。
intersectsBounds
intersectsBounds:function( bounds, inclusive )
パラメータ
- bounds {OpenLayers.Bounds}
- inclusive {Boolean} 境界線が含むかどうか。ディフォルトはtrue。
戻り値
{Boolean} 渡された境界と交差するかどうか。Simple math just check if either contains the other, allowing for partial.
containsBounds
containsBounds:function( bounds, partial, inclusive )
パラメータ
- bounds {OpenLayers.Bounds}
partial {Boolean} trueの場合は、渡された境界は部分的に含むのを許可します。falseの場合は完全に含むの意味です。ディフォルトはfalse。
- inclusive {Boolean} 境界線が含むかどうか。ディフォルトはtrue。
戻り値
{Boolean} 渡された境界は、この境界の中にあるかどうか。
determineQuadrant
determineQuadrant: function( lonlat )
パラメータ
- lonlat {OpenLayers.LonLat}
戻り値
{String} 境界座標 (“br” “tr” “tl” “bl”)
transform
transform: function( source, dest )
境界の座標変換
パラメータ
- source {OpenLayers.Projection}
- dest {OpenLayers.Projection}
戻り値
{OpenLayers.Bounds}
wrapDateLine
wrapDateLine: function( maxExtent, options )
パラメータ
- maxExtent {OpenLayers.Bounds}
- options {Object} 設定可能のオプション:
- leftTolerance {float} Allow for a margin of error with the ‘left’ value of this bound. Default is 0.
- rightTolerance {float} Allow for a margin of error with the ‘right’ value of this bound. Default is 0.
戻り値
{OpenLayers.Bounds} A copy of this bounds, but wrapped around the “dateline” (as specified by the borders of maxExtent). Note that this function only returns a different bounds value if this bounds is entirely outside of the maxExtent. If this bounds straddles the dateline (is part in/part out of maxExtent), the returned bounds will be merely a copy of this one.
fromString
OpenLayers.Bounds.fromString = function( str )
座標文字列から境界インスタンスを作成するコンストラクターです。
パラメータ
- str {String} ','で区切りの境界座標文字列 (例: ”5,42,10,45”)
戻り値
{OpenLayers.Bounds} 境界のインスタンスです。
fromArray
OpenLayers.Bounds.fromArray = function( bbox )
座標配列から境界インスタンスを作成するコンストラクターです。
パラメータ
- bbox {Array(Float)} '境界座標配列 (例: [5,42,10,45])
戻り値
{OpenLayers.Bounds} 境界のインスタンスです。
fromSize
OpenLayers.Bounds.fromSize = function( size )
サイズオブジェクトから境界インスタンスを作成するコンストラクターです。
パラメータ
- size {OpenLayers.Size}
戻り値
{OpenLayers.Bounds} 境界のインスタンスです。





