MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / toBBOX

Method toBBOX

src/common/commontypes/Bounds.js:150–164  ·  view source on GitHub ↗

* @function Bounds.prototype.toBBOX * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。 * @example * var bounds = new 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,-

(decimal, reverseAxisOrder)

Source from the content-addressed store, hash-verified

148 * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"
149 */
150 toBBOX(decimal, reverseAxisOrder) {
151 if (decimal == null) {
152 decimal = 6;
153 }
154 var mult = Math.pow(10, decimal);
155 var xmin = Math.round(this.left * mult) / mult;
156 var ymin = Math.round(this.bottom * mult) / mult;
157 var xmax = Math.round(this.right * mult) / mult;
158 var ymax = Math.round(this.top * mult) / mult;
159 if (reverseAxisOrder === true) {
160 return ymin + "," + xmin + "," + ymax + "," + xmax;
161 } else {
162 return xmin + "," + ymin + "," + xmax + "," + ymax;
163 }
164 }
165
166 ///**
167 // * @function Bounds.prototype.toGeometry

Callers 5

BoundsSpec.jsFile · 0.80
toObjectMethod · 0.80
toObjectMethod · 0.80
toObjectMethod · 0.80
toObjectMethod · 0.80

Calls 1

roundMethod · 0.80

Tested by

no test coverage detected