Skip to content

Commit

Permalink
initial stab at twotoasters#15 showing clustered point at centroid of…
Browse files Browse the repository at this point in the history
… all points
  • Loading branch information
ruckc committed Jul 13, 2013
1 parent f24a5da commit 22ecbab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions library/src/com/twotoasters/clusterkraf/ClusterPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputPoint> getPointsInCluster() {
return pointsInClusterList;
}
Expand Down

0 comments on commit 22ecbab

Please sign in to comment.