/**
 * APIMethod: getSize
 * Get the size object in LatLng of this bounds.  The object has height and 
 *     width properties.
 * 
 * Returns:
 * {Object} Size object.
 */
GLatLngBounds.prototype.getSize = function() {
    var oSize = {};

    var oSW = this.getSouthWest();
    var oNE = this.getNorthEast();

    oSize['width'] = oNE.x - oSW.x;
    oSize['height'] = oNE.y - oSW.y;

    return oSize;
};

/**
 * APIMethod: getLBRT
 * Get the left, bottom, right and top values of this bounds.  They are put in 
 *     an 'size' object with the 4 properties.
 * 
 * Returns:
 * {Object} Size object.
 */
GLatLngBounds.prototype.getLBRT = function() {
    var oLBRT = {};

    var oSW = this.getSouthWest();
    var oNE = this.getNorthEast();

    oLBRT['left'] = oSW.x;
    oLBRT['bottom'] = oSW.y;
    oLBRT['right'] = oNE.x;
    oLBRT['top'] = oNE.y;

    return oLBRT;
};

/** 
 * APIMethod: toBBOX
 * 
 * Parameters:
 * decimal - {Integer} How many significant digits in the bbox coords?
 *                     Default is 6
 * 
 * Returns:
 * {String} Simple String representation of bounds object.
 *          (ex. <i>"5,42,10,45"</i>)
 */
GLatLngBounds.prototype.toBBOX = function(decimal) {
    if (decimal== null) {
        decimal = 6; 
    }
    var mult = Math.pow(10, decimal);
    var oLBRT = this.getLBRT();
    var bbox = Math.round(oLBRT.left * mult) / mult + "," + 
    Math.round(oLBRT.bottom * mult) / mult + "," + 
    Math.round(oLBRT.right * mult) / mult + "," + 
    Math.round(oLBRT.top * mult) / mult;

    return bbox;
};

/** 
 * APIMethod: getBoundsFromRatio
 * 
 * Parameters:
 * ratio - {Float} The ratio of the needed bounds
 * 
 * Returns:
 * oBounds - {<GLatLngBounds>} The rationized bounds object
 */
GLatLngBounds.prototype.getBoundsFromRatio = function(ratio) {
    if(!ratio) {
        return this;
    }

    var center = this.getCenter();

    var oSize = this.getSize();
    var dataWidth = oSize.width * ratio;
    var dataHeight = oSize.height * ratio;

    var oBounds = new GLatLngBounds(
        new GLatLng(center.lat() - (dataHeight / 2),
                    center.lng() - (dataWidth / 2)),
        new GLatLng(center.lat() + (dataHeight / 2),
                    center.lng() + (dataWidth / 2))
    );

    return oBounds;
};

