source : map-controller.js

  1. (function() {
  2. 'use strict';
  3. /**
  4. * @memberof ngmap
  5. * @ngdoc controller
  6. * @name MapController
  7. * @param $scope {service} controller scope
  8. * @param $q {service} promise service
  9. * @param NavigatorGeolocation {service} Google NavigatorGeolocation wrapper
  10. * @param GeoCoder {service} Google GeoCoder wrapper
  11. * @param Attr2Options {service} Converts element attributes to Google Maps API options
  12. */
  13. var MapController = function($scope, $q, NavigatorGeolocation, GeoCoder, Attr2Options) {
  14. /**
  15. * @property {Hash} _objects collection og objects that belongs to this map
  16. */
  17. this._objects = {};
  18. /**
  19. * Add an object to the collection of group
  20. * @memberof MapController
  21. * @function addObject
  22. * @param groupName the name of collection that object belongs to
  23. * @param obj an object to add into a collection, i.e. marker, shape
  24. */
  25. this.addObject = function(groupName, obj) {
  26. // .. code ..
  27. };
  28. /**
  29. * Delete an object from the collection and remove from map
  30. * @memberof MapController
  31. * @function deleteObject
  32. * @param {Array} objs the collection of objects. i.e., map.markers
  33. * @param {Object} obj the object to be removed. i.e., marker
  34. */
  35. this.deleteObject = function(groupName, obj) {
  36. // .. code ..
  37. };
  38. /**
  39. * returns the location of an address or 'current-location'
  40. * @memberof MapController
  41. * @function getGeoLocation
  42. * @param {String} string an address to find the location
  43. * @returns {Promise} latlng the location of the address
  44. */
  45. this.getGeoLocation = function(string) {
  46. // .. code ..
  47. };
  48. };
  49. angular.module('ngMap').controller('MapController', MapController);
  50. })();