Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #217
- Loading branch information
Showing
9 changed files
with
310 additions
and
281 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
components/feature-filter/feature-filter-element.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export default ['config', '$compile', function (config, $compile) { | ||
// console.log($state); | ||
return { | ||
// templateUrl: `${config.hsl_path}components/feature-filter/partials/${$state.type}${config.design || ''}.html`, | ||
template: '<ng-include src="getTemplateUrl()"/>', | ||
scope: { | ||
filter: "=" | ||
}, | ||
// link: function(scope, element, attrs) { | ||
// element.html(`${hsl_path}components/feature-filter/partials/${scope.filter.type}${config.design || ''}.html`).show(); | ||
// $compile(element.contents())(scope); | ||
// }, | ||
controller: function ($scope) { | ||
$scope.getTemplateUrl = function () { | ||
if (config.design == 'md') { | ||
switch ($scope.filter.type) { | ||
case 'fieldset': | ||
return `components/feature-filter/partials/fieldsetmd.html`; | ||
case 'slider': | ||
return `components/feature-filter/partials/slidermd.html`; | ||
} | ||
|
||
} else { | ||
switch ($scope.filter.type) { | ||
case 'fieldset': | ||
return `components/feature-filter/partials/fieldset.html`; | ||
case 'slider': | ||
return `components/feature-filter/partials/slider.html`; | ||
} | ||
} | ||
|
||
}; | ||
}, | ||
// templateUrl: function(el, attrs) { | ||
// return `${config.hsl_path}components/feature-filter/partials/${attrs.filter.type}md.html` | ||
// }, | ||
// link: function(scope, element, attrs) { | ||
// scope.filter = scope.$eval(attrs.filter); | ||
// }, | ||
// template: require('components/feature-filter/partials/{{filter.type}}md.html'), | ||
}; | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export default ['$scope', 'hs.map.service', 'Core', 'hs.featureFilter.service', 'hs.layermanager.service', 'config', | ||
function ($scope, OlMap, Core, service, LayMan, config) { | ||
var map = OlMap.map; | ||
|
||
$scope.map = OlMap.map; | ||
$scope.LayMan = LayMan; | ||
|
||
$scope.applyFilters = service.applyFilters; | ||
|
||
$scope.allSelected = function (filter) { | ||
return filter.selected ? filter.selected.length === filter.values.length : false; | ||
}; | ||
|
||
$scope.isIndeterminate = function (filter) { | ||
return filter.selected ? (filter.selected.length !== 0 && filter.selected.length !== filter.values.length) : false; | ||
}; | ||
|
||
$scope.exists = function (item, list) { | ||
return list.indexOf(item) > -1; | ||
}; | ||
|
||
$scope.toggle = function (value, selected) { | ||
var idx = selected.indexOf(value); | ||
if (idx > -1) { | ||
selected.splice(idx, 1); | ||
} else { | ||
selected.push(value); | ||
} | ||
}; | ||
|
||
$scope.toggleAll = function (filter) { | ||
if (filter.selected.length === filter.values.length) { | ||
filter.selected = []; | ||
} else { | ||
filter.selected = filter.values.slice(0); | ||
} | ||
}; | ||
|
||
$scope.$emit('scope_loaded', "featureFilter"); | ||
|
||
|
||
|
||
// $rootScope.$on('layermanager.layer_added', function (e, layer) { | ||
// service.prepLayerFilter(layer); | ||
|
||
// if (layer.layer instanceof VectorLayer) { | ||
// var source = layer.layer.getSource(); | ||
// console.log(source.getState()); | ||
// var listenerKey = source.on('change', function (e) { | ||
// if (source.getState() === 'ready') { | ||
// console.log(source.getState()); | ||
// Observable.unByKey(listenerKey); | ||
// service.prepLayerFilter(layer); | ||
// $scope.applyFilters(layer); | ||
// } | ||
// }); | ||
// } | ||
// }); | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default ['config', function (config) { | ||
return { | ||
template: require(`components/feature-filter/partials/feature-filter-md.html`), | ||
link: function (scope, element) { | ||
|
||
} | ||
}; | ||
}] |
Oops, something went wrong.