Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions library/src/com/twotoasters/clusterkraf/ClustersBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ ArrayList<ClusterPoint> build() {
clusteredPoints = new ArrayList<ClusterPoint>(relevantInputPointsList.size());
for (InputPoint point : relevantInputPointsList) {
boolean addedToExistingCluster = false;
for (ClusterPoint clusterPoint : clusteredPoints) {
if (clusterPoint.getPixelDistanceFrom(point) <= options.getPixelDistanceToJoinCluster()) {
clusterPoint.add(point);
addedToExistingCluster = true;
break;

if (options.isClusterEnabled()) {
for (ClusterPoint clusterPoint : clusteredPoints) {
if (clusterPoint.getPixelDistanceFrom(point) <= options.getPixelDistanceToJoinCluster()) {
clusterPoint.add(point);
addedToExistingCluster = true;
break;
}
}
}

if (addedToExistingCluster == false) {
clusteredPoints.add(new ClusterPoint(point, projection, false));
}
Expand Down
21 changes: 20 additions & 1 deletion library/src/com/twotoasters/clusterkraf/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public class Options {
*/
private double expandBoundsFactor = DEFAULT_EXPAND_BOUNDS_FACTOR;

/**
* Enable or disable clustering
*/
private boolean clusterEnabled = true;

/**
* The MarkerOptionsChooser to use for customizing MarkerOptions objects.
*/
Expand Down Expand Up @@ -116,7 +121,21 @@ public class Options {
/**
*
*/
private ProcessingListener processingListener;
private ProcessingListener processingListener;

/**
* @return clusterEnabled
*/
public boolean isClusterEnabled() {
return clusterEnabled;
}

/**
* @param clusterEnabled
*/
public void setClusterEnabled(boolean clusterEnabled) {
this.clusterEnabled = clusterEnabled;
}

/**
* @return the transitionDuration
Expand Down