"use strict";
var polygon_controller_1 = require("./polygon.controller");
var PolygonTool = (function () {
function PolygonTool($timeout, $window, olData, ol) {
this.$timeout = $timeout;
this.$window = $window;
this.olData = olData;
this.ol = ol;
this.restrict = 'E';
this.require = '^openlayers';
this.template = "<os-button ng-if=\"!ctrl.noView\" variation=\"outline\" colour=\"primary\" ng-click=\"ctrl.isActive = !ctrl.isActive\">Polygon</os-button>";
this.scope = {};
this.bindToController = {
featureLayer: '=osFeatureLayer',
isActive: '=osIsActive',
noView: '=osNoView'
};
this.controllerAs = 'ctrl';
this.controller = polygon_controller_1.PolygonToolController;
PolygonTool.prototype.link = function (scope, iElement, iAttrs, olCtrl) {
scope.$watch('ctrl.isActive', function (isActive) {
if (isActive !== scope.ctrl.isToolActive()) {
scope.ctrl.toggle();
}
});
function PolygonTool_OL() {
ol.control.Control.call(this, {
element: iElement[0]
});
}
olData.getMap().then(function (map) {
ol.inherits(PolygonTool_OL, ol.control.Control);
map.addControl(new PolygonTool_OL());
});
};
}
PolygonTool.prototype.BasicControl = function (element) {
return ol.control.Control.call(this, {
element: element
});
};
;
PolygonTool.Factory = function () {
var directive = function ($timeout, $window, olData, ol) {
return new PolygonTool($timeout, $window, olData, ol);
};
directive['$inject'] = ['$timeout', '$window', 'olData', 'ol'];
return directive;
};
return PolygonTool;
}());
exports.PolygonTool = PolygonTool;
|