Skip to content

Commit

Permalink
Merge pull request ngageoint#640 in WV/opensphere from ~ECKLUNDE/open…
Browse files Browse the repository at this point in the history
…sphere:THIN-12698 to master

* commit 'cffda71e82ade3e96c6b9697a8f376eda8889966':
  feat(areafilter): Allow areafilterimport to be just areas or just filters
  • Loading branch information
ericadeckl committed Feb 28, 2019
2 parents 6b0ff3e + cffda71 commit a2e6342
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 7 deletions.
26 changes: 25 additions & 1 deletion src/os/filter/basefiltermanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,38 @@ os.filter.BaseFilterManager.prototype.hasEnabledFilters = function(opt_type) {
};


/**
* Determine the number of enabled filters
* @param {string=} opt_type
* @return {number} The number of enabled filters
*/
os.filter.BaseFilterManager.prototype.getNumEnabledFilters = function(opt_type) {
var numEnabledFilters = 0;
var filters = this.getFilters(opt_type) || [];
for (var i = 0; i < filters.length; i++) {
if (this.isEnabled(filters[i], opt_type)) {
numEnabledFilters += 1;
}
}
return numEnabledFilters;
};


/**
* Checks whether the filter is active against the opt_type layer.
* @param {os.filter.FilterEntry} filter
* @param {string=} opt_type
* @return {boolean}
*/
os.filter.BaseFilterManager.prototype.isEnabled = function(filter, opt_type) {
return filter.isEnabled();
var qm = os.ui.queryManager;

if (filter) {
var results = qm.getEntries(opt_type, null, filter.getId());
return !!results && !!results.length;
}

return false;
};


Expand Down
47 changes: 46 additions & 1 deletion src/os/ui/query/areafilteradd.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ os.ui.query.areaFilterAddDirective = function() {
return {
restrict: 'E',
replace: true,
scope: {},
scope: {
'hideArea': '=?',
'hideFilter': '=?'
},
templateUrl: os.ROOT + 'views/query/areafilteradd.html',
controller: os.ui.query.AreaFilterAddCtrl,
controllerAs: 'afa'
Expand Down Expand Up @@ -547,3 +550,45 @@ os.ui.query.AreaFilterAddCtrl.prototype.onAreasSelected_ = function(features) {
this.objectAreas_ = features;
this.onAreasUpdate_();
};


/**
* Launch the area/filter adder.
* @param {string} label
* @param {boolean=} opt_hideArea
* @param {boolean=} opt_hideFilter
*/
os.ui.query.AreaFilterAddCtrl.launch = function(label, opt_hideArea, opt_hideFilter) {
var id = 'areafilteradd';
if (os.ui.window.exists(id)) {
os.ui.window.bringToFront(id);
return;
}

var options = {
'id': id,
'x': 300,
'y': 'center',
'label': label,
'show-close': true,
'no-scroll': false,
'width': 400,
'min-width': 300,
'max-width': 1000,
'height': 600,
'min-height': 300,
'max-height': 1000
};

var template = '<areafilteradd';
if (opt_hideArea) {
template += ' hide-area="' + opt_hideArea + '"';
}

if (opt_hideFilter) {
template += ' hide-filter="' + opt_hideFilter + '"';
}
template += '></areafilteradd>';

os.ui.window.create(options, template);
};
2 changes: 1 addition & 1 deletion views/file/anytypeimport.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<div class="modal-body">
<div>
<div class="container-fluid">
<div class="row">
<b class="px-1 u-word-wrap-break-word">{{file.getFileName()}}</b>
</div>
Expand Down
8 changes: 4 additions & 4 deletions views/query/areafilteradd.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="d-flex flex-column flex-fill">
<div class="modal-body d-flex flex-column">
<div class="js-filters-header">
<div class="js-filters-header" ng-if="!hideFilter">
<b><i class="fa fa-fw fa-filter"></i>Choose filters to add</b>
<input class="form-control" type="text" ng-model="filterTerm" ng-change="afa.searchFilters()" placeholder="Search filters"/>
</div>
<div class="js-filter-tree d-flex" autoheight="50%" siblings=".js-areas-header, .js-filters-header, js-area-tree">
<div class="js-filter-tree d-flex" ng-if="!hideFilter" autoheight="!hideArea ? 50% : 100%" siblings=".js-areas-header, .js-filters-header, js-area-tree">
<slicktree x-data="filters" selected="selected" show-root="true" multi-select="true"></slicktree>
</div>

<div class="js-areas-header">
<div class="js-areas-header" ng-if="!hideArea">
<b>
<i class="fa fa-fw fa-star-o"></i>Choose areas to add
<div class="float-right">
Expand All @@ -27,7 +27,7 @@
</div>
<input class="form-control" type="text" ng-model="areaTerm" ng-change="afa.searchAreas()" placeholder="Search areas"/>
</div>
<div class="js-area-tree d-flex" autoheight="50%" siblings=".js-areas-header, .js-filters-header, js-filter-tree">
<div class="js-area-tree d-flex" ng-if="!hideArea" autoheight="!hideFilter ? 50% : 100%" siblings=".js-areas-header, .js-filters-header, js-filter-tree">
<slicktree x-data="areas" selected="selected" show-root="true" multi-select="true"></slicktree>
</div>
</div>
Expand Down

0 comments on commit a2e6342

Please sign in to comment.