测试地图最短路径搜索(四):做一个稍微完整的手绘覆盖以及路径搜索(附所有代码)

 

工具点此链接。

点击这里看下前面介绍的这种方案的基本原理。

测试地图最短路径搜索(一):把所有的辅助条件都铺到地图上

测试地图最短路径搜索(二):换个稍微复杂点的路径模板

测试地图最短路径搜索(三):用更细的路径模板图片来测试

测试地图最短路径搜索(四):做一个稍微完整的手绘覆盖以及路径搜索(附所有代码)

测试地图最短路径搜索(五):整个流程走一遍

 

 

用ps制作大小完全一样的手绘图和路径图模板。用配准法生成切片,用实验室生成路径搜索文件。

1、用配准法完成切片的生成。

2、生成路径搜索功能。点击实验室——定位路径模板图片(黑白png文件),生成导航——图片重置,配准,生成路径搜索。这个步骤自动使用第一步的配准参数,不要再次配准。

另外,第一步会把第二步生成的结果都抹掉。所以,要注意顺序。

这样就初步实现了路径与手绘图的对应、路径搜索功能。左键设置道路起点,右键设置终点。

几个数据:

图片大小:3229*2480,手绘图跟路径图模板必须是完全一样大小的。

判断点密度:400。

这个400比较纠结,太大会导致初次加载变慢,太小会隔断道路。有时间可以进行这样的尝试,比如使用c=300,然后不断测试什么地方路径中断,调整路径模板图,加宽这个地方的道路,然后再次重复步骤2重新生成路径参数,解决路径中断问题。

加载完成后,随便左右键定义搜索起点、终点,搜索的过程刷刷的很快,感觉没啥时间延迟。

本想打包上传生成的所有文件,但是我的网站有故障了。后面再传。

生成的切片及代码下载:https://pan.baidu.com/s/1va0ygKTK_0sL7jtM9OwyRQ

附上所有代码:

tx.html

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>tengxun</title>
    <style type="text/css">
        * {
            margin: 0px;
            padding: 0px;
        }

        body, button, input, select, textarea {
            font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
        }

        p {
            width: 603px;
            padding-top: 3px;
            overflow: hidden;
        }

        .btn {
            width: 100px;
            height: 26px
        }
        #container {
           min-width:603px;
           min-height:767px;
        }
    </style>
    <script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-"></script>
		<!--#astarjs_t#-->
	<script type='text/javascript' src='astar.js'></script>
	<!--#astarjs_b#-->
    <script>
		//varstar_t
	var graphDiagonal = new Graph(gridDest, { diagonal: true }); 
	var start = graphDiagonal.grid[0][0];
	var end = graphDiagonal.grid[0][3]; 
	var startLng, startLat, endLng, endLat;
	var pathPoi = [], pathLineArray = [];
	//varstar_b


        var map;
        function init() {
            var earthlayer = new qq.maps.ImageMapType({
                name: 'tentxun',
                alt: 'tentxun',
                tileSize: new qq.maps.Size(256, 256),
                minZoom: 14,
                maxZoom: 0,
                opacity: 1,
                getTileUrl: function (tile, zoom) {
                    var z = zoom,
                            x = tile.x,
                            y = tile.y;
					return 'tiles/' + z + '/' + x + '_' + y + '.png';
                }

            });

            map = new qq.maps.Map(document.getElementById("container"), {
                center: new qq.maps.LatLng(19.13446, 110.56323),
                zoom: 16
            });
            map.overlayMapTypes.push(earthlayer);

			//click_t
      //添加监听事件
      qq.maps.event.addListener(map, 'click', function(event) {
      	var latLng = event.latLng;
      	var lng = latLng.getLng();
      	var lat = latLng.getLat();
      	var a = lngToGC(lng, zoomStar);
      	var b = latToGR(lat, zoomStar);
      	startLng = lng;
      	startLat = lat;
      	start = graphDiagonal.grid[a][b];
      	drawLine();
      });
      qq.maps.event.addListener(map, 'rightclick', function(event) {
      	var latLng = event.latLng;
      	var lng = latLng.getLng();
      	var lat = latLng.getLat();
      	var a = lngToGC(lng, zoomStar);
      	var b = latToGR(lat, zoomStar);
      	endLng = lng;
      	endLat = lat;
      	end = graphDiagonal.grid[a][b];
      	drawLine(); 
      });
      //click_b 



        }
		//drawline_t
         function drawLine(){
         	pathlnla = astar.search(graphDiagonal, start, end, { heuristic: astar.heuristics.diagonal });
         	pathPoi = [];
         	for (var i=0; i<pathlnla.length ; i++)
         	{
         		var s1 = pathlnla[i];
         		var regx = /(?<=\[)\d+\.\d+/;
         		var regy = /\d+\.\d+(?=\])/;
         		var pathPoiX = regx.exec(s1);
         		var pathPoiY = regy.exec(s1);
         		var poi = new qq.maps.LatLng(pathPoiY, pathPoiX);
         		pathPoi.push(poi);
         	}
         	if (pathLineArray) {
         		for (i in pathLineArray) {
         			pathLineArray[i].setMap(null);
         		}
         	}
         	var polyline = new qq.maps.Polyline({
         		path: pathPoi,
         		strokeColor: '#FF0000',
         		strokeWeight: 5,
         		editable:false,
         		map: map
         	});
         	pathLineArray.push(polyline);
         }
         //drawline_b

    </script>
</head>
<body onload="init();">
<div id="container"></div>
<span id="info"></span>
</body>
</html>

astar.js:

// javascript-astar 0.4.1
// http://github.com/bgrins/javascript-astar
// Freely distributable under the MIT License.
// Implements the astar search algorithm in javascript using a Binary Heap.
// Includes Binary Heap (with modifications) from Marijn Haverbeke.
// http://eloquentjavascript.net/appendix2.html
(function(definition) {
  /* global module, define */
  if (typeof module === 'object' && typeof module.exports === 'object') {
    module.exports = definition();
  } else if (typeof define === 'function' && define.amd) {
    define([], definition);
  } else {
    var exports = definition();
    window.astar = exports.astar;
    window.Graph = exports.Graph;
	window.gridDest = exports.gridDest;
	window.lngToGC = exports.lngToGC;
	window.latToGR = exports.latToGR;
	window.zoomStar = exports.zoomStar;
	//window.gridBlack = exports.gridBlack;
	//window.gridWhite = exports.gridWhite;
	//window.startR = exports.startR; 
	//window.startC = exports.startC;

  }
})(function() {

function pathTo(node) {
  var curr = node;
  var path = [];
  var pathLngLat = []; // cbq
  while (curr.parent) {
    path.unshift(curr);
    curr = curr.parent;
  }
	var pathLngLat = [];
	for (var i = 0; i < path.length; i++) {
		var s1 = path[i];
		var regx = /(?<=\[)\d+/;
		var regy = /\d+(?=\])/;
		var pathPoiX = regx.exec(s1);
		var pathPoiY = regy.exec(s1);
		var lng = pixToLng(deltX + cellWid * (pathPoiX), zoomStar);  // polyPoiF[i].x + deltaLenX
		var lat = pixToLat(deltY + cellWid * (pathPoiY), zoomStar);  // polyPoiF[i].y + deltaLenY
		pathLngLat[i] = '[' + lng + ',' + lat + ']';
	}
	return pathLngLat;
}

function getHeap() {
  return new BinaryHeap(function(node) {
    return node.f;
  });
}

//---------------------------------------------------------------------------------
var	
	deltX = 13540482,
	deltY = 7478025,
	zoomStar = 16,
	w = 2587,
	c = 400;

	var 
	cellWid = w/c, 
	cellPosX, cellPosY; //, startR, startC;

var poly0 = [[630,1965.703125],[630,1965.296875],[631.296875,1964],[637.296875,1961],[638.296875,1960],[642.296875,1958],[644.296875,1956],[645.296875,1956],[651.296875,1953],[652.296875,1953],[656.296875,1951],[671.296875,1946],[680.296875,1945],[688.109375,1946],[697.703125,1946],[709.703125,1948],[719.703125,1950],[727.703125,1952],[728.703125,1952],[732.703125,1954],[741.703125,1957],[748.703125,1958],[751.703125,1959],[754.703125,1960],[760.703125,1962],[767.703125,1963],[781.296875,1963],[791.296875,1961],[796.296875,1960],[820.296875,1952],[821.296875,1952],[822.296875,1951],[826.296875,1949],[838.296875,1941],[843.296875,1938],[844.296875,1938],[848.296875,1936],[849.296875,1936],[856.296875,1933],[857.296875,1932],[860.296875,1930],[861.296875,1930],[866.296875,1928],[871.296875,1924],[874.296875,1922],[879.296875,1918],[881.296875,1916],[887.296875,1912],[891.296875,1908],[897.296875,1905],[899.296875,1903],[900.296875,1903],[905.296875,1901],[910.296875,1897],[918.296875,1891],[921.296875,1888],[926.296875,1885],[935.296875,1882],[941.296875,1879],[946.296875,1878],[949.296875,1877],[954.296875,1876],[961.296875,1876],[966.296875,1872],[969.296875,1870],[970,1869.296875],[976,1861.296875],[977,1860.296875],[979,1856.296875],[980,1855.296875],[986,1844.296875],[986,1842.296875],[988,1840.296875],[989,1835.296875],[990,1832.296875],[994,1826.296875],[996,1823.296875],[998,1820.296875],[1002,1815.296875],[1012,1804.296875],[1014,1801.296875],[1024,1790.296875],[1025,1789.296875],[1029,1783.296875],[1032,1780.296875],[1038,1772.296875],[1041,1769.296875],[1043,1765.296875],[1048,1760.296875],[1048,1758.296875],[1052,1754.296875],[1056,1748.296875],[1058.296875,1746],[1061.296875,1744],[1062.296875,1744],[1065.296875,1743],[1068.703125,1738.59375],[1069.296875,1738],[1070.296875,1738],[1075.703125,1731.59375],[1085.890625,1722.40625],[1097.703125,1711.59375],[1098,1711.296875],[1098,1710.296875],[1101.59375,1707.703125],[1106,1704.296875],[1109.59375,1701.703125],[1110.296875,1701],[1122.296875,1695],[1123.296875,1695],[1126.296875,1694],[1131.296875,1690],[1134.296875,1688],[1143.296875,1679],[1149.296875,1675],[1154.296875,1670],[1160.296875,1666],[1163.296875,1664],[1165.296875,1664],[1170.296875,1663],[1175.296875,1659],[1176,1658.296875],[1176,1657.296875],[1182.296875,1651],[1186.296875,1649],[1187.296875,1648],[1194.296875,1644],[1195.296875,1644],[1199.296875,1642],[1207.296875,1640],[1208.296875,1640],[1209.296875,1639],[1213.296875,1637],[1218.703125,1630.59375],[1219.296875,1630],[1220.296875,1630],[1230.296875,1620],[1236.296875,1616],[1239.296875,1613],[1245.296875,1609],[1252.296875,1606],[1254.296875,1606],[1259.296875,1604],[1260.296875,1603],[1266.296875,1600],[1273.296875,1593],[1281.296875,1587],[1284.296875,1584],[1288.296875,1582],[1294.703125,1575.59375],[1305.296875,1564],[1306.296875,1564],[1309.703125,1559.59375],[1310,1559.296875],[1310,1558.296875],[1311,1557.296875],[1313,1554.296875],[1313,1553.296875],[1314,1550.296875],[1326,1534.296875],[1330,1529.296875],[1334,1524.296875],[1334,1523.296875],[1335,1520.296875],[1336,1519.296875],[1338,1516.296875],[1341,1507.296875],[1343,1503.296875],[1343,1502.296875],[1345,1496.296875],[1346,1493.296875],[1347,1492.296875],[1349,1488.296875],[1350,1487.296875],[1353,1482.296875],[1354,1477.296875],[1356,1471.296875],[1357,1468.296875],[1359,1466.296875],[1359,1462.296875],[1362,1459.296875],[1364,1455.296875],[1366,1453.296875],[1366,1451.296875],[1368,1447.296875],[1369,1440.296875],[1369,1418.109375],[1368,1408.296875],[1371,1399.296875],[1371,1393.703125],[1369,1383.703125],[1368,1380.703125],[1361,1373.703125],[1361,1373.296875],[1363,1367.296875],[1363,1365.59375],[1364,1360],[1364.703125,1360],[1374.703125,1368],[1376.703125,1370],[1380.703125,1372],[1382.703125,1374],[1391.703125,1375],[1399.296875,1375],[1415.296875,1373],[1422.890625,1373],[1430.703125,1372],[1431.703125,1373],[1443.296875,1373],[1449.296875,1371],[1452.296875,1370],[1455.296875,1369],[1456.296875,1369],[1459.296875,1368],[1460.296875,1367],[1463.296875,1365],[1468.296875,1364],[1474.296875,1362],[1476.296875,1362],[1480.296875,1360],[1497.296875,1360],[1509.296875,1358],[1514.296875,1356],[1519.296875,1352],[1525.296875,1346],[1535.296875,1338],[1542.296875,1334],[1543.296875,1334],[1547.296875,1332],[1549.296875,1332],[1552.296875,1331],[1553.296875,1330],[1558.296875,1327],[1560.296875,1327],[1566.296875,1323],[1567.296875,1322],[1576.296875,1316],[1577.296875,1315],[1578.296875,1315],[1582.296875,1313],[1583.296875,1313],[1588.296875,1312],[1595.296875,1306],[1598,1303.296875],[1601,1298.296875],[1601,1297.296875],[1603,1292.296875],[1605,1290.296875],[1605,1289.296875],[1606,1286.296875],[1610,1281.296875],[1628,1261.296875],[1630.703125,1258.59375],[1633.296875,1255],[1634.296875,1255],[1639.703125,1248.59375],[1642,1246.296875],[1648,1238.296875],[1650,1235.296875],[1651,1230.296875],[1651,1228.296875],[1653,1223.296875],[1657,1217.296875],[1659,1214.296875],[1661,1211.296875],[1663,1207.296875],[1664,1206.296875],[1667,1201.296875],[1667,1196.296875],[1669,1194.296875],[1674,1179.296875],[1674,1176.296875],[1677,1170.296875],[1678,1165.296875],[1682,1159.296875],[1683,1158.296875],[1683,1157.296875],[1686,1151.296875],[1686,1150.296875],[1688,1146.296875],[1688,1142.296875],[1692,1130.296875],[1692,1126.296875],[1694,1122.296875],[1696,1116.296875],[1696,1110.296875],[1697,1107.296875],[1699,1105.296875],[1699,1100.296875],[1702,1091.296875],[1706,1083.296875],[1706,1081.296875],[1709,1075.296875],[1709,1070.296875],[1711,1064.296875],[1712,1061.296875],[1712,1060.890625],[1713,1056.703125],[1712,1055.703125],[1712,1055.296875],[1714,1045.296875],[1714,1040.296875],[1719,1030.296875],[1721,1024.296875],[1722,1021.296875],[1722,1020.296875],[1725,1014.296875],[1726,1009.296875],[1726,1007.296875],[1728,1003.296875],[1728,1002.296875],[1729,999.296875],[1730,998.296875],[1732,994.296875],[1736,989.296875],[1738,986.296875],[1738,985.296875],[1740,981.296875],[1740,979.296875],[1742,971.296875],[1742,967.296875],[1744,965.296875],[1747,960.296875],[1749,954.296875],[1750,947.296875],[1750,946.296875],[1752,938.296875],[1752,936.296875],[1754,930.296875],[1755,923.296875],[1756,920.296875],[1756,919.296875],[1758,913.296875],[1758,911.296875],[1761,905.296875],[1761,903.296875],[1764,897.296875],[1764,894.296875],[1766,890.296875],[1768,884.296875],[1769,881.296875],[1769,880.296875],[1771,874.296875],[1772,871.296875],[1775,862.296875],[1775,855.296875],[1777,847.296875],[1777,844.296875],[1779,832.296875],[1781,826.296875],[1781,825.296875],[1783,819.296875],[1784,816.296875],[1785,813.296875],[1786,806.296875],[1789,800.296875],[1789,797.296875],[1791,791.296875],[1792,788.296875],[1792,786.296875],[1794,780.296875],[1794,771.296875],[1797,765.296875],[1798,760.296875],[1800,758.296875],[1801,753.296875],[1801,742.703125],[1799,734.703125],[1799,730.703125],[1797,724.703125],[1797,718.703125],[1795,712.703125],[1795,711.703125],[1792,699.703125],[1791,694.703125],[1790,687.703125],[1790,684.703125],[1788,674.703125],[1788,668.703125],[1786,658.703125],[1786,657.703125],[1782,645.703125],[1781,626.703125],[1781,619.296875],[1783,607.296875],[1784,602.296875],[1785,599.296875],[1786,596.296875],[1787,591.296875],[1787,590.296875],[1792,575.296875],[1796,559.296875],[1800,547.296875],[1800,546.296875],[1812,510.296875],[1814,502.296875],[1816,492.296875],[1816,491.296875],[1818,485.296875],[1818,483.296875],[1820,477.296875],[1820,476.296875],[1822,470.296875],[1825,458.296875],[1825,453.890625],[1826,449.703125],[1825,448.703125],[1825,445.703125],[1821,433.703125],[1821,432],[1956.703125,432],[1958,433.296875],[1957,821.109375],[1956,2143.296875],[1956,2145],[1003.59375,2144],[631.296875,2144],[630,2142.703125],[630,1970.890625],[631,1966.703125],]; var poly1 = [[631.703125,1952],[631,1952],[632,431],[1808.703125,432],[1809,432.296875],[1811,435.296875],[1811,436.296875],[1813,440.296875],[1814,445.296875],[1815,448.296875],[1815,450.703125],[1812,465.703125],[1809,474.703125],[1804,494.703125],[1802,504.703125],[1791,537.703125],[1791,538.703125],[1786,553.703125],[1783,565.703125],[1782,570.703125],[1777,585.703125],[1776,592.703125],[1773,601.703125],[1771,609.703125],[1771,636.296875],[1773,650.296875],[1773,651.296875],[1775,655.296875],[1775,656.296875],[1777,662.296875],[1778,675.296875],[1781,698.296875],[1782,701.296875],[1783,706.296875],[1785,712.296875],[1787,720.296875],[1787,721.296875],[1790,742.296875],[1791,745.296875],[1791,745.703125],[1790,746.703125],[1790,758.703125],[1788,764.703125],[1786,768.703125],[1786,777.703125],[1784,783.703125],[1784,785.703125],[1781,794.703125],[1781,795.703125],[1778,804.703125],[1776,814.703125],[1772,826.703125],[1772,827.703125],[1770,831.703125],[1769,844.703125],[1768,849.703125],[1767,852.703125],[1767,860.703125],[1765,864.703125],[1765,865.703125],[1761,877.703125],[1761,878.703125],[1756,893.703125],[1756,894.703125],[1753,900.703125],[1753,902.703125],[1751,906.703125],[1750,911.703125],[1748,917.703125],[1747,924.703125],[1744,933.703125],[1744,937.703125],[1742,941.703125],[1742,946.703125],[1740,954.703125],[1740,955.703125],[1738,960.703125],[1736,962.703125],[1734,965.703125],[1734,967.703125],[1732,975.703125],[1732,977.703125],[1730,983.703125],[1730,984.703125],[1726,988.703125],[1726,990.703125],[1722,996.703125],[1721,997.703125],[1721,998.703125],[1719,1002.703125],[1718,1007.703125],[1714,1019.703125],[1714,1020.703125],[1712,1022.703125],[1712,1026.703125],[1711,1027.703125],[1708,1032.703125],[1706,1038.703125],[1706,1043.40625],[1705,1047],[1703.296875,1047],[1699.296875,1045],[1692.296875,1044],[1688.296875,1042],[1682.296875,1042],[1674.296875,1040],[1670.296875,1038],[1669,1038],[1669,1026.40625],[1668,1020],[1674.109375,1020],[1690.296875,1021],[1696,1015.296875],[1697,1008.296875],[1697,1000.59375],[1698,997],[1699.296875,997],[1706.296875,991],[1707,990.296875],[1707,989.296875],[1709,987.296875],[1715,979.296875],[1716,978.296875],[1716,977.296875],[1717,974.296875],[1721,969.296875],[1722,968.296875],[1724,965.296875],[1725,960.296875],[1725,948.296875],[1728,942.296875],[1729,937.296875],[1731,933.296875],[1731,932.296875],[1743,908.296875],[1743,901.703125],[1739,889.703125],[1737,887.703125],[1735,883.703125],[1727,874.703125],[1726.296875,874],[1723.296875,873],[1719.296875,871],[1709.296875,869],[1705.296875,869],[1705,868.703125],[1701,863.703125],[1700,850.703125],[1699,845.703125],[1699,842.703125],[1697,837.703125],[1695.296875,836],[1690.296875,833],[1682.703125,833],[1676.703125,835],[1675.703125,835],[1674.703125,836],[1670.703125,838],[1667.703125,841],[1658.703125,846],[1647.703125,847],[1638.703125,847],[1629.703125,850],[1627.703125,852],[1623.703125,854],[1614.703125,860],[1607.703125,867],[1601.703125,871],[1595.703125,874],[1590.703125,878],[1588.703125,880],[1583.703125,881],[1568.703125,882],[1564.890625,881],[1559.296875,881],[1558.296875,880],[1554.296875,878],[1549.296875,874],[1546.296875,871],[1543.296875,869],[1541.296875,869],[1534.296875,866],[1533.296875,865],[1526.296875,861],[1521.296875,860],[1508.296875,859],[1502.703125,859],[1490.703125,862],[1485.703125,863],[1484.109375,863],[1478.296875,864],[1477.296875,863],[1468.296875,857],[1468,856.703125],[1458,844.703125],[1455,839.703125],[1453,833.703125],[1451,828.703125],[1445,821.703125],[1442.296875,819],[1434.296875,813],[1429.296875,810],[1424.296875,809],[1417.703125,809],[1414.703125,810],[1411.296875,814.40625],[1411,814.703125],[1410,817.703125],[1408,821.703125],[1406,827.703125],[1405,834.703125],[1405,835.296875],[1406,836.296875],[1406,837.296875],[1410,849.296875],[1411,850.296875],[1414,855.296875],[1416,861.296875],[1416,863.296875],[1420,872.296875],[1425,877.296875],[1431,885.296875],[1431.703125,886],[1432.703125,886],[1435.296875,889.59375],[1436,890.296875],[1437,893.296875],[1439,897.296875],[1439,899.703125],[1435,905.703125],[1434,906.703125],[1434,917.296875],[1436,921.296875],[1436,934.703125],[1434,958.703125],[1433,961.703125],[1433,982.296875],[1435,990.296875],[1435,992.703125],[1431,998.703125],[1430,999.703125],[1430,1001.703125],[1427,1016.703125],[1427,1017.703125],[1425.1875,1027.5],[1426,1028.296875],[1426,1035.296875],[1428,1041.296875],[1428,1046.703125],[1425.703125,1049],[1420.703125,1050],[1415.703125,1052],[1411,1056.703125],[1410,1063.703125],[1408,1069.703125],[1406,1077.703125],[1405,1078.703125],[1403,1082.703125],[1397,1090.703125],[1394,1093.703125],[1388,1101.703125],[1380.703125,1109],[1374.296875,1109],[1369.296875,1108],[1368.296875,1107],[1365.296875,1105],[1356.296875,1104],[1353.703125,1104],[1350.703125,1105],[1347.296875,1109.40625],[1340.703125,1117],[1340,1117.703125],[1340,1118.703125],[1337.296875,1121.40625],[1334.703125,1125],[1329.703125,1127],[1323.703125,1131],[1314.703125,1134],[1303.703125,1134],[1299.703125,1136],[1292.296875,1136],[1271.296875,1129],[1267.296875,1129],[1239.296875,1127],[1237.296875,1127],[1231.296875,1125],[1218.296875,1124],[1209.703125,1124],[1206.703125,1125],[1200.703125,1129],[1194,1135.703125],[1190,1140.703125],[1188,1146.703125],[1186,1150.703125],[1186,1159.703125],[1184,1163.703125],[1181,1172.703125],[1178,1178.703125],[1178,1180.703125],[1174,1192.703125],[1174,1203.296875],[1176,1209.296875],[1176,1210.296875],[1177,1211.296875],[1179,1214.296875],[1179,1214.703125],[1175.703125,1218],[1168.703125,1224],[1163.703125,1225],[1160.703125,1226],[1155.703125,1228],[1154,1229.703125],[1152,1233.703125],[1149,1236.703125],[1149,1242.703125],[1147,1248.703125],[1147,1259.296875],[1149.703125,1262],[1152.296875,1262],[1155,1259.296875],[1155,1251.296875],[1157,1245.296875],[1157,1239.296875],[1161,1234.296875],[1161.296875,1234],[1167.296875,1232],[1169.296875,1232],[1174.296875,1230],[1180.296875,1224],[1187.296875,1218],[1190.703125,1218],[1197.703125,1221],[1198.703125,1222],[1201.703125,1224],[1207.703125,1226],[1235.890625,1226],[1241.703125,1225],[1242.703125,1226],[1244.703125,1226],[1250,1231.296875],[1252,1235.296875],[1256,1240.296875],[1261.703125,1246],[1264.703125,1248],[1273.703125,1251],[1278.703125,1252],[1285.703125,1253],[1287.703125,1253],[1295.703125,1255],[1299.703125,1255],[1305.703125,1257],[1306.703125,1257],[1307.703125,1258],[1311.703125,1260],[1318,1266.296875],[1322,1271.296875],[1323,1276.296875],[1326,1282.296875],[1326,1284.296875],[1332,1293.296875],[1335.40625,1296.703125],[1343,1303.296875],[1347,1309.296875],[1348,1310.296875],[1352,1316.296875],[1367.703125,1332],[1375.703125,1338],[1381.703125,1340],[1391.296875,1340],[1396.296875,1338],[1396.59375,1337.703125],[1401,1334.296875],[1404,1327.296875],[1406,1325.296875],[1409,1320.296875],[1410,1315.296875],[1411,1312.296875],[1411,1307.703125],[1409,1302.703125],[1394.296875,1289],[1393,1289],[1393,1287.703125],[1391,1285.703125],[1385,1276.703125],[1385,1265.296875],[1389,1253.296875],[1389,1252.59375],[1390,1249],[1406.703125,1249],[1416.703125,1251],[1418.703125,1251],[1431.703125,1257],[1434.703125,1260],[1436,1260],[1436,1261.296875],[1436.703125,1262],[1447.703125,1268],[1449.703125,1268],[1455.703125,1271],[1462.703125,1272],[1492.296875,1273],[1501.296875,1270],[1504.296875,1267],[1510.296875,1263],[1511.296875,1262],[1513.296875,1262],[1514.296875,1261],[1521.296875,1257],[1522.296875,1257],[1526.296875,1255],[1531.296875,1254],[1532.296875,1254],[1538.296875,1251],[1544.296875,1251],[1545.296875,1250],[1545.703125,1250],[1546.703125,1251],[1547.296875,1251],[1548.296875,1250],[1552.109375,1251],[1553.296875,1251],[1562.296875,1250],[1563.296875,1249],[1567.296875,1247],[1573.296875,1239],[1574,1238.296875],[1574,1237.296875],[1576,1235.296875],[1576,1233.296875],[1580,1228.296875],[1581,1223.296875],[1581,1221.296875],[1585,1209.296875],[1585,1208.703125],[1581,1199.703125],[1566.296875,1184],[1565.296875,1184],[1561.296875,1180],[1558.296875,1178],[1553.296875,1177],[1542.296875,1176],[1538.109375,1177],[1529,1177],[1529,1176.296875],[1530,1175.296875],[1530,1173.296875],[1532,1168.296875],[1534,1166.296875],[1536,1163.296875],[1537,1156.296875],[1537,1119.296875],[1538.296875,1118],[1548.296875,1116],[1557.296875,1113],[1571.296875,1101],[1574.703125,1096.59375],[1575,1096.296875],[1575,1095.296875],[1575.296875,1095],[1585.296875,1087],[1588.296875,1084],[1590.296875,1084],[1594.296875,1082],[1596.296875,1082],[1604.296875,1078],[1606.296875,1078],[1611.296875,1074],[1616.296875,1073],[1617.296875,1072],[1620.296875,1070],[1623.296875,1070],[1630.296875,1067],[1631.296875,1066],[1635.296875,1064],[1636.296875,1063],[1640.296875,1061],[1647.296875,1055],[1651.296875,1051],[1659.296875,1047],[1661.296875,1045],[1661.703125,1045],[1662.703125,1046],[1662.890625,1046],[1666.703125,1045],[1673.703125,1049],[1682.703125,1050],[1684.703125,1050],[1690.703125,1052],[1692.703125,1052],[1701.703125,1055],[1702,1055],[1702,1056.296875],[1704,1058.296875],[1704,1060.703125],[1701,1066.703125],[1701,1072.703125],[1699,1076.703125],[1696,1085.703125],[1696,1086.703125],[1694,1088.703125],[1694,1089.703125],[1692,1093.703125],[1691,1100.703125],[1691,1101.703125],[1689,1105.703125],[1688,1110.703125],[1688,1113.703125],[1684,1125.703125],[1684,1126.703125],[1680,1138.703125],[1680,1142.703125],[1678,1148.703125],[1676,1152.703125],[1676,1153.703125],[1675,1156.703125],[1671,1162.703125],[1668,1169.703125],[1666,1173.703125],[1666,1176.703125],[1663,1185.703125],[1663,1186.703125],[1661,1190.703125],[1661,1192.703125],[1659,1194.703125],[1659,1198.703125],[1658,1201.703125],[1657,1202.703125],[1655,1206.703125],[1654,1207.703125],[1652,1211.703125],[1644,1223.703125],[1643,1228.703125],[1643,1230.703125],[1641,1235.703125],[1627,1250.703125],[1623,1255.703125],[1622.296875,1256.40625],[1619.703125,1260],[1618.703125,1260],[1608.703125,1272],[1607.703125,1272],[1606,1273.703125],[1602,1279.703125],[1600,1281.703125],[1598,1284.703125],[1598,1286.703125],[1597,1287.703125],[1594,1292.703125],[1594,1293.703125],[1592,1298.703125],[1586.40625,1303.296875],[1585.703125,1304],[1582.703125,1305],[1581.703125,1305],[1575.703125,1308],[1574.703125,1308],[1571.703125,1309],[1565.703125,1313],[1564.703125,1314],[1558.703125,1318],[1550.703125,1322],[1548.703125,1324],[1539.703125,1327],[1530.703125,1331],[1521.703125,1339],[1519.703125,1341],[1509.703125,1349],[1506.703125,1351],[1497.703125,1352],[1494.703125,1353],[1486.890625,1352],[1479.703125,1352],[1475.703125,1354],[1469.703125,1356],[1468.703125,1356],[1460.703125,1358],[1457.703125,1359],[1455.703125,1361],[1450.703125,1362],[1444.703125,1365],[1436.296875,1365],[1426.296875,1363],[1423.703125,1363],[1419.703125,1365],[1408.703125,1366],[1403.703125,1367],[1390.296875,1367],[1381.296875,1364],[1365.296875,1350],[1358.296875,1343],[1336.296875,1323],[1317.296875,1304],[1312.296875,1300],[1302.296875,1298],[1266.703125,1298],[1257.703125,1301],[1256.703125,1301],[1255.703125,1302],[1252.703125,1304],[1250.703125,1304],[1244.703125,1306],[1222.296875,1306],[1216.296875,1304],[1208.703125,1304],[1198.703125,1306],[1188.296875,1306],[1184.296875,1304],[1168.296875,1304],[1150.296875,1302],[1147.296875,1302],[1142.296875,1300],[1139.59375,1297.296875],[1130,1288.703125],[1130,1287.703125],[1128,1285.703125],[1128,1274.703125],[1126,1266.703125],[1124,1260.703125],[1123,1259.703125],[1121,1256.703125],[1122,1252.890625],[1122,1251.296875],[1127,1241.296875],[1131,1229.296875],[1133,1227.296875],[1133,1226.890625],[1134,1222.703125],[1133,1221.703125],[1133,1220.703125],[1132.296875,1220],[1129.296875,1219],[1128.703125,1219],[1127,1220.703125],[1125,1224.703125],[1123,1226.703125],[1120,1235.703125],[1118,1239.703125],[1118,1240.703125],[1115,1246.703125],[1114,1251.703125],[1114,1254.703125],[1113,1255.703125],[1113,1256.296875],[1114,1257.296875],[1114,1261.296875],[1116,1263.296875],[1118,1266.296875],[1118,1267.296875],[1120,1271.296875],[1120,1288.296875],[1124,1293.296875],[1129,1298.296875],[1128,1304.109375],[1128,1325.703125],[1127,1326.703125],[1123,1333.703125],[1122,1338.703125],[1122,1342.703125],[1121,1345.703125],[1117,1349.703125],[1112,1358.703125],[1112,1372.296875],[1113,1375.296875],[1121,1385.296875],[1122.703125,1387],[1127.703125,1390],[1132.703125,1391],[1146.703125,1391],[1168.703125,1393],[1199.703125,1393],[1207.703125,1395],[1227.296875,1395],[1228.296875,1394],[1231.296875,1392],[1236.296875,1391],[1237.296875,1390],[1243.296875,1386],[1249.296875,1384],[1255.296875,1381],[1257.296875,1381],[1258.296875,1380],[1264.296875,1376],[1273.296875,1373],[1280.296875,1367],[1286.296875,1361],[1289.296875,1359],[1291.703125,1359],[1295.703125,1361],[1296.703125,1361],[1299.703125,1362],[1301.703125,1364],[1307.703125,1367],[1312.703125,1371],[1313.703125,1372],[1315,1372],[1314,1380.40625],[1313,1384],[1312,1388.40625],[1312,1388.703125],[1304,1397.703125],[1302,1399.703125],[1294,1409.703125],[1293,1410.703125],[1291,1413.703125],[1290,1418.703125],[1289,1421.703125],[1289,1427.296875],[1294,1442.296875],[1294,1446.296875],[1297,1455.296875],[1301.703125,1460],[1308.703125,1464],[1315.296875,1464],[1318.296875,1463],[1329.296875,1453],[1334.296875,1449],[1336.296875,1447],[1337.296875,1447],[1338,1446.296875],[1338,1445.296875],[1347.59375,1436.703125],[1348.296875,1436],[1355.296875,1433],[1357.296875,1431],[1358.296875,1431],[1359,1430.296875],[1359,1429],[1361,1429],[1361,1441.703125],[1359,1445.703125],[1356,1454.703125],[1353,1457.703125],[1351,1460.703125],[1351,1462.703125],[1348,1468.703125],[1348,1469.703125],[1346,1473.703125],[1346,1477.703125],[1344,1482.703125],[1343,1483.703125],[1341,1487.703125],[1340,1488.703125],[1337,1493.703125],[1334,1502.703125],[1332,1506.703125],[1332,1507.703125],[1330,1513.703125],[1330,1514.703125],[1329,1515.703125],[1327,1518.703125],[1327,1520.703125],[1317,1533.703125],[1315,1536.703125],[1311,1541.703125],[1307,1547.703125],[1306,1548.703125],[1306,1549.703125],[1305,1552.703125],[1301,1557.703125],[1297.40625,1560.296875],[1297,1560.703125],[1297,1561.703125],[1289.296875,1569.40625],[1286.703125,1573],[1278.703125,1579],[1275.703125,1581],[1270.703125,1585],[1267.703125,1588],[1259.703125,1594],[1253.703125,1598],[1241.703125,1602],[1235.703125,1606],[1234.703125,1607],[1225.703125,1613],[1225.296875,1613.40625],[1220.703125,1619],[1219.703125,1619],[1209.703125,1629],[1204.703125,1633],[1199.703125,1634],[1193.703125,1636],[1184.703125,1640],[1178.703125,1644],[1166.703125,1656],[1162.703125,1656],[1153.703125,1660],[1149.703125,1664],[1141.703125,1670],[1132.703125,1679],[1124.703125,1685],[1123.703125,1686],[1120.703125,1688],[1119.703125,1688],[1111.703125,1692],[1109.703125,1692],[1103.703125,1696],[1095.703125,1702],[1093.296875,1704.40625],[1088.703125,1710],[1087.703125,1710],[1079.703125,1718],[1073.703125,1722],[1066.296875,1730.40625],[1063.703125,1733],[1060.703125,1733],[1051,1742.703125],[1047,1748.703125],[1045.703125,1750],[1044.703125,1750],[1044,1750.703125],[1044,1751.703125],[1042,1753.703125],[1040,1757.703125],[1039,1758.703125],[1035,1764.703125],[1025,1776.703125],[1024,1777.703125],[1020,1783.703125],[1018,1785.703125],[1006,1799.703125],[1004.703125,1801],[1003.703125,1801],[1003,1801.703125],[1003,1802.703125],[1000,1805.703125],[992,1815.703125],[982,1830.703125],[979,1839.703125],[973,1852.703125],[969,1857.703125],[968.296875,1858.40625],[961.703125,1866],[952.703125,1866],[942.703125,1868],[941.703125,1868],[937.703125,1870],[935.703125,1870],[933.703125,1872],[921.703125,1876],[920.703125,1876],[919.703125,1877],[915.703125,1879],[913.703125,1881],[907.703125,1885],[902.703125,1890],[888.703125,1897],[883.703125,1901],[882.703125,1902],[876.703125,1906],[873.703125,1909],[861.703125,1918],[842.703125,1928],[833.703125,1931],[815.703125,1943],[797.703125,1949],[792.703125,1950],[789.703125,1951],[779.703125,1953],[773.296875,1953],[758.296875,1950],[752.296875,1948],[740.296875,1945],[739.296875,1945],[735.296875,1943],[726.296875,1940],[725.296875,1940],[717.296875,1938],[707.296875,1936],[674.296875,1935],[668.109375,1936],[667.703125,1936],[654.703125,1941],[651.703125,1942],[647.703125,1944],[645.703125,1944],[643.703125,1946],[642.703125,1946],[637.703125,1948],[636.703125,1949],]; var poly2 = [[1120,1371.703125],[1120,1361.296875],[1123,1355.296875],[1123,1354],[1124.296875,1354],[1127.703125,1349.59375],[1128,1349.296875],[1130,1343.296875],[1130,1338.296875],[1133,1331.296875],[1134,1330.296875],[1136,1327.296875],[1136,1306],[1136.703125,1306],[1144.703125,1310],[1157.703125,1311],[1160.703125,1312],[1180.703125,1312],[1186.703125,1314],[1199.296875,1314],[1205.296875,1312],[1212.703125,1312],[1220.703125,1314],[1245.296875,1314],[1249.296875,1312],[1251.296875,1312],[1257.296875,1310],[1258.296875,1310],[1260.296875,1308],[1266.296875,1306],[1299.703125,1306],[1309.703125,1308],[1310.703125,1308],[1330.703125,1328],[1344.703125,1340],[1355,1350.296875],[1355,1351.890625],[1356,1361.703125],[1355,1362.703125],[1355,1365.703125],[1353,1370.703125],[1352,1371.703125],[1349,1377.703125],[1348,1378.703125],[1344,1384.703125],[1342.703125,1386],[1342.296875,1386],[1335.296875,1385],[1329,1378.703125],[1326,1373.703125],[1326,1371.703125],[1325.296875,1371],[1313.296875,1362],[1312.296875,1361],[1306.296875,1358],[1303.296875,1355],[1302.296875,1355],[1296.296875,1352],[1291.296875,1351],[1289.703125,1351],[1283.703125,1353],[1282.703125,1353],[1282,1353.703125],[1282,1355],[1280.703125,1355],[1279.296875,1356.40625],[1276.703125,1360],[1275.703125,1360],[1271.703125,1364],[1266.703125,1367],[1264.703125,1367],[1257.703125,1370],[1255.703125,1372],[1248.703125,1376],[1241.703125,1377],[1240.703125,1378],[1236.703125,1380],[1232.703125,1384],[1230.703125,1384],[1224.703125,1387],[1209.296875,1387],[1203.296875,1385],[1179.296875,1385],[1157.296875,1383],[1132.296875,1383],[1127.296875,1381],[1121.296875,1373],]; var poly3 = [[1182,1203.703125],[1182,1193.296875],[1184,1189.296875],[1186,1183.296875],[1186,1181.296875],[1188,1177.296875],[1188,1176.296875],[1190,1172.296875],[1194,1160.296875],[1194,1153.296875],[1196,1149.296875],[1197,1144.296875],[1197.703125,1143.59375],[1204.296875,1136],[1205.296875,1136],[1207.296875,1134],[1210.296875,1132],[1217.703125,1132],[1231.703125,1134],[1241.703125,1136],[1269.703125,1137],[1281.703125,1141],[1285.703125,1143],[1290.703125,1144],[1300.296875,1144],[1304.296875,1142],[1312.296875,1142],[1322.296875,1140],[1323.296875,1140],[1328.296875,1138],[1334.296875,1134],[1338.296875,1132],[1342,1128.296875],[1352,1115.296875],[1355.296875,1112],[1356.703125,1112],[1363.703125,1113],[1365.703125,1115],[1366.703125,1115],[1370.703125,1117],[1380.296875,1117],[1387.296875,1114],[1399.296875,1100],[1400,1099.296875],[1408,1088.296875],[1409,1087.296875],[1411,1083.296875],[1412,1082.296875],[1414,1079.296875],[1414,1076.296875],[1415.296875,1075],[1415.703125,1075],[1419,1078.296875],[1419,1080.703125],[1417,1096.703125],[1417,1112.703125],[1415,1132.703125],[1415,1144.296875],[1417,1150.296875],[1417,1173.703125],[1413,1178.703125],[1413,1180],[1411.703125,1180],[1397.703125,1196],[1397,1196.703125],[1395,1200.703125],[1391.703125,1204],[1390.296875,1204],[1389.296875,1203],[1383.296875,1199],[1376.296875,1193],[1372.296875,1191],[1371.296875,1190],[1366.296875,1187],[1360.296875,1185],[1356.703125,1185],[1353.703125,1186],[1351.296875,1188.40625],[1340.703125,1200],[1339.703125,1200],[1337.703125,1202],[1332.703125,1205],[1327.703125,1206],[1318.703125,1206],[1314.703125,1208],[1309.703125,1209],[1303.703125,1211],[1299.703125,1213],[1298.703125,1213],[1292.703125,1215],[1277.296875,1215],[1268.296875,1212],[1263.296875,1210],[1261.296875,1208],[1258.296875,1206],[1252.296875,1204],[1206.703125,1203],[1200.703125,1206],[1199.703125,1206],[1195.703125,1208],[1190.703125,1209],[1187.703125,1210],[1186.296875,1210],[1185,1208.703125],]; var poly4 = [[1202,1213],[1203.296875,1213],[1207.296875,1211],[1212.296875,1210],[1230.703125,1210],[1236.703125,1212],[1249.703125,1212],[1255.703125,1214],[1256.703125,1214],[1258.703125,1216],[1263.703125,1219],[1264.703125,1219],[1268.703125,1221],[1273.703125,1222],[1276.703125,1223],[1291.296875,1223],[1297.296875,1221],[1298.296875,1221],[1304.296875,1219],[1307.296875,1218],[1310.296875,1217],[1319.296875,1214],[1329.296875,1214],[1335.296875,1212],[1340.296875,1210],[1347.296875,1204],[1350.703125,1200.59375],[1357.296875,1193],[1357.703125,1193],[1363.703125,1195],[1366.703125,1196],[1367.703125,1197],[1371.703125,1199],[1373.703125,1201],[1379.703125,1205],[1388,1213.296875],[1387,1217.109375],[1387,1241.703125],[1384,1244.703125],[1382,1247.703125],[1381,1252.703125],[1379,1256.703125],[1379,1258.703125],[1377,1260.703125],[1377,1279.296875],[1378,1280.296875],[1380,1284.296875],[1384,1290.296875],[1388.703125,1295],[1398.703125,1303],[1401,1305.296875],[1403,1308.296875],[1403,1310.703125],[1400,1319.703125],[1400,1320.703125],[1398,1322.703125],[1395,1328.703125],[1393.703125,1330],[1390.703125,1332],[1381.296875,1332],[1378.296875,1331],[1369.296875,1323],[1363,1316.703125],[1357,1308.703125],[1352,1303.703125],[1350,1299.703125],[1346.59375,1296.296875],[1339,1289.703125],[1333,1280.703125],[1333,1279.703125],[1331,1275.703125],[1329,1267.703125],[1325,1261.703125],[1320.296875,1257],[1314.296875,1253],[1311.296875,1251],[1306.296875,1248],[1299.296875,1247],[1291.296875,1245],[1290.296875,1245],[1276.296875,1243],[1275.296875,1243],[1271.296875,1241],[1268.296875,1241],[1263.296875,1237],[1263,1236.703125],[1257,1228.703125],[1257,1226.703125],[1254.296875,1224],[1253,1224],[1253,1222.703125],[1248.59375,1219.296875],[1248.296875,1219],[1245.296875,1218],[1212.296875,1218],[1204.296875,1216],[1203.296875,1216],[1202,1214.703125],]; var poly5 = [[1298,1420],[1298,1418.296875],[1299,1415.296875],[1307,1405.296875],[1307.296875,1405],[1308.296875,1405],[1309,1404.296875],[1315,1396.296875],[1318,1393.296875],[1320,1390.296875],[1321,1383.296875],[1321,1383],[1322.703125,1383],[1325.296875,1386.59375],[1325.40625,1386.703125],[1329,1389.296875],[1329,1391.703125],[1328,1392.703125],[1326,1396.703125],[1324,1398.703125],[1322,1401.703125],[1322,1402.703125],[1321,1405.703125],[1315,1412.703125],[1313.703125,1414],[1310.703125,1416],[1309.703125,1416],[1301.703125,1420],]; var poly6 = [[1298,1428],[1299.296875,1428],[1307.296875,1426],[1308.296875,1426],[1310.296875,1424],[1311.296875,1424],[1316.296875,1422],[1326.296875,1412],[1326.703125,1412],[1332.703125,1418],[1342.703125,1426],[1345,1428.296875],[1345,1428.703125],[1339.40625,1433.296875],[1320.703125,1451],[1319.703125,1451],[1318.703125,1452],[1313.703125,1456],[1311.296875,1456],[1306.296875,1454],[1305,1452.703125],[1303,1449.703125],[1302,1444.703125],[1302,1443.703125],[1299,1434.703125],[1299,1434.40625],]; var poly7 = [[1330,1403.296875],[1332,1401.296875],[1334,1397.296875],[1337.296875,1394],[1343.296875,1394],[1346.296875,1393],[1351,1388.296875],[1353,1384.296875],[1356.296875,1381],[1356.703125,1381],[1362,1386.296875],[1363,1391.296875],[1363,1394.703125],[1361,1404.703125],[1361,1405.703125],[1358,1414.703125],[1358,1417.703125],[1354,1421.703125],[1354,1423],[1351.296875,1423],[1345.296875,1419],[1336.296875,1411],[1330,1404.703125],]; var poly8 = [[1395,1239.703125],[1395,1219.296875],[1397,1211.296875],[1398,1208.296875],[1399,1207.296875],[1408,1195.296875],[1417,1186.296875],[1423,1178.296875],[1425,1176.296875],[1425,1151.703125],[1423,1145.703125],[1423,1145.296875],[1425,1121.296875],[1425,1104.296875],[1427,1088.296875],[1427,1077.703125],[1425,1072.703125],[1424.296875,1072],[1419.296875,1068],[1417,1068],[1418,1063.59375],[1418,1062.59375],[1419,1059],[1422.59375,1058],[1423.296875,1058],[1424.296875,1057],[1426.296875,1057],[1429.296875,1056],[1436,1049.296875],[1436,1040.703125],[1434,1036.703125],[1434,1026.296875],[1439,1001.296875],[1440,998.296875],[1441,997.296875],[1443,994.296875],[1443,991.703125],[1441,985.703125],[1441,964.296875],[1443,958.296875],[1444,923.703125],[1442,915.703125],[1442,908.296875],[1446,903.296875],[1447,898.296875],[1446,894.109375],[1446,893.703125],[1444,890.703125],[1444,887.703125],[1438,880.703125],[1432,872.703125],[1431.296875,872],[1430.296875,872],[1427.703125,868.40625],[1427,867.703125],[1424,862.703125],[1422,856.703125],[1422,854.703125],[1419,847.703125],[1418,846.703125],[1416,843.703125],[1416,842.703125],[1414,838.703125],[1414,836.109375],[1413,832.296875],[1414,831.296875],[1414,830.296875],[1418,818.296875],[1419.296875,817],[1424.703125,817],[1431.703125,820],[1438.703125,826],[1440,827.296875],[1446,836.296875],[1446,837.296875],[1448,841.296875],[1448,842.296875],[1451,849.296875],[1461,860.296875],[1469.40625,867.703125],[1469.703125,868],[1472.703125,869],[1473.703125,870],[1478.703125,873],[1483.296875,873],[1485.296875,871],[1486.296875,871],[1492.296875,869],[1500.296875,867],[1505.703125,867],[1523.703125,869],[1526.703125,870],[1527.703125,871],[1536.703125,876],[1541.703125,877],[1546.703125,882],[1550.703125,884],[1552.703125,886],[1555.703125,888],[1560.703125,889],[1573.703125,890],[1579.890625,889],[1586.296875,889],[1590.296875,887],[1592.296875,887],[1594.296875,885],[1600.296875,881],[1606.296875,878],[1611.296875,874],[1616.296875,869],[1631.296875,859],[1632.296875,858],[1637.296875,855],[1648.296875,855],[1660.296875,853],[1661.296875,853],[1670.296875,849],[1671.296875,848],[1680.296875,842],[1681.296875,841],[1688.703125,841],[1691,843.296875],[1692,854.296875],[1693,861.296875],[1693,864.296875],[1694,867.296875],[1695,868.296875],[1697,872.296875],[1697.703125,873],[1702.703125,877],[1706.703125,877],[1716.703125,879],[1722.703125,881],[1725.296875,884.59375],[1727,886.296875],[1729,890.296875],[1731,892.296875],[1734,897.296875],[1735,902.296875],[1735,905.703125],[1723,929.703125],[1722,934.703125],[1721,937.703125],[1717,945.703125],[1717,960.703125],[1716,963.703125],[1714,965.703125],[1710,971.703125],[1709,972.703125],[1709,973.703125],[1708,976.703125],[1698,987.703125],[1694.40625,990.296875],[1692,992.703125],[1689,997.703125],[1689,1010.703125],[1686.703125,1013],[1680.890625,1012],[1664.296875,1012],[1664,1011.703125],[1662,1008.703125],[1661,1003.703125],[1660,994.703125],[1660,980.703125],[1658,972.703125],[1656,966.703125],[1656,965.703125],[1655,964.703125],[1650,954.703125],[1644,947.703125],[1643.703125,947.40625],[1638.296875,941],[1634.703125,941],[1633,942.703125],[1633,945.296875],[1634,948.296875],[1642,957.296875],[1647,967.296875],[1649,969.296875],[1649,970.296875],[1651,974.296875],[1652,981.296875],[1652,992.296875],[1654,1008.296875],[1656,1014.296875],[1656,1015.296875],[1658,1017.296875],[1658,1020.296875],[1659,1021.296875],[1661,1024.296875],[1661,1033.703125],[1657,1037.703125],[1657,1039],[1655.703125,1039],[1652.703125,1042],[1651.703125,1042],[1648.703125,1043],[1645.703125,1046],[1635.703125,1054],[1634.703125,1055],[1628.703125,1058],[1627.703125,1059],[1622.703125,1062],[1621.703125,1062],[1616.703125,1063],[1615.703125,1064],[1612.703125,1066],[1611.703125,1066],[1604.703125,1069],[1602.703125,1071],[1601.703125,1071],[1595.703125,1074],[1584.703125,1077],[1572.703125,1087],[1570,1089.703125],[1566,1095.703125],[1562.703125,1099],[1556.703125,1103],[1552.703125,1107],[1547.703125,1108],[1535.703125,1111],[1533.703125,1111],[1532,1112.703125],[1529,1117.703125],[1529,1156.703125],[1528,1161.703125],[1526,1163.703125],[1523,1168.703125],[1520,1177.703125],[1520,1178.296875],[1521,1183.296875],[1522.703125,1185],[1536.890625,1185],[1546.703125,1184],[1547.703125,1185],[1552.703125,1185],[1557.703125,1187],[1558.40625,1187.703125],[1566,1194.296875],[1566,1195.296875],[1573,1202.296875],[1576,1207.296875],[1576,1209.703125],[1573,1218.703125],[1573,1223.703125],[1572,1226.703125],[1571,1227.703125],[1569,1231.703125],[1565,1237.703125],[1562.703125,1240],[1557.703125,1243],[1539.703125,1243],[1530.703125,1246],[1525.703125,1247],[1521.703125,1249],[1520.703125,1249],[1511.703125,1253],[1509.703125,1255],[1507.703125,1255],[1506.703125,1256],[1502.703125,1258],[1500.703125,1260],[1494.703125,1264],[1493.703125,1265],[1490.296875,1265],[1460.296875,1263],[1458.296875,1263],[1454.296875,1261],[1448.296875,1259],[1443.296875,1257],[1442.296875,1256],[1434.296875,1250],[1428.296875,1246],[1427.296875,1246],[1423.296875,1244],[1418.296875,1243],[1415.296875,1242],[1408.296875,1241],[1396.296875,1241],];

	function inside(point, vs) {
		var x = point[0], y = point[1];
		var res = false;
		for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
			var xi = vs[i][0], yi = vs[i][1];
			var xj = vs[j][0], yj = vs[j][1];
			
			var intersect = ((yi > y) != (yj > y))
				&& (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
			if (intersect) res = !res;
		}
		return res;
	};

	function pixToLng(pixelX, zoom){
		return pixelX * 360 / (256 * Math.pow(2, zoom)) - 180; 
	}

	function lngToGC(lng, zoom){
		var f = (lng + 180) * (256 * Math.pow(2, zoom)) / 360;
		var r = (f - deltX + cellWid / 2) / cellWid;

		if (r > c - 1)
		{
		  r = c - 1;
		}else if(r < 0)
		{
		  r = 0;
		}

		return Math.floor(r);
	}

	function pixToLat(pixelY, zoom){
		var  siny, y, z, E;
		E = 2.71828182845904523536;
		y = 2 * Math.PI * (1 - pixelY / (128 * Math.pow(2, zoom)));
		z = Math.pow(E, y);
		siny = (z - 1) / (z + 1);
		return Math.asin(siny) * 180 / Math.PI;    
	}

	function latToGR(lat, zoom){
		  var siny = Math.sin(lat * Math.PI / 180);
		  var y = Math.log((1 + siny) / (1 - siny));
		  var f = (128 * Math.pow(2, zoom)) * (1 - y / (2 * Math.PI));
		  var r = (f - deltY + cellWid / 2) / cellWid;
		  if (r > c - 1)
		  {
			  r = c - 1;
		  }else if(r < 0)
		  {
			  r = 0;
		  }

		  return Math.floor(r);
	}

	var gridDest = [];
	
	for (var y = 0; y < c; y++ )
	{
		var gridRow = [];
		//var gridRowBlack = [];
		//var gridRowWhite = [];

		for (var x = 0; x < c; x++ )
		{
			var isWall = 1;
			var a1 = [];
			
			cellPosX = cellWid * x; 
			cellPosY = cellWid * y;  
			if((inside([cellPosX, cellPosY], poly0)) || (inside([cellPosX, cellPosY], poly1)) || (inside([cellPosX, cellPosY], poly2)) || (inside([cellPosX, cellPosY], poly3)) || (inside([cellPosX, cellPosY], poly4)) || (inside([cellPosX, cellPosY], poly5)) || (inside([cellPosX, cellPosY], poly6)) || (inside([cellPosX, cellPosY], poly7)) || (inside([cellPosX, cellPosY], poly8))){
				isWall = 0;
				//var lng = pixToLng(deltX + cellWid * (y), zoomStar);  // polyPoiF[i].x + deltaLenX
				//var lat = pixToLat(deltY + cellWid * (x), zoomStar);  // polyPoiF[i].y + deltaLenY
				//a1.push(lng);
				//a1.push(lat);
				
				//gridRowBlack.push(a1);

			}else{
				//var lng = pixToLng(deltX + cellWid * (y), zoomStar);  // polyPoiF[i].x + deltaLenX
				//var lat = pixToLat(deltY + cellWid * (x), zoomStar);  // polyPoiF[i].y + deltaLenY

				//gridRowWhite.push('[' + lng + '],[' + lat + ']');
			}
			gridRow.push(isWall);


		}
		gridDest.push(gridRow);

	}
//=====================================================================================

var astar = {
  /**
  * Perform an A* Search on a graph given a start and end node.
  * @param {Graph} graph
  * @param {GridNode} start
  * @param {GridNode} end
  * @param {Object} [options]
  * @param {bool} [options.closest] Specifies whether to return the
             path to the closest node if the target is unreachable.
  * @param {Function} [options.heuristic] Heuristic function (see
  *          astar.heuristics).
  */
  search: function(graph, start, end, options) {
    graph.cleanDirty();
    options = options || {};
    var heuristic = options.heuristic || astar.heuristics.manhattan;
    var closest = options.closest || false;

    var openHeap = getHeap();
    var closestNode = start; // set the start node to be the closest if required

    start.h = heuristic(start, end);
    graph.markDirty(start);

    openHeap.push(start);

    while (openHeap.size() > 0) {

      // Grab the lowest f(x) to process next.  Heap keeps this sorted for us.
      var currentNode = openHeap.pop();

      // End case -- result has been found, return the traced path.
      if (currentNode === end) {
        return pathTo(currentNode);
      }

      // Normal case -- move currentNode from open to closed, process each of its neighbors.
      currentNode.closed = true;

      // Find all neighbors for the current node.
      var neighbors = graph.neighbors(currentNode);

      for (var i = 0, il = neighbors.length; i < il; ++i) {
        var neighbor = neighbors[i];

        if (neighbor.closed || neighbor.isWall()) {
          // Not a valid node to process, skip to next neighbor.
          continue;
        }

        // The g score is the shortest distance from start to current node.
        // We need to check if the path we have arrived at this neighbor is the shortest one we have seen yet.
        var gScore = currentNode.g + neighbor.getCost(currentNode);
        var beenVisited = neighbor.visited;

        if (!beenVisited || gScore < neighbor.g) {

          // Found an optimal (so far) path to this node.  Take score for node to see how good it is.
          neighbor.visited = true;
          neighbor.parent = currentNode;
          neighbor.h = neighbor.h || heuristic(neighbor, end);
          neighbor.g = gScore;
          neighbor.f = neighbor.g + neighbor.h;
          graph.markDirty(neighbor);
          if (closest) {
            // If the neighbour is closer than the current closestNode or if it's equally close but has
            // a cheaper path than the current closest node then it becomes the closest node
            if (neighbor.h < closestNode.h || (neighbor.h === closestNode.h && neighbor.g < closestNode.g)) {
              closestNode = neighbor;
            }
          }

          if (!beenVisited) {
            // Pushing to heap will put it in proper place based on the 'f' value.
            openHeap.push(neighbor);
          } else {
            // Already seen the node, but since it has been rescored we need to reorder it in the heap
            openHeap.rescoreElement(neighbor);
          }
        }
      }
    }

    if (closest) {
      return pathTo(closestNode);
    }

    // No result was found - empty array signifies failure to find path.
    return [];
  },
  // See list of heuristics: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
  heuristics: {
    manhattan: function(pos0, pos1) {
      var d1 = Math.abs(pos1.x - pos0.x);
      var d2 = Math.abs(pos1.y - pos0.y);
      return d1 + d2;
    },
    diagonal: function(pos0, pos1) {
      var D = 1;
      var D2 = Math.sqrt(2);
      var d1 = Math.abs(pos1.x - pos0.x);
      var d2 = Math.abs(pos1.y - pos0.y);
      return (D * (d1 + d2)) + ((D2 - (2 * D)) * Math.min(d1, d2));
    }
  },
  cleanNode: function(node) {
    node.f = 0;
    node.g = 0;
    node.h = 0;
    node.visited = false;
    node.closed = false;
    node.parent = null;
  }
};

/**
 * A graph memory structure
 * @param {Array} gridIn 2D array of input weights
 * @param {Object} [options]
 * @param {bool} [options.diagonal] Specifies whether diagonal moves are allowed
 */
function Graph(gridIn, options) {
  options = options || {};
  this.nodes = [];
  this.diagonal = !!options.diagonal;
  this.grid = [];
  for (var x = 0; x < gridIn.length; x++) {
    this.grid[x] = [];

    for (var y = 0, row = gridIn[x]; y < row.length; y++) {
      var node = new GridNode(x, y, row[y]);
      this.grid[x][y] = node;
      this.nodes.push(node);
    }
  }
  this.init();
}

Graph.prototype.init = function() {
  this.dirtyNodes = [];
  for (var i = 0; i < this.nodes.length; i++) {
    astar.cleanNode(this.nodes[i]);
  }
};

Graph.prototype.cleanDirty = function() {
  for (var i = 0; i < this.dirtyNodes.length; i++) {
    astar.cleanNode(this.dirtyNodes[i]);
  }
  this.dirtyNodes = [];
};

Graph.prototype.markDirty = function(node) {
  this.dirtyNodes.push(node);
};

Graph.prototype.neighbors = function(node) {
  var ret = [];
  var x = node.x;
  var y = node.y;
  var grid = this.grid;

  // West
  if (grid[x - 1] && grid[x - 1][y]) {
    ret.push(grid[x - 1][y]);
  }

  // East
  if (grid[x + 1] && grid[x + 1][y]) {
    ret.push(grid[x + 1][y]);
  }

  // South
  if (grid[x] && grid[x][y - 1]) {
    ret.push(grid[x][y - 1]);
  }

  // North
  if (grid[x] && grid[x][y + 1]) {
    ret.push(grid[x][y + 1]);
  }

  if (this.diagonal) {
    // Southwest
    if (grid[x - 1] && grid[x - 1][y - 1]) {
      ret.push(grid[x - 1][y - 1]);
    }

    // Southeast
    if (grid[x + 1] && grid[x + 1][y - 1]) {
      ret.push(grid[x + 1][y - 1]);
    }

    // Northwest
    if (grid[x - 1] && grid[x - 1][y + 1]) {
      ret.push(grid[x - 1][y + 1]);
    }

    // Northeast
    if (grid[x + 1] && grid[x + 1][y + 1]) {
      ret.push(grid[x + 1][y + 1]);
    }
  }

  return ret;
};

Graph.prototype.toString = function() {
  var graphString = [];
  var nodes = this.grid;
  for (var x = 0; x < nodes.length; x++) {
    var rowDebug = [];
    var row = nodes[x];
    for (var y = 0; y < row.length; y++) {
      rowDebug.push(row[y].weight);
    }
    graphString.push(rowDebug.join(" "));
  }
  return graphString.join("\n");
};

function GridNode(x, y, weight) {
  this.x = x;
  this.y = y;
  this.weight = weight;
}

GridNode.prototype.toString = function() {
  return "[" + this.x + " " + this.y + "]";
};

GridNode.prototype.getCost = function(fromNeighbor) {
  // Take diagonal weight into consideration.
  if (fromNeighbor && fromNeighbor.x != this.x && fromNeighbor.y != this.y) {
    return this.weight * 1.41421;
  }
  return this.weight;
};

GridNode.prototype.isWall = function() {
  return this.weight === 0;
};

function BinaryHeap(scoreFunction) {
  this.content = [];
  this.scoreFunction = scoreFunction;
}

BinaryHeap.prototype = {
  push: function(element) {
    // Add the new element to the end of the array.
    this.content.push(element);

    // Allow it to sink down.
    this.sinkDown(this.content.length - 1);
  },
  pop: function() {
    // Store the first element so we can return it later.
    var result = this.content[0];
    // Get the element at the end of the array.
    var end = this.content.pop();
    // If there are any elements left, put the end element at the
    // start, and let it bubble up.
    if (this.content.length > 0) {
      this.content[0] = end;
      this.bubbleUp(0);
    }
    return result;
  },
  remove: function(node) {
    var i = this.content.indexOf(node);

    // When it is found, the process seen in 'pop' is repeated
    // to fill up the hole.
    var end = this.content.pop();

    if (i !== this.content.length - 1) {
      this.content[i] = end;

      if (this.scoreFunction(end) < this.scoreFunction(node)) {
        this.sinkDown(i);
      } else {
        this.bubbleUp(i);
      }
    }
  },
  size: function() {
    return this.content.length;
  },
  rescoreElement: function(node) {
    this.sinkDown(this.content.indexOf(node));
  },
  sinkDown: function(n) {
    // Fetch the element that has to be sunk.
    var element = this.content[n];

    // When at 0, an element can not sink any further.
    while (n > 0) {

      // Compute the parent element's index, and fetch it.
      var parentN = ((n + 1) >> 1) - 1;
      var parent = this.content[parentN];
      // Swap the elements if the parent is greater.
      if (this.scoreFunction(element) < this.scoreFunction(parent)) {
        this.content[parentN] = element;
        this.content[n] = parent;
        // Update 'n' to continue at the new position.
        n = parentN;
      }
      // Found a parent that is less, no need to sink any further.
      else {
        break;
      }
    }
  },
  bubbleUp: function(n) {
    // Look up the target element and its score.
    var length = this.content.length;
    var element = this.content[n];
    var elemScore = this.scoreFunction(element);

    while (true) {
      // Compute the indices of the child elements.
      var child2N = (n + 1) << 1;
      var child1N = child2N - 1;
      // This is used to store the new position of the element, if any.
      var swap = null;
      var child1Score;
      // If the first child exists (is inside the array)...
      if (child1N < length) {
        // Look it up and compute its score.
        var child1 = this.content[child1N];
        child1Score = this.scoreFunction(child1);

        // If the score is less than our element's, we need to swap.
        if (child1Score < elemScore) {
          swap = child1N;
        }
      }

      // Do the same checks for the other child.
      if (child2N < length) {
        var child2 = this.content[child2N];
        var child2Score = this.scoreFunction(child2);
        if (child2Score < (swap === null ? elemScore : child1Score)) {
          swap = child2N;
        }
      }

      // If the element needs to be moved, swap it, and continue.
      if (swap !== null) {
        this.content[n] = this.content[swap];
        this.content[swap] = element;
        n = swap;
      }
      // Otherwise, we are done.
      else {
        break;
      }
    }
  }
};

return {
  astar: astar,
  Graph: Graph,
  gridDest: gridDest,
  lngToGC: lngToGC,
  latToGR: latToGR,
  zoomStar: zoomStar
};

});

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值