code: function() {
          if (this.components) {
              var len = this.components.length;
              if (len > 0 && len <= 2) {
                  return this.components[0].clone();
              } else if (len > 2) {
                  var sumX = 0.0;
                  var sumY = 0.0;
                  var x0 = this.components[0].x;
                  var y0 = this.components[0].y;
                  var area = -1 * this.getArea();
                  if (area != 0) {
                      for (var i = 0; i < len - 1; i++) {
                          var b = this.components[i];
                          var c = this.components[i+1];
                          sumX += (b.x + c.x - 2 * x0) * ((b.x - x0) * (c.y - y0) - (c.x - x0) * (b.y - y0));
                          sumY += (b.y + c.y - 2 * y0) * ((b.x - x0) * (c.y - y0) - (c.x - x0) * (b.y - y0));
                      }
                      var x = x0 + sumX / (6 * area);
                      var y = y0 + sumY / (6 * area);
                  } else {
                      for (var i = 0; i < len - 1; i++) {
                          sumX += this.components[i].x;
                          sumY += this.components[i].y;
                      }
                      var x = sumX / (len - 1);
                      var y = sumY / (len - 1);
                  }
                  return new OpenLayers.Geometry.Point(x, y);
              } else {
                  return null;
              }
          }
      }
docs: APIMethod: getCentroid
  
  Returns:
  {<OpenLayers.Geometry.Point>} The centroid of the collection