Skip to content

Commit

Permalink
#57 Added clustering toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
kev007 committed May 18, 2016
1 parent f280dce commit 77e2ee4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
var updateQueued = false;
$scope.search.updateFilters = function () {
if (!httpService.getLoading()) {
httpService.setLoading(true);
/**
* Pass the filters to the httpService
*/
Expand Down Expand Up @@ -222,7 +223,7 @@
/**
* Reset all markers
*/
$scope.markers = {}
$scope.markers = {};

/**
* Iterate through tweets
Expand All @@ -241,16 +242,28 @@
* Create new marker then add to marker array
* @type {{id: *, lat: *, lng: *, focus: boolean, draggable: boolean, message: *, icon: {}}}
*/
var newMarker = {
id: tweet.id,
layer: 'cluster',
lat: tweet.coordinates.coordinates[1],
lng: tweet.coordinates.coordinates[0],
focus: false,
draggable: false,
message: "@" + tweet.user.screen_name + ": " + tweet.text,
// icon: $scope.icons.red
};
var newMarker = {}
if($scope.clusteringEnabled) {
newMarker = {
id: tweet.id,
layer: 'cluster',
lat: tweet.coordinates.coordinates[1],
lng: tweet.coordinates.coordinates[0],
focus: false,
draggable: false,
message: "@" + tweet.user.screen_name + ": " + tweet.text,
};
} else {
newMarker = {
id: tweet.id,
lat: tweet.coordinates.coordinates[1],
lng: tweet.coordinates.coordinates[0],
focus: false,
draggable: false,
message: "@" + tweet.user.screen_name + ": " + tweet.text,
icon: $scope.icons.red
};
}
// $scope.markers.push(newMarker)
// $scope.markers.push(tweet.id + ": " + newMarker)
$scope.markers[tweet.id] = newMarker;
Expand Down
3 changes: 2 additions & 1 deletion rest_service/src/main/resources/static/views/mapView.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
</div>
</div>

<div class="row alert alert-danger" uib-collapse="clickOnce = true" role="alert">
<div class="row alert alert-danger" uib-collapse="clickOnce" role="alert">
<label class="btn btn-danger btn-lsmg" ng-model="clusteringEnabled" uib-btn-checkbox btn-checkbox-true=true btn-checkbox-false=false ng-click="populateMarkers();">Clustering</label>
<strong>[DEBUG]</strong>
<button class="btn btn-danger btn-sm" ng-click="clickOnce = true;">Hide</button>
<br>
Expand Down

0 comments on commit 77e2ee4

Please sign in to comment.