diff --git a/library/src/com/twotoasters/clusterkraf/ClusterPoint.java b/library/src/com/twotoasters/clusterkraf/ClusterPoint.java index d3a2948..61c2adb 100644 --- a/library/src/com/twotoasters/clusterkraf/ClusterPoint.java +++ b/library/src/com/twotoasters/clusterkraf/ClusterPoint.java @@ -35,10 +35,22 @@ public class ClusterPoint extends BasePoint { void add(InputPoint point) { pointsInClusterList.add(point); pointsInClusterSet.add(point); + + mapPosition = getCenterLatLng(); boundsOfInputPoints = null; } + private LatLng getCenterLatLng() { + LatLngBounds bounds = getBoundsOfInputPoints(); + LatLng loc = new LatLng(avg(bounds.northeast.latitude,bounds.southwest.latitude),avg(bounds.northeast.longitude,bounds.southwest.longitude)); + return loc; + } + + private double avg(double a, double b) { + return (a+b)/2; + } + ArrayList getPointsInCluster() { return pointsInClusterList; }