Merge vector-2.4 branch back to trunk.

svn merge sandbox/vector-2.4/@2307 sandbox/vector-2.4/@HEAD trunk/openlayers/


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2803 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-03-16 13:23:56 +00:00
parent 8b9d974dc2
commit 3ca974acec
159 changed files with 10193 additions and 343 deletions

View File

@@ -0,0 +1,76 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */
/**
* @class
*
* A Rectangle is a simple geometry. It is specified by a a point (x and y)
* and dimensions (width and height), all of which are directly accessible as
* properties.
*
* @requires OpenLayers/Geometry.js
*/
OpenLayers.Geometry.Rectangle = OpenLayers.Class.create();
OpenLayers.Geometry.Rectangle.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry, {
/** @type float */
x: null,
/** @type float */
y: null,
/** @type float */
width: null,
/** @type float */
height: null,
/**
* @constructor
*
* @param {array} points
*/
initialize: function(x, y, width, height) {
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
this.x = x;
this.y = y;
this.width = width;
this.height = height;
},
/**
*
*/
calculateBounds: function() {
this.bounds = new OpenLayers.Bounds(this.x, this.y,
this.x + this.width,
this.y + this.height);
},
/**
* @returns The length of the geometry
* @type float
*/
getLength: function() {
var length = (2 * this.width) + (2 * this.height);
return length;
},
/**
* @returns The area of the geometry
* @type float
*/
getArea: function() {
var area = this.width * this.height;
return area;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Geometry.Rectangle"
});