MapParser.cpp 116 KB
Newer Older
oscar's avatar
oscar committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646

#include "MapParser.h"

#include "FileSys.h"
#include "LogicEvaluator.h"
#include "Utils.h"
#include "ajson.hpp"
#include "shapefil.h"

//地图文件名称配置
const char *c_cJunction_dbf = "Junction.dbf";
const char *c_cJunction_shp = "Junction.shp";
const char *c_cRoad_EdgeNode_dbf = "Road_EdgeNode.dbf";
const char *c_cRoad_EdgeNode_shp = "Road_EdgeNode.shp";
const char *c_cRoad_EdgeLink_dbf = "Road_EdgeLink.dbf";
const char *c_cRoad_EdgeLink_shp = "Road_EdgeLink.shp";
const char *c_cRoad_dbf = "Road.dbf";
const char *c_cRoad_shp = "Road.shp";
const char *c_cRoad_CrossArea_dbf = "Road_CrossArea.dbf";
const char *c_cRoad_CrossArea_shp = "Road_CrossArea.shp";

const char *c_cHD_LaneNode_dbf = "HD_LaneNode.dbf";
const char *c_cHD_LaneNode_shp = "HD_LaneNode.shp";
const char *c_cHD_LaneLink_dbf = "HD_LaneLink.dbf";
const char *c_cHD_LaneLink_shp = "HD_LaneLink.shp";

const char *c_cHD_EdgeNode_dbf = "HD_EdgeNode.dbf";
const char *c_cHD_EdgeNode_shp = "HD_EdgeNode.shp";
const char *c_cHD_LaneMark_dbf = "HD_LaneMark.dbf";
const char *c_cHD_LaneMark_shp = "HD_LaneMark.shp";
const char *c_cHD_EdgeLink_dbf = "HD_EdgeLink.dbf";
const char *c_cHD_EdgeLink_shp = "HD_EdgeLink.shp";

const char *c_cOBJ_TrafficSign_dbf = "OBJ_TrafficSign.dbf";
const char *c_cOBJ_TrafficSign_shp = "OBJ_TrafficSign.shp";
const char *c_cOBJ_TrafficLight_dbf = "OBJ_TrafficLight.dbf";
const char *c_cOBJ_TrafficLight_shp = "OBJ_TrafficLight.shp";

const char *c_cOBJ_Pole_dbf = "OBJ_Pole.dbf";
const char *c_cOBJ_Pole_shp = "OBJ_Pole.shp";

const char *c_cOBJ_Arrow_dbf = "OBJ_Arrow.dbf";
const char *c_cOBJ_Arrow_shp = "OBJ_Arrow.shp";
const char *c_cOBJ_Text_dbf = "OBJ_Text.dbf";
const char *c_cOBJ_Text_shp = "OBJ_Text.shp";
const char *c_cOBJ_Symbol_dbf = "OBJ_Symbol.dbf";
const char *c_cOBJ_Symbol_shp = "OBJ_Symbol.shp";
const char *c_cOBJ_StopLine_dbf = "OBJ_StopLine.dbf";
const char *c_cOBJ_StopLine_shp = "OBJ_StopLine.shp";
const char *c_cOBJ_Crossing_dbf = "OBJ_Crossing.dbf";
const char *c_cOBJ_Crossing_shp = "OBJ_Crossing.shp";
const char *c_cOBJ_OverHead_dbf = "OBJ_OverHead.dbf";
const char *c_cOBJ_OverHead_shp = "OBJ_OverHead.shp";

const char *c_cOBJ_NoParking_dbf = "OBJ_NoParking.dbf";
const char *c_cOBJ_NoParking_shp = "OBJ_NoParking.shp";

const char *c_cOBJ_SpeedBump_dbf = "OBJ_SpeedBump.dbf";
const char *c_cOBJ_SpeedBump_shp = "OBJ_SpeedBump.shp";

const char *c_cOBJ_Parking_dbf = "OBJ_Parking.dbf";
const char *c_cOBJ_Parking_shp = "OBJ_Parking.shp";

const char *c_cOBJ_FillArea_dbf = "OBJ_FillArea.dbf";
const char *c_cOBJ_FillArea_shp = "OBJ_FillArea.shp";

const char *c_cOBJ_Hydrant_dbf = "OBJ_Hydrant.dbf";
const char *c_cOBJ_Hydrant_shp = "OBJ_Hydrant.shp";

const char *c_cOBJ_BusStop_dbf = "OBJ_BusStop.dbf";
const char *c_cOBJ_BusStop_shp = "OBJ_BusStop.shp";

const char *c_cLaneADAS_csv = "LaneADAS.csv";

const char *c_cIndFacility_dbf = "IndFacility.dbf";
const char *c_cIndFacility_shp = "IndFacility.shp";
const char *c_cSpeed_dbf = "Speed.dbf";
const char *c_cFeature_json = "Feature.json";
// const char *c_cSpeed_shp = "Road.shp";

namespace jf {

HdJson MapParser::ParseAll(const std::string &strPath, MapIdNode &mapIdNode, MapIdWay &mapIdWay, ShpBound &stBound) {
    // jf_log_info("[MapParser::Parse] file : {}", strPath);

    std::map<JfDataId, HdLink> mapIdHdLink = {};

    std::map<JfDataId, std::vector<ObjTrafficLight>> mapLinkIdVctTrafficLight = {};
    std::map<JfDataId, std::vector<ObjTrafficLight>> mapLaneIdVctTrafficLight = {};

    ParseOBJTrafficLight(strPath, mapLinkIdVctTrafficLight, mapLaneIdVctTrafficLight);

    {
        std::map<JfDataId, std::vector<ObjPole>> mapLinkIdVctPole = {};
        std::map<JfDataId, std::vector<ObjStopLine>> mapLinkIdVctStopLine = {};
        std::map<JfDataId, std::vector<ObjCrossing>> mapLinkIdVctCrossing = {};
        std::map<JfDataId, std::vector<ObjPoint>> mapLinkIdVctPoint = {};
        std::map<JfDataId, std::vector<ObjTrafficSign>> mapLinkIdVctTrafficSign = {};
        std::map<JfDataId, std::vector<ObjOverHead>> mapLinkIdVctOverHead = {};
        std::map<JfDataId, std::vector<ObjFillArea>> mapLinkIdVctFillArea = {};
        std::map<JfDataId, std::vector<ObjBusStop>> mapLinkIdVctBusStop = {};
        std::map<JfDataId, std::vector<ObjHydrant>> mapLinkIdVctHydrant = {};
        std::map<JfDataId, std::vector<ObjParking>> mapLinkIdVctParking = {};
        std::map<JfDataId, std::vector<ObjSpeedBump>> mapLinkIdVctSpeedBump = {};
        std::map<JfDataId, std::vector<ObjNoParking>> mapLinkIdVctNoParking = {};

        ParseOBJTrafficSign(strPath, mapLinkIdVctTrafficSign);
        ParseOBJStopLine(strPath, mapLinkIdVctStopLine);
        ParseOBJCrossing(strPath, mapLinkIdVctCrossing);
        // ParseOBJPoint(strPath, mapLinkIdVctPoint);
        ParseOBJOverHead(strPath, mapLinkIdVctOverHead);
        ParseOBJFillArea(strPath, mapLinkIdVctFillArea);
        ParseOBJNoParking(strPath, mapLinkIdVctNoParking);
        ParseOBJSpeedBump(strPath, mapLinkIdVctSpeedBump);
        ParseOBJParking(strPath, mapLinkIdVctParking);
        ParseOBJHydrant(strPath, mapLinkIdVctHydrant);
        ParseOBJBusStop(strPath, mapLinkIdVctBusStop);
        ParseOBJPole(strPath, mapLinkIdVctPole);

        std::map<JfDataId, std::vector<RoadCrossArea>> mapLinkIdVctCrossArea = {};
        std::map<JfDataId, RoadJunction> mapLinkIdRoadJunction = {};
        std::map<JfDataId, RoadEdgeNode> mapLinkIdREdgeNode = {};
        std::map<JfDataId, RoadEdge> mapLinkIdRoadEdge = {};
        ParseRoadCrossArea(strPath, mapLinkIdVctCrossArea);
        ParseJunction(strPath, mapLinkIdRoadJunction);
        ParseRoadEdgeNode(strPath, mapLinkIdREdgeNode);
        ParseRoadEdgeLink(strPath, mapLinkIdREdgeNode, mapLinkIdRoadEdge);
        ParseRoad(strPath, mapLinkIdVctPole, mapLinkIdVctStopLine, mapLinkIdVctCrossing, mapLinkIdVctTrafficLight, mapLinkIdVctTrafficSign, mapLinkIdVctOverHead, mapLinkIdVctFillArea, mapLinkIdVctBusStop, mapLinkIdVctHydrant, mapLinkIdVctParking,
                  mapLinkIdVctSpeedBump, mapLinkIdVctNoParking, mapLinkIdVctCrossArea, mapLinkIdVctPoint, mapLinkIdRoadJunction, mapLinkIdRoadEdge, mapIdHdLink, stBound);
    }

    {
        std::map<JfDataId, HdEdgeNode> mapIdEdgeNode = {};
        std::map<JfDataId, std::vector<HdLaneMark>> mapEdgeIdVctLaneMark = {};
        std::map<JfDataId, HdEdge> mapIdEdge = {};
        ParseHDEdgeNode(strPath, mapIdEdgeNode);
        ParseHDLaneMark(strPath, mapEdgeIdVctLaneMark);
        ParseHDEdgeLink(strPath, mapIdEdgeNode, mapEdgeIdVctLaneMark, mapIdEdge, mapIdHdLink);
    }

    {
        std::map<JfDataId, HdLaneNode> mapIdLaneNode = {};
        std::map<JfDataId, std::vector<HdLaneAdas>> mapLaneIdVctLaneADASes = {};
        std::map<JfDataId, std::vector<ObjArrow>> mapLaneIdVctObjArrow = {};
        std::map<JfDataId, std::vector<ObjText>> mapLaneIdVctObjText = {};
        std::map<JfDataId, std::vector<ObjSymbol>> mapLaneIdVctObjSymbol = {};

        ParseHDLaneNode(strPath, mapIdLaneNode);
        ParseLaneADAS(strPath, mapLaneIdVctLaneADASes);
        ParseOBJArrow(strPath, mapLaneIdVctObjArrow);
        ParseOBJText(strPath, mapLaneIdVctObjText);
        ParseOBJSymbol(strPath, mapLaneIdVctObjSymbol);
        ParseHDLaneLink(strPath, mapIdLaneNode, mapLaneIdVctLaneADASes, mapLaneIdVctObjArrow, mapLaneIdVctTrafficLight, mapLaneIdVctObjText, mapLaneIdVctObjSymbol, mapIdHdLink);
    }

    HdJson result = {};
    MakeSdData(mapIdHdLink, mapIdNode, mapIdWay);
    MakeHdLink(mapIdHdLink, result);

    // insertFeatures(strPath, result);

    return result;
}

/**
 * 停止线预处理
 * @param strPath   文件路径
 * @param mapOutLinkIdVctStopLine
 */
void MapParser::ParseOBJStopLine(const std::string &strPath, std::map<JfDataId, std::vector<ObjStopLine>> &mapOutLinkIdVctStopLine) {
    std::string strFile_dbf = strPath + c_cOBJ_StopLine_dbf;
    std::string strFile_shp = strPath + c_cOBJ_StopLine_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJStopLine(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJStopLine(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_SL_type = "SL_type";
    const std::string c_strFieldName_Color = "Color";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_SL_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_SL_type.c_str());
    int nFieldIndex_Color = DBFGetFieldIndex(dbhHandle, c_strFieldName_Color.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        ObjStopLine slStopLine = {};
        slStopLine.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        slStopLine.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_SL_type);
        slStopLine.nColor = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Color);

        // nParts must be 1
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                slStopLine.vctvdGeoLink.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLinkIdVctStopLine[lRoadID].push_back(slStopLine);
        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

/**
 * 人行横道预处理
 * @param strPath
 * @param mapOutLinkIdVctCrossing
 */
void MapParser::ParseOBJCrossing(const std::string &strPath, std::map<JfDataId, std::vector<ObjCrossing>> &mapOutLinkIdVctCrossing) {
    std::string strFile_dbf = strPath + c_cOBJ_Crossing_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Crossing_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJCrossing(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJCrossing(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        ObjCrossing crCrossing = {};
        crCrossing.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));

        // nParts must be 1
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                crCrossing.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLinkIdVctCrossing[lRoadID].push_back(crCrossing);
        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

bool TRIdLess(const ObjTrafficLight objTrafficLight, const ObjTrafficLight objTrafficLight1) { return objTrafficLight.lId < objTrafficLight1.lId; }

bool TRIdEqual(const ObjTrafficLight objTrafficLight, const ObjTrafficLight objTrafficLight1) { return objTrafficLight.lId == objTrafficLight1.lId; }

/**
 * 交通信号灯预处理
 * @param strPath
 * @param mapOutLinkIdVctTrafficLight
 */
void MapParser::ParseOBJTrafficLight(const std::string &strPath, std::map<JfDataId, std::vector<ObjTrafficLight>> &mapOutLinkIdVctTrafficLight, std::map<JfDataId, std::vector<ObjTrafficLight>> &mapOutLaneIdVctTrafficLight) {
    std::string strFile_dbf = strPath + c_cOBJ_TrafficLight_dbf;
    std::string strFile_shp = strPath + c_cOBJ_TrafficLight_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";
    const std::string c_strFieldName_Heading = "Heading";
    const std::string c_strFieldName_Light_type = "Light_type";
    const std::string c_strFieldName_Light_dir = "Light_dir";
    const std::string c_strFieldName_LightArray = "LightArray";
    const std::string c_strFieldName_LightCount = "LightCount";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());
    int nFieldIndex_Heading = DBFGetFieldIndex(dbhHandle, c_strFieldName_Heading.c_str());
    int nFieldIndex_Light_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Light_type.c_str());
    int nFieldIndex_Light_dir = DBFGetFieldIndex(dbhHandle, c_strFieldName_Light_dir.c_str());
    int nFieldIndex_LightArray = DBFGetFieldIndex(dbhHandle, c_strFieldName_LightArray.c_str());
    int nFieldIndex_LightCount = DBFGetFieldIndex(dbhHandle, c_strFieldName_LightCount.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        ObjTrafficLight tlTrafficLight = {};
        tlTrafficLight.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        tlTrafficLight.dHeading = Utils::StringToNum<double>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Heading));
        tlTrafficLight.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Light_type);
        tlTrafficLight.strDir = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Light_dir);
        tlTrafficLight.nArray = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_LightArray);
        tlTrafficLight.nCount = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_LightCount);

        // nParts must be 1
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                tlTrafficLight.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLinkIdVctTrafficLight[lRoadID].push_back(tlTrafficLight);

        std::vector<HdLaneId> vctLaneIdTmp;
        AnalyseStrNums(strLaneIDS, vctLaneIdTmp);
        for (HdLaneId hdLaneId : vctLaneIdTmp) {
            mapOutLaneIdVctTrafficLight[hdLaneId].push_back(tlTrafficLight);
        }
        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

/**
 * 地面箭头预处理
 * @param strPath
 * @param mapOutLaneIdVctObjArrow
 */
void MapParser::ParseOBJArrow(const std::string &strPath, std::map<JfDataId, std::vector<ObjArrow>> &mapOutLaneIdVctObjArrow) {
    std::string strFile_dbf = strPath + c_cOBJ_Arrow_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Arrow_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_LaneID = "LaneID";
    const std::string c_strFieldName_Color = "Color";
    const std::string c_strFieldName_Arrow_type = "Arrow_type";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_LaneID = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneID.c_str());
    int nFieldIndex_Color = DBFGetFieldIndex(dbhHandle, c_strFieldName_Color.c_str());
    int nFieldIndex_Arrow_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Arrow_type.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpObjArrow = SHPReadObject(shhHandle, i);

        // read a dbf data object
        ObjArrow arArrow = {};
        arArrow.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        JfDataId lLaneID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneID));
        arArrow.nColor = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Color);
        arArrow.strType = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Arrow_type);

        // nParts must be 1
        for (int j = 0; j < pshpObjArrow->nParts; ++j) {
            for (int k = 0; k < pshpObjArrow->nVertices; ++k) {
                double dLon = pshpObjArrow->padfX[k];
                double dLat = pshpObjArrow->padfY[k];
                double dAlt = pshpObjArrow->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                arArrow.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLaneIdVctObjArrow[lLaneID].push_back(arArrow);
        SHPDestroyObject(pshpObjArrow);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

/**
 * 交通标牌预处理
 * @param strPath
 * @param mapOutLinkIdVctTrafficSign
 */
void MapParser::ParseOBJTrafficSign(const std::string &strPath, std::map<JfDataId, std::vector<ObjTrafficSign>> &mapOutLinkIdVctTrafficSign) {
    std::string strFile_dbf = strPath + c_cOBJ_TrafficSign_dbf;
    std::string strFile_shp = strPath + c_cOBJ_TrafficSign_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_Shape = "Shape";
    const std::string c_strFieldName_Sign_type = "Sign_type";
    const std::string c_strFieldName_Type1 = "Type1";
    const std::string c_strFieldName_Type2 = "Type2";
    const std::string c_strFieldName_Sign_text = "Sign_text";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_Shape = DBFGetFieldIndex(dbhHandle, c_strFieldName_Shape.c_str());
    int nFieldIndex_Sign_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Sign_type.c_str());
    int nFieldIndex_Type1 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Type1.c_str());
    int nFieldIndex_Type2 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Type2.c_str());
    int nFieldIndex_Sign_text = DBFGetFieldIndex(dbhHandle, c_strFieldName_Sign_text.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjTrafficSign objTrafficSign;
        objTrafficSign.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        objTrafficSign.nShape = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Shape);
        objTrafficSign.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Sign_type);
        objTrafficSign.nType1 = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Type1);
        objTrafficSign.nType2 = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Type2);
        objTrafficSign.strText = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Sign_text);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objTrafficSign.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLinkIdVctTrafficSign[lRoadID].push_back(objTrafficSign);
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 杆状物预处理
 * @param strPath
 * @param mapOutLinkIdVctPole
 */
void MapParser::ParseOBJPole(const std::string &strPath, std::map<JfDataId, std::vector<ObjPole>> &mapOutLinkIdVctPole) {
    std::string strFile_dbf = strPath + c_cOBJ_Pole_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Pole_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_Height = "Height";
    const std::string c_strFieldName_Pole_type2 = "Pole_type2";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_Height = DBFGetFieldIndex(dbhHandle, c_strFieldName_Height.c_str());
    int nFieldIndex_Pole_type2 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Pole_type2.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjPole objPole;
        objPole.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        objPole.height = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Height);
        objPole.poleType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Pole_type2);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objPole.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLinkIdVctPole[lRoadID].push_back(objPole);
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 地面文字预处理
 * @param strPath
 * @param mapOutLaneIdVctText
 */
void MapParser::ParseOBJText(const std::string &strPath, std::map<JfDataId, std::vector<ObjText>> &mapOutLaneIdVctText) {
    std::string strFile_dbf = strPath + c_cOBJ_Text_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Text_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_LaneID = "LaneID";
    const std::string c_strFieldName_Color = "Color";
    const std::string c_strFieldName_Text = "Text";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_LaneID = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneID.c_str());
    int nFieldIndex_Color = DBFGetFieldIndex(dbhHandle, c_strFieldName_Color.c_str());
    int nFieldIndex_Text = DBFGetFieldIndex(dbhHandle, c_strFieldName_Text.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjText objText;
        objText.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lLaneID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneID));
        objText.nColor = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Color);
        objText.strText = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Text);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objText.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        mapOutLaneIdVctText[lLaneID].push_back(objText);
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 地面符号预处理
 * @param strPath
 * @param mapOutLaneIdVctText
 */
void MapParser::ParseOBJSymbol(const std::string &strPath, std::map<JfDataId, std::vector<ObjSymbol>> &mapOutLaneIdVctSymbol) {
    std::string strFile_dbf = strPath + c_cOBJ_Symbol_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Symbol_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_LaneID = "LaneID";
    const std::string c_strFieldName_Color = "Color";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_LaneID = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneID.c_str());
    int nFieldIndex_Color = DBFGetFieldIndex(dbhHandle, c_strFieldName_Color.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjSymbol objSymbol;
        objSymbol.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lLaneID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneID));
        objSymbol.color = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Color);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objSymbol.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        mapOutLaneIdVctSymbol[lLaneID].push_back(objSymbol);
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 上方障碍物预处理
 * @param strPath
 * @param mapOutLaneIdVctText
 */
void MapParser::ParseOBJOverHead(const std::string &strPath, std::map<JfDataId, std::vector<ObjOverHead>> &mapOutLinkIdVctOverHead) {
    std::string strFile_dbf = strPath + c_cOBJ_OverHead_dbf;
    std::string strFile_shp = strPath + c_cOBJ_OverHead_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";
    const std::string c_strFieldName_Height = "Height";
    const std::string c_strFieldName_OH_type = "OH_type";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_Height = DBFGetFieldIndex(dbhHandle, c_strFieldName_Height.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());
    int nFieldIndex_OH_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_OH_type.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjOverHead objOverHead = {};
        objOverHead.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        objOverHead.height = DBFReadDoubleAttribute(dbhHandle, i, nFieldIndex_Height);
        objOverHead.OH_type = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_OH_type);

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objOverHead.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objOverHead.vctvdGeoLink.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctOverHead[lRoadID].push_back(objOverHead);
        }
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 禁止停车区预处理
 * @param strPath
 * @param mapOutLinkIdVctOverHead
 */
void MapParser::ParseOBJNoParking(const std::string &strPath, std::map<JfDataId, std::vector<ObjNoParking>> &mapOutLinkIdVctNoParking) {
    std::string strFile_dbf = strPath + c_cOBJ_NoParking_dbf;
    std::string strFile_shp = strPath + c_cOBJ_NoParking_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjNoParking objNoParking = {};
        objNoParking.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objNoParking.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objNoParking.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctNoParking[lRoadID].push_back(objNoParking);
        }
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 减速带预处理
 * @param strPath
 * @param mapOutLinkIdVctSpeedBump
 */
void MapParser::ParseOBJSpeedBump(const std::string &strPath, std::map<JfDataId, std::vector<ObjSpeedBump>> &mapOutLinkIdVctSpeedBump) {
    std::string strFile_dbf = strPath + c_cOBJ_SpeedBump_dbf;
    std::string strFile_shp = strPath + c_cOBJ_SpeedBump_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjSpeedBump objSpeedBump = {};
        objSpeedBump.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objSpeedBump.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objSpeedBump.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctSpeedBump[lRoadID].push_back(objSpeedBump);
        }
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 停车区预处理
 * @param strPath
 * @param mapOutLinkIdVctParking
 */
void MapParser::ParseOBJParking(const std::string &strPath, std::map<JfDataId, std::vector<ObjParking>> &mapOutLinkIdVctParking) {
    std::string strFile_dbf = strPath + c_cOBJ_Parking_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Parking_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjParking objParking = {};
        objParking.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objParking.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objParking.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctParking[lRoadID].push_back(objParking);
        }
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 导流区预处理
 * @param strPath
 * @param mapOutLinkIdVctFillArea
 */
void MapParser::ParseOBJFillArea(const std::string &strPath, std::map<JfDataId, std::vector<ObjFillArea>> &mapOutLinkIdVctFillArea) {
    std::string strFile_dbf = strPath + c_cOBJ_FillArea_dbf;
    std::string strFile_shp = strPath + c_cOBJ_FillArea_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjFillArea objFillArea = {};
        objFillArea.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objFillArea.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objFillArea.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctFillArea[lRoadID].push_back(objFillArea);
        }
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 消防栓预处理
 * @param strPath
 * @param mapOutLinkIdVctHydrant
 */
void MapParser::ParseOBJHydrant(const std::string &strPath, std::map<JfDataId, std::vector<ObjHydrant>> &mapOutLinkIdVctHydrant) {
    std::string strFile_dbf = strPath + c_cOBJ_Hydrant_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Hydrant_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjHydrant objHydrant = {};
        objHydrant.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objHydrant.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objHydrant.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctHydrant[lRoadID].push_back(objHydrant);
        }
        SHPDestroyObject(pshpObj);
    }
}

/**
 * 公交站预处理
 * @param strPath
 * @param mapOutLinkIdVctBusStop
 */
void MapParser::ParseOBJBusStop(const std::string &strPath, std::map<JfDataId, std::vector<ObjBusStop>> &mapOutLinkIdVctBusStop) {
    std::string strFile_dbf = strPath + c_cOBJ_BusStop_dbf;
    std::string strFile_shp = strPath + c_cOBJ_BusStop_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJText(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJArrow(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        ObjBusStop objBusStop = {};
        objBusStop.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));

        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);
        AnalyseStrNums(strLaneIDS, objBusStop.vctlLaneId);

        std::string lRoadIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDS;
        AnalyseStrNums(lRoadIDS, vctlRoadIDS);

        // read a shp data object
        SHPObject *pshpObj = SHPReadObject(shhHandle, i);
        // nParts must be 1
        for (int j = 0; j < pshpObj->nParts; ++j) {
            for (int k = 0; k < pshpObj->nVertices; ++k) {
                double dLon = pshpObj->padfX[k];
                double dLat = pshpObj->padfY[k];
                double dAlt = pshpObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                objBusStop.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }
        for (JfDataId lRoadID : vctlRoadIDS) {
            mapOutLinkIdVctBusStop[lRoadID].push_back(objBusStop);
        }
        SHPDestroyObject(pshpObj);
    }
}

void MapParser::ParseOBJPoint(const std::string &strPath, std::map<JfDataId, std::vector<ObjPoint>> &mapOutLinkIdVctPoint) {
    std::string strFile_dbf = strPath + c_cOBJ_Symbol_dbf;
    std::string strFile_shp = strPath + c_cOBJ_Symbol_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseOBJSymbol(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseOBJSymbol(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_OBJID = "OBJID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_LANE_IDS = "LANE_IDS";
    const std::string c_strFieldName_OBJ_type = "OBJ_type";
    const std::string c_strFieldName_Memo1 = "Memo1";
    const std::string c_strFieldName_Memo2 = "Memo2";
    const std::string c_strFieldName_Memo3 = "Memo3";
    const std::string c_strFieldName_Memo4 = "Memo4";

    int nFieldIndex_OBJID = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_LANE_IDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LANE_IDS.c_str());
    int nFieldIndex_OBJ_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_OBJ_type.c_str());
    int nFieldIndex_Memo1 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Memo1.c_str());
    int nFieldIndex_Memo2 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Memo2.c_str());
    int nFieldIndex_Memo3 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Memo3.c_str());
    int nFieldIndex_Memo4 = DBFGetFieldIndex(dbhHandle, c_strFieldName_Memo4.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        ObjPoint ptPoint = {};
        ptPoint.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_OBJID));
        JfDataId lRoadID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LANE_IDS);
        AnalyseStrNums(strLaneIDS, ptPoint.vctlLaneId);
        ptPoint.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_OBJ_type);
        ptPoint.strMemo1 = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Memo1);
        ptPoint.strMemo2 = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Memo2);
        ptPoint.strMemo3 = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Memo3);
        ptPoint.strMemo4 = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Memo4);

        // nParts must be 1
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                ptPoint.vctdGeoNode = std::vector<double>{dLon, dLat, dAlt};
            }
        }

        mapOutLinkIdVctPoint[lRoadID].push_back(ptPoint);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseRoadCrossArea(const std::string &strPath, std::map<JfDataId, std::vector<RoadCrossArea>> &mapOutLinkIdVctCrossArea) {
    std::string strFile_dbf = strPath + c_cRoad_CrossArea_dbf;
    std::string strFile_shp = strPath + c_cRoad_CrossArea_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseRoadCrossArea(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseRCrossArea(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_Cross_ID = "Cross_ID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";

    int nFieldIndex_Cross_ID = DBFGetFieldIndex(dbhHandle, c_strFieldName_Cross_ID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        RoadCrossArea caCrossArea = {};
        caCrossArea.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Cross_ID));
        std::string strRoadID = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);
        std::vector<JfDataId> vctlRoadIDs = {};
        AnalyseStrNums(strRoadID, vctlRoadIDs);

        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                // double dM = pshpRCrossAreaObj->padfM[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                caCrossArea.vctvdGeoArea.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        for (JfDataId lRoadID : vctlRoadIDs) {
            mapOutLinkIdVctCrossArea[lRoadID].push_back(caCrossArea);
        }

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseJunction(const std::string &strPath, std::map<JfDataId, RoadJunction> &mapOutIdJunction) {
    std::string strFile_dbf = strPath + c_cJunction_dbf;
    std::string strFile_shp = strPath + c_cJunction_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseJunction(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseJunction(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_JCID = "JCID";
    const std::string c_strFieldName_RoadIDS = "RoadIDS";

    int nFieldIndex_JCID = DBFGetFieldIndex(dbhHandle, c_strFieldName_JCID.c_str());
    int nFieldIndex_RoadIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        RoadJunction jcJunction = {};
        jcJunction.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_JCID));
        std::string strRoadIds = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadIDS);

        // nParts is 0, so ignore it
        // for (int j = 0; j < pshpJunctionObj->nParts; ++j)
        {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                // double dM = pshpJunctionObj->padfM[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                jcJunction.vctdGeoNode = std::vector<double>{dLon, dLat, dAlt};
            }
        }

        mapOutIdJunction[jcJunction.lId] = jcJunction;

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseRoadEdgeNode(const std::string &strPath, std::map<JfDataId, RoadEdgeNode> &mapOutIdEdgeNode) {
    std::string strFile_dbf = strPath + c_cRoad_EdgeNode_dbf;
    std::string strFile_shp = strPath + c_cRoad_EdgeNode_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseRoadEdgeNode(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseREdgeNode(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_RE_NodeID = "RE_NodeID";
    const std::string c_strFieldName_REdgeIDS = "REdgeIDS";

    int nFieldIndex_RE_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RE_NodeID.c_str());
    int nFieldIndex_REdgeIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_REdgeIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        RoadEdgeNode enEdgeNode = {};
        enEdgeNode.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RE_NodeID));
        std::string strREdgeIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_REdgeIDS);

        // nParts is 0, so ignore it
        // for (int j = 0; j < pshpJunctionObj->nParts; ++j)
        {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                // double dM = pshpJunctionObj->padfM[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                enEdgeNode.vctdGeoNode = std::vector<double>{dLon, dLat, dAlt};
            }
        }

        mapOutIdEdgeNode[enEdgeNode.lId] = enEdgeNode;

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseRoadEdgeLink(const std::string &strPath, const std::map<JfDataId, RoadEdgeNode> &mapIdEdgeNode, std::map<JfDataId, RoadEdge> &mapOutIdEdge) {
    std::string strFile_dbf = strPath + c_cRoad_EdgeLink_dbf;
    std::string strFile_shp = strPath + c_cRoad_EdgeLink_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseRoadEdgeLink(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseRoadEdgeLink(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_REdgeID = "REdgeID";
    const std::string c_strFieldName_SRE_NodeID = "SRE_NodeID";
    const std::string c_strFieldName_ERE_NodeID = "ERE_NodeID";
    const std::string c_strFieldName_REdge_type = "REdge_type";
    const std::string c_strFieldName_REdgeColor = "REdgeColor";

    int nFieldIndex_REdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_REdgeID.c_str());
    int nFieldIndex_SRE_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_SRE_NodeID.c_str());
    int nFieldIndex_ERE_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_ERE_NodeID.c_str());
    int nFieldIndex_REdge_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_REdge_type.c_str());
    int nFieldIndex_REdgeColor = DBFGetFieldIndex(dbhHandle, c_strFieldName_REdgeColor.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        RoadEdge elEdgeLink = {};
        elEdgeLink.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_REdgeID));
        JfDataId lSRE_NodeID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_SRE_NodeID));
        Point ptStart = {};
        if (mapIdEdgeNode.find(lSRE_NodeID) != mapIdEdgeNode.end()) {
            elEdgeLink.enStartNode = mapIdEdgeNode.at(lSRE_NodeID);
            ptStart = elEdgeLink.enStartNode.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseRoadEdgeLink(), could not find Road_EdgeNode lValue = {0}, Road_EdgeLink lValue = {1}", lSRE_NodeID, elEdgeLink.lREdgeID);
        }
        Point ptEnd = {};
        JfDataId lERE_NodeID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_ERE_NodeID));
        if (mapIdEdgeNode.find(lERE_NodeID) != mapIdEdgeNode.end()) {
            elEdgeLink.enEndNode = mapIdEdgeNode.at(lERE_NodeID);
            ptEnd = elEdgeLink.enEndNode.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseRoadEdgeLink(), could not find Road_EdgeNode lValue = {0}, Road_EdgeLink lValue = {1}", lERE_NodeID, elEdgeLink.lREdgeID);
        }
        elEdgeLink.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_REdge_type);
        elEdgeLink.nColor = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_REdgeColor);

        // nParts is 0, so ignore it
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                // double dM = pshpJunctionObj->padfM[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                elEdgeLink.vctvdGeoLink.push_back(std::vector<double>{dLon, dLon, dLat, dAlt});
            }
        }

        // insert the start and end node if not exist in the egolink
        // if (ptStart != Point() && ptStart.dLon != Point(elEdgeLink.vctvdGeoLink.at(0)).dLon && ptStart.dLat != Point(elEdgeLink.vctvdGeoLink.at(0)).dLat) {
        //     elEdgeLink.vctvdGeoLink.insert(elEdgeLink.vctvdGeoLink.begin(), elEdgeLink.enStartNode.vctdGeoNode);
        // }
        // if (ptEnd != Point() && ptEnd.dLon != Point(elEdgeLink.vctvdGeoLink.at(elEdgeLink.vctvdGeoLink.size() - 1)).dLon && ptEnd.dLat != Point(elEdgeLink.vctvdGeoLink.at(elEdgeLink.vctvdGeoLink.size() - 1)).dLat) {
        //     elEdgeLink.vctvdGeoLink.insert(elEdgeLink.vctvdGeoLink.end(), elEdgeLink.enEndNode.vctdGeoNode);
        // }

        mapOutIdEdge[elEdgeLink.lId] = elEdgeLink;

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseRoad(const std::string &strPath, const std::map<JfDataId, std::vector<ObjPole>> mapLinkIdVctPole, const std::map<JfDataId, std::vector<ObjStopLine>> mapLinkIdVctStopLine,
                          const std::map<JfDataId, std::vector<ObjCrossing>> mapLinkIdVctCrossing, const std::map<JfDataId, std::vector<ObjTrafficLight>> mapLinkIdVctTrafficLight,
                          const std::map<JfDataId, std::vector<ObjTrafficSign>> mapLinkIdVctTrafficSign, const std::map<JfDataId, std::vector<ObjOverHead>> mapLinkIdVctOverHead, const std::map<JfDataId, std::vector<ObjFillArea>> mapLinkIdVctFillArea,
                          const std::map<JfDataId, std::vector<ObjBusStop>> mapLinkIdVctBusStop, const std::map<JfDataId, std::vector<ObjHydrant>> mapLinkIdVctHydrant, const std::map<JfDataId, std::vector<ObjParking>> mapLinkIdVctParking,
                          const std::map<JfDataId, std::vector<ObjSpeedBump>> mapLinkIdVctSpeedBump, const std::map<JfDataId, std::vector<ObjNoParking>> mapLinkIdVctNoParking, const std::map<JfDataId, std::vector<RoadCrossArea>> &mapLinkIdVctCrossArea,
                          const std::map<JfDataId, std::vector<ObjPoint>> mapLinkIdVctPoint, const std::map<JfDataId, RoadJunction> &mapIdJunction, const std::map<JfDataId, RoadEdge> &mapIdEdge, std::map<JfDataId, HdLink> &mapOutIdHdLink,
                          ShpBound &bdOutBound) {
    std::string strFile_dbf = strPath + c_cRoad_dbf;
    std::string strFile_shp = strPath + c_cRoad_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseRoad(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseRoad(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_SJCID = "SJCID";
    const std::string c_strFieldName_EJCID = "EJCID";
    const std::string c_strFieldName_L_REdgeID = "L_REdgeID";
    const std::string c_strFieldName_R_REdgeID = "R_REdgeID";
    const std::string c_strFieldName_Length = "Length";
    const std::string c_strFieldName_Lane_num = "Lane_num";
    const std::string c_strFieldName_Direction = "Direction";
    const std::string c_strFieldName_Road_rank = "Road_rank";
    const std::string c_strFieldName_Road_type = "Road_type";
    const std::string c_strFieldName_Startangle = "Startangle";
    const std::string c_strFieldName_Name_chn = "Name_chn";
    const std::string c_strFieldName_Speed = "Speed";

    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_SJCID = DBFGetFieldIndex(dbhHandle, c_strFieldName_SJCID.c_str());
    int nFieldIndex_EJCID = DBFGetFieldIndex(dbhHandle, c_strFieldName_EJCID.c_str());
    int nFieldIndex_L_REdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_L_REdgeID.c_str());
    int nFieldIndex_R_REdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_R_REdgeID.c_str());
    int nFieldIndex_Length = DBFGetFieldIndex(dbhHandle, c_strFieldName_Length.c_str());
    int nFieldIndex_Lane_num = DBFGetFieldIndex(dbhHandle, c_strFieldName_Lane_num.c_str());
    int nFieldIndex_Direction = DBFGetFieldIndex(dbhHandle, c_strFieldName_Direction.c_str());
    int nFieldIndex_Road_rank = DBFGetFieldIndex(dbhHandle, c_strFieldName_Road_rank.c_str());
    int nFieldIndex_Road_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Road_type.c_str());
    int nFieldIndex_Startangle = DBFGetFieldIndex(dbhHandle, c_strFieldName_Startangle.c_str());
    int nFieldIndex_Name_chn = DBFGetFieldIndex(dbhHandle, c_strFieldName_Name_chn.c_str());
    int nFieldIndex_Speed = DBFGetFieldIndex(dbhHandle, c_strFieldName_Speed.c_str());

    // LogicEvaluator logic_evaluator(MapConfig::map_road_filer_logic);

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        HdLink hlLink = {};
        JfDataId lRoadId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        JfDataId lSJCID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_SJCID));
        Point ptStart = {};
        if (mapIdJunction.find(lSJCID) != mapIdJunction.end()) {
            hlLink.jcStartJunc = mapIdJunction.at(lSJCID);
            ptStart = hlLink.jcStartJunc.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseRoad(), could not find Junction lValue = {0}, Road lValue = {1}", lSJCID, lRoadId);
        }
        JfDataId lEJCID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EJCID));
        Point ptEnd = {};
        if (mapIdJunction.find(lEJCID) != mapIdJunction.end()) {
            hlLink.jcEndJunc = mapIdJunction.at(lEJCID);
            ptEnd = hlLink.jcEndJunc.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseRoad(), could not find Junction lValue = {0}, Road lValue = {1}", lEJCID, lRoadId);
        }
        std::string strL_REdgeID = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_L_REdgeID);
        std::vector<JfDataId> vctlL_REdgeIDs = {};
        AnalyseStrNums(strL_REdgeID, vctlL_REdgeIDs);
        for (JfDataId lL_REdgeID : vctlL_REdgeIDs) {
            if (mapIdEdge.find(lL_REdgeID) != mapIdEdge.end()) {
                hlLink.vctreLeftEdge.push_back(mapIdEdge.at(lL_REdgeID));
            } else {
                // jf_log_error("MapParser::ParseRoad(), could not find Road_EdgeLink lValue = {0}, Road lValue = {1}", lL_REdgeID, lRoadId);
            }
        }
        std::string strR_REdgeID = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_R_REdgeID);
        std::vector<JfDataId> vctlR_REdgeIDs = {};
        AnalyseStrNums(strR_REdgeID, vctlR_REdgeIDs);
        for (JfDataId lR_REdgeID : vctlR_REdgeIDs) {
            if (mapIdEdge.find(lR_REdgeID) != mapIdEdge.end()) {
                hlLink.vctreRightEdge.push_back(mapIdEdge.at(lR_REdgeID));
            } else {
                // jf_log_error("MapParser::ParseRoad(), could not find Road_EdgeLink lValue = {0}, Road lValue = {1}", lR_REdgeID, lRoadId);
            }
        }
        hlLink.dLength = DBFReadDoubleAttribute(dbhHandle, i, nFieldIndex_Length);
        hlLink.nLaneNum = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Lane_num);
        hlLink.nDirection = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Direction);
        hlLink.nRank = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Road_rank);
        hlLink.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Road_type);
        hlLink.dStartAngle = DBFReadDoubleAttribute(dbhHandle, i, nFieldIndex_Startangle);
        hlLink.strName = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Name_chn);
        hlLink.nSpeedLimit = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Speed);

        // nParts must be 1
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                // double dM = pshpRoadObj->padfM[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                hlLink.vctvdGeoLink.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        // insert the start and end node if not exist in the egolink
        // if (ptStart != Point() && ptStart.dLon != Point(hlLink.vctvdGeoLink.at(0)).dLon && ptStart.dLat != Point(hlLink.vctvdGeoLink.at(0)).dLat) {
        //     hlLink.vctvdGeoLink.insert(hlLink.vctvdGeoLink.begin(), hlLink.jcStartJunc.vctdGeoNode);
        // }
        // if (ptEnd != Point() && ptEnd.dLon != Point(hlLink.vctvdGeoLink.at(hlLink.vctvdGeoLink.size() - 1)).dLon && ptEnd.dLat != Point(hlLink.vctvdGeoLink.at(hlLink.vctvdGeoLink.size() - 1)).dLat) {
        //     hlLink.vctvdGeoLink.insert(hlLink.vctvdGeoLink.end(), hlLink.jcEndJunc.vctdGeoNode);
        // }

        /********对象数据的赋值************/
        if (mapLinkIdVctTrafficSign.find(lRoadId) != mapLinkIdVctTrafficSign.end()) {
            hlLink.vctTrafficSign = mapLinkIdVctTrafficSign.at(lRoadId);
        }
        if (mapLinkIdVctPole.find(lRoadId) != mapLinkIdVctPole.end()) {
            hlLink.vctPole = mapLinkIdVctPole.at(lRoadId);
        }
        if (mapLinkIdVctStopLine.find(lRoadId) != mapLinkIdVctStopLine.end()) {
            hlLink.vctslStopLine = mapLinkIdVctStopLine.at(lRoadId);
        }
        if (mapLinkIdVctCrossing.find(lRoadId) != mapLinkIdVctCrossing.end()) {
            hlLink.vctcrCrossing = mapLinkIdVctCrossing.at(lRoadId);
        }
        if (mapLinkIdVctTrafficLight.find(lRoadId) != mapLinkIdVctTrafficLight.end()) {
            hlLink.vcttlTrafficLight = mapLinkIdVctTrafficLight.at(lRoadId);
        }
        if (mapLinkIdVctOverHead.find(lRoadId) != mapLinkIdVctOverHead.end()) {
            hlLink.vctOverHead = mapLinkIdVctOverHead.at(lRoadId);
        }
        if (mapLinkIdVctNoParking.find(lRoadId) != mapLinkIdVctNoParking.end()) {
            hlLink.vctNoParking = mapLinkIdVctNoParking.at(lRoadId);
        }
        if (mapLinkIdVctSpeedBump.find(lRoadId) != mapLinkIdVctSpeedBump.end()) {
            hlLink.vctSpeedBump = mapLinkIdVctSpeedBump.at(lRoadId);
        }
        if (mapLinkIdVctParking.find(lRoadId) != mapLinkIdVctParking.end()) {
            hlLink.vctParking = mapLinkIdVctParking.at(lRoadId);
        }
        if (mapLinkIdVctFillArea.find(lRoadId) != mapLinkIdVctFillArea.end()) {
            hlLink.vctFillArea = mapLinkIdVctFillArea.at(lRoadId);
        }
        if (mapLinkIdVctHydrant.find(lRoadId) != mapLinkIdVctHydrant.end()) {
            hlLink.vctHydrant = mapLinkIdVctHydrant.at(lRoadId);
        }
        if (mapLinkIdVctBusStop.find(lRoadId) != mapLinkIdVctBusStop.end()) {
            hlLink.vctBusStop = mapLinkIdVctBusStop.at(lRoadId);
        }
        if (mapLinkIdVctPoint.find(lRoadId) != mapLinkIdVctPoint.end()) {
            hlLink.vctRsuPoint = mapLinkIdVctPoint.at(lRoadId);
        }
        if (mapLinkIdVctCrossArea.find(lRoadId) != mapLinkIdVctCrossArea.end()) {
            hlLink.vctcaCrossArea = mapLinkIdVctCrossArea.at(lRoadId);
        }

        mapOutIdHdLink[lRoadId] = hlLink;

        // std::map<std::string, std::string> logic_map{
        //     {"RoadID", jf::to_string(lRoadId)},
        //     {"rank", jf::to_string(rdRoad.nRank)},
        //     {"length", jf::to_string(rdRoad.dLength)},
        //     {"nLaneNum", jf::to_string(rdRoad.nLaneNum)},
        //     {"direction", jf::to_string(rdRoad.nDirection)},
        //     {"type", jf::to_string(rdRoad.nType)},
        //     {"dStartAngle", jf::to_string(rdRoad.dStartAngle)},
        //     {"speed", jf::to_string(rdRoad.nSpeed)},
        // };
        // if (logic_evaluator.IsValid(logic_map)) {
        //     mapIdRoad[lRoadId] = rdRoad;
        // }

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseHDEdgeNode(const std::string &strPath, std::map<JfDataId, HdEdgeNode> &mapOutIdHdEdgeNode) {
    std::string strFile_dbf = strPath + c_cHD_EdgeNode_dbf;
    std::string strFile_shp = strPath + c_cHD_EdgeNode_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseEdgeNode(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseEdgeNode(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_EdgeNodeID = "EdgeNodeID";
    const std::string c_strFieldName_EdgeIDS = "EdgeIDS";

    int nFieldIndex_EdgeNodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_EdgeNodeID.c_str());
    int nFieldIndex_EdgeIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_EdgeIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        HdEdgeNode enEdgeNode = {};
        enEdgeNode.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EdgeNodeID));
        std::string strEdgeIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EdgeIDS);

        // nParts is 0 so ignore it
        // for (int j = 0; j < pshpEdgeNodeObj->nParts; ++j)
        {
            // nVertices must be 1
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                enEdgeNode.vctdGeoNode = std::vector<double>{dLon, dLat, dAlt};
            }
        }

        mapOutIdHdEdgeNode[enEdgeNode.lId] = enEdgeNode;

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseHDLaneMark(const std::string &strPath, std::map<JfDataId, std::vector<HdLaneMark>> &mapOutEdgeIdVctLaneMark) {
    std::string strFile_dbf = strPath + c_cHD_LaneMark_dbf;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    if (nullptr == dbhHandle) {
        // jf_log_error("MapParser::ParseLaneMark(), invalid map file path, could not open.");
        return;
    }

    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (0 == nRcdCnt) {
        // jf_log_error("MapParser::ParseLaneMark(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_MarkID = "MarkID";
    const std::string c_strFieldName_EdgeID = "EdgeID";
    const std::string c_strFieldName_Mark_no = "Mark_no";
    const std::string c_strFieldName_Mark_type = "Mark_type";
    const std::string c_strFieldName_Mark_color = "Mark_color";
    const std::string c_strFieldName_Mark_width = "Mark_width";

    int nFieldIndex_MarkID = DBFGetFieldIndex(dbhHandle, c_strFieldName_MarkID.c_str());
    int nFieldIndex_EdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_EdgeID.c_str());
    int nFieldIndex_Mark_no = DBFGetFieldIndex(dbhHandle, c_strFieldName_Mark_no.c_str());
    int nFieldIndex_Mark_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Mark_type.c_str());
    int nFieldIndex_Mark_color = DBFGetFieldIndex(dbhHandle, c_strFieldName_Mark_color.c_str());
    int nFieldIndex_Mark_width = DBFGetFieldIndex(dbhHandle, c_strFieldName_Mark_width.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a dbf data object
        HdLaneMark lmLaneMark = {};
        lmLaneMark.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_MarkID));
        JfDataId lEdgeId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EdgeID));
        lmLaneMark.nNum = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Mark_no);
        lmLaneMark.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Mark_type);
        lmLaneMark.nColor = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Mark_color);
        lmLaneMark.nWidth = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Mark_width);

        mapOutEdgeIdVctLaneMark[lEdgeId].push_back(lmLaneMark);
    }

    DBFClose(dbhHandle);
}

void MapParser::ParseHDEdgeLink(const std::string &strPath, const std::map<JfDataId, HdEdgeNode> &mapIdEdgeNode, const std::map<JfDataId, std::vector<HdLaneMark>> &mapEdgeIdVctLaneMark, const std::map<JfDataId, HdEdge> &mapIdEdge,
                                std::map<JfDataId, HdLink> &mapOutIdHdLink) {
    std::string strFile_dbf = strPath + c_cHD_EdgeLink_dbf;
    std::string strFile_shp = strPath + c_cHD_EdgeLink_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseEdgeLink(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error(
        //     "MapParser::ParseEdgeLink(), invalid map file content, could not "
        //     "Parse.");
        return;
    }

    const std::string c_strFieldName_EdgeID = "EdgeID";
    const std::string c_strFieldName_SE_NodeID = "SE_NodeID";
    const std::string c_strFieldName_EE_NodeID = "EE_NodeID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_Edge_no = "Edge_no";
    const std::string c_strFieldName_Edge_type = "Edge_type";
    const std::string c_strFieldName_Edge_cross = "Edge_cross";
    const std::string c_strFieldName_Mark_count = "Mark_count";

    int nFieldIndex_EdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_EdgeID.c_str());
    int nFieldIndex_SE_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_SE_NodeID.c_str());
    int nFieldIndex_EE_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_EE_NodeID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_Edge_no = DBFGetFieldIndex(dbhHandle, c_strFieldName_Edge_no.c_str());
    int nFieldIndex_Edge_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Edge_type.c_str());
    int nFieldIndex_Edge_cross = DBFGetFieldIndex(dbhHandle, c_strFieldName_Edge_cross.c_str());
    int nFieldIndex_Mark_count = DBFGetFieldIndex(dbhHandle, c_strFieldName_Mark_count.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        HdEdge heEdge = {};
        heEdge.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EdgeID));
        Point ptStart = {};
        JfDataId lSE_NodeID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_SE_NodeID));
        if (mapIdEdgeNode.find(lSE_NodeID) != mapIdEdgeNode.end()) {
            heEdge.enStartNode = mapIdEdgeNode.at(lSE_NodeID);
            ptStart = heEdge.enStartNode.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseEdgeLink(), could not find HD_EdgeNode id = {0}, HD_EdgeLink lValue = {1}", lSE_NodeID, elEdgeLink.lEdgeID);
        }
        JfDataId lEE_NodeID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EE_NodeID));
        Point ptEnd = {};
        if (mapIdEdgeNode.find(lEE_NodeID) != mapIdEdgeNode.end()) {
            heEdge.enEndNode = mapIdEdgeNode.at(lEE_NodeID);
            ptEnd = heEdge.enEndNode.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseEdgeLink(), could not find HD_EdgeNode id = {0}, EdgeId = {1}", lSE_NodeID, elEdgeLink.lEdgeID);
        }
        JfDataId lRoadId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        heEdge.nNum = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Edge_no);
        heEdge.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Edge_type);
        heEdge.nCross = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Edge_cross);
        heEdge.nMarkCount = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Mark_count);

        // nParts must be 1
        for (int j = 0; j < pshpRecord->nParts; ++j) {
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                heEdge.vctvdGeoLink.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        // insert the start and end node if not exist in the egolink
        // if (ptStart != Point() && ptStart.dLon != Point(heEdge.vctvdGeoLink.at(0)).dLon && ptStart.dLat != Point(heEdge.vctvdGeoLink.at(0)).dLat) {
        //     heEdge.vctvdGeoLink.insert(heEdge.vctvdGeoLink.begin(), heEdge.enStartNode.vctdGeoNode);
        // }
        // if (ptEnd != Point() && ptEnd.dLon != Point(heEdge.vctvdGeoLink.at(heEdge.vctvdGeoLink.size() - 1)).dLon && ptEnd.dLat != Point(heEdge.vctvdGeoLink.at(heEdge.vctvdGeoLink.size() - 1)).dLat) {
        //     heEdge.vctvdGeoLink.insert(heEdge.vctvdGeoLink.end(), heEdge.enEndNode.vctdGeoNode);
        // }

        if (mapEdgeIdVctLaneMark.find(heEdge.lId) != mapEdgeIdVctLaneMark.end()) {
            heEdge.vcthmMark = mapEdgeIdVctLaneMark.at(heEdge.lId);
        }

        mapOutIdHdLink[lRoadId].vctheEdge.push_back(heEdge);

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseHDLaneNode(const std::string &strPath, std::map<JfDataId, HdLaneNode> &mapOutIdHdLaneNode) {
    std::string strFile_dbf = strPath + c_cHD_LaneNode_dbf;
    std::string strFile_shp = strPath + c_cHD_LaneNode_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseHDLaneNode(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseLaneNode(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_LaneNodeID = "LaneNodeID";
    const std::string c_strFieldName_LaneIDS = "LaneIDS";

    int nFieldIndex_LaneNodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneNodeID.c_str());
    int nFieldIndex_LaneIDS = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneIDS.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpRecord = SHPReadObject(shhHandle, i);

        // read a dbf data object
        HdLaneNode lnLaneNode = {};
        lnLaneNode.lId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneNodeID));
        std::string strLaneIDS = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneIDS);

        // nParts is 0 so ignore it
        // for (int j = 0; j < pshpLaneNodeObj->nParts; ++j)
        {
            // nVertices must be 1
            for (int k = 0; k < pshpRecord->nVertices; ++k) {
                double dLon = pshpRecord->padfX[k];
                double dLat = pshpRecord->padfY[k];
                double dAlt = pshpRecord->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                lnLaneNode.vctdGeoNode = std::vector<double>{dLon, dLat, dAlt};
            }
        }

        mapOutIdHdLaneNode[lnLaneNode.lId] = lnLaneNode;

        SHPDestroyObject(pshpRecord);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::ParseLaneADAS(const std::string &strPath, std::map<JfDataId, std::vector<HdLaneAdas>> &mapOutLaneIdVctHdLaneAdas) {
    std::string strFile_csv = strPath + c_cLaneADAS_csv;

    std::ifstream ifsLaneADAS(strFile_csv, std::ios::in);
    if (!ifsLaneADAS) {
        // jf_log_error("sdGlParser::ParseLaneADAS(), invalid map file path, could not open.");
        return;
    }

    int i = 0;
    std::string strLine = {};
    std::string strField = {};

    getline(ifsLaneADAS, strLine);  // 将整行数据读取到sin流中,第一行是是说明文,不用

    while (getline(ifsLaneADAS, strLine))  // 按行读取csv文件中的数据
    {
        strLine = strLine.substr(0, strLine.length() - 1);  // 去掉最后的换行符

        HdLaneAdas laLaneAdas = {};

        std::istringstream ssStreamIn(strLine);  // 将整行数据读取到sin流中

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,id
        JfDataId lLaneID = Utils::StringToNum<JfDataId>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,meshId
        double _ = Utils::StringToNum<double>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,Seq_num
        laLaneAdas.nSeqNum = Utils::StringToNum<int>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,Latitude
        laLaneAdas.dLat = Utils::StringToNum<double>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,Longitude
        laLaneAdas.dLon = Utils::StringToNum<double>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,outCurvature
        laLaneAdas.dOutCurvature = Utils::StringToNum<double>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,outRoll
        laLaneAdas.dOutRoll = Utils::StringToNum<double>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,outPitch
        laLaneAdas.dOutPitch = Utils::StringToNum<double>(strField);

        getline(ssStreamIn, strField, ',');  // 将字符串流sin中的的字符读取到field中,以逗号分割,outAzminuth
        laLaneAdas.dOutAzimuth = Utils::StringToNum<double>(strField);

        mapOutLaneIdVctHdLaneAdas[lLaneID].push_back(laLaneAdas);
    }

    ifsLaneADAS.close();
}

void MapParser::ParseHDLaneLink(const std::string &strPath, const std::map<JfDataId, HdLaneNode> &mapIdHdLaneNode, const std::map<JfDataId, std::vector<HdLaneAdas>> &mapIdVctHdLaneAdas, const std::map<JfDataId, std::vector<ObjArrow>> &mapIdVctObjArrow,
                                const std::map<JfDataId, std::vector<ObjTrafficLight>> &mapLaneIdVctTrafficLight, const std::map<JfDataId, std::vector<ObjText>> &mapLaneIdVctText, const std::map<JfDataId, std::vector<ObjSymbol>> &mapLaneIdVctSymbol,
                                std::map<JfDataId, HdLink> &mapOutIdHdLink) {
    std::string strFile_dbf = strPath + c_cHD_LaneLink_dbf;
    std::string strFile_shp = strPath + c_cHD_LaneLink_shp;

    DBFHandle dbhHandle = DBFOpen(strFile_dbf.c_str(), "rb");
    SHPHandle shhHandle = SHPOpen(strFile_shp.c_str(), "rb");
    if ((nullptr == shhHandle) || (nullptr == dbhHandle)) {
        // jf_log_error("MapParser::ParseLaneLink(), invalid map file path, could not open.");
        return;
    }

    int nEntities = 0;
    int nShapeType = 0;
    double dMinBound[4] = {};
    double dMaxBound[4] = {};
    SHPGetInfo(shhHandle, &nEntities, &nShapeType, dMinBound, dMaxBound);
    int nRcdCnt = DBFGetRecordCount(dbhHandle);
    if (nEntities != nRcdCnt) {
        // jf_log_error("MapParser::ParseLaneLink(), invalid map file content, could not Parse.");
        return;
    }

    const std::string c_strFieldName_LaneID = "LaneID";
    const std::string c_strFieldName_SL_NodeID = "SL_NodeID";
    const std::string c_strFieldName_EL_NodeID = "EL_NodeID";
    const std::string c_strFieldName_L_EdgeID = "L_EdgeID";
    const std::string c_strFieldName_R_EdgeID = "R_EdgeID";
    const std::string c_strFieldName_RoadID = "RoadID";
    const std::string c_strFieldName_Lane_no = "Lane_no";
    const std::string c_strFieldName_Direction = "Direction";
    const std::string c_strFieldName_Lane_type = "Lane_type";
    const std::string c_strFieldName_Arrow = "Arrow";
    const std::string c_strFieldName_Lane_width = "Lane_width";
    const std::string c_strFieldName_Speed = "Speed";
    const std::string c_strFieldName_Speed_min = "Speed_min";

    int nFieldIndex_LaneID = DBFGetFieldIndex(dbhHandle, c_strFieldName_LaneID.c_str());
    int nFieldIndex_SL_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_SL_NodeID.c_str());
    int nFieldIndex_EL_NodeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_EL_NodeID.c_str());
    int nFieldIndex_L_EdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_L_EdgeID.c_str());
    int nFieldIndex_R_EdgeID = DBFGetFieldIndex(dbhHandle, c_strFieldName_R_EdgeID.c_str());
    int nFieldIndex_RoadID = DBFGetFieldIndex(dbhHandle, c_strFieldName_RoadID.c_str());
    int nFieldIndex_Lane_no = DBFGetFieldIndex(dbhHandle, c_strFieldName_Lane_no.c_str());
    int nFieldIndex_Direction = DBFGetFieldIndex(dbhHandle, c_strFieldName_Direction.c_str());
    int nFieldIndex_Lane_type = DBFGetFieldIndex(dbhHandle, c_strFieldName_Lane_type.c_str());
    int nFieldIndex_Arrow = DBFGetFieldIndex(dbhHandle, c_strFieldName_Arrow.c_str());
    int nFieldIndex_Lane_width = DBFGetFieldIndex(dbhHandle, c_strFieldName_Lane_width.c_str());
    int nFieldIndex_Speed = DBFGetFieldIndex(dbhHandle, c_strFieldName_Speed.c_str());
    int nFieldIndex_Speed_min = DBFGetFieldIndex(dbhHandle, c_strFieldName_Speed_min.c_str());

    for (int i = 0; i < nRcdCnt; ++i) {
        // read a shp data object
        SHPObject *pshpHDLaneLinkObj = SHPReadObject(shhHandle, i);

        // read a dbf data object
        HdLane hlLane = {};
        hlLane.liId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_LaneID));
        JfDataId lSL_NodeID = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_SL_NodeID));
        Point ptStart = {};
        if (mapIdHdLaneNode.find(lSL_NodeID) != mapIdHdLaneNode.end()) {
            hlLane.lnStartNode = mapIdHdLaneNode.at(lSL_NodeID);
            ptStart = hlLane.lnStartNode.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseRoad(), could not find HD_LaneNode id = {0}, HD_LaneLink lValue = {1}", lSL_NodeID, llLaneLink.lLaneID);
        }
        JfDataId lEL_NodeId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_EL_NodeID));
        Point ptEnd = {};
        if (mapIdHdLaneNode.find(lEL_NodeId) != mapIdHdLaneNode.end()) {
            hlLane.lnEndNode = mapIdHdLaneNode.at(lEL_NodeId);
            ptEnd = hlLane.lnEndNode.vctdGeoNode;
        } else {
            // jf_log_error("MapParser::ParseRoad(), could not find HD_LaneNode id = {0}, HD_LaneLink lValue = {1}", lEL_NodeId, llLaneLink.lLaneID);
        }
        hlLane.nSeqNum = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Lane_no);
        hlLane.lLeftEdgeId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_L_EdgeID));
        hlLane.lRightEdgeId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_R_EdgeID));

        JfDataId lRoadId = Utils::StringToNum<JfDataId>(DBFReadStringAttribute(dbhHandle, i, nFieldIndex_RoadID));
        hlLane.nDirection = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Direction);
        hlLane.nType = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Lane_type);
        hlLane.strArrows = DBFReadStringAttribute(dbhHandle, i, nFieldIndex_Arrow);
        hlLane.nWidth = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Lane_width);
        hlLane.nMaxSpeed = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Speed);
        hlLane.nMinSpeed = DBFReadIntegerAttribute(dbhHandle, i, nFieldIndex_Speed_min);

        // nParts must be 1
        for (int j = 0; j < pshpHDLaneLinkObj->nParts; ++j) {
            for (int k = 0; k < pshpHDLaneLinkObj->nVertices; ++k) {
                double dLon = pshpHDLaneLinkObj->padfX[k];
                double dLat = pshpHDLaneLinkObj->padfY[k];
                double dAlt = pshpHDLaneLinkObj->padfZ[k];
                if (std::isnan(dLon)) {
                    dLon = 0;
                }
                if (std::isnan(dLat)) {
                    dLat = 0;
                }
                if (std::isnan(dAlt)) {
                    dAlt = 0;
                }
                hlLane.vctvdGeoLink.push_back(std::vector<double>{dLon, dLat, dAlt});
            }
        }

        // insert the start and end node if not exist in the egolink
        // if (ptStart != Point() && ptStart.dLon != Point(hlLane.vctvdGeoLink.at(0)).dLon && ptStart.dLat != Point(hlLane.vctvdGeoLink.at(0)).dLat) {
        //     hlLane.vctvdGeoLink.insert(hlLane.vctvdGeoLink.begin(), hlLane.lnStartNode.vctdGeoNode);
        // }
        // if (ptEnd != Point() && ptEnd.dLon != Point(hlLane.vctvdGeoLink.at(hlLane.vctvdGeoLink.size() - 1)).dLon && ptEnd.dLat != Point(hlLane.vctvdGeoLink.at(hlLane.vctvdGeoLink.size() - 1)).dLat) {
        //     hlLane.vctvdGeoLink.insert(hlLane.vctvdGeoLink.end(), hlLane.lnEndNode.vctdGeoNode);
        // }

        if (mapIdVctObjArrow.find(hlLane.liId) != mapIdVctObjArrow.end()) {
            hlLane.vctarArrow = mapIdVctObjArrow.at(hlLane.liId);
        }
        if (mapLaneIdVctText.find(hlLane.liId) != mapLaneIdVctText.end()) {
            hlLane.vcttxText = mapLaneIdVctText.at(hlLane.liId);
        }
        if (mapLaneIdVctSymbol.find(hlLane.liId) != mapLaneIdVctSymbol.end()) {
            hlLane.vctsbSymbol = mapLaneIdVctSymbol.at(hlLane.liId);
        }

        if (mapLaneIdVctTrafficLight.find(hlLane.liId) != mapLaneIdVctTrafficLight.end()) {
            hlLane.vcttlTrafficLight = mapLaneIdVctTrafficLight.at(hlLane.liId);
        }

        if (mapIdVctHdLaneAdas.find(hlLane.liId) != mapIdVctHdLaneAdas.end()) {
            hlLane.vctlaLaneAdas = mapIdVctHdLaneAdas.at(hlLane.liId);
        }

        mapOutIdHdLink[lRoadId].vcthlLane.push_back(hlLane);

        for (int m = 0; m < mapOutIdHdLink[lRoadId].vctheEdge.size(); m++) {
            const HdEdge &heEdge = mapOutIdHdLink[lRoadId].vctheEdge[m];
            if (mapOutIdHdLink[lRoadId].vctheEdge[m].lId == hlLane.lRightEdgeId || mapOutIdHdLink[lRoadId].vctheEdge[m].lId == hlLane.lLeftEdgeId) {
                double angleTmp1 = jf::PointsAngle(hlLane.vctvdGeoLink[0], hlLane.vctvdGeoLink[1]);
                double angleTmp2 = jf::PointsAngle(mapOutIdHdLink[lRoadId].vctheEdge[m].vctvdGeoLink[0], mapOutIdHdLink[lRoadId].vctheEdge[m].vctvdGeoLink[1]);

                double dAngleSub = jf::AngleSub(angleTmp1, angleTmp2);
                if (dAngleSub > 90.0) {
                    reverse(mapOutIdHdLink[lRoadId].vctheEdge[m].vctvdGeoLink.begin(), mapOutIdHdLink[lRoadId].vctheEdge[m].vctvdGeoLink.end());
                    HdEdgeNode enSwap = mapOutIdHdLink[lRoadId].vctheEdge[m].enStartNode;
                    mapOutIdHdLink[lRoadId].vctheEdge[m].enStartNode = mapOutIdHdLink[lRoadId].vctheEdge[m].enEndNode;
                    mapOutIdHdLink[lRoadId].vctheEdge[m].enEndNode = enSwap;
                }
            }
        }

        SHPDestroyObject(pshpHDLaneLinkObj);
    }

    DBFClose(dbhHandle);
    SHPClose(shhHandle);
}

void MapParser::MakeSdData(const std::map<JfDataId, HdLink> &mapIdHdLink, MapIdNode &mapOutIdNode, MapIdWay &mapOutIdWay) {
    for (auto iter = mapIdHdLink.begin(); iter != mapIdHdLink.end(); ++iter) {
        BaseWay bwWay = {};
        bwWay.id = iter->first;
        bwWay.level = iter->second.nRank;
        bwWay.direction = iter->second.nDirection;

        int i = 0;
        for (std::vector<double> vctPoint : iter->second.vctvdGeoLink) {
            SdNode snNode = {};
            snNode.id_p = SdNodeId{Point(vctPoint)};
            // stNode.p = vctPoint;
            snNode.speed_limit_big = iter->second.nSpeedLimit;
            snNode.speed_limit_small = iter->second.nSpeedLimit;
            snNode.level = bwWay.level;
            // stNode.direction = stWay.direction;

            bwWay.nodes.push_back(snNode.id_p);

            mapOutIdNode[snNode.id_p] = snNode;
        }

        mapOutIdWay[bwWay.id] = bwWay;
    }
}

void MapParser::MakeHdLink(const std::map<JfDataId, HdLink> &mapIdHdLink, HdJson &jsnOutResult) {
    std::map<HdLinkId, HdLink> mapIdLink = {};
    // 预处理: for PLanes and NLanes
    // 确定所有LaneNode点的前后连接的所有的lane
    typedef LaneConnection LaneNodeConnection;
    std::map<JfDataId, LaneNodeConnection> mapLaneNodeIdConnection = {};
    for (auto iter = mapIdHdLink.begin(); iter != mapIdHdLink.end(); ++iter) {
        for (HdLane hlLane : iter->second.vcthlLane) {
            if (hlLane.nDirection == 2) {  // Lane方向与矢量方向相同 (矢量方向:GeoLink一系列坐标点方向、Lane的开始节点和结束节点方向)
                mapLaneNodeIdConnection[hlLane.lnStartNode.lId].vctNextLaneIds.push_back(hlLane.liId.lValue);
                mapLaneNodeIdConnection[hlLane.lnEndNode.lId].vctPreLaneIds.push_back(hlLane.liId.lValue);
            } else if (hlLane.nDirection == 3) {  // Lane方向与矢量方向相反
                mapLaneNodeIdConnection[hlLane.lnStartNode.lId].vctPreLaneIds.push_back(hlLane.liId.lValue);
                mapLaneNodeIdConnection[hlLane.lnEndNode.lId].vctNextLaneIds.push_back(hlLane.liId.lValue);
            } else if (hlLane.nDirection == 1) {  //双向车道
                mapLaneNodeIdConnection[hlLane.lnStartNode.lId].vctPreLaneIds.push_back(hlLane.liId.lValue);
                mapLaneNodeIdConnection[hlLane.lnEndNode.lId].vctNextLaneIds.push_back(hlLane.liId.lValue);
                mapLaneNodeIdConnection[hlLane.lnStartNode.lId].vctNextLaneIds.push_back(hlLane.liId.lValue);
                mapLaneNodeIdConnection[hlLane.lnEndNode.lId].vctPreLaneIds.push_back(hlLane.liId.lValue);
            } else {
                std::cout << "====ERROR=====车道" << hlLane.liId << "的驾驶方向未确定" << std::endl;
                while (1)
                    ;
            }
        }
    }
    // 确定所有Lane之间的前后关系
    std::map<HdLaneId, LaneConnection> mapLaneIdConnection = {};
    for (auto iter = mapLaneNodeIdConnection.begin(); iter != mapLaneNodeIdConnection.end(); ++iter) {
        // 针对LaneNode后面的所有Lane,将LaneNode前面的所有Lane加入到他们的PreLane中去
        for (HdLaneId lNextLaneId : iter->second.vctNextLaneIds) {
            for (HdLaneId lPreLaneId : iter->second.vctPreLaneIds) {
                mapLaneIdConnection[lNextLaneId].vctPreLaneIds.push_back(lPreLaneId);
            }
        }
        // 针对LaneNode前面的所有Lane,将LaneNode后面的所有Lane加入到他们的NextLane中去
        for (HdLaneId lPreLaneId : iter->second.vctPreLaneIds) {
            for (HdLaneId lNextLaneId : iter->second.vctNextLaneIds) {
                mapLaneIdConnection[lPreLaneId].vctNextLaneIds.push_back(lNextLaneId);
            }
        }
    }

    // 先生成除了PreLinks和NxtLinks之外的数据
    for (auto iter = mapIdHdLink.begin(); iter != mapIdHdLink.end(); ++iter) {
        HdLink hlLink = iter->second;

        if (iter->second.vcthlLane.size() <= 0) {
            // jf_log_info("[MapParser::MakehdLink]: map error no lanes link : {}", iter->first);
            continue;
        }
        if (iter->second.vctvdGeoLink.size() <= 0) {
            // jf_log_info("[MapParser::MakehdLink]: map error no geo link : {}", iter->first);
            continue;
        }
        std::vector<TileId> vctlTIds = {};
        GetTids(iter->second.vctvdGeoLink, vctlTIds);
        hlLink.liId = HdLinkId{iter->first, vctlTIds};

        SortHdEdges(hlLink, hlLink.vctheEdge);
        ConvertHdLanes(iter->second, mapLaneIdConnection, hlLink.vcthlLane);

        mapIdLink[hlLink.liId] = hlLink;
    }

    // 再生成PLinks和NLinks的数据
    ConvertPNLinkIds(mapIdHdLink, mapIdLink);

    jsnOutResult.links = mapIdLink;
}

void MapParser::SortHdEdges(const HdLink &hlLink, std::vector<HdEdge> &vcthlOutEdges) {
    // 将数据按照edge_num的顺序添加到vcthlSeqEdges中
    std::vector<HdEdge> vcthlSeqEdges = {};
    for (size_t i = 1; i <= hlLink.vctheEdge.size(); i++) {
        for (auto heEdge : hlLink.vctheEdge) {
            if (heEdge.nNum == -i) {
                vcthlSeqEdges.push_back(heEdge);
            }
        }
    }
    for (size_t i = 1; i <= hlLink.vctheEdge.size(); i++) {
        for (auto heEdge : hlLink.vctheEdge) {
            if (heEdge.nNum == i) {
                vcthlSeqEdges.push_back(heEdge);
            }
        }
    }

    assert(hlLink.vctheEdge.size() == vcthlSeqEdges.size());
    vcthlOutEdges = vcthlSeqEdges;

    return;
}

/***
 * 生成Link属性值中的lane数组vcthlLane
 * @param hlLink
 * @param mapLaneIdConnection
 * @param vcthlOutLanes
 */
void MapParser::ConvertHdLanes(const HdLink &hlLink, const std::map<HdLaneId, LaneConnection> &mapLaneIdConnection, std::vector<HdLane> &vcthlOutLanes) {
    std::vector<HdLane> vcthlTempLanes = {};
    for (HdLane hlLane : hlLink.vcthlLane) {
        HdLane hlTempLane = hlLane;
        static const int sc_nLaneDirection_TwoWay = 1;
        static const int sc_nLaneDirection_Forward = 2;
        static const int sc_nLaneDirection_Reverse = 3;
        if (mapLaneIdConnection.find(hlLane.liId.lValue) != mapLaneIdConnection.end()) {
            hlTempLane.vctliPreLaneId = mapLaneIdConnection.at(hlLane.liId.lValue).vctPreLaneIds;
            hlTempLane.vctliNxtLaneId = mapLaneIdConnection.at(hlLane.liId.lValue).vctNextLaneIds;
        }
        vcthlTempLanes.push_back(hlTempLane);
    }
    /**按照Lane的nSeqNum值大小,从小到大进行排序*/
    sort(vcthlTempLanes.begin(), vcthlTempLanes.end(), [](HdLane hlLane1, HdLane hlLane2) {
        int nSeqNum1 = hlLane1.nSeqNum;
        int nSeqNum2 = hlLane2.nSeqNum;
        return nSeqNum1 < nSeqNum2;
    });
    vcthlOutLanes = vcthlTempLanes;
    return;
}

/**
 * 生成RoadLink的 联通关系数据
 * @param mapIdRoad  map<JfDataId, HdLink> RoadLink的ID和RoadLink对象键值对
 * @param mapIdLink
 */
void MapParser::ConvertPNLinkIds(const std::map<JfDataId, HdLink> &mapIdRoad, std::map<HdLinkId, HdLink> &mapIdLink) {
    struct Link {
        std::vector<JfDataId> vctStartRoadIds;
        std::vector<JfDataId> vctEndRoadIds;
    };

    std::map<JfDataId, HdLinkId> mapIdLinkId = {};
    // 先遍历整个mapIdLink,生成一个以hdLinkId的id为key,以相关连的hdLinkId为值的map
    for (auto iter = mapIdLink.begin(); iter != mapIdLink.end(); ++iter) {
        mapIdLinkId[iter->first.lValue] = iter->first;
    }

    // 定义一个如下结构
    // RoadId A ->JunctionId->RoadId B
    // --------->行进方向--------->
    // 由此知道,Road A的下一个节点是Road B
    std::map<JfDataId, Link> mapJIdLinks = {};

    static const int sc_nRoadDirection_TwoWay = 1;
    static const int sc_nRoadDirection_Forward = 2;
    static const int sc_nRoadDirection_Reverse = 3;

    // 再遍历整个mapIdRoad,生成一个以JunctionId为key,以相关连的RoadId为值的map
    for (auto iter = mapIdRoad.begin(); iter != mapIdRoad.end(); ++iter) {
        if (iter->second.vcthlLane.size() <= 0) {
            // jf_log_info("[MapParser::ConvertToNLinks] map error no lanes link : {}", iter->first);
            continue;
        }

        switch (iter->second.nDirection) {
            case sc_nRoadDirection_TwoWay:
                /* 双向通行 */
                mapJIdLinks[iter->second.jcStartJunc.lId].vctStartRoadIds.push_back(iter->first);
                mapJIdLinks[iter->second.jcEndJunc.lId].vctEndRoadIds.push_back(iter->first);
                mapJIdLinks[iter->second.jcStartJunc.lId].vctEndRoadIds.push_back(iter->first);
                mapJIdLinks[iter->second.jcEndJunc.lId].vctStartRoadIds.push_back(iter->first);
                break;

            case sc_nRoadDirection_Forward:
                /* 与矢量方向相同 */
                mapJIdLinks[iter->second.jcStartJunc.lId].vctStartRoadIds.push_back(iter->first);
                mapJIdLinks[iter->second.jcEndJunc.lId].vctEndRoadIds.push_back(iter->first);
                break;
            case sc_nRoadDirection_Reverse:
                /* 与矢量方向相反 */
                mapJIdLinks[iter->second.jcStartJunc.lId].vctEndRoadIds.push_back(iter->first);
                mapJIdLinks[iter->second.jcEndJunc.lId].vctStartRoadIds.push_back(iter->first);
                break;
            default:
                /* 双向禁行, 或者未调查 */
                break;
        }
    }

    for (auto iter = mapJIdLinks.begin(); iter != mapJIdLinks.end(); ++iter) {
        for (auto nextId : iter->second.vctStartRoadIds) {
            for (auto endId : iter->second.vctEndRoadIds) {
                // 自己的下一条不能是自己
                if (mapIdLink[mapIdLinkId[nextId]].liId.lValue != mapIdLinkId[endId].lValue) {
                    mapIdLink[mapIdLinkId[nextId]].vctliPreLinkId.push_back(mapIdLinkId[endId]);
                }
            }
        }
    }

    for (auto iter = mapJIdLinks.begin(); iter != mapJIdLinks.end(); ++iter) {
        for (auto preId : iter->second.vctEndRoadIds) {
            for (auto startId : iter->second.vctStartRoadIds) {
                // 自己的上一条不能是自己
                if (mapIdLink[mapIdLinkId[preId]].liId.lValue != mapIdLinkId[startId].lValue) {
                    mapIdLink[mapIdLinkId[preId]].vctliNxtLinkId.push_back(mapIdLinkId[startId]);
                }
            }
        }
    }
}

void MapParser::GetTids(const std::vector<std::vector<double>> &vctvdGeoLink, std::vector<TileId> &vctOutTids) {
    std::set<TileId> setTids = {};
    for (const std::vector<double> &vctdGeoLink : vctvdGeoLink) {
        TileId tid = P2TId(Point(vctdGeoLink));
        setTids.insert(tid);
    }

    vctOutTids = Utils::Set2Vector(setTids);

    return;
}

// void MapParser::insertFeatures(const std::string &strPath, HdJson &data) {
//     std::string strFeature = strPath + c_cFeature_json;
//     std::map<hdMarkerId, std::vector<double>> marks;
//     FileSys fs;
//     std::string is;
//     if (true == fs.read(strFeature, is)) {
//         ajson::load_from_buff(marks, is.c_str());
//         for (auto &lk : data.links) {
//             for (hdettmk &vcthmMarks : lk.second.entity_marks) {
//                 vcthmMarks.feature = marks[vcthmMarks.lValue];
//             }
//         }
//     }
// }

int MapParser::Factorial(int n) {
    // 计算阶乘
    int nResult = 1;
    for (size_t i = 2; i <= n; i++) {
        nResult *= i;
    }

    return nResult;
}

}  // namespace jf