Guest User

error

a guest
Oct 6th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.  
  6.  
  7.  
  8.  
  9.  
  10. <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
  11.  
  12.  
  13.  
  14. <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
  15.  
  16.  
  17.  
  18. <style type="text/css">
  19. <?php /* html, body, #map { width:100%; height:100%; margin:0; padding:0; }*/?>
  20. body {
  21. padding: 0;
  22. margin: 0;
  23. }
  24. html, body, #map {
  25. height: 100vh;
  26. width: 100vw;
  27. }
  28. </style>
  29.  
  30. <title> by error</title>
  31.  
  32.  
  33.  
  34.  
  35. <link href="css/leaflet.css" rel="stylesheet" type="text/css">
  36.  
  37.  
  38. <script type='text/javascript'>//<![CDATA[
  39. window.onload=function(){
  40. var w = 120000;
  41. var h = 120000;
  42. var mapMinZoom = 3;
  43. var mapMaxZoom = 3;
  44.  
  45.  
  46.  
  47. var _map = L.map('map', {
  48. zoom:1,
  49. maxBounds: new L.LatLngBounds([0,0], [120000, 120000]),
  50. touchZoom:false,
  51. scrollWheelZoom: false,
  52. doubleClickZoom:false,
  53. crs: L.CRS.Simple,
  54. zoomControl: false,
  55. attributionControl: false,
  56. detectRetina: false
  57. })
  58. var southWest = _map.unproject([0,120000], _map.getMaxZoom());
  59. var northEast = _map.unproject([120000,0], _map.getMaxZoom());
  60. _map.setMaxBounds(new L.LatLngBounds(southWest, northEast));
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. var _mapBounds = new L.LatLngBounds(
  69. _map.unproject([1, h], mapMaxZoom),
  70. _map.unproject([w, 1], mapMaxZoom));
  71. _map.setMaxBounds(_mapBounds);
  72.  
  73. //var _mapCenter = _map.unproject([w/2, h/2], mapMaxZoom);
  74. //_map.setView(_mapCenter, 3);
  75.  
  76. <?php
  77. require('db.conf.php');
  78.  
  79. $strImagePath = "";
  80. // Create connection
  81. $conn = new mysqli($servername, $username, $password, $dbname);
  82. // Check connection
  83. if ($conn->connect_error) {
  84. die("Connection failed: " . $conn->connect_error);
  85. }
  86.  
  87. $sql = "SELECT * FROM `kingdome` WHERE member_id = '1'";
  88. $result = $conn->query($sql);
  89.  
  90. if ($result->num_rows > 0) {
  91. // output data of each row
  92. while($row = $result->fetch_assoc()) {
  93. $pieces = explode(",", $row['latlng']);
  94. $one = $pieces[0];
  95. $two = $pieces[1];
  96. /*?>alert(<?php echo "108" . " + '-' + " . $two;?>);<?php*/
  97. /*?>_map.setView([<?php echo $one;?>,<?php echo $two;?>], 3);<?php*/
  98. }
  99. } else {
  100. //do nothing
  101. }
  102. $conn->close();
  103. ?>
  104.  
  105.  
  106. var _tileLayer = L.tileLayer(
  107. //'http://127.0.0.1/wotu/map/img/{z}/map_{x}_{y}.png', {
  108. //'http://192.168.43.205/wotu/map/test/map_{x}_{y}.png', {
  109. 'http://192.168.43.205/wotu/map/image.php?space_id={x}r{y}', {
  110. //'http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
  111. bounds: _mapBounds,
  112. continuousWorld: true,
  113. noWrap:true,
  114. tileSize:100,
  115. crs: L.CRS.Simple,
  116. detectRetina:false
  117.  
  118. }).addTo(_map);
  119.  
  120.  
  121. //var _mapCenter = _map.unproject([500, 300], mapMaxZoom);
  122. //_map.setView(_mapCenter, 3);
  123.  
  124. //_map.setView([-2500, 300]);
  125.  
  126. var london = new L.LatLng(-35, 20);
  127. _map.setView(london, 3);
  128.  
  129. var markerLocation = new L.LatLng(-20, 20);
  130. var markerLocation2 = new L.LatLng(-35, 20);
  131. //Extend the Default marker class
  132. var RedIcon = L.Icon.Default.extend({
  133. options: {
  134. iconUrl: 'image/castle.png',
  135. iconSize:[100,100],
  136. }
  137. });
  138. var redIcon = new RedIcon();
  139.  
  140. /*
  141. //Other things we could have changed
  142. iconSize: [25, 41], // size of the icon
  143. shadowSize: [50, 64], // size of the shadow
  144. iconAnchor: [12, 41] // point of the icon which will correspond to marker's location
  145. shadowAnchor: [4, 62], // the same for the shadow
  146. popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
  147. */
  148.  
  149.  
  150. L.marker(markerLocation, {icon: redIcon}).addTo(_map);
  151. L.marker(markerLocation2, {icon: redIcon}).addTo(_map);
  152.  
  153. _map.on('click', function(e) {
  154. alert("Lat, Lon : " + e.latlng.lat + ", " + e.latlng.lng)
  155. });
  156. function onMapClick(e) {
  157. e.originalEvent.defaultPrevented = true;
  158. var orig = e.originalEvent;
  159. console.log(orig);
  160. //_map.setView([orig.x,orig.y], 3);
  161. alert(orig.toElement.src);
  162. orig.toElement.src = "http://cdn.head-fi.org/b/b3/100x100px-LS-b331da36_1000x500px-LL-9b46fb2b_homer-headphones.jpeg";
  163.  
  164. }
  165. _map.on('click', onMapClick);
  166.  
  167.  
  168.  
  169. function onMapClick2(e) {
  170.  
  171.  
  172.  
  173. console.log(e.latlng);
  174.  
  175.  
  176. }
  177.  
  178. //Hadnel on right click functions TODO: MOVE THIS LATER
  179. _map.on('contextmenu', onMapClick2);
  180.  
  181. }
Add Comment
Please, Sign In to add comment