d3.relationshipgraph.js 180 KB
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 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966
/** 
 * @discription TODO(图层类)
 * 
 * @author bsth@lq
 * 
 * @date 二〇一六年十二月八日 10:39:52
 * 
 **/

/**
 * 
 * 图层作用域下的全局变量定义
 * 
 ************************************************************************************************************************************************/
var historyArray = [],// 保存操作图形后的数据集合(撤销与恢复操作)
	$_keyIndex = 0,// 记录当前操作步骤 (在撤销与恢复操作时)
	$_GlobalGraph = new Object(),// 图层对象(在创建图层对象时)
	flagIndex = 0,// 鼠标绘制的当前选择框标识(这里限制只做一次性选择元素拖拽,在绘制选择框时)
	_singElmtDrStartX = 0, // 记录单个rect元素(班次)做左右拖拽(拖拽开始...)鼠标开始位置.
	_singElemtDrStatus = false,// 标记单个rect元素沿X方向进行拖拽状态.默认关闭状态.
	drwaStartY = 0,// 鼠标从选择框按下开始标记Y值(在选择框做上下【↕】拖拽时)
	drwaStartYStatus = false,// 标记选择框沿Y方向进行拖拽状态.默认关闭状态.
	drwaStartX = 0,// 鼠标从选择框左右拖拽中心点按下开始标记X值 (在选择框上边线中心点做左右【↔】拖拽时)
	drwaStartXStatus = false,// 标记鼠标从选择框中心点按下沿X方向进行拖拽状态.默认关闭状态.
	drwaRightX = 0,// 鼠标从选择框右拖拽中心点按下开始标记X值 (在选择框右边线中心点做右【→】拖拽时)
	drwaRightXStatus = false,// 标记鼠标从选择框右边点按下沿X方向进行拖拽状态.默认关闭状态.
	drwaLeftX = 0,// 鼠标从选择框左拖拽中心点按下开始标记X值 (在选择框左边线中心点做左【←】拖拽时)
	drwaLeftXStatus = false,// 标记鼠标从选择框左边点按下沿X方向进行拖拽状态.默认关闭状态.
 	gClassNameArray = new Array(),// 标记被选择的元素(在绘制选择框完成时)
 	yAxisYArray = new Array(),// Y轴坐标数组
 	tipEventTimer = null,// 提示工具栏定时器.
	workeType = [{'type':'六工一休','minueV':6.40,'hourV':6.66},
	             {'type':'五工一休','minueV':6.51,'hourV':6.85},
	             {'type':'四工一休','minueV':7.08,'hourV':7.14},
	             {'type':'三工一休','minueV':7.37,'hourV':7.61},
	             {'type':'二工一休','minueV':8.34,'hourV':8.34},
	             {'type':'一工一休','minueV':11.25,'hourV':11.42},
	             {'type':'五工二休','minueV':8.00,'hourV':7.99},
	             {'type':'无工休',  'minueV':5.43,'hourV':5.67}];// 班工时规定
/************************************************************************************************************************************************/

/** 
 * @description : (TODO) : 撤销事件(后退)
 *
 * @see   ✿ 判断是否在图层编辑(元素拖拽)中。
 * 
 * 		     如果在,关闭图层编辑状态,记录当前操作步骤,根据步骤数在保存操作图形后的数据集合中获取数据重新渲染图层。
 * 
 * @status OK.
 ************************************************************************************************************************************************/
 $('.revoke').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0){
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【撤销】!', {
		btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行撤销函数.
			RelationshipGraph.cancel();
		});
	}else {
		// 执行撤销函数.
		RelationshipGraph.cancel();
	}
});
/************************************************************************************************************************************************/


/**
 * @description : (TODO) 监听恢复事件(前进)
 * 
 * @see   ✿ 判断是否在图层编辑(元素拖拽)中。
 * 
 * 			 如果在,关闭图层编辑状态,记录当前操作步骤,根据步骤数在保存操作图形后的数据集合中获取数据重新渲染图层。
 * 
 * @status OK.
 ************************************************************************************************************************************************/
$('.recover').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【恢复】!', {
		btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行恢复函数.
			RelationshipGraph.regain();
		});
	}else {
		// 执行恢复函数.
		RelationshipGraph.regain();
	}
});
/************************************************************************************************************************************************/

/**
 * @desciption (TODO) 监听删除事件.
 * 
 * @status OK.
 ************************************************************************************************************************************************/
$('.reladelete').on('click',function() {
	// 判断是否存在选择框选中班次状态.
	if(RelationshipGraph.getFlagIndex()<1) {
		layer.msg('批量删除需要【框选择中班次】才可以操作哦...!');
		return;
	}
	// 关闭所有提示弹出层.
	layer.closeAll();
	// 定义路牌.发车序号数组.
	var lp = new Array(),fcno = new Array();
	for(var c =0;c<gClassNameArray.length;c++) {
		if(typeof(gClassNameArray[c])=='string') {
			var data = d3.select('rect[parent-node='+ gClassNameArray[c] +']').data()[0];
			if(lp.indexOf(data.lpName)<0)
				lp.push(data.lpName);
			fcno.push(data.fcno);
		}
	}
	layer.confirm('您确定要进行批量删除路牌【'+ lp.toString() +'】-->发车序号【'+ fcno.toString() +'】嘛!'+
			  '</br>&nbsp;&nbsp;&nbsp;* 注意:如需要撤销当前操作,您可以在系统工具下拉选择点击【撤销按钮】进行恢复.', {
	btn : [ '确认提示并提交', '取消' ]
	}, function() { 
		// 关闭所有提示弹出层.
		layer.closeAll();
		// 删除class为case_g的g元素。
		$("g.case_g").remove();
		// 获取选择框所有的元素.
		var nodes = d3.selectAll('.caseactive')[0];
		// 删除选择框.
		$_GlobalGraph.removeNodes(nodes);
		// 选择框标记清零.
		RelationshipGraph.setFlagIndex(0);
		// 清空标记被选择框选中的元素数组.
		gClassNameArray.splice(0,gClassNameArray.length);
		// 重新绘制发车时刻,并重新统计.
		RelationshipGraph.reDrawDepart();
		// 记录当前操作.
		$_GlobalGraph.addHistory();
	});
});
/************************************************************************************************************************************************/


/**
 * @description : (TODO) 监听添加班次事件.
 * 
 * @status OK.
 ************************************************************************************************************************************************/
$('.reladplus').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【添加班次】!', {
		btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 关闭所有提示弹出层.
			layer.closeAll();
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行添加班次函数.
			RelationshipGraph.reladplus();
		});
	}else {
		// 执行添加班次函数.
		RelationshipGraph.reladplus();
	}
});
/************************************************************************************************************************************************/

/**
 * @description : (TODO) 监听添加路牌事件.
 * 
 * @status OK.
 ************************************************************************************************************************************************/
 $('.addlp').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【添加路牌】!', {
			btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 关闭所有提示弹出层.
			layer.closeAll();
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行添加路牌函数.
			RelationshipGraph.addlp();
		});
	}else {
		// 执行添加路牌函数.
		RelationshipGraph.addlp();
	}
 });
/************************************************************************************************************************************************/

/** 
 * @description : (TODO) 监听均匀发车事件.
 * 
 * @stutas : OK.
 * 	
 ************************************************************************************************************************************************/
$('.updownread').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【均匀发车间隙】!', {
			btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 关闭所有提示弹出层.
			layer.closeAll();
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行均匀发车间隙函数.
			RelationshipGraph.updownread01();
		});
	}else {
		// 执行均匀发车间隙函数
		RelationshipGraph.updownread01();
	}
});
/************************************************************************************************************************************************/

/** 
 * @description : (TODO) 班次调整点击事件
 * 
 * @status OK.
 ************************************************************************************************************************************************/
$('.aboutread').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【调整班次】!', {
			btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 关闭所有提示弹出层.
			layer.closeAll();
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行调整班次函数.
			RelationshipGraph.aboutread();
		});
	}else {
		// 执行调整班次函数
		RelationshipGraph.aboutread();
	}
});
/************************************************************************************************************************************************/

/** 
 * @description : (TODO) 修改路牌点击事件
 * 
 * @status OK.
 ************************************************************************************************************************************************/
$('.editlp').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【修改路牌】!', {
			btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 关闭所有提示弹出层.
			layer.closeAll();
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行修改路牌函数.
			RelationshipGraph.editlpEvents();
		});
	}else {
		// 执行修改路牌函数
		RelationshipGraph.editlpEvents();
	}
});
/************************************************************************************************************************************************/



/** 
 * @description : (TODO) 监听保存数据事件.
 * 
 * @status OK. 
 ************************************************************************************************************************************************/
 $('.checkAdd').on('click',function() {
	// 判断选择框是否存在.
	if(RelationshipGraph.getFlagIndex()>0) {
		// 关闭所有提示弹出层.
		layer.closeAll();
		layer.confirm('您正处于【批量班次操作】过程中...是否确定退出当前操作进行【保存数据】!', {
			btn : [ '确认提示并提交', '取消' ]
		},function () {
			// 关闭所有提示弹出层.
			layer.closeAll();
			// 执行选择框关闭函数.
			RelationshipGraph.gClose();
			// 执行均匀发车间隙函数.
			RelationshipGraph.checkAdd();
		});
	}else {
		// 执行均匀发车间隙函数
		RelationshipGraph.checkAdd();
	}
 });
/************************************************************************************************************************************************/

/**
 * @description : (TODO) 重新生成事件.
 *
 * @status OK.
 ************************************************************************************************************************************************/
$('.parambtn').on('click', function() {
    // 弹出层mobal页面
    $.get('/pages/base/timesmodel/paramadd.html', function(m){
        $(pjaxContainer).append(m);
        // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。
        $('#paramadd_mobal').trigger('paramAddMobal.show', [Main_v2, Main_v2_2, InternalScheduleObj_v2_2]);
    });
});

/************************************************************************************************************************************************/


/**
 * @description : (TODO) 监听统计数据事件.
 * 
 * @status OK.
 ************************************************************************************************************************************************/
 $('.countAdd').on('click',function() {
	var list = $_GlobalGraph.getDataArray();
	var countBc = 0,// 总班次
		serviceBc = 0,// 营运班次
		jcbc = 0, // 进场总班次.
		ccbc = 0, // 出场总班次.
		cfbc = 0,// 吃饭总班次.
		zwlbbc = 0,// 早晚例保总班次.
		countGs = 0.0,// 总工时
		servicesj = 0,// 营运班次总时间
		jcsj = 0.0,// 进场总时间.
		ccsj = 0.0 // 出场总时间.
		cfsj = 0.0, // 吃饭总时间.
		zwlbsj = 0.0, // 早晚例保总时间.
		ksBc = 0,// 空驶班次
		serviceLc = 0.0 ,// 营运里程
		ksLc = 0.0 ,// 空驶里程
		avgTzjx = 0.0,// 平均停站间隙
		gfServiceBc = 0,// 高峰营运班次
		dgServiceBc = 0,// 低谷营运班次
		gfAvgTzjx = 0.0,// 高峰平均停站间隙
		dgAvgTzjx = 0.0;// 低谷平均停站间隙
	for(var i = 0;i<list.length;i++) {
		if(list[i].bcsj>0) {
			countBc = countBc + 1;
			countGs = countGs + list[i].STOPTIME + list[i].bcsj;
			var nowDate = BaseFun.getDateTime(list[i].fcsj);
			if((BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.zgfsjd[0].st,$_GlobalGraph.configuration.dataMap.zgfsjd[0].ed,nowDate) ||
					BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.wgfsjd[0].st,$_GlobalGraph.configuration.dataMap.wgfsjd[0].ed,nowDate)) &&
					(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal ||
							list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
							list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.major)) {
				gfServiceBc = gfServiceBc + 1;
				gfAvgTzjx = gfAvgTzjx + list[i].STOPTIME;
			} else if((!BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.zgfsjd[0].st,$_GlobalGraph.configuration.dataMap.zgfsjd[0].ed,nowDate) ||
						!BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.wgfsjd[0].st,$_GlobalGraph.configuration.dataMap.wgfsjd[0].ed,nowDate)) &&
					(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal ||
							list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
							list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.major)){
				dgServiceBc = dgServiceBc + 1;
				dgAvgTzjx = dgAvgTzjx + list[i].STOPTIME;
			}
			if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal ||
					list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
					list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.major) {
				serviceBc = serviceBc + 1;
				serviceLc = serviceLc + list[i].jhlc;
				servicesj = servicesj + list[i].bcsj;
				avgTzjx = avgTzjx + list[i].STOPTIME;
			}else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.venting) {
				ksBc = ksBc +1;
				ksLc = ksLc  + list[i].jhlc;
			}else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_) {
				jcbc = jcbc +1;
				jcsj = jcsj + list[i].bcsj;
			}else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out) {
				ccbc = ccbc +1;
				ccsj = ccsj + list[i].bcsj;
			}else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf) {
				cfbc = cfbc +1;
				cfsj = cfsj + list[i].bcsj;
			}else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd ||
					list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc ) {
				zwlbbc = zwlbbc +1;
				zwlbsj = zwlbsj + list[i].bcsj;
			}
		}
	}
	dgAvgTzjx = dgAvgTzjx/dgServiceBc;
	gfAvgTzjx = gfAvgTzjx/gfServiceBc;
	avgTzjx = avgTzjx/dgServiceBc;
	 var countDate = [{'name':'总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)','value':countBc},
	                  {'name':'进场总班次(包括进场且班次时间大于零的班次)','value':jcbc},
	                  {'name':'出场总班次(包括进场且班次时间大于零的班次)','value':ccbc},
	                  {'name':'吃饭总班次(包括吃饭且班次时间大于零的班次)','value':cfbc},
	                  {'name':'早晚例保总班次(包括早晚例保且时间大于零的班次)','value':zwlbbc},
	                  {'name':'营运总班次(包括正常、区间、放大站且班次时间大于零班次)','value':serviceBc},
	                  {'name':'进场总时间(包括进场班次且班次时间大于零)','value':parseFloat((jcsj/60).toFixed(2)) + ' 小时'},
	                  {'name':'出场总时间(包括进场班次且班次时间大于零)','value':parseFloat((ccsj/60).toFixed(2)) + ' 小时'},
	                  {'name':'吃饭总时间(包括吃饭班次且班次时间大于零)','value':parseFloat((cfsj/60).toFixed(2)) + ' 小时'},
	                  {'name':'早晚例保总时间(包括早晚例保班次且时间大于零的)','value':parseFloat((zwlbsj/60).toFixed(2)) + ' 小时'},
	                  {'name':'营运班次总时间(包括正常、区间、放大站且班次时间大于零)','value':parseFloat((servicesj/60).toFixed(2)) + ' 小时'},
	                  {'name':'总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)','value': parseFloat((countGs/60).toFixed(2)) + ' 小时'},
	                  {'name':'空驶班次(包括直放班次)','value':ksBc},
	                  {'name':'营运里程(包括正常、区间、放大站里程)','value':Number(serviceLc).toFixed(3) + ' 公里'},
	                  {'name':'空驶里程(包括直放里程)','value':ksLc + ' 公里'},
	                  {'name':'平均停站时间(营运班次停站时间总和/营运总班次)','value':parseInt(avgTzjx) + ' 分钟' },
	                  {'name':'高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)','value':gfServiceBc},
	                  {'name':'低谷营运班次(包括低谷时段的正常、区间、放大站班次)','value':dgServiceBc},
	                  {'name':'高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)','value':parseInt(gfAvgTzjx) + ' 分钟'},
	                  {'name':'低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)','value':parseInt(dgAvgTzjx) + ' 分钟'},
	                  {'name':'综合评估','value':3}];
	// 弹出层mobal页面
	$.get('/pages/base/timesmodel/countadd.html', function(m){
		$(pjaxContainer).append(m);
		// 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。
		$('#countadd_mobal').trigger('countAddMobal.show',[countDate]);
	});
 });
/************************************************************************************************************************************************/


/**
 * d3动画过度
 *
 * @param {Object} d3 Element
 * 
 * @returns {Function} 动画函数部分
 ************************************************************************************************************************************************/
var _animation = function(d3Node) {return d3Node.transition().delay(function(d,i){return 0.001;}).duration(300).ease("linear");}
/************************************************************************************************************************************************/


/** 创建提示框内容
 *
 *	@param {Object} RelationshipGraph 对象
 * 	
 *  @returns {Object} table.outerHTML
 ************************************************************************************************************************************************/
var createTooltip = function createTooltip(self) {
    return d3.tip().attr('class', 'relationshipGraph-tip').offset([-8, -10]).html(function (obj) {
        var keys = Object.keys(obj),
            table = document.createElement('table'),
            count = keys.length,
            rows = [];
        var showKeys = self.configuration.showKeys;
        var hiddenKeys = ['_PRIVATE_' ,'PARENTCOLOR', 'SETNODECOLOR', 'SETNODESTROKECOLOR','lpNo','parent','lp','lpType',
                          'jhlc','tcc','ttinfo','xl','isfb','qdz','zdz','isSwitchXl','bz','bcs',/*'fcno'*/];
        while (count--) {
            var element = keys[count];
                // upperCaseKey = element.toUpperCase();
            if (!RelationshipGraph.contains(hiddenKeys, element) && !element.startsWith('__') && obj[element] !='tjz') {
                var row = document.createElement('tr'),
                    key = showKeys ? document.createElement('td') : null,
                    value = document.createElement('td');
                if (showKeys) {
                	   var changeKey = null;
                       if(element=='fcsj')
                       		changeKey = '发车时间:';
                       else if(element=='ARRIVALTIME')
                    	   changeKey = '到站时间:';
                       else if(element=='bcsj')
                    	   changeKey = '行驶时间:';
                       else if(element=='STOPTIME')
                       		changeKey = '停息时间:';
                       else if(element=='xlDir')
                       		changeKey = '行驶方向:';
                       else if(element=='lpName')
                      		changeKey = '当前路牌:';
                       else if(element=='bcType')
                     		changeKey = '班次类型:';
                       else if(element=='tjbx')
                    		changeKey = '推荐班型:';
                       else
                   		changeKey = element;
                       key.innerHTML =changeKey;
                    row.appendChild(key);
                }

                if (element == 'VALUE' && !self.configuration.valueKeyName) {
                    continue;
                }
                
                if(obj[element]=='relationshipGraph-up')
                	value.innerHTML = '上行';
                else if(obj[element]=='relationshipGraph-down')
                	value.innerHTML = '下行';
                else if(obj[element]=='normal')
                	value.innerHTML = '正常';
                else if(obj[element]=='region')
                	value.innerHTML = '区间';
                else if(obj[element]=='fb')
                	value.innerHTML = '分班';
                else if(obj[element]=='in')
                	value.innerHTML = '进场';
                else if(obj[element]=='lc')
                	value.innerHTML = '保养';
                else if(obj[element]=='out')
                	value.innerHTML = '出场';
                else if(obj[element]=='bd')
                	value.innerHTML = '保养';
                else 
                	value.innerHTML = obj[element];
                value.style.fontWeight = 'normal';
                row.appendChild(value);
                rows.push(row);
            }
        }
        var rowCount = rows.length;
        while (rowCount--) {
            table.appendChild(rows[rowCount]);
        }
        return table.outerHTML;
    });
};
/************************************************************************************************************************************************/

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("不能调用一个类作为函数."); } }

/** 定义图层类
 * 
 * @return {Object} 返回图层对象
 * 
 **/
var RelationshipGraph = function () {
    
	/**
	 * 创建对象
	 * 
	 * @param {d3.selection} 选择包含图的元素的标识
	 * 
	 * @param {Object} 图层参数配置信息
	 * 
	 **/
    function RelationshipGraph(selection) {
    	// 获取配置参数
        var userConfig = arguments.length <= 1 || arguments[1] === undefined ? { showTooltips: true, maxChildCount: 0, thresholds: [] } : arguments[1];
        // 不能把类作为函数调用
        _classCallCheck(this, RelationshipGraph);
        var defaultOnClick = { parent: RelationshipGraph.noop, child: RelationshipGraph.noop };
        // 图层配置参数信息
        this.configuration = {
        	multiple: userConfig.multiple || 0,
        	hours : userConfig.hours || 24,
        	dxHours : userConfig.dxHours,
        	width:userConfig.width || 0,// 图层宽
        	height:userConfig.height || 0,// 图层高
        	offsetX:userConfig.offsetX || 0,// 偏移X值
	        offsetY:userConfig.offsetY || 0,// 偏移Y值
	        widtMargin:userConfig.widtMargin || 0,// 宽边距
	        heightMargin : userConfig.heightMargin ||0,// 高边距
	        downDy :userConfig.downDy ||0,// 下行发车时刻Y值差距
	        upDy : userConfig.upDy ||0,// 下行发车时刻Y值差值
        	timeDomainStart : userConfig.timeDomainStart,// 开始时间
        	timeDomainEnd : userConfig.timeDomainEnd,// 结束时间
        	startStr:userConfig.startStr,
	        endStr: userConfig.endStr,
        	taskTypes : userConfig.taskTypes,
        	lpNoA : userConfig.lpNoA,
        	lpNameA : userConfig.lpNameA,
        	tickFormat: userConfig.tickFormat,
        	stopAraay : userConfig.stopAraay,
        	dataMap : userConfig.dataMap,
            selection: selection, // 图形的标识.
            showTooltips: userConfig.showTooltips, // 是否显示工具提示在盘旋
            maxChildCount: userConfig.maxChildCount || 0, // 每行最多显示的儿童数量.
            onClick: userConfig.onClick || defaultOnClick, // 回调函数调用.
            showKeys: userConfig.showKeys, // 是否显示在工具提示中的钥匙.
            transitionTime: userConfig.transitionTime || 1500, // 过渡到开始和完成的时间.
            valueKeyName: userConfig.valueKeyName, // 设置工具提示自定义键
            bxrcgs : userConfig.bxrcgs
        };
        // 是否开启提示框 ,默认开启。
        if (this.configuration.showTooltips === undefined)
        	this.configuration.showTooltips = true;
        // 是否显示键 ,默认显示。
        if (this.configuration.showKeys === undefined)
        	this.configuration.showKeys = true;
        // 是否显示值,默认显示。
        if (this.configuration.keyValueName === undefined)
        	 this.configuration.keyValueName = 'value';
        
        this.measurementDiv = document.createElement('div');
        
        this.measurementDiv.className = 'relationshipGraph-measurement';
        
        document.body.appendChild(this.measurementDiv);
        
        this.measuredCache = {};
        
        this.representation = [];
        
        this._spacing = 1;
        
        this._d3V4 = !!this.configuration.selection._groups;
        
        if (this.configuration.showTooltips) {
            this.tooltip = createTooltip(this);
            this.tooltip.direction('n');
        } else {
            this.tooltip = null;
        }
        
        this.svg = this.configuration.selection.select('svg').select('g');
        if (this.svg.empty()) {
            // 创建SVG元素将包含图
        	this.svg = this.configuration.selection.append('svg').attr("class", "svg-chart")
						   .attr('width',this.configuration.width + this.configuration.widtMargin)
						   .attr('height', this.configuration.height + this.configuration.heightMargin)
						   .attr('style', 'display: block')
						   .append('g').attr("class", "gantt-chart");
        	// 创建时间线性区域
        	var x = d3.time
        			  .scale()
        			  .domain([ this.configuration.timeDomainStart, this.configuration.timeDomainEnd ])
        			  .range([ 0, this.configuration.width])
        			  .clamp(true),
        		// 创建Y线性区域
        		y = d3.scale
        			  .ordinal()
        			  .domain(this.configuration.lpNameA)
        			  .rangeRoundBands([ 0, this.configuration.height], .1);
            this.configuration.y = y;
            // 创建X轴
    		var xAxis = d3.svg
    					  .axis()
    					  .scale(x)
    					  .orient("top")
    					  .ticks(this.configuration.hours)
    					  .tickFormat(d3.time.format(this.configuration.tickFormat))
    					  .tickSubdivide(true)
    					  .tickSize(8)
    					  .tickPadding(8)
    					  .innerTickSize(-(this.configuration.height)),
    			// 创建Y轴
    			yAxis = d3.svg
    					  .axis()
    					  .scale(y)
    					  .orient("left")
    					  .tickSize(0),
    			// 创建上行发车时间刻度尺轴
    			upxAxis = d3.svg
    					 	.axis()
    					 	.scale(x)
    					 	.orient("top")
    					 	.ticks(this.configuration.hours)
    					 	.tickFormat(d3.time.format(this.configuration.tickFormat))
    					 	.tickSubdivide(true)
    					 	.tickSize(30).tickPadding(3),
    			// 创建下行发车时间刻度尺轴
    			downxAxis = d3.svg
    						  .axis()
    						  .scale(x)
    						  .orient("top")
    						  .ticks(this.configuration.hours)
    						  .tickFormat(d3.time.format(this.configuration.tickFormat))
    						  .tickSubdivide(true)
							  .tickSize(30).tickPadding(3);
    		// 添加X轴
        	this.svg
        		.append("g")
        		.attr("class", "x axis")
        		.attr("transform", "translate(" + this.configuration.offsetX + ", " + this.configuration.offsetY + ")")
        		.transition()
        		.call(xAxis);
        	// 添加Y轴
        	this.svg
        		.append("g")
        		.attr("class", "y axis")
        		.attr("transform", "translate(" + this.configuration.offsetX + ", " + this.configuration.offsetY + ")")
        		.transition().call(yAxis);
        	// 添加上行发车时间刻度尺
        	this.svg
			    .append("g")
	    		.attr("class", "up")
	    		.attr("transform", "translate(" + this.configuration.offsetX + ", " + (this.configuration.offsetY - this.configuration.upDy) + ")")
	    		.transition().call(upxAxis);
        	// 添加下行发车时间刻度尺
        	this.svg
        		.append("g")
        		.attr("class", "down")
        		.attr("transform", "translate(" + this.configuration.offsetX + ", " + (this.configuration.offsetY - this.configuration.downDy) + ")")
        		.transition().call(downxAxis);
        	this.svg
	    		.append("g")
	    		.attr("class", "shift");
        	var $_UP = d3.select('g.up')
        				 .append('g')
    					 .attr('class','tick')
    					 .attr('transform','translate(0,0)')
    					 .style('opacity',1),
    			$_DOWN = d3.select('g.down')
						   .append('g')
						   .attr('class','tick')
						   .attr('transform','translate(0,0)')
						   .style('opacity',1)
        	$_UP.append('line').attr('x2',0).attr('y2',0);
        	$_UP.append('text').attr('x',-10).attr('dy','.32em').attr('y',0).style('text-anchor','end').text('上行发车时刻');
        	$_DOWN.append('line').attr('x2',0).attr('y2',0);
        	$_DOWN.append('text').attr('x',-10).attr('dy','.32em').attr('y',0).style('text-anchor','end').text('下行发车时刻');
        	this.addListenerMouseEvent();
        	this.createStatistics();
        	// 清空数组
        	if(yAxisYArray.length>0)
        		yAxisYArray.splice(0,yAxisYArray.length);
        	for(var t = 0;t<this.configuration.taskTypes.length;t++) {
        		yAxisYArray.push({
        			y:y(this.configuration.taskTypes[t].lpName)+this.configuration.offsetY,
        			carname:this.configuration.taskTypes[t].lpName,
        			lpA : this.configuration.taskTypes[t]});
        	}
        }
        this.graph = this;
    }
    _createClass(RelationshipGraph, [{
        key: 'data',
        value: function data(json) {
            if (RelationshipGraph.verifyJson(json)) {
            	/** 上、下行JSON数组 */
            	var upArray = new Array(),downArray = new Array();
            	for(var j = 0 ; j< json.length ; j++) {
            		if(json[j].bcType=='normal' || json[j].bcType=='region') {
            			if(json[j].xlDir == 'relationshipGraph-up')
                			upArray.push(json[j]);
                		else if(json[j].xlDir == 'relationshipGraph-down')
                			downArray.push(json[j])
            		}
            	}
            	this.removeNodes(d3.selectAll('g.up_tick')[0]);
            	this.removeNodes(d3.selectAll('g.down_tick')[0]);
            	this.removeNodes($('g.shift').children());
            	var upNodes = this.configuration.selection.select('svg').select('g.up').selectAll('.up_tick').data(upArray),
            		downNodes = this.configuration.selection.select('svg').select('g.down').selectAll('.down_tick').data(downArray),
            		nodes = this.configuration.selection.select('svg').select('g.shift').selectAll('.data').data(json);
            	// 绘制上行发车时刻
            	this.createUpTime(upNodes);
            	// 绘制下行发车时刻
            	this.createDownTime(downNodes);
                // 绘制班次
                this.createClasses(nodes);
                // 绘制统计值
                this.statistics();
                if (this.configuration.showTooltips) {
                    d3.select('.d3-tip').remove();
                    this.svg.call(this.tooltip);
                }
            }
            return this;
        }
     }, {
    	 key : 'createUpTime',
    	 value : function createUpTime(upNodes) {
    		 var _this = this;
    		 var $g_tick = upNodes.enter().append('g').attr('class','up_tick')
    		 		.attr('transform', function (obj) {
             	var hourMinue = obj.fcsj.split(":");
             	var rectX = (parseInt(hourMinue[0])-_this.configuration.dxHours )*60*_this.configuration.multiple + 
             				parseInt(hourMinue[1])*_this.configuration.multiple;
             	return 'translate(' +  rectX + ',0)';
             });
    		 $g_tick.append('line').attr('y2',-5).attr('x2',0);
    		 $g_tick.append('text').attr('y',-10).attr('dy','0em').attr('x',0).style('text-anchor','middle')
    		 		.text(function(obj) {
    		 			var hourMinue = obj.fcsj.split(":");
    		 			return hourMinue[1];
    		 		});
    	 }
     }, {
    	 key : 'createDownTime',
    	 value: function createDownTime(downNodes) {
    		 var _this = this;
    		 var $g_tick = downNodes.enter().append('g').attr('class','down_tick')
    		 		.attr('transform', function (obj) {
             	var hourMinue = obj.fcsj.split(":");
             	var rectX = (parseInt(hourMinue[0])-_this.configuration.dxHours )*60*_this.configuration.multiple + parseInt(hourMinue[1])*_this.configuration.multiple;
             	return 'translate(' +  rectX + ',0)';
             });
    		 $g_tick.append('line').attr('y2',-5).attr('x2',0);
    		 $g_tick.append('text').attr('y',-10).attr('dy','0em').attr('x',0).style('text-anchor','middle')
    		 		.text(function(obj) {
    		 			var hourMinue = obj.fcsj.split(":");
    		 			return hourMinue[1];
    		 		});
    		 
    	 }
     }, {
    	 key: 'setBxTagType',
    	 value : function setBxTagType(node) {
    		 
    	 }
    	 
     }, {
    	/**
    	 * @description : (TODO) 创建rect、text(班次对象、班次属性值)元素对象
    	 * 
    	 * @param {Object} Elements
    	 * 
    	 * @status : OK.
    	 */
        key: 'createClasses',
        value: function createClasses(childrenNodes) {
        	// 把当前对象赋值给_this.
        	var _this = this;
        	// 添加底层rect元素(班次)对象.
            childrenNodes.enter().append('rect').attr('id',RelationshipGraph.setIdValue) // 设值id
            									.attr('x',RelationshipGraph.setXValue) // 设值x坐标
            									.attr('y',RelationshipGraph.setYValue) // 设值y坐标.
            									.attr('class',RelationshipGraph.setRectClassV)// 设值class
            									.attr('width',RelationshipGraph.setRectWidthV) // 设值宽度
            									.attr('height',RelationshipGraph.setRectHeight)// 设值高度
            									.attr('parent-node',RelationshipGraph.setRectParenNodeIdV)// 设值父元素id
            									.attr('next-node',RelationshipGraph.setNextNodeIdV)// 设值下个元素的id
            									.attr('last-node',RelationshipGraph.setLastNodeIdV)// 设值上个元素的id
            									.attr('rect-type',RelationshipGraph.setNodeType('shift')); // 设值元素类型
            // 添加第一行text元素(班次属性值[发车时间~到站时间])对象.
            childrenNodes.enter().append('text').attr('id',RelationshipGraph.setText01IdV) //设值id.
            					 				.attr('x',RelationshipGraph.setXValue) // 设值x坐标.
				            					.attr('y',RelationshipGraph.setYValue) // 设值y.
				            					.attr('dx',RelationshipGraph.setTextDxV(5)) // 设值x方向偏移量.
				            					.attr('dy',RelationshipGraph.setTextDyV(18))// 设值y方向偏移量.
				            					.attr('class',RelationshipGraph.setTextClassV) //设值class.
				            					.text(RelationshipGraph.setText01text)// 设值text文本
				            					.attr('parent-node',RelationshipGraph.setIdValue)// 设置父元素id
				            					.attr('text-type',RelationshipGraph.setNodeType('timeslot'));// 设值元素类型.
            // 添加第二行text元素(班次属性值[行驶时间])对象.
            childrenNodes.enter().append('text').attr('id',RelationshipGraph.setText02IdV)// 设值id.
            									.attr('x',RelationshipGraph.setXValue)// 设值x.
            									.attr('y',RelationshipGraph.setYValue)// 设值y.
            									.attr('dx',RelationshipGraph.setTextDxV(5))// 设值x方向偏移量.
            									.attr('dy',RelationshipGraph.setTextDyV(36))// 设值y方向偏移量.
            									.attr('class',RelationshipGraph.setTextClassV) // 设值class.
            									.text(RelationshipGraph.setText02text)// 设值text文本.
            									.attr('parent-node',RelationshipGraph.setIdValue)// 设值父元素id
            									.attr('text-type', RelationshipGraph.setNodeType('travel'));// 设置元素类型.
            // 添加第三行text元素(班次属性值[停息时间])对象. 
            childrenNodes.enter().append('text').attr('id',RelationshipGraph.setText03IdV)// 设值id.
            									.attr('x',RelationshipGraph.setXValue)// 设值x
            									.attr('y',RelationshipGraph.setYValue)// 设值y
            									.attr('dx',RelationshipGraph.setTextDxV(5))// 设值x方向偏移量.
            									.attr('dy',RelationshipGraph.setTextDyV(54))// 设值y方向偏移量.
            									.attr('class',RelationshipGraph.setTextClassV)// 设值class.
            									.text(RelationshipGraph.setText03text)// 设值text文本.
            									.attr('parent-node',RelationshipGraph.setIdValue)// 设值父元素id.
            									.attr('text-type',RelationshipGraph.setNodeType('gap'));// 设值元素类型.
            // 添加底层rect元素上的圆.
            childrenNodes.enter().append('circle').attr('id',RelationshipGraph.setCircleIdV)// 设值id.
            									  .attr('cx',RelationshipGraph.setCirclecxV)// 设值cx.
            									  .attr('cy',RelationshipGraph.setCirclecyV)// 设值cy.
            									  .attr('r',RelationshipGraph.setCircleRV)// 设值半径r.
            									  .attr('class',RelationshipGraph.setCircleClass)// 设值class.
            									  .attr('parent-node',RelationshipGraph.setIdValue);// 设值父元素id.
           // 添加圆里的text元素(班次类型值)对象
           childrenNodes.enter().append('text').attr('id',RelationshipGraph.setText04IdV)// 设值id.
           									   .attr('x',RelationshipGraph.setText04XV)// 设值x.
           									   .attr('y',RelationshipGraph.setText04YV)// 设值y.
           									   .attr('class',RelationshipGraph.setText04ClassV)// 设值class
           									   .text(RelationshipGraph.setText04text)//设值text文本.
           									   .attr('parent-node', RelationshipGraph.setIdValue)// 设值父元素id.
           									   .attr('text-type',RelationshipGraph.setNodeType('bcType'));// 设值元素类型.
           // 添加底层rect元素的rect对象(覆盖层). 添加覆盖层是为了对拖拽事件的响应.
           childrenNodes.enter().append('rect').attr('id',RelationshipGraph.setCoverRectIdV)// 设值id.
           										.attr('x',RelationshipGraph.setXValue)// 设值x.
           										.attr('y',RelationshipGraph.setYValue)// 设值y.
           										.attr('class',RelationshipGraph.setCoverRectClassV('rect-cover'))// 设值class.
           										.attr('width',RelationshipGraph.setRectWidthV)// 设值宽度.
           										.attr('height',RelationshipGraph.setRectHeight)// 设值高度.
           										.attr('parent-node',RelationshipGraph.setCoverRectParentV)// 设值父元素id.
           										.attr('rect-type',RelationshipGraph.setNodeType('cover'))// 设值元素类型.
           										.attr('next-node',RelationshipGraph.setCoverRectLastIdV)// 设值下个元素id.
           										.on('mouseover', _this.tooltip ? _this.tooltip.show : RelationshipGraph.noop)// 监听鼠标移入事件.
           										.on('mouseout',  _this.tooltip ? _this.tooltip.hide : RelationshipGraph.noop)// 监听鼠标移出事件.
           										.on('mousedown', function (obj) {
           											_this.tooltip.hide();
           											_this.configuration.onClick.child(obj);
           											// 这里很关键.移除鼠标右击时做拖拽事件.决定了鼠标右击时只做左菜单.
           											if(window.event.which==3)
           												context.setisContext(true);
           										}).call(d3.behavior.drag()
           														   .on("dragstart", RelationshipGraph.singleElementDrawStart) // 监听单个rect元素拖拽开始事件
           													       .on("drag",RelationshipGraph.singleElementDrawRuing)// 监听单个rect元素拖拽中事件.
           														    .on("dragend",RelationshipGraph.singleElementDrawStop));// 监听单个rect元素拖拽结束事件.
        }
    }, {
        key: 'removeNodes',
        value: function removeNodes(nodes) {
        	for(var n = 0 ;n<nodes.length;n++) {
        		$(nodes[n]).remove();
        	}
        }
    }, {
    	key : 'getSvgyAxisTransformY',
    	value : function getSvgyAxisTransformY() {
    		var listChildrNodes =  $(".y").children(".tick");
        	var len_node = listChildrNodes.length;
        	var y_array = new Array();
        	for(var n = 0;n<len_node;n++) {
        		var transform = $(listChildrNodes[n]).attr("transform");
        		var t_value = transform.substring(transform.indexOf("(")+1  ,transform.lastIndexOf(")") ).split(",");
        		y_array.push(parseInt(t_value[1]));
        	}
        	return y_array;
    	}
    }, {
    	key : 'getDataArray',
    	value : function getDataArray() {
    		var nodes  = d3.selectAll('rect.data')[0],dataArray = new Array();
    		for(var i = 0 ; i<nodes.length;i++) {
    			dataArray.push(d3.select(nodes[i]).data()[0]);
    		}
    		return dataArray;
    	}
    }, {
    	/**
    	 * @description : (TODO) 获取路牌对应的班次数(这里的班次不包括早晚例保班次、吃饭时间) 
    	 * 
    	 * @params : [a1--班次数组;a2--路牌数组]
    	 * 
    	 * @return : 返回一个数组.这里返回的是一个封装的每个路牌对应的班次数(这里的班次不包括早晚例保班次、吃饭时间、班次时间为0的班次) 
    	 **/
    	key : 'getbczs',
    	value : function getbczs(a1,a2,dataMap) {
    		// 定义返回数组.
    		var array = new Array();
    		// 判断参数数组长度大于〇,dataMap不能为空.
    		if(a1.length>0 && a2.length>0 && dataMap!=null && dataMap!='') {
    			// 遍历路牌数组
    			for(var i = 0 ;i < a2.length ; i++) {
    				// 定义当前路牌下班次数,初始化为0.
    				var bcs = 0;
    				// 遍历班次数组
    				for(var j = 0 ; j < a1.length ; j++) {
    					// 判断当前班次j是否属于当前路牌i下,除去早晚例保班次、吃饭时间、班次时间为0的班次
    					if(a1[j].parent == a2[i].lpA.lpNo && 
    							a1[j].bcType != dataMap.bcTypeArr.bd && 
    							a1[j].bcType != dataMap.bcTypeArr.lc && 
    							a1[j].bcType != dataMap.bcTypeArr.cf && 
    							a1[j].bcsj > 0) {
    						bcs++;
    					}
    				}
    				// 把每个路牌下的对应班次数一一封装在一起,并添加到返回数组里边
    				array.push({lpNo : a2[i].lpA.lpNo , lpName:a2[i].lpA.lpName , bcs:bcs});
    			}
    		}else {
    			error.show('参数异常!','【 a1:' + a1 + ' , a2:' + a2 + ' , dataMap:' + dataMap + '】');
    			// console.log("您传入的参数异常!【 a1:" + a1 + ", a2:" + a2 + ", dataMap:" + dataMap);
    		}
    		return array;
    	}
    }, {
    	key : 'addHistory' ,
    	value : function addHistory() {
    		historyArray.push({'data':JSON.stringify(this.getDataArray()),'granph':JSON.stringify(this.configuration)});
    		$_keyIndex++;
    	}
    }, {
    	key : 'statistics',
    	value : function statistics() {
    		var $_this = this,
    			// array = $_this.getSvgyAxisTransformY(),
    			array = $_this.configuration.taskTypes,
    			tza = $_this.getDataArray();
    		for(var a=0;a<array.length;a++) {
    			var lpNo = array[a].lpNo;
    			var timeNum = 0 ,tempNum = 0;
    			for(var z = 0 ;z < tza.length;z++) {
    				if(tza[z].lpNo == lpNo && tza[z].bcsj >0 ) {
    					timeNum = timeNum + tza[z].bcsj + tza[z].STOPTIME;
    					if( tza[z].bcType !='bd' && tza[z].bcType !='lc' && tza[z].bcType !='cf') {
    						tempNum ++;
    					}
    				}
				}
    			var className = 'statis_container_' + lpNo;
    			var textNodes = $("."+className).children("text");
    			var hours = parseInt(timeNum/60);
    			var mimus = timeNum%60, zgs =  hours +  (mimus==0? "": "." + mimus);
    			var zgs = parseFloat((timeNum/60).toFixed(2));
    			// var zgs = timeNum;
    			$(textNodes[0]).text("总工时:" + zgs);
    			$(textNodes[1]).text("总班次:"+(tempNum));
    			// $_this.pptjbx($("."+className).children("rect")[2],zgs*1,lpNo,$_this);
    		}
    	}
    	
    }, {
    	
    }, {
    	key : 'pptjbx',
    	value : function pptjbx(node,gs,lpNo,$_this) {
    		if($_this.configuration.bxrcgs!=null) {
    			for(var t = 0 ; t<$_this.configuration.bxrcgs.length;t++) {
    				if($_this.configuration.bxrcgs[t].lpNo == lpNo)
    					d3.select(node).data()[0].tjbx = $_this.configuration.bxrcgs[t].type;
    			}
    		}else {
    			workeType.sort(function(a,b){return b.hourV-a.hourV});
    			var zhHoursA = new Array();
    			if(gs>(workeType[0].hourV+1)) {
    				for(var k = 0 ; k<workeType.length;k++) {
    					 var kHourV = workeType[k].hourV;
    					 for(var a = k ; a<workeType.length;a++) {
    						 var aHourV = workeType[a].hourV;
    						 var dx = Math.abs(parseInt(kHourV + aHourV - gs));
    						 zhHoursA.push({'bx1': workeType[k].type,'bx2': '</br></br>' + workeType[a].type,'countGs':dx});
    					 }
    				 }
    			}else {
    				for(var b = 0 ; b<workeType.length;b++) {
    					zhHoursA.push({'bx1': workeType[b].type,'bx2':'','countGs':Math.abs(parseInt(workeType[b].hourV - gs))});
    				}
    			}
    			zhHoursA.sort(function(a,b){return a.countGs-b.countGs});
				d3.select(node).data()[0].tjbx = zhHoursA[0].bx1  + zhHoursA[0].bx2;
    		}
    		/*if(gs>16) {
    			d3.select(node).data()[0].tjbx = 'zyxy';
    		} else {
    			var bclx = 'wz';
        		for(var g = 0 ; g<workeType.length;g++) {
        			if((gs<workeType[g].value && gs>workeType[g].value-10) || (gs<workeType[g].value*2 && gs>workeType[g].value2* -10)){
        				bclx = workeType[g].type;
        				break;
        			}
        		}
        		d3.select(node).data()[0].tjbx = bclx;
    		}*/
    	}
    }, {
    	key : 'createStatistics',
    	value : function createStatistics() {
    		var svg = d3.select('.gantt-chart'),
    			_this = this,
    			yAyxisA = _this.getSvgyAxisTransformY();
    			array = _this.configuration.taskTypes;
    		var g_statis = svg.selectAll('.g_statis').data([1]).enter().append('g').classed({'g_statis':true}).attr("transform", "translate(" + _this.configuration.offsetX + ", " + _this.configuration.offsetY + ")");
        	for(var c = 0 ;c<array.length;c++) {
        		var className = 'statis_container_' + array[c].lpNo;
        		var statis_container = g_statis.append('g').attr("class",className).attr("transform", "translate(" + 0 + ", " + yAyxisA[c] + ")");
        		statis_container.append('rect').classed({'rect_shift':true})
        						.attr("x",-_this.configuration.offsetX)
        						.attr("y",9)
        						.attr("rx",5)
        						.attr("ry",5)
        						.attr("width",_this.configuration.offsetX)
        						.attr("height",20);
        		statis_container.append('rect').classed({'rect_Whours':true})
        						.attr("x",-_this.configuration.offsetX)
        						.attr("y",32)
        						.attr("rx",5)
        						.attr("ry",5)
        						.attr("width",_this.configuration.offsetX)
        						.attr("height",20);
        		statis_container.append("text")
								.attr("class","statis_text")
								.attr("x",-_this.configuration.offsetX)
								.attr("y",9)
								.attr('dx',15)
								.attr('dy',15)
								.text("总工时:");
        		statis_container.append("text")
        						.attr("class","statis_text")
        						.attr("x",-_this.configuration.offsetX)
        						.attr("y",32)
        						.attr('dx',15)
        						.attr('dy',15)
        						.text("总班次:");
        		statis_container.append('rect').data([{'tjbx':'未知','bcType':'tjz'}]).classed({'rect-cover-statis':true})
								.attr("x",-_this.configuration.offsetX)
								.attr("y",8)
								.attr("rx",5)
								.attr("ry",5)
								.attr("width",_this.configuration.offsetX)
								.attr("height",20)
								.on('mouseover', _this.tooltip ? _this.tooltip.show : RelationshipGraph.noop)
								.on('mouseout', _this.tooltip ? _this.tooltip.hide : RelationshipGraph.noop);
        		statis_container.append('rect').data([{'bcType':'tjz'}]).classed({'rect-cover-statis':true})
				        		.attr("x",-_this.configuration.offsetX)
								.attr("y",32)
								.attr("rx",5)
								.attr("ry",5)
								.attr("width",_this.configuration.offsetX)
								.attr("height",20);
        	}
    	}
    	
    }, {
    	/**
    	 * @description : (TODO) 添加鼠标监听事件.
    	 * 
    	 * 				  ^^^^^^^^^^^^^^^^^^^^^
    	 * 				  此事件做绘制选中班次框.     
    	 * 
    	 **/
    	key: 'addListenerMouseEvent',
    	value : function addListenerMouseEvent() {
    		// 1、 控制鼠标操作从 按下(300ms开始,并且按下时不能移动鼠标,打开开关) ---> 移动(画选择框) ---> 松开(关闭开关) 过程.
    		var flag = false,stop;
    		// 2、获取DIV ID为 [ganttSvg] svg容器.
        	var svg = d3.select("#ganttSvg");
        	// 3、给svg容器元素对象 添加鼠标按下事件.
        	svg.on('mousedown',function(e){
        		// 3.1、如果开关没打开,或者已存在选择框对象,或者从rect元素(班次)对象上按下时,提前结束鼠标操作过程.
        		if(flag || RelationshipGraph.getFlagIndex()>0 || d3.event.target.nodeName =='rect')
        			return false;
        		// 3.2、定义鼠标按下的x、y坐标 .
        		var d3MouseDown_x = parseInt(d3.mouse(this)[0]),d3MouseDown_y = parseInt(d3.mouse(this)[1]);
        		// 3.3、计时鼠标是否按下已有300ms,并且在300ms中鼠标未曾移动,则打开开关,进入鼠标操作过程.
        		stop = setTimeout(function() {
        			// 3.4、打开鼠标移动和松开事件开关.
        			flag = true;
        			// 3.5、记录当前选择框数 .
        			RelationshipGraph.setFlagIndex(1);
        			// 3.6、创建选择框 .
        			var container_g = d3.selectAll(".gantt-chart").selectAll('.case_g').data([1]).enter().append('g').classed({'case_g':true});
        			// 3.7、给选择框添加class为case_rect caseactive 元素.
                    container_g.append('rect').data([{'bcType':'tjz'}]).classed({'case_rect caseactive':true})
                    		   .attr('id', 'case_rectId')
                    		   .attr('x', d3MouseDown_x)
                    		   .attr('y', d3MouseDown_y)
                    		   .attr('rect-type', function (obj) {
                    			   return 'case';
                    		   }).call(d3.behavior.drag()
                    				   .on("dragstart",RelationshipGraph.regionDrawStart) // 3.7.1 给选择框添加沿X轴开始拖拽事件.
                    				   .on("drag",RelationshipGraph.regionDrawRuing) // 3.7.2 给选择框添加沿X轴拖拽中事件.
                    				   .on("dragend",RelationshipGraph.regionDrawStop));// 3.7.3 给选择框添加沿X轴拖拽结束事件.
                    // 3.8 打开小tips提示层.
                    layer.tips('鼠标绘制工具已打开,从此处位置开始绘制选中框来进行选中班次。', '.case_rect', {
                    	tips: [1, '#3595CC'],
                    	time: 4000
                    });
        		},200);
        	//  4、给svg容器元素对象 添加鼠标移动事件 . 这里等同于绘制选择框.
        	}).on('mousemove',function(e){
        		// $('.ganttSvgContainer').css('overflow','auto');
        		// 4.1 判断开关是否打开状态.
        		if(flag) {
        			// 4.1.1、定义鼠标移动的x、y坐标.
        			var d3MouseMove_x = parseInt(d3.mouse(this)[0]),d3MouseMove_y = parseInt(d3.mouse(this)[1]);
        			// 4.1.2、获取class 为case_rect 的元素起始x、y坐标点.
            		var mdX = parseInt($("rect.case_rect").attr("x")),mdY = parseInt($("rect.case_rect").attr("y"));
            		// 4.1.3、根据两点之间计算高和宽,并给class为case_rect元素设置高和宽的属性值.
            		svg.selectAll('rect.case_rect').attr("width", Math.abs(d3MouseMove_x - mdX)).attr("height", Math.abs(d3MouseMove_y - mdY));
        		}else {
        			// 4.2 清楚定时器.
    				clearTimeout(stop);
    			}
        	// 5、 给svg容器元素对象 添加鼠标松开事件.
        	}).on('mouseup',function(e){
        		if(flag) {
        			layer.closeAll();// 关闭弹出层.
            		RelationshipGraph.mouseUpEvent(flag);
            		flag = false;
        		} else {
        			clearTimeout(stop);
        		}
    		// 6、给svg容器元素对象 添加鼠标移出事件.解决鼠标在其他元素上松开而不关闭开关问题.只有在绑定 mouseleave 事件的元素上,将鼠标移出时,才会触发该事件。
        	}).on('mouseleave',function() {
        		// $('.ganttSvgContainer').css('overflow','hidden');
        		if(flag) {
        			layer.closeAll();// 关闭弹出层.
            		RelationshipGraph.mouseUpEvent(flag);
            		flag = false;
        		} else {
        			clearTimeout(stop);
        		}
        	});
    	}
    }], [{ 
    	key: 'contains',
        value: function contains(arr, key) {
        		return arr.indexOf(key) > -1;
       }
    }, {
    	/**
    	 * @description : (TODO)  获取鼠标绘制的当前选择框标识(这里限制只做一次性选择元素拖拽,在绘制选择框时)
     	 * 
     	 * @return 返回一个数值. 鼠标绘制的当前选择框标识(这里限制只做一次性选择元素拖拽,在绘制选择框时)
    	 * */
    	key : 'getFlagIndex',
    	value : function getFlagIndex() {
    		return flagIndex;
    	}
    	
    }, {
    	/**
    	 * @description : (TODO)  设值鼠标绘制的当前选择框标识(这里限制只做一次性选择元素拖拽,在绘制选择框时).
    	 * 
    	 * @param [v--数值]
    	 * */
    	key : 'setFlagIndex',
    	value: function setFlagIndex(v) {
    		flagIndex =  v;
    	}
    }, {
    	/**
    	 * @description : (TODO) 关闭选择框按钮事件.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'gClose',
    	value : function gClose() {
    		$("g.case_g").remove(); 
    		RelationshipGraph.setFlagIndex(0);
    		gClassNameArray = [];
    		d3.selectAll('.caseactive').classed({'caseactive':false});
    	}
    }, {
    	/**
    	 * @description : (TODO) 添加班次事件.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'reladplus',
    	value : function reladplus() {
    		// 弹出层mobal页面
    		$.get('/pages/base/timesmodel/reladplus.html', function(m){
    			$(pjaxContainer).append(m);
    			// 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。
    			$('#reladplus_mobal').trigger('reladplusMobal.show',[$_GlobalGraph,BaseFun,yAxisYArray]);
    		});
    	}
    }, {
    	/**
    	 * @description : (TODO) 添加路牌.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'addlp',
    	value : function addlp() {
    		// 获取初始路牌总数.
    		 var len = $_GlobalGraph.configuration.taskTypes.length;
    		 // 添加路牌.
    		 $_GlobalGraph.configuration.taskTypes.push({'lp':null,'lpName':len+1,'lpNo':len+1,'lpType':'普通路牌'});
    		 // 添加路牌编码
    		 $_GlobalGraph.configuration.lpNoA.push(len+1);
    		 $_GlobalGraph.configuration.lpNameA.push(len+1);
    		 // 修改图形高度
    		 $_GlobalGraph.configuration.height = $_GlobalGraph.configuration.lpNoA.length*60 + 240;
    		 // 修改初始化图形时间轴开始时间
    		 $_GlobalGraph.configuration.timeDomainStart=new Date($_GlobalGraph.configuration.startStr);
    		 // 修改初始化图形时间轴结束时间
    		 $_GlobalGraph.configuration.timeDomainEnd=new Date($_GlobalGraph.configuration.endStr);
    		 // 获取数据.
    		 var data_ = $_GlobalGraph.getDataArray();
    		 // 删除图形.
    		 $('svg.svg-chart').remove();
    		 // 重新创建图形.
    		 var graph_ = d3.select('#ganttSvg').relationshipGraph($_GlobalGraph.configuration);
    		 // 根据数据重新渲染图形.
    		 graph_.data(data_);
    		 $_GlobalGraph = graph_;
    		 // 记录当前操作.
    		 graph_.addHistory();
    		 // 弹出提示消息
    		 layer.msg('操作成功!已添路牌【'+  (len+1) +'】!');
    	}
    	
    }, {
    	key : 'testFcno',
    	value : function testFcno(arr) {
    		for(var r = 0 ; r<arr.length;r++) {
    			console.log(arr[r].fcno);
    		}
    	}
    }, {
    	/**
    	 * 均匀发车间隙
    	 * 
    	 */
    	key : 'updownread01',
    	value : function updownread01() {
    		var list = $_GlobalGraph.getDataArray();
    		var dataMap = $_GlobalGraph.configuration.dataMap;
    		var cara =  $_GlobalGraph.configuration.taskTypes;
    		var bxrcgs = $_GlobalGraph.configuration.bxrcgs;
    		var resultJA = new Array();
    		if(list.length !=0 && dataMap!=null && dataMap!='' && cara.length !=0) {
    			var rsmap = BaseFun.getsxAndxxbc(list,dataMap);
        		var jar01 = rsmap.qt.concat(rsmap.sxbc).concat(rsmap.xxbc);
        		BaseFun.jhfcjx01(jar01,dataMap);
        		var jar = BaseFun.tzsmbcsj01(
    					BaseFun.setbcsAndfcno(BaseFun.tzsmbcsj01(BaseFun.setbcsAndfcno(BaseFun.tzsztest(cara,jar01,dataMap)),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,dataMap.lbsj,dataMap)),
    							dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,dataMap.lbsj,dataMap);
        		for(var r = 0 ; r < bxrcgs.length; r++) {
    				var lpNo = bxrcgs[r].lpNo;
    				var gsv = 0 , bczs = 0;
    				for(var g = 0 ; g< jar.length; g++) {
    					if(jar[g].lpNo == lpNo) {
    						gsv = gsv + jar[g].bcsj + jar[g].STOPTIME;
    						bczs++;
    					}
    				}
    				bxrcgs[r].sjgsV = gsv;
    				bxrcgs[r].bczs = bczs;
    			}
        		var jar3 = BaseFun.dqbcsAndgs(bxrcgs,jar,dataMap,cara.length);
        		var rsjar = BaseFun.tzsztest(cara,jar3,dataMap);
        		resultJA = BaseFun.addjcclcbc01(cara,rsjar,dataMap,$_GlobalGraph.configuration.stopAraay,dataMap.map);
    		} else {
    			resultJA = list;
    			error.show('参数异常!','【 list:' + list + ' , dataMap:' 
    					+ dataMap + ' , cara:' + cara + ' , bxrcgs:' + bxrcgs + '】');
    		}
			// 删除图形.
   		 	$('svg.svg-chart').remove();
   		 	// 重新创建图形.
   		 	var graph_ = d3.select('#ganttSvg').relationshipGraph($_GlobalGraph.configuration);
   		 	// 根据数据重新渲染图形.
   		 	graph_.data(resultJA);
   		 	$_GlobalGraph = graph_;
    	}
    }, {
    	key : 'updownread',
    	value : function updownread() {
    		//var index = layer.load(1, {shade: [0.1,'#fff'] });//0.1透明度的白色背景
    		// 1、获取所有班次数.
    		var list = $_GlobalGraph.getDataArray();
    		//console.log(list.length);
    		// 2、获取方向代码.
    		var upDir = $_GlobalGraph.configuration.dataMap.dira[0],// 2.1 上行方向.
    			downDir = $_GlobalGraph.configuration.dataMap.dira[1];// 2.2 下行方向.
    		// 3、获取周转时间.
    		var zzsj = $_GlobalGraph.configuration.stopAraay[0].zzsj;
    		// 4、根据方向,归类班次.[上行班次;下行班次;其他班次(早晚例保、进出场、吃饭时间)].
    		var tempa = BaseFun.getDirBc(list,$_GlobalGraph.configuration.dataMap.dira);
    		//console.log(tempa);
    		//console.log(tempa.upArr.concat(tempa.downArr).length);
    		// 5、均匀上行班次的发车间距.
    		if(tempa.upArr.length>0)
    			BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap);
    		//var sxbc = BaseFun.jhfcjx(tempa.upArr,upDir,zzsj,$_GlobalGraph.configuration.dataMap);
    		//console.log('getDirBc---- '+tempa.downArr.length);
    		// 6、均匀下行班次的发车间距.
    		if(tempa.downArr.length>0)
    			BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap);
    		//var xxbc = BaseFun.jhfcjx(tempa.downArr,downDir,zzsj,$_GlobalGraph.configuration.dataMap);
    		//console.log('jhfcjx---'+ xxbc.length);
    		//console.log(sxbc.concat(xxbc).length);
    		// $_GlobalGraph.data(sxbc);
    		// console.log($_GlobalGraph.configuration);
    		var rsData = BaseFun.tztzsj01(tempa.upArr.concat(tempa.downArr),$_GlobalGraph.configuration.lpNoA,$_GlobalGraph.configuration.dataMap);
    		var jar = BaseFun.tzsmbcsj(BaseFun.setbcsAndfcno(rsData),$_GlobalGraph.configuration.dataMap.smbcsjArr,
    				$_GlobalGraph.configuration.dataMap.ccsjArr,
    				$_GlobalGraph.configuration.dataMap.cclcArr,
    				$_GlobalGraph.configuration.dataMap.qdzArr,
    				$_GlobalGraph.configuration.stopAraay[0].lbsj);
    		
    		var resultJA = new Array();
    		for(var m = 0 ; m < $_GlobalGraph.configuration.taskTypes.length; m++) {
    			// 获取路牌编号.
    			var lpNo_ = $_GlobalGraph.configuration.taskTypes[m].lpNo;
    			// 定义路牌下的所有班次.
    			var lpbc_ = new Array();
    			// 遍历班次数.
    			for(var j =0 ; j <jar.length; j++) {
    				// 判断当期遍历的班次是否属于当前的路牌.
    				if(jar[j].lpNo == lpNo_)
    					lpbc_.push(jar[j]);
    			}
    			// 按照发车序号顺序排序.
    			lpbc_.sort(function(a,b){return a.fcno-b.fcno});
    			resultJA = resultJA.concat(BaseFun.addjclbbc(lpbc_,
    					$_GlobalGraph.configuration.dataMap,$_GlobalGraph.configuration.stopAraay[0].lbsj,$_GlobalGraph.configuration.dataMap.map));
    		}
    		
    		 // 删除图形.
   		 	$('svg.svg-chart').remove();
   		 	// 重新创建图形.
   		 	var graph_ = d3.select('#ganttSvg').relationshipGraph($_GlobalGraph.configuration);
   		 	// 根据数据重新渲染图形.
   		 	graph_.data(resultJA);
   		 	$_GlobalGraph = graph_;
    		// $_GlobalGraph.data(rsData);
    		/*BaseFun.tztzsj(jar,$_GlobalGraph.configuration.lpNoA,$_GlobalGraph.configuration.dataMap);*/
    		/*var resultJA = new Array();
    		for(var m = 0 ; m < $_GlobalGraph.configuration.taskTypes.length; m++) {
    			// 获取路牌编号.
    			var lpNo_ = $_GlobalGraph.configuration.taskTypes[m].lpNo;
    			// 定义路牌下的所有班次.
    			var lpbc_ = new Array();
    			// 遍历班次数.
    			for(var j =0 ; j <jar.length; j++) {
    				// 判断当期遍历的班次是否属于当前的路牌.
    				if(jar[j].lpNo == lpNo_)
    					lpbc_.push(jar[j]);
    			}
    			// 按照发车序号顺序排序.
    			lpbc_.sort(function(a,b){return a.fcno-b.fcno});
    			resultJA = resultJA.concat(BaseFun.addjclbbc(lpbc_,
    					$_GlobalGraph.configuration.dataMap,$_GlobalGraph.configuration.stopAraay[0].lbsj,$_GlobalGraph.configuration.dataMap.map));
    		}*/
    		
    		// BaseFun.tztzsj01(xxbc.concat(sxbc),$_GlobalGraph.configuration.lpNoA,$_GlobalGraph.configuration.dataMap)
    		// $_GlobalGraph.data(BaseFun.tztzsj01(jar,$_GlobalGraph.configuration.lpNoA,$_GlobalGraph.configuration.dataMap));
    		// 7、调整停站间隙.
    		// var data = BaseFun.tztzsj(sxbc.concat(xxbc).concat(tempa.qt),$_GlobalGraph.configuration.lpNoA,$_GlobalGraph.configuration.dataMap);
    		// 8、重新给定班次序号和发车序号.再确定首末班车时间.最后渲染数据.
    		/*$_GlobalGraph.data(BaseFun.tzsmbcsj(BaseFun.setbcsAndfcno(data),
    				$_GlobalGraph.configuration.dataMap.smbcsjArr,
    				$_GlobalGraph.configuration.dataMap.ccsjArr,
    				$_GlobalGraph.configuration.dataMap.cclcArr,
    				$_GlobalGraph.configuration.dataMap.qdzArr,
    				$_GlobalGraph.configuration.dataMap.lbsj));*/
    		// 9、记录早操.并保存历史班次数据.
    		// $_GlobalGraph.addHistory();
    		//layer.close(index);
    	}
    }, {
    	/**
    	 * @description : (TODO) 班次调整函数.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'aboutread',
    	value : function aboutread() {
    		// 弹出层mobal页面
    		$.get('/pages/base/timesmodel/bctz.html', function(m){
    			$(pjaxContainer).append(m);
    			// 获取各路牌下的班次数
    			var lpbcs = $_GlobalGraph.getbczs($_GlobalGraph.getDataArray() , yAxisYArray , $_GlobalGraph.configuration.dataMap);
    			$('#tzbc_mobal').trigger('tzbcMobal.show',[$_GlobalGraph , lpbcs , BaseFun , ErrorInfo]);
    		});
    	}
    	
    }, {
    	key : 'editlpEvents',
    	value : function() {
    		// 弹出层mobal页面
    		$.get('/pages/base/timesmodel/editlp.html', function(m){
    			$(pjaxContainer).append(m);
    			$('#editlp_mobal').trigger('editlpMobal.show',[$_GlobalGraph,BaseFun]);
    		});
    	}
    }, {
    	key : 'checkAdd',
    	value : function checkAdd() {
    		var xl = $_GlobalGraph.configuration.dataMap.map.lineName.split('_');
    		if($_GlobalGraph.configuration.dataMap.map.istidc==1) {
    			layer.confirm('系统已存在-->线路【'+ 
    					$_GlobalGraph.configuration.dataMap.map.xlmc +'】-->时刻表【'+
    					$_GlobalGraph.configuration.dataMap.map.skbmc +
    					'】明细!是否覆盖!', {
					btn : [ '确认并提交', '取消' ]
				},function () {
					// 关闭所有提示弹出层.
					layer.closeAll();
					RelationshipGraph.submit($_GlobalGraph.configuration.dataMap.map.skbName,xl[0]);
				});
    		}else {
    			RelationshipGraph.submit($_GlobalGraph.configuration.dataMap.map.skbName,xl[0]);
    		}
    	}
    	
    },{ 
    	key : 'submit',
    	value : function submit(skb,xl) {
    		// 1、获取所有班次数据.
    		var listA = $_GlobalGraph.getDataArray();
    		// 2、弹出提示层.
    		var index = layer.load(1, {
    			  shade: [0.1,'#fff'] // 0.1透明度的白色背景
    		});
    		// 3、post请求保存数据.
    		$post('/tidc/skbDetailMxSave',{'d':JSON.stringify(listA), 'xl':xl, 'skb':skb},function(result) {
    			// 3.1、关闭弹出层.
    			layer.close(index);
    			if(result){
    				if(result.status=='SUCCESS') {
    					layer.msg('保存成功...');// 弹出添加成功提示消息
    				} else if(result.status=='ERROR') {
    					layer.msg('保存失败...');// 弹出添加失败提示消息
    				}
    			}
    			loadPage('index.html');// 返回index.html页面
    		});
    	}
    }, {
    	/**
    	 * @description : (TODO) 撤销函数.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'cancel',
    	value : function cancel() {
    		// 关闭弹出层.
    		layer.closeAll();
			// 判断当对图形操作的步骤.
			if($_keyIndex==1) {
				layer.msg('已经是撤回到操作记录的【第一步】了!');
				return;
			}
			// 标记操作下标后退.
			$_keyIndex--;
			// 删除图形.
			$('svg.svg-chart').remove();
			// 获取撤销到当前操作下标的数据.
			var _obj = historyArray[$_keyIndex-1];
			// 创建图形对象.
			var graph_ = d3.select('#ganttSvg').relationshipGraph(JSON.parse(_obj.granph));
			// 根据数据重新渲染图形.
			graph_.data(JSON.parse(_obj.data));
			// 重新赋值图形对象.
			$_GlobalGraph = graph_;
			// 重新赋值图形对象.
			layer.msg('您已成功从【第 '+ ($_keyIndex+1) +'】撤销到【第 ' + ($_keyIndex) + '步】!');
    	},
    }, {
    	/**
    	 * @description : (TODO) 恢复函数.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'regain',
    	value : function regain() {
    		// 关闭弹出层.
    		layer.closeAll();
    		// 判断当前操作是否恢复到最后一步的操纵.
			if($_keyIndex==historyArray.length) {
				layer.msg('已经是恢复到操作记录的【最后一步】了!');
				return;
			} 
			// 标记操作下标前进.
			$_keyIndex++;
			// 删除图形.
    		$('svg.svg-chart').remove();
    		// 获取撤销到当前操作下标的数据.
    		var _obj = historyArray[$_keyIndex-1];
    		// 创建图形对象.
    		var graph_ = d3.select('#ganttSvg').relationshipGraph(JSON.parse(_obj.granph));
    		// 根据数据重新渲染图形.
    		graph_.data(JSON.parse(_obj.data));
    		// 重新赋值图形对象.
    		$_GlobalGraph = graph_;
    		// 弹出提示.
    		layer.msg('您已成功从【第 '+ ($_keyIndex-1) +'】恢复到【第 ' + ($_keyIndex) + '步】!');
    	},
    }, {
    	/**
    	 * @description : (TODO) 获取底层Rect元素Id属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个底层Rect元素Id属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setIdValue',
    	value : function setIdValue(obj) {
    		// 设置id属性值. 由一个 常量字符串 + 班次数 + 常量字符串 + 发车序号 + 常量字符 + 对应的y轴值.
        	// return 'shift-rect-' + obj.bcs + '_' + obj.fcno + '_' + $_GlobalGraph.configuration.y(obj.parent);
    		return 'shift-rect-' + obj.bcs + '_' + obj.fcno + '_' + $_GlobalGraph.configuration.y(obj.lpName);
    	}
    }, {
    	/**
    	 * @description : (TODO) 获取X坐标属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个X坐标属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setXValue',
    	value : function setXValue(obj) {
        	// 设置x坐标值.
        	var hourMinue = obj.fcsj.split(":");
        	return (parseInt(hourMinue[0])-$_GlobalGraph.configuration.dxHours )*60*$_GlobalGraph.configuration.multiple + 
					parseInt(hourMinue[1])*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取Y坐标属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个Y坐标属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setYValue',
    	value : function setYValue(obj) {
        	/*return $_GlobalGraph.configuration.y(obj.parent) + $_GlobalGraph.configuration.offsetY;*/
    		return $_GlobalGraph.configuration.y(obj.lpName) + $_GlobalGraph.configuration.offsetY;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取Rect元素class属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个Rect元素class属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setRectClassV',
    	value : function setRectClassV(obj) {
        	return obj.xlDir+ " data";
        }
    }, {
    	/**
    	 * @description : (TODO) 获取Rect元素width属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个Rect元素width属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setRectWidthV',
    	value : function setRectWidthV(obj) {
        	return obj.bcsj * $_GlobalGraph.configuration.multiple;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取Rect元素高度属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个Rect元素高度属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setRectHeight',
    	value : function setRectHeight(obj) {
        	return  $_GlobalGraph.configuration.y.rangeBand() + 2; 
        }
    }, {
    	/**
    	 * @description : (TODO) 获取底层rect父元素ID属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个底层rect父元素ID属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setRectParenNodeIdV',
    	value : function setRectParenNodeIdV(obj) {
        	// return 'parent_' + $_GlobalGraph.configuration.y(obj.parent) + '_' + obj.bcs + "_node_" + obj.fcno;
    		return 'parent_' + $_GlobalGraph.configuration.y(obj.lpName) + '_' + obj.bcs + "_node_" + obj.fcno;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取下一个底层rect元素ID值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个下一个底层rect元素ID值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setNextNodeIdV',
    	value : function setNextNodeIdV(obj) {
        	// return "shift-rect-" + (obj.bcs+1)  + '_' +  (obj.fcno+1) + '_' + $_GlobalGraph.configuration.y(obj.parent);
    		return "shift-rect-" + (obj.bcs+1)  + '_' +  (obj.fcno+1) + '_' + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	/**
    	 * @description : (TODO) 获取上一个底层rect元素ID值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个上一个底层rect元素ID值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setLastNodeIdV',
    	value : function setLastNodeIdV(obj) {
        	// return "shift-rect-" + (obj.bcs-1)  + '_' + (obj.fcno-1)+ '_' + $_GlobalGraph.configuration.y(obj.parent);
    		return "shift-rect-" + (obj.bcs-1)  + '_' + (obj.fcno-1)+ '_' + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	/**
    	 * @description : (TODO) 获取元素类型.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个元素类型.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setNodeType',
    	value : function setNodeType(type) {
        	return type;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text01元素ID属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text01元素ID属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText01IdV',
    	value : function setText01IdV(obj) {
        	// return "shift-rect-text01-" + obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.parent);
    		return "shift-rect-text01-" + obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text元素dx属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text元素dx属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setTextDxV',
    	value : function setTextDxV(dx) {
    		return dx;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text元素dy属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text元素dy属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setTextDyV',
    	value : function setTextDyV(dy) {
    		return dy;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text元素class属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text元素class属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setTextClassV',
    	value : function setTextClassV(obj) {
    		return obj.xlDir+ "-text";
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text01元素text文本.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text01元素text文本.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText01text',
    	value :function setText01text(obj) {
    		var text = '';
        	// 判断.如果班次时间大于〇 ,并且当前班次类型是 (正常班次、区间班次、直放班次、放站班次)其中的一种.则展示.这里的判断班次时间是为了隐藏那些班次时间为零的班次.
    		if(obj.bcsj > 0 && (obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.normal || 
    							obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
    							obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.major  ||
    							obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.venting)) {
    			 var nowDate = new Date($_GlobalGraph.configuration.timeDomainStart);
    			 var hourMinuArray = obj.fcsj.split(":");
           	 	 nowDate.setHours(parseInt(hourMinuArray[0]));
           	 	 nowDate.setMinutes(parseInt(hourMinuArray[1])+obj.bcsj);
           	 	 text =  obj.fcsj + '~' + (nowDate.getHours()<10? "0" + nowDate.getHours():nowDate.getHours()) + 
           	 	 		":"  + 
           	 	 		(nowDate.getMinutes()<10?"0"+nowDate.getMinutes():nowDate.getMinutes());
    		 }
    		 return text;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取circle圆元素ID值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个circle圆元素ID值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCircleIdV',
    	value : function setCircleIdV(obj) {
     	   // return "shift-rect-circle-" +  obj.bcs + '_' + obj.fcno  + $_GlobalGraph.configuration.y(obj.parent);
    		return "shift-rect-circle-" +  obj.bcs + '_' + obj.fcno  + $_GlobalGraph.configuration.y(obj.lpName);
         }
    }, {
    	/**
    	 * @description : (TODO) 获取circle圆元素cx值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个circle圆元素cx值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCirclecxV',
    	value :  function setCirclecxV(obj) {
    		var hourMinue = obj.fcsj.split(":");
        	return  (parseInt(hourMinue[0])-$_GlobalGraph.configuration.dxHours )*60*$_GlobalGraph.configuration.multiple + 
	 			 	parseInt(hourMinue[1])*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX +  
	 			 	obj.bcsj * $_GlobalGraph.configuration.multiple - 12;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取circle圆元素cy值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个circle圆元素cy值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCirclecyV',
    	value : function setCirclecyV(obj) {
        	/*return $_GlobalGraph.configuration.y(obj.parent) +  $_GlobalGraph.configuration.offsetY + 12;*/
    		return $_GlobalGraph.configuration.y(obj.lpName) +   $_GlobalGraph.configuration.offsetY + 12;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取circle圆元素r半径值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个circle圆元素r半径值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCircleRV',
    	value : function setCircleRV(obj) {
        	// 设置圆的半径.判断.如果班次时间大于〇则设置圆的半径常量8. 这里的判断是为了隐藏那些班次时间为零的班次.
    	    if(obj.bcsj>0)
    		    return 8 ;
    	    else
    		    return 0;
       }
    }, {
    	/**
    	 * @description : (TODO) 获取circle圆元素class值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个circle圆元素class值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCircleClass',
    	value : function setCircleClass(obj) {
     	   return obj.xlDir+ "-circle";
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text02元素ID属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text02元素ID属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText02IdV',
    	value : function setText02IdV(obj) {
           	// return "shift-rect-text02-" +  obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.parent);
    		 return "shift-rect-text02-" +  obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text02元素text文本值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text02元素text文本值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText02text',
    	value : function setText02text(obj) {
    		var text = '';
    		if(obj.bcsj>0) {
    			if(obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.bd ||
    			   obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.out|| 
				   obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.in_|| 
				   obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
    				text =  obj.fcsj;
    			else if(obj.bcType=='cf')
    				text = '吃:' + obj.bcsj;
    			else 
    				text = "行:" + obj.bcsj;
    		}
    		return text;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text03元素ID属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text03元素ID属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText03IdV',
    	value : function setText03IdV(obj) {
        	/*return "shift-rect-text03-" +  obj.bcs + '_' + obj.fcno  + $_GlobalGraph.configuration.y(obj.parent);*/
    		return "shift-rect-text03-" +  obj.bcs + '_' + obj.fcno  + $_GlobalGraph.configuration.y(obj.lpName);
        	
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text03元素text文本值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text03元素text文本值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText03text',
    	value : function setText03text(obj) {
    		var text = '';
    		if(obj.bcsj>0) {
    			if(obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.bd ||
    			   obj.bcType==$_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
    				text = "保:" + obj.bcsj;
    			else if(obj.bcType=='out' || obj.bcType=='in')
    				text = "行:" + obj.bcsj;
    			else 
    				text = "停:" + obj.STOPTIME;
    		}
    		return text;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text04元素ID属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text04元素ID属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText04IdV',
    	value : function (obj) {
     	   /*return "shift-rect-text04-" +  obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.parent);*/
    		return "shift-rect-text04-" +  obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text04元素x属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text04元素x属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText04XV',
    	value : function (obj) {
     	   var hourMinue = obj.fcsj.split(":");
           return (parseInt(hourMinue[0])-$_GlobalGraph.configuration.dxHours )*60*$_GlobalGraph.configuration.multiple + 
           		  parseInt(hourMinue[1])*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX +  
           		  obj.bcsj * $_GlobalGraph.configuration.multiple - 18;
       }
    }, {
    	/**
    	 * @description : (TODO) 获取text04元素y属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text04元素y属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText04YV',
    	value : function setText04YV(obj) {
    		/*return $_GlobalGraph.configuration.y(obj.parent) +  $_GlobalGraph.configuration.offsetY + 16;*/
    		return  $_GlobalGraph.configuration.y(obj.lpName) +$_GlobalGraph.configuration.offsetY + 16;
    		
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text04元素class属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text04元素class属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText04ClassV',
    	value : function setText04ClassV(obj) {
          	return obj.xlDir+ "-circle-text";
        }
    }, {
    	/**
    	 * @description : (TODO) 获取text04元素text文本值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个text04元素text文本值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setText04text',
    	value : function(obj) {
    		if(obj.bcsj>0) {
    			if(obj.isfb == 1){
    				return '分';
    			}else {
    				if(obj.bcType=='normal')
        				return '正';
        			else if(obj.bcType=='region')
        				return '区';
        			else if(obj.bcType=='major')
        				return '站';
        			else if(obj.bcType=='venting')
        				return '直';
        			else if(obj.bcType=='fb')
        				return '分';
        			else if(obj.bcType=='in')
        				return '进';
            	 	else if(obj.bcType=='lc')
            	 		return '离';
            	 	else if(obj.bcType=='out')
            	 		return '出';
            	 	else if(obj.bcType=='bd')
            	 		return '到';
            	 	else if(obj.bcType=='cf')
            	 		return '吃';
    			}
    	    }
    	}
    }, {
    	/**
    	 * @description : (TODO) 获取底层Rect元素的覆盖层rect元素Id属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个底层Rect元素的覆盖层rect元素Id属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCoverRectIdV',
    	value : function setCoverRectIdV(obj) {
        	/*return "shift-rect-cover-" +  obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.parent);*/
    		return "shift-rect-cover-" +  obj.bcs + '_' + obj.fcno + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	/**
    	 * @description : (TODO) 获取底层Rect元素的覆盖层rect元素class属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个底层Rect元素的覆盖层rect元素class属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCoverRectClassV',
    	value : function setCoverRectClassV(className) {
        	return className;
        }
    }, {
    	/**
    	 * @description : (TODO) 获取底层Rect元素的覆盖层rect元素paren-node属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个底层Rect元素的覆盖层rect元素paren-node属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCoverRectParentV',
    	value : function setCoverRectParentV(obj) {
        	//return "shift-rect-" + obj.bcs + '_' + obj.fcno + '_' + $_GlobalGraph.configuration.y(obj.parent) + '-cover';
    		return "shift-rect-" + obj.bcs + '_' + obj.fcno + '_' + $_GlobalGraph.configuration.y(obj.lpName) + '-cover';
        }
    }, {
    	/**
    	 * @description : (TODO) 获取底层Rect元素的覆盖层rect元素next-node属性值.
    	 * 
    	 * @param [obj--当前班次对象属性值]
    	 * 
    	 * @return 返回一个底层Rect元素的覆盖层rect元素next-node属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'setCoverRectLastIdV',
    	value : function setCoverRectLastIdV(obj) {
        	// return "shift-rect-cover-" +  obj.bcs + '_' + (obj.fcno+1) + $_GlobalGraph.configuration.y(obj.parent);
    		return "shift-rect-cover-" +  obj.bcs + '_' + (obj.fcno+1) + $_GlobalGraph.configuration.y(obj.lpName);
        }
    }, {
    	key : 'mouseUpEvent',
    	value : function mouseUpEvent(flag) {
    		// 5.1.2、 获取选择框的最小X、最小Y、最大X、最大Y.
			var caseRect = RelationshipGraph.getCaseRectAttribute(d3.selectAll('rect.case_rect'));
			// 5.1.3、获取所有的class为data的rect元素(班次)对象.
			var rectNodes = $('rect.data');
			// 5.1.4、定义被选中的上、下行元素(班次)元素对象x、y、parentId值数组 .
			var arrayUpX = new Array(),arrayUpY = new Array(),arrayDownX = new Array(),arrayDownY  = new Array(),parA = new Array();
			// 5.1.5、遍历所有的元素对象. 获取出被选中的元素(班次)对象.
			for(var n = 0;n<rectNodes.length;n++) {
				// 5.1.5.1、定义当前元素最小X
				var downStartX =  parseInt($(rectNodes[n]).attr('x')),
					downEndX = downStartX + parseInt($(rectNodes[n]).attr('width'));// 5.1.5.2、定义当前元素最大X
				// 5.1.5.3、定义当前元素最小Y
				var downStartY = parseInt($(rectNodes[n]).attr('y')),
					downEndY = downStartY + parseInt($(rectNodes[n]).attr('height'));// 5.1.5.4、定义当前元素最大Y
				/**
				 * 5.1.5.4、 判断当前班次是否被框选在选中框内
				 * 
				 * 		    ✿ 图形理解判断条件  最大框代表选择框,框中的小方块代表选中的班次.
				 * 
				 * 			minX----------------------------- maxY 
				 * 			 	│  							│			
				 * 			   	│	□ □ □ □	□ □	□ □	□		│
				 * 				│							│
				 * 			minY----------------------------- maxX
				 * 
				 * 			如果当前小方块的最大X > 选择框的minX 并且 当前小方块的最小X < 选择框的maxX
				 * 			并且当前小方块的最大Y > 选择框的minY 并且 当前小方块的最小Y < 选择框的maxY
				 * 			则代表当前小方块在选择框内.
				 **/
				if((downEndX > caseRect.caseRectMinX && downStartX < caseRect.caseRectMaxX) &&
             	         (downEndY > caseRect.caseRectMinY && downStartY < caseRect.caseRectMaxY)){
					var node = d3.select(rectNodes[n]);
					// 5.1.5.4.1、 获取当前元素的data数据.
					var d = node.data()[0];
					// 除去首末班车班次、早晚例保、进出场班次、吃饭班次.
					if(RelationshipGraph.issmbc(d.fcsj) ||  d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd || 
		    				 d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
		    				 d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf ||
		    				 d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_ ||
		    				 d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
						continue;
					if(parA.indexOf(d.lpNo)<0)
						parA.push(d.lpNo);
					// 5.1.5.4.4、 把当前选择的最小x添加到arrayUpX数组中.
					arrayUpX.push(downStartX);
					// 5.1.5.4.5、 把当前选择的最小y添加到arrayUpY数组中.
					arrayUpY.push(downStartY);
					// 5.1.5.4.6、 把当前选择的最大x添加到arrayDownX数组中.
					arrayDownX.push(downEndX);
					// 5.1.5.4.7、 把当前选择的最大y添加到arrayDownY数组中.
          			arrayDownY.push(downEndY);
          			// 5.1.5.4.8、 把当前选择的元素的parent-node元素节点属性值添加到gClassNameArray中.
          			gClassNameArray.push(node.attr('parent-node'));
				}
			}
			// 5.1.6、如果没有选择到元素(班次).给出提示,并执行选择框关闭事件.
			if(gClassNameArray.length==0) {
				// 5.1.6.1、弹出提示框.
				layer.msg('您没有框选中班次,请重新框选...');
				// 5.1.6.2、清除
				RelationshipGraph.gClose();
   			 	// 5.1.6.3、结束事件.
   			 	return false;
   		 	}
			gClassNameArray.parA = parA;
			// 5.1.7、遍历 标记被选择的元素parent-node属性节点值的元素 添加class caseactive选中标记.
			for(var c =0;c<gClassNameArray.length;c++) {
				if(typeof(gClassNameArray[c])=='string') {
					var parentNodeCName = gClassNameArray[c], nodes = d3.selectAll('rect[parent-node='+ parentNodeCName +']')[0];
    				for(var l =0;l<nodes.length;l++) {
    					d3.select(nodes[l]).classed({'caseactive':true});
    					var childrenNodesCName = $(nodes[l]).attr('id'),childrenNodes = $('text[parent-node='+ childrenNodesCName +']');
    					d3.select('rect[parent-node='+ childrenNodesCName +'-cover]').classed({'caseactive':true});
    					d3.select(d3.selectAll('circle[parent-node='+ childrenNodesCName +']')[0][0]).classed({'caseactive':true});
    					for(var t = 0;t<childrenNodes.length;t++) {
    						d3.select(childrenNodes[t]).classed({'caseactive':true});
    					}
    				}
				}
			}
			// 5.1.8、获取选择框元素对象.
			var d3CaseRectNode = d3.selectAll(".gantt-chart").selectAll('rect.case_rect');
			// 5.1.9、重新计算选择框的x、y、width、height属性值,并加上钢琴版动画效果.
 	        _animation(d3CaseRectNode).attr("x",function(d){
 	            return Math.min.apply(null, arrayUpX) -4;
 	        }).attr("y",function(d){
 	            return Math.min.apply(null, arrayUpY) -4;
 	        }).attr("width",function(d){
 	            return Math.max.apply(null, arrayDownX) - Math.min.apply(null, arrayUpX) + 8;
 	        }).attr("height",function(d){
 	            return Math.max.apply(null, arrayDownY) - Math.min.apply(null, arrayDownY) + parseInt(d3.select('rect[parent-node='+ gClassNameArray[0] +']').attr('height')) + 8;
 	        });
 	        // 5.1.9.10、延迟350毫秒绘制选择框上的关闭、拖动(左、右、中)按钮 .
			setTimeout(function(){
				RelationshipGraph._delayExecute();// 绘制选择框上的关闭、拖动(左、右、中)按钮. 
				// 重新绘制g.shift下的选中元素.
				RelationshipGraph.restCaseNodes(document.querySelector("g.shift"),document.querySelectorAll("g.shift .caseactive"));
				// 重新绘制g.case_g下的选中元素.
				RelationshipGraph.restCaseNodes(document.querySelector("g.case_g"),document.querySelectorAll("g.case_g .caseactive"));
				
			},350);
    	}
    }, {
    	key : 'restCaseNodes',
    	value : function(parends , nodes) {
    		for(var n = 0 ;  n<nodes.length;n++) {
    			parends.removeChild(nodes[n]);
    			parends.appendChild(nodes[n]);
    		}
    	}
    }, {
        key: 'noop',
        value: function noop() {}
    }, {
        key: 'isArray',
        value: function isArray(arr) {
            return Object.prototype.toString.call(arr) == '[object Array]';
        }
    }, {
    	key : 'getCaseRectAttribute',
    	value : function getCaseRectAttribute(node) {
    		var caseRectMinX = parseInt(node.attr('x')),
				caseRectMinY = parseInt(node.attr('y'));
    		var caseRectMaxX = caseRectMinX + parseInt(node.attr('width')),
				caseRectMaxY = caseRectMinY + parseInt(node.attr('height'));
    		return {'caseRectMinX' : caseRectMinX, 'caseRectMinY': caseRectMinY, 'caseRectMaxX': caseRectMaxX,'caseRectMaxY':caseRectMaxY};
    	}
    }, {
    	/** 
    	 * @description : (TODO) 绘制选择框上的关闭、拖动(左、右、中)按钮. 
    	 * 
    	 * @stauts : OK.
    	 *
    	 **/
    	key : '_delayExecute',
    	value : function _delayExecute() {
    		// 1、获取选择框元素对象.
    		var gCaseNode = d3.selectAll('g.case_g');
    		// 2、获取选择框的最小X、最小Y、最大X、最大Y. 
    		var caseRect = RelationshipGraph.getCaseRectAttribute(d3.selectAll('rect.case_rect'));
    		// 3、计算Y轴方向中间点的Y坐标.
    		var Ds_yToe_d = Math.abs(caseRect.caseRectMaxY - caseRect.caseRectMinY)/2;
    		// 4、计算X轴方向中间点的X坐标.
    		var Ds_xToe_x = Math.abs(caseRect.caseRectMaxX - caseRect.caseRectMinX)/2;
    		// 5、给选择框添加圆.这里画选择框关闭按钮
    		gCaseNode.append('circle').classed({'c_close caseactive':true})
    				 .attr('cx', caseRect.caseRectMaxX+5).attr('cy', caseRect.caseRectMinY-5).attr('r', 8)
    				 .attr('group-id','c_close')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'c_close_so caseactive':true})
    				 .attr('cx', caseRect.caseRectMaxX+5).attr('cy', caseRect.caseRectMinY-5).attr('r', 6)
    				 .attr('group-id','c_close')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('line').classed({'c_close_line_r caseactive':true})
    				 .attr('x1', caseRect.caseRectMaxX+2)
    				 .attr('y1',  caseRect.caseRectMinY-8)
    				 .attr('x2', caseRect.caseRectMaxX+8)
    				 .attr('y2', caseRect.caseRectMinY-2)
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('line').classed({'c_close_line_l caseactive':true})
    				 .attr('x1', caseRect.caseRectMaxX+2)
    				 .attr('y1', caseRect.caseRectMinY-2)
    				 .attr('x2', caseRect.caseRectMaxX+8)
    				 .attr('y2',caseRect.caseRectMinY-8)
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'c_close_cover caseactive':true})
    				 .attr('cx', caseRect.caseRectMaxX+5).attr('cy',caseRect.caseRectMinY-5).attr('r', 10)
    				 .attr('group-id','c_close')
    				 .attr('parent-node','case_rectId')
    				 .on('mouseover', function() {
    					 $(this).css("cursor","pointer");
    		           	 $("circle.c_close").css("opacity",1)
    		           	 $("line.c_close_line_r").css("opacity",1)
    		           	 $("line.c_close_line_l").css("opacity",1)
    				 }).on('mouseout',function() {
    					 $(this).css("cursor","default");
    		           	 $("circle.c_close").css("opacity",0.5)
    		           	 $("line.c_close_line_r").css("opacity",0.5)
    		           	 $("line.c_close_line_l").css("opacity",0.5)
    				 }).on('click', RelationshipGraph.gClose);
    		// 6、给选择框添加圆.这里画左边拖拽点.
    		gCaseNode.append('circle').classed({'test_r_left caseactive':true})
    				 .attr('cx', caseRect.caseRectMinX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 6)
    				 .attr('group-id','c_left')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'test_r_left_so caseactive':true})
    				 .attr('cx', caseRect.caseRectMinX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 4)
    				 .attr('group-id','c_left')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'test_r_left_solid caseactive':true})
    				 .attr('cx', caseRect.caseRectMinX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 2)
    				 .attr('group-id','c_left')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'r_left_cover caseactive':true})
    				 .attr('cx', caseRect.caseRectMinX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 6)
    				 .attr('group-id','c_left')
    				 .attr('parent-node','case_rectId')
    				 .call(d3.behavior.drag()
    						 .on("dragstart",RelationshipGraph.dragLeftStart)
    						 .on("drag",RelationshipGraph.dragLeftRuing)
    						 .on("dragend",RelationshipGraph.dragLeftStop))
    				 .on('mouseover', function() {
    					 $(this).css("cursor","e-resize");
    				 }).on('mouseout',function() {
    					 $(this).css("cursor","default");
    				 });
    		// 7、给选择框添加圆.这里画右边拖拽点.
    		gCaseNode.append('circle').classed({'test_r_right caseactive':true})
    				 .attr('cx', caseRect.caseRectMaxX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 6)
    				 .attr('group-id','c_right')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'test_r_right_so caseactive':true})
    				 .attr('cx', caseRect.caseRectMaxX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 4)
    				 .attr('group-id','c_right')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'test_r_right_solid caseactive':true})
    		 		 .attr('cx', caseRect.caseRectMaxX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 2)
    		 		 .attr('group-id','c_right')
    		 		 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'r_right_cover caseactive':true})
    				 .attr('cx', caseRect.caseRectMaxX).attr('cy', Ds_yToe_d + caseRect.caseRectMinY).attr('r', 6)
    				 .attr('group-id','c_right')
    				 .attr('parent-node','case_rectId')
    				 .call(d3.behavior.drag()
    						 .on("dragstart",RelationshipGraph.dragRightStart)
    						 .on("drag",RelationshipGraph.dragRightRuing)
    						 .on("dragend",RelationshipGraph.dragRightStop))
    				 .on('mouseover', function() {
    					 $(this).css("cursor","e-resize");
    				 }).on('mouseout',function() {
    					 $(this).css("cursor","default");
    				 });
    		// 7、给选择框添加圆.这里画中心拖拽点.
    		gCaseNode.append('circle').classed({'test_r_center caseactive':true})
    				 .attr('cx', Ds_xToe_x + caseRect.caseRectMinX).attr('cy', caseRect.caseRectMinY).attr('r', 8)
    				 .attr('group-id','c_center')
    				 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'test_r_center_so caseactive':true})
    		 		 .attr('cx', Ds_xToe_x + caseRect.caseRectMinX).attr('cy', caseRect.caseRectMinY).attr('r', 6)
    		 		 .attr('group-id','c_center')
    		 		 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'test_r_center_solid caseactive':true})
    		 		 .attr('cx', Ds_xToe_x + caseRect.caseRectMinX).attr('cy', caseRect.caseRectMinY).attr('r', 4)
    		 		 .attr('group-id','c_center')
    		 		 .attr('parent-node','case_rectId');
    		gCaseNode.append('circle').classed({'r_center_cover caseactive':true})
    		 		 .attr('cx', Ds_xToe_x + caseRect.caseRectMinX).attr('cy', caseRect.caseRectMinY).attr('r', 8)
    		 		 .attr('group-id','c_center')
    		 		 .attr('parent-node','case_rectId')
    		 		 .call(d3.behavior.drag()
    		 				 .on("dragstart",RelationshipGraph.centerMoveSart)
    		 				 .on("drag",RelationshipGraph.centerMoveRuing)
    		 				 .on("dragend",RelationshipGraph.centerMoveStop))
    		 		.on('mouseover', function() {
    		 			$(this).css("cursor","move");
    				 }).on('mouseout',function() {
    					 $(this).css("cursor","default");
    				 });
    	}
    }, {
    	/**
    	 * @desription : (TODO) 选择框左边拖拽点沿X轴方向拖拽开始事件. 
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'dragLeftStart',
    	value : function dragLeftStart(d,i) {
    		// 1、拖拽开始鼠标当前坐标X点.
    		drwaLeftX = d3.mouse(this)[0];
    	}
    }, {
    	/**
    	 * @desription : (TODO)  选择框左边拖拽点沿X轴方向拖拽中事件. 
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'dragLeftRuing',
    	value : function dragLeftRuing(d,i) {
    		// 1、开启标记鼠标从选择框左边点按下沿X方向进行拖拽状态.
    		drwaLeftXStatus = true;
    		// 2、记录鼠标当前X坐标
    		var RDX = d3.mouse(this)[0];
    		// 3、计算沿X轴方向偏移量. 当前坐标X - 初始起点坐标X.
    		var dx  = RDX - drwaLeftX;
    		// 4、更新初始起点坐标X.
    		drwaLeftX = RDX;
    		RelationshipGraph.leftAndRightDraw(dx,'left');
    	}
    }, {
    	/**
    	 * @description : (TODO) 选择框左边拖拽点沿X轴方向停止拖拽事件. 
    	 * 
    	 * @status OK.
    	 * */
    	key : 'dragLeftStop',
    	value : function dragLeftStop(d,i) {
    		if(drwaLeftXStatus) {
    			// 1、关闭标记鼠标从选择框左边点按下沿X方向进行拖拽状态.
        		drwaLeftXStatus = false;
        		RelationshipGraph.leftAndRightStop('left');
    		}
    	}
    	
    }, {
    	/**
    	 * @description : (TODO) 选择框右边拖拽点沿X轴方向拖拽开始事件. 
    	 * 
    	 * @status OK.
    	 * */
    	key : 'dragRightStart',
    	value : function dragRightStart(d,i) {
    		// 1、拖拽开始鼠标当前坐标X点.
    		drwaRightX = d3.mouse(this)[0];
    	}
    	
    }, {
    	/**
    	 * @description : (TODO) 选择框右边拖拽点沿X轴方向拖拽中事件. 
    	 * 
    	 * @status OK.
    	 * */
    	key : 'dragRightRuing',
    	value : function dragRightRuing(d,i) {
    		// 1、开启标记鼠标从选择框右边点按下沿X方向进行拖拽状态.
    		drwaRightXStatus = true;
    		// 2、记录鼠标当前X坐标
    		var RDX = d3.mouse(this)[0];
    		// 3、计算沿X轴方向偏移量. 当前坐标X - 初始起点坐标X.
    		var dx  = RDX - drwaRightX;
    		// 4、更新初始起点坐标X.
    		drwaRightX = RDX;
    		RelationshipGraph.leftAndRightDraw(dx,'right');
    	}
    	
    }, {
    	/**
    	 * @description : (TODO) 选择框右边拖拽点沿X轴方向停止拖拽事件.
    	 * 
    	 * @status OK. 
    	 * */
    	key : 'dragRightStop',
    	value : function dragRightStop(d,i) {
    		if(drwaRightXStatus) {
    			drwaRightXStatus = false;
    			RelationshipGraph.leftAndRightStop('right');
    		}
    	}
    	
    }, {
    	key : 'leftAndRightDraw',
    	value : function leftAndRightDraw(dx,drawDir) {
    		// 5、获取选中元素对象
    		var rectTypeA = RelationshipGraph.getRectElementsNodes(d3.selectAll('.caseactive')[0],drawDir);
    		RelationshipGraph.updCaseRect(RelationshipGraph.getCaseNodesAttr(rectTypeA.caseRect),dx,drawDir);
    		var shiftRectA = rectTypeA.shiftRect,len = shiftRectA.length;
    		var shiftRectA = rectTypeA.shiftRect,len = shiftRectA.length;
    		for(var s = 0 ; s < len ; s++) {
    			var rectNodesAttr = RelationshipGraph.getContextNodeAndData(d3.select(shiftRectA[s]).attr('id'));
    			rectNodesAttr.qdbcNode.attr('x',parseInt(rectNodesAttr.qdbcNode.attr('x'))+(dx*shiftRectA[s].fcnodx));
    			var tm = RelationshipGraph.zbTosj(parseInt(rectNodesAttr.qdbcNode.attr('x'))-$_GlobalGraph.configuration.offsetX);
    			rectNodesAttr.dqbcData.fcsj =  tm.hour + ':' + tm.min;
				var nowDate = BaseFun.getDateTime(rectNodesAttr.dqbcData.fcsj);
				nowDate.setMinutes(parseInt(tm.min)+rectNodesAttr.dqbcData.bcsj);
				rectNodesAttr.dqbcData.ARRIVALTIME = BaseFun.getTimeStr(nowDate);
				rectNodesAttr.dqbcData.STOPTIME = parseInt((BaseFun.getDateTime(rectNodesAttr.nextData.fcsj)- 
												  BaseFun.getDateTime(rectNodesAttr.dqbcData.ARRIVALTIME))/60000);
    			for(var t = 0 ; t<rectNodesAttr.dqbctextNodes.length;t++) {
    				RelationshipGraph.changeNode(rectNodesAttr.dqbctextNodes[t],dx*shiftRectA[s].fcnodx,rectNodesAttr.dqbcData);
    			}
    			rectNodesAttr.dqbcCircleNode.attr('cx',parseInt(rectNodesAttr.dqbcCircleNode.attr('cx'))+(dx*shiftRectA[s].fcnodx));
    			if(rectNodesAttr.dqbcData.STOPTIME<0)
    				d3.selectAll('text[parent-node='+ rectNodesAttr.qdbcNodeId +']').classed({'alert-danger':true});
    			else 
    				d3.selectAll('text[parent-node='+ rectNodesAttr.qdbcNodeId +']').classed({'alert-danger':false});
    		}
    	}
    }, {
    	key : 'leftAndRightStop',
    	value : function leftAndRightStop(drawDir) {
    		var rectTypeA = RelationshipGraph.getRectElementsNodes(d3.selectAll('.caseactive')[0],drawDir);
    		var shiftRectA = rectTypeA.shiftRect,len = shiftRectA.length;
    		for(var s = 0 ; s < len ; s++) {
    			var rectNodesAttr = RelationshipGraph.getContextNodeAndData(d3.select(shiftRectA[s]).attr('id'));
    			if(rectNodesAttr.dqbcData.STOPTIME<0) {
    				// var nextTzsjDx = $_GlobalGraph.configuration.dataMap.minztjx - rectNodesAttr.dqbcData.STOPTIME;
    				var nextTzsjDx = 0 - rectNodesAttr.dqbcData.STOPTIME;
    				// 修改遍历的当前元素数据的停站时间为最小停站时间.
    				// rectNodesAttr.dqbcData.STOPTIME =  $_GlobalGraph.configuration.dataMap.minztjx;
    				rectNodesAttr.dqbcData.STOPTIME =  0;
    				// 修改遍历的当前元素数据的文本展示停站时间
    				for(var t = 0 ; t < rectNodesAttr.dqbctextNodes.length ; t++) {
    					if(d3.select(rectNodesAttr.dqbctextNodes[t]).attr('text-type')=='gap') 
    						d3.select(rectNodesAttr.dqbctextNodes[t]).text('停:' + rectNodesAttr.dqbcData.STOPTIME);
    				}
    				/**
    				 * 修改下个班次的 发车时间、到达时间、停站时间
    				 * 
    				 * 
    				 * */
    				var $_date = BaseFun.getDateTime(rectNodesAttr.dqbcData.ARRIVALTIME);
    				$_date.setMinutes(parseInt($_date.getMinutes() + rectNodesAttr.dqbcData.STOPTIME));
    				rectNodesAttr.nextData.fcsj =  BaseFun.getTimeStr($_date);
    				var $_x = parseInt($_date.getHours()-$_GlobalGraph.configuration.dxHours)*60*$_GlobalGraph.configuration.multiple + 
			  		  		  parseInt($_date.getMinutes())*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX;
    				$_date.setMinutes(parseInt($_date.getMinutes() + rectNodesAttr.nextData.bcsj));
    				rectNodesAttr.nextData.ARRIVALTIME =  BaseFun.getTimeStr($_date);
    				rectNodesAttr.nextData.STOPTIME =  rectNodesAttr.nextData.STOPTIME-nextTzsjDx;
    				/**
    				 * 修改下个班次的元素坐标属性值
    				 * 
    				 * */
    				
    				rectNodesAttr.nextbcNode.attr('x',$_x);
    				var rectCover = d3.select(d3.selectAll('rect[parent-node='+ rectNodesAttr.nextbcNodeId + '-cover' +']')[0][0]);
    				rectCover.attr('x',$_x);
    				rectNodesAttr.nextbcCircleNode.attr('cx',parseInt(rectNodesAttr.nextbcNode.attr('x')) +  
    						(rectNodesAttr.nextData.bcsj) * ($_GlobalGraph.configuration.multiple) - 12);
    				var _text = parseInt(rectNodesAttr.nextbcNode.attr('x')) +  (rectNodesAttr.nextData.bcsj) * ($_GlobalGraph.configuration.multiple) - 18;// 1.5.4、计算时刻转text X轴坐标值.
    				
    				for(var n = 0 ; n < rectNodesAttr.nextbctextNodes.length ; n++) {
    					var _textType = d3.select(rectNodesAttr.nextbctextNodes[n]).attr('text-type'); // 1.5.4.1、获取当前text元素的类型.
    					if(_textType =='bcType')
    						d3.select(rectNodesAttr.nextbctextNodes[n]).attr('x',_text);
    					else
    						d3.select(rectNodesAttr.nextbctextNodes[n]).attr('x',$_x);
    					if(_textType=='timeslot')
    						d3.select(rectNodesAttr.nextbctextNodes[n]).text(rectNodesAttr.nextData.fcsj  + '~' + rectNodesAttr.nextData.ARRIVALTIME);
    					else if(_textType=='gap') 
    						d3.select(rectNodesAttr.nextbctextNodes[n]).text('停:' + rectNodesAttr.nextData.STOPTIME);
    				}
    				d3.selectAll('text[parent-node='+ rectNodesAttr.qdbcNodeId +']').classed({'alert-danger':false});
    			}
    		}
    	}
    }, {
    	/**
    	 * @description : (TODO) 修改选择框以及框边拖拽点的坐标属性值.
    	 * 
    	 * @status OK.
    	 * */
    	key : 'updCaseRect',
    	value : function updCaseRect(nodes,dx,drawtype) {
    		// 修改选择框元素的宽度属性值.
    		if(drawtype == 'left') {
    			nodes.caseRectNode.attr('width',parseInt(nodes.caseRectNode.attr('width'))-dx);
    			// 修改选择框元素的X坐标属性值.
        		nodes.caseRectNode.attr('x',parseInt(nodes.caseRectNode.attr('x'))+dx);
    		}else if(drawtype == 'right') {
    			nodes.caseRectNode.attr('width',parseInt(nodes.caseRectNode.attr('width'))+dx);
    			var lineNodes = nodes.attrLine,_lLen = lineNodes.length;
    			for(var l = 0 ; l < _lLen ; l++) {
    				var line = d3.select(lineNodes[l]);
    				line.attr('x1',parseInt(line.attr('x1'))+dx);
    				line.attr('x2',parseInt(line.attr('x2'))+dx);
    			}
    		}
    		var circleNodes = nodes.attrCircle,len = circleNodes.length;
			for(var c = 0 ; c < len ; c++) {
				var circle = d3.select(circleNodes[c]);
				var gourpId = circle.attr('group-id');
				if(gourpId=='c_left' && drawtype == 'left')
					circle.attr('cx',parseInt(circle.attr('cx'))+dx);
				else if(gourpId!='c_left' && gourpId!='c_center' && drawtype == 'right')
					circle.attr('cx',parseInt(circle.attr('cx'))+dx);
				else if(gourpId=='c_center')
					circle.attr('cx',parseInt(nodes.caseRectNode.attr('x')) + parseInt(nodes.caseRectNode.attr('width'))/2);
			}
    	}
    }, {
    	key : 'getRectNodesAttr',
    	value : function getRectNodesAttr(rectNode) {
    		var node = d3.select(rectNode);
    		var nodeId = node.attr('id');
    		return {'qdbcNodeId':nodeId,
					'qdbcNode':node,
					'dqbctextNodes':d3.selectAll('text[parent-node='+ nodeId +']')[0],// 当前班次元素对象的text文本元素.
					'dqbcCircleNode':d3.select(d3.selectAll('circle[parent-node='+ nodeId +']')[0][0]),// 当前班次元素对象的circle圆元素
					'dqbcData' : node.data()[0]
    				}
    	}
    }, {
    	key : 'getCaseNodesAttr' ,
    	value : function getCaseNodesAttr(caseRectNode) {
    		var node = d3.select(caseRectNode);
    		var nodeId = node.attr('id');
    		return {'nodeId' : nodeId,
    				'caseRectNode' : node ,
    				'attrCircle' : d3.selectAll('circle[parent-node=' + nodeId + ']')[0],
    				'attrLine' : d3.selectAll('line[parent-node=' + nodeId + ']')[0]};
    	}
    }, {
    	key : 'getRectElementsNodes',
    	value : function getRectElementsNodes(nodes,drawDir) {
    		// 1、定义rect元素对象集合数组.
    		var _rectNodes = new Array(),caseRect = null, tempAr = new Array();
    		// 2、遍历nodes元素对象集合.
    		for(var n = 0; n<nodes.length;n++) {
    			// 2.1、定义遍历的当前元素对象的元素标签名称与rect-type名称.
    			var tagName =  $(nodes[n]).get(0).tagName;
    			// 2.2、如果是rect并且是shift.则添加到rect元素集合数组中.
    			if(tagName=='rect') {
    				var rn = d3.select(nodes[n]);
    				var rdt = rn.data()[0];
    				var rectType = rn.attr('rect-type');
    				if(rectType == 'shift')  {
    					_rectNodes.push(nodes[n]);// 2.3、添加到_rectNodes数组中.
    					if(tempAr.indexOf(rdt.lpNo)<0)
    						tempAr.push(rdt.lpNo);
    				}else if(rectType == 'case') {
    					caseRect = nodes[n];
    				}
    			}
    		}
    		var lpfcno = new Array();
    		for(var p = 0 ; p < tempAr.length ; p++) {
    			var fcnoA = new Array();
    			for(var  t = 0 ; t < _rectNodes.length ; t++) {
        			var node = d3.select(_rectNodes[t]);
        			var data = node.data()[0];
        			if(data.lpNo == tempAr[p])
        				fcnoA.push(data.fcno);
        			
        		}
    			lpfcno.push({'lpNo':tempAr[p],'fcnoA' : fcnoA});
			}
    		
    		for(var r = 0;r<_rectNodes.length;r++ ) {
    			var rtn = d3.select(_rectNodes[r]);
    			var ndta = rtn.data()[0];
    			for(var c = 0 ; c< lpfcno.length;c++) {
    				if(ndta.lpNo == lpfcno[c].lpNo){
    					if(drawDir=='right')
    						_rectNodes[r].fcnodx = ndta.fcno - Math.min.apply(null, lpfcno[c].fcnoA);
    					if(drawDir=='left')
    						_rectNodes[r].fcnodx = Math.max.apply(null, lpfcno[c].fcnoA) - ndta.fcno;
    				} 
    			}
    		}
    		return {shiftRect:_rectNodes,'caseRect':caseRect};
    	}
    }, {
    	/**
    	 * @desription : (TODO) 获取rect 元素对象.这里表示的是只获取班次元素对象.
    	 * 
    	 * @params : [nodes--元素对象集合;type--移动的方向.]
    	 * 
    	 * @status OK .
    	 **/
    	key : 'getFirstRectElements',
    	value : function getFirstRectElements(nodes,type) {
    		// 遍历rect元素集合数组.
    		for(var r =0; r<nodes.length;r++) {
    			/**
    			 * 判断 type类型
    			 * 
    			 *  	✿ 如果是right.代表的是右拖拽时候.
    			 * 
    			 * 		✿ 如果是left.代表的是左拖拽时候.
    			 **/
    			// 右拖拽.
    			if(type=='right') {
    				if(d3.select(_rectNodes[r]).attr('id').split('_')[1] != temp) {
        				result.push({id:d3.select(_rectNodes[r]).attr('id')});
        			}
    				temp = d3.select(_rectNodes[r]).attr('id').split('_')[1];
    			// 左拖拽.
    			}else if(type =='left') {
    				// 判断当前遍历是否到了数组下标最后一个.
    				if(r<_rectNodes.length-1) {
    					if(d3.select(_rectNodes[r]).attr('id').split('_')[1] != d3.select(_rectNodes[r+1]).attr('id').split('_')[1]) {
            				result.push({id:d3.select(_rectNodes[r]).attr('id')});
            			}
    				}else {
    					result.push({id:d3.select(_rectNodes[r]).attr('id')});
    				}
    			}
    		}
    		return {'fistnodes':result,'arr':_arr};
    	}
    	
    }, {
    	/**
    	 * @desription : (TODO) 选择框沿Y轴拖拽开始事件.
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'regionDrawStart',
    	value : function regionDrawStart(d,i) {
    		drwaStartY = d3.mouse(this)[1];// 给选择框往Y轴拖拽时开始点的Y坐标赋值.
    	}
    }, {
    	/**
    	 * @desription : (TODO) 选择框往Y轴方向拖拽中 
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'regionDrawRuing',
    	value : function regionDrawRuing(d,i) {
    		drwaStartYStatus = true;// 开启标记选择框沿Y方向进行拖拽状态.
    		// 1、当前鼠标坐标位置.
    		var RDY = d3.mouse(this)[1];
    		// 2、当前鼠标位置的Y坐标 减去 起始点Y坐标 得到 Y轴方向的偏移量.
			var dy  = RDY - drwaStartY;
			// 3、重新标记起始点.
			drwaStartY = RDY;
			// 4、获取选择的元素.
			var nodes = d3.selectAll('.caseactive')[0];
			// 5、遍历选中元素,并在拖拽过程中修改选中元素的属性值Y坐标.因为这里只沿Y轴方向进行拖拽,所以值修改Y坐标.
			for(var n = 0; n<nodes.length;n++) {
				// 5.1、获取当前元素的元素标签名称.
				var tagName =  $(nodes[n]).get(0).tagName;
				// 5.2、判断 如果当前元素的元素标签名为rect元素.代表 方块
				if(tagName=='rect') {
					d3.select(nodes[n]).attr('y',parseInt(d3.select(nodes[n]).attr('y'))+dy);// 5.2.1、修改当前元素的Y属性值.
				// 5.3、判断 如果当前元素的元素标签名为text元素. 代表 文本
				}else if(tagName=='text') {
					d3.select(nodes[n]).attr('y',parseInt(d3.select(nodes[n]).attr('y'))+dy);// 5.3.1、修改当前元素的Y属性值.
				// 5.4、判断 如果当前元素的元素标签名为circle元素.代表 圆
				}else if(tagName == 'circle'){
					d3.select(nodes[n]).attr('cy',parseInt(d3.select(nodes[n]).attr('cy'))+dy);// 5.4.1、修改当前元素的Y属性值.
				// 5.5、判断 如果当前元素的元素标签名为circle元素.代表 线
				}else if(tagName=='line') {
					d3.select(nodes[n]).attr('y1',parseInt(d3.select(nodes[n]).attr('y1'))+dy);// 5.5.1、修改当前元素的Y属性值.
					d3.select(nodes[n]).attr('y2',parseInt(d3.select(nodes[n]).attr('y2'))+dy);// 5.5.2、修改当前元素的Y属性值.
				}
			}
    	}
    	
    }, {
    	/**
    	 * @desription : (TODO) 选择框往Y轴方向拖拽结束.
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'regionDrawStop',
    	value : function regionDrawStop(d,i) {
    		if(drwaStartYStatus) {
    			drwaStartYStatus = false;//  // 关闭标记选择框沿Y方向进行拖拽状态.
    			// 1、获取拖拽元素当前的Y坐标点.
        		var dqY = d3.select(this).attr("y");
        		// 2、定义靠近对应路牌对应的Y坐标最近点,与路牌名称.
        		var RDY = 0;//$_carName = '';
        		for(var q = 0 ; q<yAxisYArray.length;q++) {
        			if(dqY<yAxisYArray[q].y) {
        				if(q==0) {
        					RDY = yAxisYArray[q].y;
        				}else {
        					RDY = yAxisYArray[q-1].y;
        				}
        				break;
        			}
        		}
        		// 3、当坐标点不在路牌所对应的坐标点范围内,如果小于最小路牌的Y坐标.则去最小路牌对应的Y坐标,如果大于最大路牌的Y坐标,则取最大路牌对应的Y坐标.
        		var tagb = yAxisYArray[0].y-dqY < yAxisYArray[yAxisYArray.length-1].y-dqY;
        	    RDY = (RDY == 0  ?  yAxisYArray[yAxisYArray.length-Math.max.apply(null, gClassNameArray.parA)].y  : RDY);
        		// 4、得到最终在沿Y拖拽过程中的Y轴偏移量.
        		var dy = RDY - dqY - 4;
        		// 5、获取选择的元素.
        		var nodes = d3.selectAll('.caseactive')[0];
        		// 6、遍历选中元素,并在拖拽过程中修改选中元素的属性值Y坐标.因为这里只沿Y轴方向进行拖拽,所以值修改Y坐标.
        		for(var n = 0; n<nodes.length;n++) {
        			// 6.1、获取当前元素的元素标签名称.
        			var tagName =  $(nodes[n]).get(0).tagName;
        			// 6.2、判断 如果当前元素的元素标签名为rect元素.代表 方块
        			if(tagName=='rect') {
        				var y_dx = parseInt(d3.select(nodes[n]).attr('y'))+dy,lpA = '';
        				_animation(d3.select(nodes[n])).attr('y',y_dx);
        				for(var q = 0 ; q<yAxisYArray.length;q++) {
        	    			if(y_dx<yAxisYArray[q].y) {
        	    				if(q==0)
        	    					lpA = yAxisYArray[q].lpA;
        	    				else 
        	    					lpA = yAxisYArray[q-1].lpA;
        	    				break;
        	    			}
        	    		}
        				var tagb_ = yAxisYArray[0].y-y_dx < yAxisYArray[yAxisYArray.length-1].y-y_dx;
        				lpA = (lpA == '' ?  tagb_ ? yAxisYArray[yAxisYArray.length-1].lpA : yAxisYArray[0].lpA : lpA);
        				var dt = d3.select(nodes[n]).data()[0];
        				dt.parent = lpA.lpName;
        				dt.lp = lpA.lp;
        				dt.lpName = lpA.lpName;
        				dt.lpNo = lpA.lpNo;
        				dt.lpType = lpA.lpType;
        			// 6.3、判断 如果当前元素的元素标签名为text元素. 代表 文本
        			}else if(tagName=='text') {
        				_animation(d3.select(nodes[n])).attr('y',parseInt(d3.select(nodes[n]).attr('y'))+dy);
        			// 6.4、判断 如果当前元素的元素标签名为circle元素.代表 圆
        			}else if(tagName == 'circle'){
        				_animation(d3.select(nodes[n])).attr('cy',parseInt(d3.select(nodes[n]).attr('cy'))+dy);
        			// 5.5、判断 如果当前元素的元素标签名为circle元素.代表 线
        			}else if(tagName=='line') {
        				_animation(d3.select(nodes[n])).attr('y1',parseInt(d3.select(nodes[n]).attr('y1'))+dy).attr('y2',parseInt(d3.select(nodes[n]).attr('y2'))+dy);
        			}
        		}
        		setTimeout(function(){
        			$_GlobalGraph.statistics();
        			$_GlobalGraph.addHistory();
        		},310);
    		}
    	}
    }, {
    	/** 
    	 * @description : (TODO) 鼠标从选择框中心点按下沿X方向左右拖拽开始事件.
    	 * 
    	 * @status OK .
    	 **/
    	key : 'centerMoveSart',
    	value : function centerMoveSart(d,i) {
    		// 1、记录拖拽起始点.
    		drwaStartX = d3.mouse(this)[0];
    	}
    }, {
    	/** 
    	 * @description : (TODO) 鼠标从选择框中心点按下沿X方向左右拖拽中事件.
    	 * 
    	 * @status OK.
    	 **/
    	key : 'centerMoveRuing',
    	value : function centerMoveRuing(d,i) {
    		// 1、开启标记鼠标从选择框中心点按下沿X方向进行拖拽状态.
    		drwaStartXStatus = true;
    		// 2、获取鼠标当前X坐标点位置.
    		var RDX = d3.mouse(this)[0];
    		// 3、计算起始点到当前点X方向的偏移量.
    		var dx  = RDX - drwaStartX;
    		// 4、重新标记起点.
    		drwaStartX = RDX;
    		// 5、获取选中的元素.变量修改其元素属性值与数据.
    		var nodes = d3.selectAll('.caseactive')[0];
    		for(var n = 0; n<nodes.length;n++) {
    			// 5.1、获取遍历的当前元素的元素标签名称.
    			var tagName =  $(nodes[n]).get(0).tagName;
    			// 5.2、选择遍历的当前元素对象.
    			var node = d3.select(nodes[n]);
    			// 5.3、获取遍历的当前元素数据.
    			var dt = node.data()[0];
    			/**
    			 * 5.4、判断 tagName.
    			 * 		
    			 * 		5.4.1、	✿ 如果是rect 则修改X.并修改数据.
    			 * 
    			 * 		5.4.2、	✿ 如果是text 修改文本属性值.
    			 * 
    			 * 		5.4.3、	✿ 如果是circle 修改C.
    			 * 
    			 * 		5.4.4、	✿ 如果是line 修改X1、X2.
    			 **/
    			if(tagName=='rect') {
    				// 5.4.1.1、修改遍历的当前元素X坐标属性值.
    				node.attr('x',parseInt(node.attr('x'))+dx);
    				// 5.4.1.2、根据X坐标值转为时刻
    				var tm = RelationshipGraph.zbTosj(parseInt(node.attr('x'))-$_GlobalGraph.configuration.offsetX);
    				// 5.4.1.3、修改遍历的当前元素数据的发车时间.
    				dt.fcsj =  tm.hour + ':' + tm.min;
    				// 5.4.1.4、发车时间转时间对象
					var nowDate = BaseFun.getDateTime(dt.fcsj);
					// 5.4.1.5、修改时间.
					nowDate.setMinutes(parseInt(tm.min)+dt.bcsj);
					// 5.4.1.6、时间对象转字符串时刻.修改到达时间.
					dt.ARRIVALTIME = BaseFun.getTimeStr(nowDate);
    			}else if(tagName=='text') {
    				// 5.4.2.1、修改遍历的当前文本元素X坐标属性值.
    				node.attr('x',parseInt(node.attr('x'))+dx);
    				if(node.attr('text-type') =='timeslot') {
    					if(dt.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.bd &&
    							dt.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.out &&
    		   				 	dt.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.cf &&
    		   				 	dt.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.in_ &&
    		   				 	dt.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
    						node.text(dt.fcsj + '~' + dt.ARRIVALTIME);// 5.4.2.2、修改第一行的text文本.发车时间 ~ 到达时间.
    				}
    			}else if(tagName == 'circle'){
    				// 5.4.3.1、修改遍历的当前圆元素CX坐标属性值.
    				node.attr('cx',parseInt(node.attr('cx'))+dx);
    			}else if(tagName=='line') {
    				// 5.4.3.1、修改遍历的当前line线1元素X1坐标属性值.
    				node.attr('x1',parseInt(node.attr('x1'))+dx);
    				// 5.4.3.1、修改遍历的当前line线2元素X1坐标属性值.
    				node.attr('x2',parseInt(node.attr('x2'))+dx);
    			}
    		}
    		// 6、重新统计值.
    		RelationshipGraph.reDrawDepart();
    	}
    }, {
    	/**
    	 * @description : (TODO) 鼠标从选择框中心点按下沿X方向左右拖拽结束事件.
    	 * 
    	 * @status OK.
    	 **/
    	key : 'centerMoveStop',
    	value : function centerMoveStop(d,i) {
    		/**
    		 * 1、《《《《《《《《判断 是否已经过沿X方向左右拖拽》》》》》》》》 
    		 * 
    		 **/
    		if(drwaStartXStatus) {
    			// 1.1、关闭标记鼠标从选择框中心点按下沿X方向进行拖拽状态.
    			drwaStartXStatus = false; 
    			// 1.2、保存该操作记录.
    			$_GlobalGraph.addHistory(); 
    		}
    	}
    }, {
    	/**
    	 * @description : (TODO) 重新绘制发车时刻,并重新统计.
    	 *  
    	 * @status : OK.
    	 * */
    	key : 'reDrawDepart',
    	value : function reDrawDepart() {
    		// 1、删除g元素class为up_tick的节点(包括子节点).这里等同与清楚上行的发车时刻.
    		$_GlobalGraph.removeNodes(d3.selectAll('g.up_tick')[0]);
    		// 2、删除g元素class为down_tick的节点(包括子节点).这里等同与清楚下行的发车时刻.
    		$_GlobalGraph.removeNodes(d3.selectAll('g.down_tick')[0]);
    		// 3、获取所有的班次数据.
    		var $_json = $_GlobalGraph.getDataArray();
    		// 4、定义上、下行班次数组.
    		var upArray = new Array(),downArray = new Array();
    		for(var j = 0 ; j< $_json.length ; j++) {
    			// 4.1、判断遍历的当前班次类型是否为normal
    			if($_json[j].bcType== $_GlobalGraph.configuration.dataMap.bcTypeArr.normal) {
    				// 4.2、判断遍历的当前元素方向.
    				if($_json[j].xlDir == $_GlobalGraph.configuration.dataMap.dira[0])
    	    			upArray.push($_json[j]);
    	    		else if($_json[j].xlDir == $_GlobalGraph.configuration.dataMap.dira[1])
    	    			downArray.push($_json[j])
    			}
    		}
    		// 5、定义上、下行发车时刻元素节点集合.
    		var upNodes = $_GlobalGraph.configuration.selection.select('svg').select('g.up').selectAll('.up_tick').data(upArray),
    			downNodes = $_GlobalGraph.configuration.selection.select('svg').select('g.down').selectAll('.down_tick').data(downArray);
    		// 6、绘制上行发车时刻
    		$_GlobalGraph.createUpTime(upNodes);
    		// 7、绘制下行发车时刻
    		$_GlobalGraph.createDownTime(downNodes);
    		// 8、重新统计值.
    		$_GlobalGraph.statistics();
    	}
    }, {
    	/**
    	 * @description : (TODO) 对单个rect元素(班次)做左右拖拽(拖拽开始...).
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'singleElementDrawStart',
    	value : function singleElementDrawStart(d,i) {
    		_singElmtDrStartX = d3.mouse(this)[0];// 初始化对单个rect元素进行拖拽时开始点X坐标.
    	}
    }, {
    	/**
    	 * @description : (TODO) 对单个rect元素(班次)做左右拖拽(拖拽中...).
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'singleElementDrawRuing',
    	value : function singleElementDrawRuing(d,i) {
    		/**
    		 * 1、判断
    		 * 		
    		 * 		✿ 当前班次是首末班车班次,如果是则不能结束拖拽.(* 根据_singElemtDrStatus状态来判断 除去正在进行拖拽的班次刚好拖拽到首末班次班次的发车时间点.)
    		 * 	
    		 * 		✿ 当前班次是早晚例保、进出场班次、吃饭班次.如果是则不能结束拖拽.
    		 * 
    		 **/
    		if((RelationshipGraph.issmbc(d.fcsj) ||
    			context.getisContext() ||
    			d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd || 
    			d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
    			d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf ||
    			d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_ ||
    			d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc) && !_singElemtDrStatus)
    			return;
    		// 2、拖拽过程隐藏提示工具窗口.
    		$_GlobalGraph.tooltip.hide();
    		// 3、开启标记单个rect元素沿X方向进行拖拽状态.
    		_singElemtDrStatus = true;
    		// 4、获取鼠标在拖拽中的当前坐标点.
    		var RDX = d3.mouse(this)[0];
    		// 5、计算当前鼠标坐标X相对初始点坐标X的偏移量.
    		var dx  = RDX - _singElmtDrStartX;
    		// 6、重新赋值初始点坐标X.
    		_singElmtDrStartX = RDX;
    		// 7、根据当前被拖拽的元素rect元素的parent-node属性值 , 来获取当前班次的底层rect元素的相邻两个班次元素的相关信息.
    		var nodeContext =  RelationshipGraph.getContextNodeAndData(d3.select(this).attr('parent-node').replace('-cover',''));
    		// 8、计算rect元素的被拖拽后的X坐标值.
    		var chageX = parseInt(nodeContext.qdbcNode.attr('x'))+dx;
    		
    		/****************************************** update 当前的班次数据以及相关元素对象属性值. START ************************************/
    			
    		/**
    		 * 9.1、修改当期rect(班次)data数据属性值.
    		 * 
    		 *    ✿ 因为rect元素是沿X轴移动的.这里修改的值一般是 [fcsj--发车时间;ARRIVALTIME--到达时间;STOPTIME--停站时间].
    		 *    
    		 *    ✿ 因为当前班次的到达时间改变,导致与下个班次的发车时间相隔时间段改变.也就是当前班次停站时间被改变.
    		 **/
    		// 9.1.1、根据当前元素的X坐标值等到对应的时刻.
			var tm = RelationshipGraph.zbTosj(chageX-$_GlobalGraph.configuration.offsetX);
			// 9.1.2、修改当前班次的发车时间.
			d.fcsj =  tm.hour + ':' + tm.min;
			// 9.1.3 、定义当前班次的到达时间对象.
			var nowDate = BaseFun.getDateTime(d.fcsj);
			nowDate.setMinutes(parseInt(tm.min)+d.bcsj);// 10.3.1、设置分钟.
			// 9.1.4、修改当前班次的到达时间.
			d.ARRIVALTIME  =  BaseFun.getTimeStr(nowDate);
			d.STOPTIME = d.isfb == 1 ? 0 : parseInt((BaseFun.getDateTime(nodeContext.nextData.fcsj) -  BaseFun.getDateTime(d.ARRIVALTIME))/ 60000);
			// parseInt((BaseFun.getDateTime(nodeContext.nextData.fcsj) -  BaseFun.getDateTime(d.ARRIVALTIME))/ 60000)
			
    		/**
    		 * 9.2、修改元素沿X轴方向的X坐标属性值. 
    		 * 
    		 *    ✿ 这里的元素包括
    		 *    			
    		 *    			 当前被拖拽的元素(覆盖层)、当前被拖拽的元素的底层元素、text元素(文本元素)、circle元素(圆)
    		 **/
			// 9.2.1、修改当前被拖拽的班次rect元素覆盖层的X坐标值.
    		d3.select(this).attr('x',chageX);
    		// 9.2.2、修改当前被拖拽的班次rect底层元素X坐标值.
    		nodeContext.qdbcNode.attr('x',chageX);
    		// 9.2.3、修改当前被拖拽的rect底层元素上的 圆的元素对象.
    		nodeContext.dqbcCircleNode.attr('cx',parseInt(nodeContext.dqbcCircleNode.attr('cx'))+dx);
    		// 9.2.4、遍历text元素,并修改text属性值.
    		for(var n = 0 ; n < nodeContext.dqbctextNodes.length ; n++) {
    			// 9.2.4.1、修改text属性值.
    			RelationshipGraph.changeNode(nodeContext.dqbctextNodes[n],dx,d);
    		}
    		/****************************************** update 当前的班次数据以及相关元素对象属性值. END ************************************/
    		
    		//console.log(nodeContext);
    		// 10、计算与上个班次的停站时间.
			var dxMinues =  parseInt((BaseFun.getDateTime(d.fcsj) - BaseFun.getDateTime(nodeContext.lastData.ARRIVALTIME)) / 60000);
    		
    		/****************************************** update 上个的班次数据以及相关元素对象属性值. START ************************************/
			
			/**
			 * 11、判断上个班次的类型. 
			 * 
			 * 		 ✿ 11.1、如果是出场班次、吃饭班次 则停站时间为零,也就是说上个班次的到达时间是下个班次的发车时间.
			 * 
			 * 		 ✿ 11.2、如果是正常班次
			 *
			 **/
			if(nodeContext.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
					nodeContext.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf) {
				/**
				 * 11.1.1、 如果是出场班次、吃饭班次.修改上个班次数据属性值. 
				 * 
				 * 		   ✿ 需要修改的数据属性值有[发车时间,到达时间].
				 **/
				// 11.1.1.1、修改上个班次的到达时间.
				nodeContext.lastData.ARRIVALTIME = d.fcsj;
				var ddsj = BaseFun.getDateTime(nodeContext.lastData.ARRIVALTIME);
				ddsj.setMinutes(ddsj.getMinutes() - nodeContext.lastData.bcsj);
				// 11.1.1.2、修改上个班次的发车时间.
				nodeContext.lastData.fcsj = BaseFun.getTimeStr(ddsj);
				/**
				 * 11.1.2、修改上个班次元素的属性值.
				 * 
				 **/
				// 11.1.2.1、修改上个元素的rect覆盖层元素X坐标值.
				var lastRectCover = d3.select(d3.selectAll('rect[parent-node='+ nodeContext.qdbcNode.attr('last-node') + '-cover' +']')[0][0]);
	    		lastRectCover.attr('x',parseInt(lastRectCover.attr('x'))+dx);// 12.2.1.3.1、修改圆的cx属性值.
				// 11.1.2.2、修改上个元素的rect底层元素X坐标值.
				nodeContext.lastbcNode.attr('x',parseInt(nodeContext.lastbcNode.attr('x'))+dx);
				// 11.1.4.3、修改上个元素的rect底层元素上的 圆的元素CX坐标值
				nodeContext.lastbcCircleNode.attr('cx',parseInt(nodeContext.lastbcCircleNode.attr('cx'))+dx);
	    		// 11.1.4.4、遍历上个元素的text元素,并修改text属性值.
	    		for(var c = 0 ; c < nodeContext.lastTextNodes.length ; c++) {
	    			// 11.1.4.4.1、修改text属性值.
	    			RelationshipGraph.changeNode(nodeContext.lastTextNodes[c],dx,nodeContext.lastData);
	    		}
	    		// 11.1.4.5、获取上上个班次的元素对象.
	    		var xxgbcNode = d3.select('rect[id='+ nodeContext.lastbcNode.attr('last-node') +']');
	    		// 11.1.4.6、获取上上个班次的数据
	    		var xxgbc = xxgbcNode.data()[0];
	    		
	    		/**
	    		 * 11.1.4.7、判断 上上个班次类型. 
	    		 * 		
	    		 * 			 ✿ 11.1.4.7.1、如果是保养班次.则修改这个班次的到达与发车时间以及元素属性值.
	    		 * 
	    		 * 			 ✿ 11.1.4.7.2、如果是正常班次.则修改这个班次的停站时间以及元素属性值.
	    		 * 
	    		 **/
	    		if(xxgbc.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd) {
	    			
	    			/**
	    			 *  11.1.4.7.1.1、修改上上个班次元素的数据属性值. 
	    			 * 
	    			 **/
	    			xxgbc.ARRIVALTIME = nodeContext.lastData.fcsj;// 修改到达时间
					var xxgbcddsj = BaseFun.getDateTime(xxgbc.ARRIVALTIME);
					xxgbcddsj.setMinutes(xxgbcddsj.getMinutes() - xxgbc.bcsj);
					xxgbc.fcsj = BaseFun.getTimeStr(xxgbcddsj);// 修改发车时间
					/**
					 *  11.1.4.7.1.2、修改上上个班次元素的属性值. 
					 * 
					 **/
					xxgbcNode.attr('x',parseInt(xxgbcNode.attr('x'))+dx);// 修改底层rectX坐标值.
		    		var xxgbcCircle = d3.select(d3.selectAll('circle[parent-node='+ nodeContext.lastbcNode.attr('last-node') +']')[0][0]);
		    		xxgbcCircle.attr('cx',parseInt(xxgbcCircle.attr('cx'))+dx);// 修改圆的cx属性值.
		    		var xxgbcRectCover = d3.select(d3.selectAll('rect[parent-node='+ nodeContext.lastbcNode.attr('last-node') + '-cover' +']')[0][0]);
		    		xxgbcRectCover.attr('x',parseInt(xxgbcRectCover.attr('x'))+dx);// 修改覆盖层rectX坐标值.
		    		var xxgbcTextNodes = d3.selectAll('text[parent-node='+ nodeContext.lastbcNode.attr('last-node') +']')[0];
		    		for(var x = 0 ; x < xxgbcTextNodes.length ; x++) {
		    			RelationshipGraph.changeNode(xxgbcTextNodes[x],dx,xxgbc);// 修改text属性值.
		    		}
	    		}else if(xxgbc.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal) {
	    			/**
	    			 * 11.1.4.7.2、如果是正常班次.
	    			 * 
	    			 **/
	    			// 11.1.4.7.2.1、修改上上个班次元素的数据停站时间属性值. 
	    			xxgbc.STOPTIME = parseInt((BaseFun.getDateTime(nodeContext.lastData.fcsj) - BaseFun.getDateTime(xxgbc.ARRIVALTIME)) / 60000);
	    			// 11.1.4.7.2.2、修改上上个班次text元素属性值. 
					var _normalxxgbc = d3.selectAll('text[parent-node=' +  nodeContext.lastbcNode.attr('last-node')  +']')[0];
					for(var i = 0 ;i < _normalxxgbc.length ;i++) {
						var normalxxgbcNode_ = d3.select(_normalxxgbc[i]);
						if(normalxxgbcNode_.attr('text-type')=='gap')
							normalxxgbcNode_.text('停:' +   xxgbc.STOPTIME); 
					}
	    		}
			}else {
				var dataMap = $_GlobalGraph.configuration.dataMap;
    			// 定义是否高峰
    			var flag = BaseFun.isPeakTimeScope(BaseFun.getDateTime(nodeContext.lastData.fcsj) , dataMap); 
    			// 定义当前班次方向下标代码[0代表上行;1代表下行].
    			var cctag = BaseFun.dirDmToIndex(nodeContext.lastData.xlDir);
    			// 获取行驶时间.
    			var xxsj = BaseFun.getByDirTravelTime(dataMap.zgfsjd , dataMap.wgfsjd , nowDate, dataMap.pcxssjArr , dataMap.gfxxsjArr ,  cctag);
    			var normmintzsj = xxsj*0.1,normmaxtzsj = xxsj*0.15;
    			// 如果小于零
    			if(dxMinues <= 0 && nodeContext.lastData.isfb ==0 ) {
    				// 根据不同时段的停站时间.重新赋值停站时间.
    				dxmin = flag ?  dataMap.gftzsj[cctag] : dataMap.dgtzsj[cctag]; 
    			}else {
    				// 如果 大于等于低谷最大停站时间 并且 小于等于三小时.则把低谷最大停站时间 作为 停站时间.
    				if(dxMinues >= dataMap.dgmaxtzsj && dxMinues < 180) {
    					dxMinues = dataMap.dgmaxtzsj;
    				// 如果大于零 并且 小于等于行业标准的最小停站时间
    				}else if(dxMinues > 0 && dxMinues <= normmintzsj ) {
    					// dxmin = dxmin;
    				// 如果大于行业标准的最小停站时间  并且  小于等于行业标准的最大停站时间
    				}else if(dxMinues > normmintzsj && dxMinues <= normmaxtzsj ) {
    					// dxmin = dxmin;
    				// 如果大于行业标准的最大停站时间  并且 小于低谷最大停站时间
    				}else if(dxMinues > normmaxtzsj && dxMinues < dataMap.dgmaxtzsj ) {
    					// dxmin = dxmin;
    				}else if (dxMinues >= 180){
    					dxMinues = 0;
    				}
    			}
    			// 修改当前班次的停站时间.
    			// nodeContext.lastData.STOPTIME = dxMinues;
    			// d.STOPTIME =  parseInt(dxmin) ;
				/**
				 * 11.2.1、如果是正常班次
				 * 
				 * 		   ✿ 需要修改的数据属性值有[停站时间].
				 **/
				// 11.2.1.1、修改上个班次的停站时间.
				nodeContext.lastData.STOPTIME = dxMinues;
				/**
				 * 11.2.2、修改上个班次元素的属性值.
				 * 
				 **/
				for(var t = 0 ; t < nodeContext.lastTextNodes.length ;t++) {
					// 11.2.2.1、修改text元素对象.
					var lastNode_ = d3.select(nodeContext.lastTextNodes[t]);
					if(lastNode_.attr('text-type')=='gap')
						lastNode_.text('停:' +   nodeContext.lastData.STOPTIME);// 15.4、修改第三行的text文本. 停站时间.
				}
			}
			/****************************************** update 上个的班次数据以及相关元素对象属性值. END ************************************/
    		// 12、判断停站时间是否小于零.
    		if(nodeContext.lastData.STOPTIME <0 || d.STOPTIME<0)
				d3.selectAll('text[parent-node='+ nodeContext.qdbcNodeId +']').classed({'alert-danger':true});// 12.1、添加停站时间小零的样式.
			else
				d3.selectAll('text[parent-node='+ nodeContext.qdbcNodeId +']').classed({'alert-danger':false});// 12.1、删除停站时间小零的样式.
    		// 13、重新绘制发车时刻,并重新统计.
    		RelationshipGraph.reDrawDepart();
    	}
    }, {
    	/**
    	 * @description : (TODO) 对单个rect元素(班次)做左右拖拽(拖拽结束...).
    	 * 
    	 * @status : OK.
    	 * 
    	 * */
    	key : 'singleElementDrawStop',
    	value : function singleElementDrawStop(d,i) {
    		// 1、先判断是否进行过对该班次元素的拖拽行为.
    		if(_singElemtDrStatus) {
    			// 1.1、关闭标记单个rect元素沿X方向进行拖拽状态.
    			_singElemtDrStatus = false;
    			/**
    			 * 1.2、根据当前被拖拽的rect元素的parent-node属性值
    			 * 
    			 * 		✿ 获取当前班次的底层rect元素id属性值、以及底层的rect元素对象、以及属于该班次元素的属性值元素对象(circle、text)
    			 * 
    			 * 		✿ 获取上个班次的底层rect元素对象与数据. 以及属于该班次元素的属性值元素对象(circle、text).
    			 * 
    			 * 		✿ 获取下个班次的底层rect元素对象与数据. 以及属于该班次元素的属性值元素对象(circle、text).
    			 * 
    			 **/
        		var _obj = RelationshipGraph.getContextNodeAndData(d3.select(this).attr('parent-node').replace('-cover',''));
        		// 1.3、定义最小停站间隙.
    			// var minSoptTime = $_GlobalGraph.configuration.dataMap.minztjx;
        		var minSoptTime = 0;
    			// 1.4、创建当前时间对象.
    			var $_date = new Date();
    			// 1.5、判断 如果当前班次的停站时间小于零,则修改成最小停站时间.
    			if(d.STOPTIME<0) {
    				if(_obj.nextData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_)
    					minSoptTime= 0;
    				/**
    				 * 1.5.1、修改当前班次数据值. 
    				 * 
    				 **/
    				$_date = BaseFun.getDateTime(_obj.nextData.fcsj);// 1.5.1.1、时间字符串转时间对象.
    				$_date.setMinutes(parseInt($_date.getMinutes() - minSoptTime));// 1.5.1.2、修改分钟.
    				d.STOPTIME = minSoptTime;// 1.5.1.3、修改当前班次的停站时间.
    				d.ARRIVALTIME =  BaseFun.getTimeStr($_date);// 1.5.1.4、修改当前班次的达到时间.
    				$_date.setMinutes($_date.getMinutes()-d.bcsj);// 1.5.1.5、修改分钟.
    				d.fcsj = BaseFun.getTimeStr($_date);// 1.5.1.4、修改当前班次的发车时间.
    				// 1.5.2、计算时刻转rect X轴坐标值.
    				var $_x = parseInt($_date.getHours()-$_GlobalGraph.configuration.dxHours)*60*$_GlobalGraph.configuration.multiple + 
    						  parseInt($_date.getMinutes())*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX;
    				/**
    				 * 1.5.3、修改当前班次元素属性值.
    				 * 
    				 **/
    				d3.select(this).attr('x',$_x);// 1.5.3.1、修改当前被拖拽元素覆盖层rect元素的X坐标属性值.
    				_obj.qdbcNode.attr('x',$_x);// 1.5.3.2、修改底层rect元素的X坐标属性值.
    				_obj.dqbcCircleNode.attr('cx',parseInt(_obj.qdbcNode.attr('x')) +  
    						(d.bcsj) * ($_GlobalGraph.configuration.multiple) - 12);// 1.5.3.3、修改属于当前班次元素的circle元素圆的cx值.
    				var _text = parseInt(_obj.qdbcNode.attr('x')) +  (d.bcsj) * ($_GlobalGraph.configuration.multiple) - 18;// 1.5.4、计算时刻转text X轴坐标值.
    				/**
    				 * 1.5.4、修改当前班次元素下所属的text元素属性值.
    				 * 
    				 **/
    				for(var n = 0 ; n < _obj.dqbctextNodes.length ; n++) {
    					var _textType = d3.select(_obj.dqbctextNodes[n]).attr('text-type'); // 1.5.4.1、获取当前text元素的类型.
    					if(_textType =='bcType')
    						d3.select(_obj.dqbctextNodes[n]).attr('x',_text);
    					else
    						d3.select(_obj.dqbctextNodes[n]).attr('x',$_x);
    					if(_textType=='timeslot')
    						d3.select(_obj.dqbctextNodes[n]).text(d.fcsj  + '~' + d.ARRIVALTIME);
    					else if(_textType=='gap') 
    						d3.select(_obj.dqbctextNodes[n]).text('停:' + d.STOPTIME);
    				}
        			if(_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
    						_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf) {
        				// 11.1.1.1、修改上个班次的到达时间.
        				_obj.lastData.ARRIVALTIME = d.fcsj;
        				var ddsj = BaseFun.getDateTime(_obj.lastData.ARRIVALTIME);
        				ddsj.setMinutes(ddsj.getMinutes() - _obj.lastData.bcsj);
        				// 11.1.1.2、修改上个班次的发车时间.
        				_obj.lastData.fcsj = BaseFun.getTimeStr(ddsj);
        				var last_x = parseInt(ddsj.getHours()-$_GlobalGraph.configuration.dxHours)*60*$_GlobalGraph.configuration.multiple + 
        							 parseInt(ddsj.getMinutes())*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX;
        				/**
        				 * 11.1.2、修改上个班次元素的属性值.
        				 * 
        				 **/
        				// 11.1.2.1、修改上个元素的rect覆盖层元素X坐标值.
        				var lastRectCover = d3.select(d3.selectAll('rect[parent-node='+ _obj.qdbcNode.attr('last-node') + '-cover' +']')[0][0]);
        				lastRectCover.attr('x',last_x);// 12.2.1.3.1、修改圆的cx属性值.
        				// 11.1.2.2、修改上个元素的rect底层元素X坐标值.
        				_obj.lastbcNode.attr('x',last_x);
        				// 11.1.4.3、修改上个元素的rect底层元素上的 圆的元素CX坐标值
        				_obj.lastbcCircleNode.attr('cx',parseInt(_obj.lastbcNode.attr('x')) +  
        						(_obj.lastData.bcsj) * ($_GlobalGraph.configuration.multiple) - 12);// 1.5.3.3、修改属于当前班次元素的circle元素圆的cx值.
        				var _text = parseInt(_obj.lastbcNode.attr('x')) +  (_obj.lastData.bcsj) * ($_GlobalGraph.configuration.multiple) - 18;// 1.5.4、计算时刻转text X轴坐标值.
        	    		// 11.1.4.4、遍历上个元素的text元素,并修改text属性值.
        	    		for(var n = 0 ; n < _obj.lastTextNodes.length ; n++) {
        	    			// 11.1.4.4.1、修改text属性值.
        	    			// RelationshipGraph.changeNode(_obj.lastTextNodes[c],dx,_obj.lastData);
        	    			var textNode = d3.select(_obj.lastTextNodes[n]);
        	    			var _textType = textNode.attr('text-type'); // 1.5.4.1、获取当前text元素的类型.
        	    			if(_textType =='bcType')
        						d3.select(_obj.lastTextNodes[n]).attr('x',_text);
        					else
        						d3.select(_obj.lastTextNodes[n]).attr('x',last_x);
        	    			if(_textType=='travel') {
        	        			if(_obj.lastData.bcsj>0) {
        	        				// 4.2 修改第二行的text文本. 
        	            			if(_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd ||
        	            					_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
        	            					_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_ ||
        	            					_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
        	            				textNode.text(_obj.lastData.fcsj);
        	                    	else if(_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf)
        	                    		textNode.text('吃:' + _obj.lastData.bcsj); 
        	                    	else 
        	                    		textNode.text("行:" + _obj.lastData.bcsj); 
        	        			}
        	        		}else if(_textType=='gap') {
        	        			if(_obj.lastData.bcsj>0) {
        	        				// 4.3 修改第三行的text文本. 停站时间.
        	            			if(_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd||
        	            					_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
        	            				textNode.text('保:' + d.bcsj);
        	            			else if(_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
        	            					_obj.lastData.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_)
        	            				textNode.text('行:' + _obj.lastData.bcsj); 
        	            			else
        	            				textNode.text('停:' + _obj.lastData.STOPTIME); 
        	        			}
        	        		}
        	    		}
        	    		// 11.1.4.5、获取上上个班次的元素对象.
        	    		var xxgbcNode = d3.select('rect[id='+ _obj.lastbcNode.attr('last-node') +']');
        	    		// 11.1.4.6、获取上上个班次的数据
        	    		var xxgbc = xxgbcNode.data()[0];

        	    		/**
        	    		 * 11.1.4.7、判断 上上个班次类型. 
        	    		 * 		
        	    		 * 			 ✿ 11.1.4.7.1、如果是保养班次.则修改这个班次的到达与发车时间以及元素属性值.
        	    		 * 
        	    		 * 			 ✿ 11.1.4.7.2、如果是正常班次.则修改这个班次的停站时间以及元素属性值.
        	    		 * 
        	    		 **/
        	    		if(xxgbc.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd) {
        	    			
        	    			/**
        	    			 *  11.1.4.7.1.1、修改上上个班次元素的数据属性值. 
        	    			 * 
        	    			 **/
        	    			xxgbc.ARRIVALTIME = _obj.lastData.fcsj;// 修改到达时间
        					var xxgbcddsj = BaseFun.getDateTime(xxgbc.ARRIVALTIME);
        					xxgbcddsj.setMinutes(xxgbcddsj.getMinutes() - xxgbc.bcsj);
        					xxgbc.fcsj = BaseFun.getTimeStr(xxgbcddsj);// 修改发车时间
        					var xxbgc_x = parseInt(xxgbcddsj.getHours()-$_GlobalGraph.configuration.dxHours)*60*$_GlobalGraph.configuration.multiple + 
        								  parseInt(xxgbcddsj.getMinutes())*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX;
        					/**
        					 *  11.1.4.7.1.2、修改上上个班次元素的属性值. 
        					 * 
        					 **/
        					xxgbcNode.attr('x',xxbgc_x);// 修改底层rectX坐标值.
        		    		var xxgbcCircle = d3.select(d3.selectAll('circle[parent-node='+ _obj.lastbcNode.attr('last-node') +']')[0][0]);
        		    		xxgbcCircle.attr('cx',parseInt(xxgbcNode.attr('x')) +  
            						(xxgbc.bcsj) * ($_GlobalGraph.configuration.multiple) - 12);// 修改圆的cx属性值.
        		    		var xxgbcRectCover = d3.select(d3.selectAll('rect[parent-node='+ _obj.lastbcNode.attr('last-node') + '-cover' +']')[0][0]);
        		    		xxgbcRectCover.attr('x',xxbgc_x);// 修改覆盖层rectX坐标值.
        		    		var xxgbcTextNodes = d3.selectAll('text[parent-node='+ _obj.lastbcNode.attr('last-node') +']')[0];
        		    		var _text = parseInt(xxgbcNode.attr('x')) +  (xxgbc.bcsj) * ($_GlobalGraph.configuration.multiple) - 18;// 1.5.4、计算时刻转text X轴坐标值.
        		    		for(var x = 0 ; x < xxgbcTextNodes.length ; x++) {
        		    			// RelationshipGraph.changeNode(xxgbcTextNodes[x],dx,xxgbc);// 修改text属性值.
        		    			var textNode =  d3.select(xxgbcTextNodes[x]);
        		    			var _textType = textNode.attr('text-type'); // 1.5.4.1、获取当前text元素的类型.
            	    			if(_textType =='bcType')
            						d3.select(xxgbcTextNodes[x]).attr('x',_text);
            					else
            						d3.select(xxgbcTextNodes[x]).attr('x',xxbgc_x);
            	    			if(_textType=='travel') {
            	        			if(xxgbc.bcsj>0)
            	        				textNode.text(xxgbc.fcsj);
            	        		}else if(_textType=='gap') {
            	        			if(xxgbc.bcsj>0)
            	        				textNode.text('保:' + xxgbc.bcsj);
            	        		}
        		    		}
        	    		}else if(xxgbc.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal) {
        	    			/**
        	    			 * 11.1.4.7.2、如果是正常班次.
        	    			 * 
        	    			 **/
        	    			// 11.1.4.7.2.1、修改上上个班次元素的数据停站时间属性值. 
        	    			xxgbc.STOPTIME = parseInt((BaseFun.getDateTime(_obj.lastData.fcsj) - BaseFun.getDateTime(xxgbc.ARRIVALTIME)) / 60000);
        	    			// 11.1.4.7.2.2、修改上上个班次text元素属性值. 
        					var _normalxxgbc = d3.selectAll('text[parent-node=' +  _obj.lastbcNode.attr('last-node')  +']')[0];
        					for(var i = 0 ;i < _normalxxgbc.length ;i++) {
        						var normalxxgbcNode_ = d3.select(_normalxxgbc[i]);
        						if(normalxxgbcNode_.attr('text-type')=='gap')
        							normalxxgbcNode_.text('停:' +   xxgbc.STOPTIME); 
        					}
        	    		}
    				}else {
    					var dxMinues =  parseInt((BaseFun.getDateTime(d.fcsj) - BaseFun.getDateTime(_obj.lastData.ARRIVALTIME)) / 60000);
    					/**
        				 * 1.5.6、修改上个元素班次与当前班次的停站时间和text元素的文本属性值.
        				 * 
        				 **/
    					var dataMap = $_GlobalGraph.configuration.dataMap;
    	    			// 定义是否高峰
    	    			var flag = BaseFun.isPeakTimeScope(BaseFun.getDateTime(nodeContext.lastData.fcsj) , dataMap); 
    	    			// 定义当前班次方向下标代码[0代表上行;1代表下行].
    	    			var cctag = BaseFun.dirDmToIndex(nodeContext.lastData.xlDir);
    	    			// 获取行驶时间.
    	    			var xxsj = BaseFun.getByDirTravelTime(dataMap.zgfsjd , dataMap.wgfsjd , nowDate, dataMap.pcxssjArr , dataMap.gfxxsjArr ,  cctag);
    	    			var normmintzsj = xxsj*0.1,normmaxtzsj = xxsj*0.15;
    	    			// 如果小于零
    	    			if(dxMinues <= 0 && nodeContext.lastData.isfb ==0 ) {
    	    				// 根据不同时段的停站时间.重新赋值停站时间.
    	    				dxmin = flag ?  dataMap.gftzsj[cctag] : dataMap.dgtzsj[cctag]; 
    	    			}else {
    	    				// 如果 大于等于低谷最大停站时间 并且 小于等于三小时.则把低谷最大停站时间 作为 停站时间.
    	    				if(dxMinues >= dataMap.dgmaxtzsj && dxMinues < 180) {
    	    					dxMinues = dataMap.dgmaxtzsj;
    	    				// 如果大于零 并且 小于等于行业标准的最小停站时间
    	    				}else if(dxMinues > 0 && dxMinues <= normmintzsj ) {
    	    					// dxmin = dxmin;
    	    				// 如果大于行业标准的最小停站时间  并且  小于等于行业标准的最大停站时间
    	    				}else if(dxMinues > normmintzsj && dxMinues <= normmaxtzsj ) {
    	    					// dxmin = dxmin;
    	    				// 如果大于行业标准的最大停站时间  并且 小于低谷最大停站时间
    	    				}else if(dxMinues > normmaxtzsj && dxMinues < dataMap.dgmaxtzsj ) {
    	    					// dxmin = dxmin;
    	    				}else if (dxMinues >= 180){
    	    					dxMinues = 0;
    	    				}
    	    			}
            			 _obj.lastData.STOPTIME = dxMinues;
            			for(var t = 0 ; t < _obj.lastTextNodes.length ;t++) {
            				var nowTextNode =  d3.select(_obj.lastTextNodes[t]);
        					if(nowTextNode.attr('text-type')=='gap')
        						d3.select(nowTextNode).text('停:' + _obj.lastData.STOPTIME);
        				}
    				}
    			}else if(_obj.lastData.STOPTIME<0) {
    				_obj.lastData.STOPTIME = minSoptTime;
    				$_date = BaseFun.getDateTime(_obj.lastData.ARRIVALTIME);
            		$_date.setMinutes($_date.getMinutes()+minSoptTime);
            		var $_x = parseInt($_date.getHours()-$_GlobalGraph.configuration.dxHours)*60*$_GlobalGraph.configuration.multiple + 
            				  parseInt($_date.getMinutes())*$_GlobalGraph.configuration.multiple + $_GlobalGraph.configuration.offsetX;
            		d.fcsj =  BaseFun.getTimeStr($_date);
            		$_date.setMinutes($_date.getMinutes()+ d.bcsj);
            		d.ARRIVALTIME =  BaseFun.getTimeStr($_date);
            		d3.select(this).attr('x',$_x);	
            		_obj.qdbcNode.attr('x',$_x);
        			for(var t = 0 ; t < _obj.lastTextNodes.length ;t++) {
        				var nowlastTextNode = d3.select(_obj.lastTextNodes[t]);
    					if(nowlastTextNode.attr('text-type')=='gap')
    						nowlastTextNode.text('停:' + _obj.lastData.STOPTIME);
    				}
        			_obj.dqbcCircleNode.attr('cx',
        					parseInt(_obj.qdbcNode.attr('x')) + (d.bcsj) * ($_GlobalGraph.configuration.multiple) - 12);// 1.5.3.3、修改属于当前班次元素的circle元素圆的cx值.
            		var _text = parseInt(_obj.qdbcNode.attr('x')) +  
            					(d.bcsj) * ($_GlobalGraph.configuration.multiple) - 18;
            		var textNodes = _obj.dqbctextNodes;
            		for(var n = 0 ; n < _obj.dqbctextNodes.length ; n++) {
            			var tn = d3.select(_obj.dqbctextNodes[n]);
            			var _textType = tn.attr('text-type');
            			if(_textType =='bcType')
            				d3.select(textNodes[n]).attr('x',_text);
            			else
            				d3.select(textNodes[n]).attr('x',$_x);
            			if(_textType=='timeslot') {
            				d3.select(_obj.dqbctextNodes[n]).text(d.fcsj  + '~' + d.ARRIVALTIME);
            			}else if(_textType=='gap') {
        					d.STOPTIME = parseInt((BaseFun.getDateTime(_obj.nextData.fcsj) - BaseFun.getDateTime(d.ARRIVALTIME)) / 60000);
        					d3.select(textNodes[n]).text('停:' + d.STOPTIME);
            			}
            			
            		}
    			}
        		d3.selectAll('text[parent-node='+ _obj.qdbcNodeId +']').classed({'alert-danger':false});
    			RelationshipGraph.reDrawDepart();
    			$_GlobalGraph.addHistory();
    		}
    	}
    }, {
    	/**
    	 * @description : (TODO) 根据一个班次rect元素属性ID值获取上下相邻两个班次的相关信息. 
    	 * 
    	 * @params [idValue--某个班次元素对象字符串ID值]
    	 * 
    	 * @returns 返回一个Object
    	 * 
    	 * @status OK.
    	 **/
    	key : 'getContextNodeAndData',
    	value : function(idValue) {
    		// 1、定义当前元素班次的底层rect元素.
    		var qdbcNode = d3.select('rect[id='+ idValue +']'); 
    		// 2、定义当前班次数据.
    		var dqbcData = qdbcNode.data()[0];
    		// 3、定义上个班次、下个班次的ID属性值.
    		var lastbcNodeId = qdbcNode.attr('last-node'),nextbcNodeId = qdbcNode.attr('next-node');
			// 4、定义上个元素班次的底层rect元素.
			var lastbcNode = d3.select('rect[id='+ lastbcNodeId  +']');
			// 5、定义上个班次数据.
			var lastData = lastbcNode.data()[0];
			// 6、定义下个班次元素对象
			var nextbcNode = d3.select('rect[id='+ nextbcNodeId +']');
			// 7、定义下个班次数据.
			var nextData = nextbcNode.data()[0];
			return {'qdbcNodeId':idValue,
					'qdbcNode':qdbcNode,
					'dqbctextNodes':d3.selectAll('text[parent-node='+ idValue +']')[0],// 当前班次元素对象的text文本元素.
					'dqbcCircleNode':d3.select(d3.selectAll('circle[parent-node='+ idValue +']')[0][0]),// 当前班次元素对象的circle圆元素
					'dqbcData' : dqbcData,
					'lastbcNodeId':lastbcNodeId,
					'lastbcNode':lastbcNode,
					'lastTextNodes': d3.selectAll('text[parent-node='+  lastbcNodeId +']')[0],// 下个班次元素对象的text元素对象
					'lastbcCircleNode':d3.select(d3.selectAll('circle[parent-node='+ lastbcNodeId +']')[0][0]),// 下个班次元素对象的circle元素对象
					'lastData':lastData,
					'nextbcNodeId':nextbcNodeId,
					'nextbcNode':nextbcNode,
					'nextbctextNodes' : d3.selectAll('text[parent-node='+  nextbcNodeId +']')[0],// 下个班次元素对象的text元素对象
					'nextbcCircleNode':d3.select(d3.selectAll('circle[parent-node='+ nextbcNodeId +']')[0][0]),// 下个班次元素对象的circle元素对象
					'nextData':nextData
			};
    	}
    }, {
    	/**
    	 * @description : (TODO) 修改班次属性值.
    	 * 
    	 * @param
    	 * 
    	 * @status OK.
    	 * 
    	 * */
    	key : 'updbcData',
    	value : function updbcData(obj) {
    		
    	}
    }, {
    	/**
    	 * @description : (TODO) 判断是否为首末班车班次.
    	 * 
    	 * @params : [str--时间字符串]
    	 * 
    	 * @return : 返回布尔值.
    	 * 
    	 **/
    	key : 'issmbc',
    	value : function issmbc(str) {
    		var tag = false;
    		var list = $_GlobalGraph.configuration.dataMap.smbcsjArr;// 获取起终点站首末班车时间对成数组
    		var len = list.length;
    		for(var t = 0 ; t<len ; t++) {
    			if(str== list[t].kssj || str == list[t].jssj)
    				tag = true;
    		}
    		return tag;
    	}
    }, {
    	key : 'zbTosj',
    	value : function zbTosj(_d3x) {
    		var hour = parseInt(_d3x/($_GlobalGraph.configuration.multiple*60)) + $_GlobalGraph.configuration.dxHours;
    		var min = parseInt((_d3x%($_GlobalGraph.configuration.multiple*60))/$_GlobalGraph.configuration.multiple);
    		return {'hour': hour<10? '0' + hour : hour ,'min' : min < 10 ? '0' + min : min};
    		
    	}
    },  {
    	/**
    	 * @description : (TODO) 修改text沿X方向的X坐标属性值和文本内容.
    	 * 
    	 * @status : OK.
    	 **/
    	key : 'changeNode',
    	value : function changeNode(node,dx,d) {
    		// 1、获取当前text元素对象.
    		var textNode = d3.select(node);
    		// 2、修改当前text元素的X属性值
    		textNode.attr('x',parseInt(textNode.attr('x'))+dx);
    		// 3、获取当前元素的text-type属性值.
    		var _textType = textNode.attr('text-type');
    		/**
    		 * 4、判断当前元素的text-type属性值类型.
    		 * 
    		 * 		✿ 如果是timeslot.代表的是第一行的text文本.发车时间 ~ 到达时间
    		 * 
    		 * 		✿ 如果是gap.代表的是第三行的text文本. 停站时间.
    		 */
    		if(_textType=='timeslot') {
    			// 4.1、修改第一行的text文本.发车时间 ~ 到达时间
				if(d.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.bd &&
						d.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.out &&
	   				 	d.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.cf &&
	   				 	d.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.in_ &&
	   				 	d.bcType != $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
					textNode.text(d.fcsj + '~' + d.ARRIVALTIME);
    			
    		}else if(_textType=='travel') {
    			if(d.bcsj>0) {
    				// 4.2 修改第二行的text文本. 
        			if(d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd ||
    						d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
    	   				 	d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_ ||
    	   				 	d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
        				textNode.text(d.fcsj);
                	else if(d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf)
                		textNode.text('吃:' + d.bcsj); 
                	else 
                		textNode.text("行:" + d.bcsj); 
    			}
    		}else if(_textType=='gap') {
    			if(d.bcsj>0) {
    				// 4.3 修改第三行的text文本. 停站时间.
        			if(d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd||
        					d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc)
        				textNode.text('保:' + d.bcsj);
        			else if(d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out ||
        						d.bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_)
        				textNode.text('行:' + d.bcsj); 
        			else
        				textNode.text('停:' + d.STOPTIME); 
    			}
    		}
    	}
    }, {
        key: 'verifyJson',
        value: function verifyJson(json) {
            if (!RelationshipGraph.isArray(json) || json.length < 0 || _typeof(json[0]) !== 'object') {
                throw 'JSON是JavaScript对象,不为空数组.';
            }
            var length = json.length;
            while (length--) {
                var element = json[length];
                var keys = Object.keys(element);
                var keyLength = keys.length;
                var parentColor = element.parentColor;
                if (element.parent === undefined) {
                    throw '孩子没有父节点.';
                } else if (parentColor !== undefined && (parentColor > 4 || parentColor < 0)) {
                    throw '父节点不支持该颜色.';
                }
                while (keyLength--) {
                    if (keys[keyLength].toUpperCase() == 'VALUE') {
                        if (keys[keyLength] != 'value') {
                            json[length].value = json[length][keys[keyLength]];
                            delete json[length][keys[keyLength]];
                        }
                        break;
                    }
                }
            }
            return true;
        }
    }]);
    return RelationshipGraph;
}();

/** 创建关系图层
 *
 * 	@param {Object} 图层参数配置信息
 * 
 *  @return {Object} 返回创建图层对象
 * 
 **/
d3.selection.prototype.relationshipGraph = function (userConfig) {
    'use strict';
    $_GlobalGraph = new RelationshipGraph(this, userConfig);
    return $_GlobalGraph;
};

/**
 * 全局定义,模块,svgelement
 * 
 * 
 */
(function (root, factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        define(['d3'], factory);
    } else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
        module.exports = function (d3) {
            d3.tip = factory(d3);
            return d3.tip;
        };
    } else {
        window.d3.tip = factory(d3);
    }
})(undefined, function (d3) {
    'use strict';
    return function () {
        var d3TipDirection = function d3TipDirection() {
            return 'n';
        };
        var d3TipOffset = function d3TipOffset() {
            return [0, 0];
        };

        var d3TipHtml = function d3TipHtml() {
            return ' ';
        };
        var initNode = function initNode() {
            var node = d3.select(document.createElement('div'));
            node.style('position', 'absolute').style('top', 0).style('opacity', 0).style('pointer-events', 'none').style('box-sizing', 'border-box');
            return node.node();
        };
        var getNodeEl = function getNodeEl() {
            if (node === null) {
                node = initNode();
                document.body.appendChild(node);
            }

            return d3.select(node);
        };
        var getScreenBBox = function getScreenBBox() {
            var targetel = target || d3.event.target;

            while ('undefined' === typeof targetel.getScreenCTM && 'undefined' === targetel.parentNode) {
                targetel = targetel.parentNode;
            }

            var bbox = {},
                matrix = targetel.getScreenCTM(),
                tbbox = targetel.getBBox(),
                width = tbbox.width,
                height = tbbox.height,
                x = tbbox.x,
                y = tbbox.y;

            point.x = x;
            point.y = y;
            bbox.nw = point.matrixTransform(matrix);
            point.x += width;
            bbox.ne = point.matrixTransform(matrix);
            point.y += height;
            bbox.se = point.matrixTransform(matrix);
            point.x -= width;
            bbox.sw = point.matrixTransform(matrix);
            point.y -= height / 2;
            bbox.w = point.matrixTransform(matrix);
            point.x += width;
            bbox.e = point.matrixTransform(matrix);
            point.x -= width / 2;
            point.y -= height / 2;
            bbox.n = point.matrixTransform(matrix);
            point.y += height;
            bbox.s = point.matrixTransform(matrix);
            return bbox;
        };
        var direction = d3TipDirection,
            offset = d3TipOffset,
            html = d3TipHtml,
            node = initNode(),
            svg = null,
            point = null,
            target = null;
        var getPageTopLeft = function getPageTopLeft(el) {
            var rect = el.getBoundingClientRect(),
                docEl = document.documentElement;
            return {
                top: rect.top + (window.pageYOffset || docEl.scrollTop || 0),
                right: rect.right + (window.pageXOffset || 0),
                bottom: rect.bottom + (window.pageYOffset || 0),
                left: rect.left + (window.pageXOffset || docEl.scrollLeft || 0)
            };
        };
        var functor = function functor(val) {
            return typeof val === 'function' ? val : function () {
                return val;
            };
        };
        var directionN = function directionN() {
            var bbox = getScreenBBox();
            return {
                top: bbox.n.y - node.offsetHeight,
                left: bbox.n.x - node.offsetWidth / 2
            };
        };
        var directionS = function directionS() {
            var bbox = getScreenBBox();
            return {
                top: bbox.s.y,
                left: bbox.s.x - node.offsetWidth / 2
            };
        };
        var directionE = function directionE() {
            var bbox = getScreenBBox();
            return {
                top: bbox.e.y - node.offsetHeight / 2,
                left: bbox.e.x
            };
        };
        var directionW = function directionW() {
            var bbox = getScreenBBox();
            return {
                top: bbox.w.y - node.offsetHeight / 2,
                left: bbox.w.x - node.offsetWidth
            };
        };

        var directionNW = function directionNW() {
            var bbox = getScreenBBox();
            return {
                top: bbox.nw.y - node.offsetHeight,
                left: bbox.nw.x - node.offsetWidth
            };
        };
        var directionNE = function directionNE() {
            var bbox = getScreenBBox();
            return {
                top: bbox.ne.y - node.offsetHeight,
                left: bbox.ne.x
            };
        };
        var directionSW = function directionSW() {
            var bbox = getScreenBBox();
            return {
                top: bbox.sw.y,
                left: bbox.sw.x - node.offsetWidth
            };
        };

        var directionSE = function directionSE() {
            var bbox = getScreenBBox();
            return {
                top: bbox.se.y,
                left: bbox.e.x
            };
        };
        var direction_callbacks = d3.map({
            n: directionN,
            s: directionS,
            e: directionE,
            w: directionW,
            nw: directionNW,
            ne: directionNE,
            sw: directionSW,
            se: directionSE
        }),
        directions = direction_callbacks.keys();
        var getSVGNode = function getSVGNode(el) {
            el = el.node();
            if (el.tagName.toLowerCase() === 'svg') {
                return el;
            }
            return el.ownerSVGElement;
        };
        var tip = function tip(vis) {
            svg = getSVGNode(vis);
            point = svg.createSVGPoint();
            document.body.appendChild(node);
        };
        tip.show = function () {
        	var _this = this;
        	var args = Array.prototype.slice.call(arguments);
            if (args[args.length - 1] instanceof SVGElement) {
                 target = args.pop();
             }
            var content = html.apply(_this, args),
                poffset = offset.apply(_this, args),
                nodel = getNodeEl(),
                scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
                scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
            var coords = void 0,
                dir = direction.apply(_this, args),
                i = directions.length;
             
            tipEventTimer = setTimeout(function(e) {
            	nodel.html(content).style('position', 'absolute').style('opacity', 1).style('pointer-events', 'all');
            },500);
            	 
            var node = nodel._groups ? nodel._groups[0][0] : nodel[0][0],
        		nodeWidth = node.clientWidth,
        		nodeHeight = node.clientHeight,
        		windowWidth = window.innerWidth,
        		windowHeight = window.innerHeight,
        		elementCoords = getPageTopLeft(_this),
        		breaksTop = elementCoords.top - nodeHeight < 0,
        		breaksLeft = elementCoords.left - nodeWidth < 0,
        		breaksRight = elementCoords.right + nodeHeight > windowWidth,
        		breaksBottom = elementCoords.bottom + nodeHeight > windowHeight;
        		if (breaksTop && !breaksRight && !breaksBottom && breaksLeft) {
        			dir = 'e';
        		} else if (breaksTop && !breaksRight && !breaksBottom && !breaksLeft) {
	    			dir = 's';
        		} else if (breaksTop && breaksRight && !breaksBottom && !breaksLeft) {
        			dir = 'w';
        		} else if (!breaksTop && !breaksRight && !breaksBottom && breaksLeft) {
        			dir = 'e';
        		} else if (!breaksTop && !breaksRight && breaksBottom && breaksLeft) {
        			dir = 'e';
        		} else if (!breaksTop && !breaksRight && breaksBottom && !breaksLeft) {
        			dir = 'e';
        		} else if (!breaksTop && breaksRight && breaksBottom && !breaksLeft) {
        			dir = 'n';
        		} else if (!breaksTop && breaksRight && !breaksBottom && !breaksLeft) {
        			dir = 'w';
        		}
        		direction(dir);
        		while (i--) {
        			nodel.classed(directions[i], false);
        		}
        		coords = direction_callbacks.get(dir).apply(_this);
        		nodel.classed(dir, true).style('top', coords.top + poffset[0] + scrollTop + 'px').style('left', coords.left + poffset[1] + scrollLeft + 'px');
            return tip;
        };
        tip.hide = function () {
        	clearTimeout(tipEventTimer);
            var nodel = getNodeEl();
            nodel.style('opacity', 0).style('pointer-events', 'none');
            return tip;
        };
        tip.attr = function (n) {
            if (arguments.length < 2 && typeof n === 'string') {
                return getNodeEl().attr(n);
            } else {
                var args = Array.prototype.slice.call(arguments);
                d3.selection.prototype.attr.apply(getNodeEl(), args);
            }

            return tip;
        };
        tip.style = function (n) {
            if (arguments.length < 2 && typeof n === 'string') {
                return getNodeEl().style(n);
            } else {
                var args = Array.prototype.slice.call(arguments);

                if (args.length === 1) {
                    var styles = args[0],
                        keys = Object.keys(styles);

                    for (var key = 0; key < keys.length; key++) {
                        d3.selection.prototype.style.apply(getNodeEl(), styles[key]);
                    }
                }
            }

            return tip;
        };
        tip.direction = function (v) {
            if (!arguments.length) {
                return direction;
            }
            direction = v == null ? v : functor(v);
            return tip;
        };
        tip.offset = function (v) {
            if (!arguments.length) {
                return offset;
            }
            offset = v == null ? v : functor(v);
            return tip;
        };
        tip.html = function (v) {
            if (!arguments.length) {
                return html;
            }
            html = v == null ? v : functor(v);
            return tip;
        };
        tip.destroy = function () {
            if (node) {
                getNodeEl().remove();
                node = null;
            }
            return tip;
        };
        return tip;
    };
});