2014-12-26 03:05:07 +00:00
|
|
|
(function(fp, $, ng, undefined) {
|
|
|
|
|
2016-03-04 19:18:01 +00:00
|
|
|
fp.app.factory("fpMapToolbox", function($compile, $templateCache, fpTable) {
|
2014-12-26 03:05:07 +00:00
|
|
|
return function(map) {
|
|
|
|
var scope = map.socket.$new();
|
|
|
|
|
|
|
|
scope.addObject = function(type) {
|
|
|
|
if(type.type == "marker")
|
|
|
|
map.markersUi.addMarker(type);
|
|
|
|
else if(type.type == "line")
|
|
|
|
map.linesUi.addLine(type);
|
|
|
|
};
|
|
|
|
|
|
|
|
scope.displayView = map.displayView.bind(map);
|
|
|
|
|
|
|
|
scope.saveView = map.viewsUi.saveView.bind(map.viewsUi);
|
|
|
|
|
|
|
|
scope.manageViews = map.viewsUi.manageViews.bind(map.viewsUi);
|
|
|
|
|
|
|
|
scope.layers = map.getLayerInfo();
|
|
|
|
|
|
|
|
scope.setLayer = function(layer) {
|
|
|
|
map.showLayer(layer.permalinkName, !layer.visibility);
|
|
|
|
scope.layers = map.getLayerInfo();
|
|
|
|
};
|
|
|
|
|
|
|
|
scope.editPadSettings = map.padUi.editPadSettings.bind(map.padUi);
|
|
|
|
|
|
|
|
scope.editObjectTypes = map.typesUi.editTypes.bind(map.typesUi);
|
|
|
|
|
2014-12-31 02:26:45 +00:00
|
|
|
scope.showTable = fpTable.showTable.bind(fpTable);
|
|
|
|
|
2016-09-28 12:10:08 +00:00
|
|
|
scope.exportGpx = map.gpxUi.exportGpx.bind(map.gpxUi);
|
|
|
|
|
2016-10-04 12:43:57 +00:00
|
|
|
var ret = {
|
|
|
|
div: $($templateCache.get("map/toolbox/toolbox.html"))
|
|
|
|
};
|
|
|
|
$compile(ret.div.insertBefore(map.map.div))(scope);
|
2014-12-26 03:05:07 +00:00
|
|
|
scope.$evalAsync(); // $compile only replaces variables on next digest
|
2016-10-04 12:43:57 +00:00
|
|
|
|
|
|
|
return ret;
|
2014-12-26 03:05:07 +00:00
|
|
|
}
|
2016-03-04 19:18:01 +00:00
|
|
|
});
|
2014-12-26 03:05:07 +00:00
|
|
|
|
|
|
|
})(FacilPad, jQuery, angular);
|