{"version":3,"names":[],"mappings":"","sources":["global/maps.js"],"sourcesContent":["'use strict';\n\nvar map;\nvar directionsDisplay;\nvar directionsService;\nvar stepDisplay;\nvar markerArray = [];\n\nfunction initialize() {\n // Instantiate a directions service.\n directionsService = new google.maps.DirectionsService();\n\n var manhattan = new google.maps.LatLng(41.014557, 28.978994);\n var mapOptions = {\n zoom: 14,\n center: manhattan\n\n };\n var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);\n var image = 'img/maps.png';\n var myLatLng = new google.maps.LatLng(41.014557, 28.978994);\n var beachMarker = new google.maps.Marker({\n position: myLatLng,\n map: map,\n icon: image\n });\n // Create a renderer for directions and bind it to the map.\n var rendererOptions = {\n map: map\n };\n directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);\n // Instantiate an info window to hold step text.\n stepDisplay = new google.maps.InfoWindow({\n content: \"SİRKECİ EMEK HOTEL\"\n });\n calcRoute();\n stepDisplay.open(map, beachMarker);\n}\n\nfunction calcRoute() {\n\n // First, remove any existing markers from the map.\n for (var i = 0; i < markerArray.length; i++) {\n markerArray[i].setMap(null);\n }\n\n // Now, clear the array itself.\n markerArray = [];\n\n // Retrieve the start and end locations and create\n // a DirectionsRequest using WALKING directions.\n var start = document.getElementById('start').value;\n var end = document.getElementById('end').value;\n var request = {\n origin: start,\n destination: end,\n travelMode: google.maps.TravelMode.WALKING\n };\n\n // Route the directions and pass the response to a\n // function to create markers for each step.\n directionsService.route(request, function (response, status) {\n if (status == google.maps.DirectionsStatus.OK) {\n var warnings = document.getElementById('warnings_panel');\n warnings.innerHTML = '' + response.routes[0].warnings + '';\n directionsDisplay.setDirections(response);\n showSteps(response);\n }\n });\n}\nfunction showSteps(directionResult) {\n // For each step, place a marker, and add the text to the marker's\n // info window. Also attach the marker to an array so we\n // can keep track of it and remove it when calculating new\n // routes.\n var myRoute = directionResult.routes[0].legs[0];\n\n for (var i = 0; i < myRoute.steps.length; i++) {\n var marker = new google.maps.Marker({\n position: myRoute.steps[i].start_location,\n map: map\n });\n attachInstructionText(marker, myRoute.steps[i].instructions);\n markerArray[i] = marker;\n }\n}\n\nfunction attachInstructionText(marker, text) {\n google.maps.event.addListener(marker, 'click', function () {\n // Open an info window when the marker is clicked on,\n // containing the text of the step.\n stepDisplay.setContent(text);\n stepDisplay.open(map, marker);\n });\n}\n\ngoogle.maps.event.addDomListener(window, 'load', initialize);"],"file":"../../global/maps.js"}