@@ -0,0 +1,1333 @@
+package com.cocoahero.android.gmaps.addons.util;%0A%0Aimport java.util.List;%0A%0Aimport com.google.android.gms.maps.model.LatLng;%0Aimport com.google.android.gms.maps.model.Polygon;%0A%0Apublic class PolygonUtils %7B%0A%0A    public static LatLng getCentroid(Polygon polygon) %7B%0A        List%3CLatLng%3E points = polygon.getPoints();%0A%0A        if (points.size() %3C= 2) %7B%0A            return null;%0A        %7D%0A        %0A        double x0 = 0.0;%0A        double y0 = 0.0;%0A        double x1 = 0.0;%0A        double y1 = 0.0;%0A        double wa = 0.0;%0A        double sa = 0.0;%0A        double cx = 0.0;%0A        double cy = 0.0;%0A%0A        int i = 0;%0A%0A        for (i = 0; i %3C points.size() - 1; ++i) %7B%0A            x0 = points.get(i).latitude;%0A            y0 = points.get(i).longitude;%0A            x1 = points.get(i + 1).latitude;%0A            y1 = points.get(i + 1).longitude;%0A%0A            sa += wa = (x0 * y1) - (x1 * y0);%0A%0A            cx += (x0 + x1) * wa;%0A            cy += (y0 + y1) * wa;%0A        %7D%0A%0A        x0 = points.get(i).latitude;%0A        y0 = points.get(i).longitude;%0A        x1 = points.get(0).latitude;%0A        y1 = points.get(0).longitude;%0A%0A        sa += wa = (x0 * y1) - (x1 * y0);%0A%0A        cx += (x0 + x1) * wa;%0A        cy += (y0 + y1) * wa;%0A%0A        sa *= 0.5;%0A%0A        cx /= (6.0 * sa);%0A        cy /= (6.0 * sa);%0A%0A        return new LatLng(cx, cy);%0A    %7D%0A%0A%7D%0A

Add polygon centroid calculation