1 |
- "use strict";app.controller("MapCoordinatesCtrl",["$scope","$compile",function(o,n){function t(o,n,t){return null!=n&&(o=Math.max(o,n)),null!=t&&(o=Math.min(o,t)),o}function e(o){return o*(Math.PI/180)}function i(o){return o/(Math.PI/180)}function r(){this.pixelOrigin_=new google.maps.Point(a/2,a/2),this.pixelsPerLonDegree_=a/360,this.pixelsPerLonRadian_=a/(2*Math.PI)}var a=256;r.prototype.fromLatLngToPoint=function(o,n){var i=this,r=n||new google.maps.Point(0,0),a=i.pixelOrigin_;r.x=a.x+o.lng()*i.pixelsPerLonDegree_;var l=t(Math.sin(e(o.lat())),-.9999,.9999);return r.y=a.y+.5*Math.log((1+l)/(1-l))*-i.pixelsPerLonRadian_,r},r.prototype.fromPointToLatLng=function(o){var n=this,t=n.pixelOrigin_,e=(o.x-t.x)/n.pixelsPerLonDegree_,r=(o.y-t.y)/-n.pixelsPerLonRadian_,a=i(2*Math.atan(Math.exp(r))-Math.PI/2);return new google.maps.LatLng(a,e)},o.$on("mapInitialized",function(n,t){var e=1<<t.getZoom(),i=new r;o.chicago=t.getCenter(),o.worldCoordinate=i.fromLatLngToPoint(o.chicago),o.pixelCoordinate=new google.maps.Point(o.worldCoordinate.x*e,o.worldCoordinate.y*e),o.tileCoordinate=new google.maps.Point(Math.floor(o.pixelCoordinate.x/a),Math.floor(o.pixelCoordinate.y/a))})}]),app.controller("EventSimpleCtrl",["$scope","$timeout",function(o,n){var t,e;o.$on("mapInitialized",function(o,n){e=n,t=e.markers[0]}),o.centerChanged=function(o){n(function(){e.panTo(t.getPosition())},3e3)},o.click=function(o){e.setZoom(8),e.setCenter(t.getPosition())}}]),app.controller("EventPropertiesCtrl",["$scope",function(o){o.$on("mapInitialized",function(n,t){var e=t.infoWindows[1];o.zoomChanged=function(o){e.setContent("Zoom: "+t.getZoom()),t.setCenter(e.getPosition())}})}]),app.controller("ControlCustomStateCtrl",["$scope",function(o){o.home=new google.maps.LatLng(41.850033,-87.6500523),o.goHome=function(){o.map.setCenter(o.home)},o.setHome=function(){o.home=o.map.getCenter()}}]);
|