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
|
/*-----------------------------------------------------------------------------------*/
/* Copyright (C) 1998-2000 INRIA/Enpc */
/* Fabrice LERAY INRIA 2005 */
/* Allan CORNET INRIA 2005 */
/*-----------------------------------------------------------------------------------*/
#include "intgset.h"
/*-----------------------------------------------------------------------------------*/
#include "../graphics/bcg.h"
#include "../stack-c.h"
#include "../graphics/CloneObjects.h"
#include "../graphics/Interaction.h"
#include "../graphics/SetProperty.h"
#include "../graphics/GetProperty.h"
#include "../graphics/InitObjects.h"
#include "../graphics/DrawObjects.h"
/* Constructors should NOT be called at this level (not inside matdes.c) */
#include "../graphics/BuildObjects.h"
#include "../graphics/DestroyObjects.h"
#ifdef WITH_TK
#include "../tclsci/GedManagement.h"
#endif
#include "intcommongraphics.h"
#ifdef WIN32
#include "../os_specific/win_mem_alloc.h" /* MALLOC */
#else
#include "../os_specific/sci_mem_alloc.h" /* MALLOC */
#endif
/*-----------------------------------------------------------------------------------*/
extern sciPointObj *pfiguremdl;
extern sciPointObj *paxesmdl;
extern int versionflag;
/*-----------------------------------------------------------------------------------*/
static char error_message[256];
/*-----------------------------------------------------------------------------------*/
int setticks(char * xyztick, sciPointObj* psubwin, int * ptrindex, int * numrow, int * numcol);
int setchampdata(sciPointObj *pobj, int *value, int *numrow, int *numcol, char *fname);
int setgrayplotdata(sciPointObj *pobj, int *value, int *numrow, int *numcol, char *fname);
int set3ddata(sciPointObj *pobj, int *value, int *numrow, int *numcol, int flagc, char *fname);
int sciSet(sciPointObj *pobj, char *marker, int *value, int *numrow, int *numcol);
int LinearScaling2Colormap(sciPointObj* pobj);
char ** ReBuildUserTicks( char old_logflag, char new_logflag, double * u_xgrads, int *u_nxgrads, char ** u_xlabels);
char ** CaseLogflagN2L(int * u_nxgrads, double *u_xgrads, char ** u_xlabels);
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------
* sciset(choice-name,x1,x2,x3,x4,x5)
* or xset()
*-----------------------------------------------------------*/
int gset(fname,fname_len)
char *fname;
unsigned long fname_len;
{
integer m1,n1,l1,m2,n2,l2,numrow3,numcol3,l3,num,cur,na,verb=0;
unsigned long hdl;
int lw,t2;
BOOL vis_save;
sciPointObj *pobj;
/* F.Leray Adding some tmp variable for SCI_SURFACE / data case*/
integer m3tl, n3tl, l3tl;
int numrow[4],i;
int numcol[4], lxyzcol[4];
int ptrindex[2];
int flagc = -1;
/* F.Leray Init. to 0*/
for(i=0;i<4;i++){
numrow[i] = 0;
numcol[i] = 0;
lxyzcol[i] = 0;
}
ptrindex[0] = 0;
ptrindex[1] = 0;
CheckRhs(2,3);
CheckLhs(0,1);
/* set or create a graphic window */
switch(VarType(1))
{
case 1: /* tclsci handle */
lw = 1 + Top - Rhs;
C2F(overload)(&lw,"set",3);return 0;
return 0;
break;
case 9: /* first is a scalar argument so it's a gset(hdl,"command",[param]) */
/* F.Leray; INFO: case 9 is considered for a matrix of graphic handles*/
CheckRhs(3,3);
GetRhsVar(1,"h",&m1,&n1,&l1); /* Gets the Handle passed as argument */
if ( *hstk(l1) != sciGetHandle(pfiguremdl) && *hstk(l1) != sciGetHandle(paxesmdl)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_title)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_x_label)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_y_label) /* Addings here F.Leray 10.06.04 */
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_z_label))
{
if (m1!=1||n1!=1) {
lw = 1 + Top - Rhs;
C2F(overload)(&lw,"set",3);return 0;
}
if (version_flag() ==0)
hdl = (unsigned long)*hstk(l1); /* Puts the value of the Handle to hdl */
else
hdl = (unsigned long)0;
if (hdl == (unsigned long)0 )
pobj = (sciPointObj *) NULL;
else
pobj = sciGetPointerFromHandle(hdl);
}
else
{
hdl = (unsigned long)*hstk(l1);
pobj = sciGetPointerFromHandle(hdl);
}
GetRhsVar(2,"c",&m2,&n2,&l2); /* Gets the command name */
if ( *hstk(l1) != sciGetHandle(pfiguremdl) && *hstk(l1) != sciGetHandle(paxesmdl)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_title)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_x_label)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_y_label)
&& *hstk(l1) != sciGetHandle(pSUBWIN_FEATURE(paxesmdl)->mon_z_label))
if ((strcmp(cstk(l2),"old_style") !=0)
&&(strcmp(cstk(l2),"default_figure") !=0)
&& (strcmp(cstk(l2),"default_axes") !=0) ) SciWin();
if (strcmp(cstk(l2),"user_data")==0) {
/* set pobj->user_data*/
int *size_ptr, data_size;
int **user_data_ptr,*data_ptr;
int delete_user_data=0;
if (VarType(3) == 1) {
GetRhsVar(3,"d",&numrow3,&numcol3,&l3);
if (numrow3==0||numcol3==0) delete_user_data=1;
}
else if (VarType(3) == 0) delete_user_data=1;
sciGetPointerToUserData (pobj,&user_data_ptr, &size_ptr);
if (delete_user_data) {
FREE(*user_data_ptr);
*user_data_ptr=NULL;
*size_ptr=0;
}
else {
data_ptr=GetData(3);
data_size=GetDataSize(3)*2;
if (*user_data_ptr==NULL) {
if ( (*user_data_ptr=(int *) MALLOC (data_size*sizeof (int))) == NULL) {
strcpy(error_message,"No memory left for allocating user_data");return -1;}
*size_ptr=data_size;
memcpy(*user_data_ptr,data_ptr,data_size*sizeof (int));
}
else if (*size_ptr==data_size) {
memcpy(*user_data_ptr,data_ptr,data_size*sizeof (int));
}
else {
FREE(*user_data_ptr);
if ( (*user_data_ptr=(int *) MALLOC (data_size * sizeof (int))) == NULL) {
strcpy(error_message,"No memory left for allocating user_data");return -1;}
*size_ptr=data_size;
memcpy(*user_data_ptr,data_ptr,data_size*sizeof(int));
}
}
return 0;
}
t2=sciType(cstk(l2),pobj);
if (t2<0) {
Scierror(999,"%s: unknown property name '%s' \r\n",fname,cstk(l2));
return 0;}
if (VarType(3) != t2) {
Scierror(999,"%s: uncompatible values for property type '%s' \r\n",fname,cstk(l2));
return 0;}
if (VarType(3) == 1) GetRhsVar(3,"d",&numrow3,&numcol3,&l3);
if (VarType(3) == 9) GetRhsVar(3,"h",&numrow3,&numcol3,&l3);
if (VarType(3) == 10)
{ if ((strcmp(cstk(l2),"tics_labels") !=0)
&& ((strcmp(cstk(l2),"auto_ticks")) !=0)
&& ((strcmp(cstk(l2),"axes_visible")) !=0)
&& ((strcmp(cstk(l2),"axes_reverse")) !=0))
{GetRhsVar(3,"c",&numrow3,&numcol3,&l3);}
else
GetRhsVar(3,"S",&numrow3,&numcol3,&l3); }
break;
case 10:/* first is a string argument so it's a gset("command",[param]) */
CheckRhs(2,2);
GetRhsVar(1,"c",&m2,&n2,&l2);
if (strcmp(cstk(l2),"default_figure") !=0 && strcmp(cstk(l2),"default_axes") !=0 )
{
if ((strcmp(cstk(l2),"old_style") ==0) ||
(strcmp(cstk(l2),"current_figure") ==0)) {
hdl = (unsigned long)0;
pobj = (sciPointObj *) NULL;
}
else
{
SciWin();
if (version_flag() == 0 )
if ((strcmp(cstk(l2),"zoom_") !=0) &&
(strcmp(cstk(l2),"auto_") !=0) &&
(strcmp(cstk(l2),"clip_box") !=0) )
hdl = (unsigned long ) sciGetHandle(sciGetCurrentObj ()) ;
else
hdl = (unsigned long ) sciGetHandle(sciGetSelectedSubWin (sciGetCurrentFigure ()));
else
hdl = (unsigned long)0;
if (hdl == (unsigned long)0 )
pobj = (sciPointObj *) NULL;
else
pobj = sciGetPointerFromHandle(hdl);
}
}
else
{
hdl = (unsigned long)0;
pobj = (sciPointObj *) NULL;
}
t2=sciType(cstk(l2),pobj);
if (t2<0) {
Scierror(999,"%s: unknown property name '%s' \r\n",fname,cstk(l2));
return 0;}
if (VarType(2) != t2)
if(strcmp(cstk(l2),"current_figure") != 0 && VarType(2) !=1 ){
/* F.Leray : special unique case here set("current_figure", HANDLE);*/
/* HANDLE type is 9 */
Scierror(999,"%s: uncompatible values for property type '%s' \r\n",fname,cstk(l2));
return 0;
}
if ( (VarType(2) == 1) ) {GetRhsVar(2,"d",&numrow3,&numcol3,&l3); }
if ( (VarType(2) == 9) ) {GetRhsVar(2,"h",&numrow3,&numcol3,&l3); }
if ( (VarType(2) == 10) ) {
if ((strcmp(cstk(l2),"tics_labels") !=0)
&& ((strcmp(cstk(l2),"auto_ticks")) !=0)
&& ((strcmp(cstk(l2),"axes_visible")) !=0)
&& ((strcmp(cstk(l2),"axes_reverse")) !=0))
{GetRhsVar(2,"c",&numrow3,&numcol3,&l3);}
else
GetRhsVar(2,"S",&numrow3,&numcol3,&l3);
}
break;
default:
lw = 1 + Top - Rhs;
C2F(overload)(&lw,"set",3);return 0;
break;
}
if ( (hdl != (unsigned long)0) ) { /* F.Leray 16.03.04*/
pobj = sciGetPointerFromHandle(hdl);
if (pobj == (sciPointObj *)NULL) {
Scierror(999,"%s :the handle is not or no more valid\r\n",fname);
return 0;
}
vis_save=sciGetVisibility(pobj); /*used not to redraw the figure is object remains invisible SS 20.04.04*/
if(sciGetEntityType(pobj) == SCI_SUBWIN && (strcmp(cstk(l2),"x_ticks")==0 ||
strcmp(cstk(l2),"y_ticks")==0 ||
strcmp(cstk(l2),"z_ticks")==0))
{
if(VarType(3) != 16){
Scierror(999,"%s: Incorrect argument, must be a Tlist!\r\n",fname);
return -1;
}
GetRhsVar(3,"t",&m3tl,&n3tl,&l3tl);
GetListRhsVar(3,2,"d",&numrow[0],&numcol[0],&ptrindex[0]);
GetListRhsVar(3,3,"S",&numrow[1],&numcol[1],&ptrindex[1]);
if(numrow[0] == 0 || numrow[1] == 0 || numcol[0] == 0 || numcol[1] == 0){
Scierror(999,"%s: Incorrect argument, a complete 'ticks' tlist must be defined!\r\n",fname);
return -1;
}
if(setticks(cstk(l2),pobj, ptrindex, numrow, numcol) != 0) return 0;
}
else if(strcmp(cstk(l2),"data") == 0){ /* distinction for "data" treatment for champ and surface objects */
if((sciGetEntityType(pobj) == SCI_SEGS) && (pSEGS_FEATURE(pobj)->ptype == 1))
{ /* F.Leray Work here*/
int address[4],i;
for(i=0;i<4;i++) address[i] = 0;
if(VarType(3) != 16){
Scierror(999,"%s: Incorrect argument, must be a Tlist!\r\n",fname);
return -1;
}
GetRhsVar(3,"t",&m3tl,&n3tl,&l3tl);
if(m3tl != 5 || n3tl != 1){
sciprint("Tlist size must be 1x5\r\n");
return -1;
}
GetListRhsVar(3,2,"d",&numrow[0],&numcol[0],&address[0]);
GetListRhsVar(3,3,"d",&numrow[1],&numcol[1],&address[1]);
GetListRhsVar(3,4,"d",&numrow[2],&numcol[2],&address[2]);
GetListRhsVar(3,5,"d",&numrow[3],&numcol[3],&address[3]);
if (setchampdata(pobj, address, numrow, numcol,fname)!=0) return 0;
}
else if((sciGetEntityType(pobj) == SCI_GRAYPLOT) && (pGRAYPLOT_FEATURE(pobj)->type == 0)) /* case 0: real grayplot */
{ /* F.Leray Work here*/
int address[4],i;
for(i=0;i<4;i++) address[i] = 0;
if(VarType(3) != 16){
Scierror(999,"%s: Incorrect argument, must be a Tlist!\r\n",fname);
return -1;
}
GetRhsVar(3,"t",&m3tl,&n3tl,&l3tl);
if(m3tl != 4 || n3tl != 1){
sciprint("Tlist size must be 1x4\r\n");
return -1;
}
GetListRhsVar(3,2,"d",&numrow[0],&numcol[0],&address[0]);
GetListRhsVar(3,3,"d",&numrow[1],&numcol[1],&address[1]);
GetListRhsVar(3,4,"d",&numrow[2],&numcol[2],&address[2]);
if (setgrayplotdata(pobj, address, numrow, numcol,fname)!=0) return 0;
}
else if(sciGetEntityType(pobj) == SCI_SURFACE)
{ /* F.Leray Work here*/
if(VarType(3) != 16){
Scierror(999,"%s: Incorrect argument, must be a Tlist!\r\n",fname);
return -1;
}
GetRhsVar(3,"t",&m3tl,&n3tl,&l3tl);
/* GetListRhsVar(3,1,"d",&numrow[0],&numcol[0],&lxyzcol[0]);
Not good because 3,1 is the string character "3d x y z [en option col]"*/
GetListRhsVar(3,2,"d",&numrow[0],&numcol[0],&lxyzcol[0]);
GetListRhsVar(3,3,"d",&numrow[1],&numcol[1],&lxyzcol[1]);
if(m3tl == 4)
{
GetListRhsVar(3,4,"d",&numrow[2],&numcol[2],&lxyzcol[2]);
flagc = 0;
}
else if( m3tl == 5)
{
GetListRhsVar(3,4,"d",&numrow[2],&numcol[2],&lxyzcol[2]);
GetListRhsVar(3,5,"d",&numrow[3],&numcol[3],&lxyzcol[3]);
flagc = 1;
}
else
{
sciprint("Error m3tl must be equal to 4 or 5\r\n");
return -1;
}
if (set3ddata(pobj, lxyzcol, numrow, numcol,flagc,fname)!=0) return 0;
}
else /* F.Leray 02.05.05 : "data" case for others (using sciGetPoint routine inside GetProperty.c) */
{
if (sciSet(pobj, cstk(l2), &l3, &numrow3, &numcol3)!=0) {
Scierror(999,"%s: %s\r\n",fname,error_message);
return 0;
}
}
}
else{ /* F.Leray 02.05.05 : main case (using sciGetPoint routine inside GetProperty.c) */
if (sciSet(pobj, cstk(l2), &l3, &numrow3, &numcol3)!=0) {
Scierror(999,"%s: %s\r\n",fname,error_message);
return 0;
}
}
if (!(vis_save==0&&sciGetVisibility(pobj)==0)) {/* do not redraw figure if object remains invisible */
if ((strcmp(cstk(l2),"figure_style") !=0) &&
(strcmp(cstk(l2),"old_style") !=0 ) &&
(strcmp(cstk(l2),"current_axes") !=0) &&
(strcmp(cstk(l2),"default_figure") !=0) &&
(strcmp(cstk(l2),"default_axes") !=0) &&
(pobj != pfiguremdl) && (pobj != paxesmdl)
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_title
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_x_label
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_y_label
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_z_label ){ /* Addings F.Leray 10.06.04 */
num= sciGetNumFigure (pobj);
C2F (dr) ("xget", "window",&verb,&cur,&na,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F (dr) ("xset", "window",&num,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
sciDrawObj(sciGetParentFigure(pobj)); /* F.Leray we redraw here*/
/* EraseAndOrRedraw(pobj); */ /* inhibit EraseAndOrRedraw for now F.Leray 20.12.04 */
C2F (dr) ("xset", "window",&cur,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
}
}
}
else if (sciSet((sciPointObj *) NULL, cstk(l2), &l3, &numrow3, &numcol3)!=0) {
Scierror(999,"%s: %s\r\n",fname,error_message);
return 0;
}
LhsVar(1)=0;
return 0;
}
/*-----------------------------------------------------------------------------------*/
int setticks(char * xyztick, sciPointObj* psubwin, int * ptrindex, int * numrow, int * numcol)
{
sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
int i,row,col,prod,old_prod;
row = *numrow;
col = *numcol;
prod = row * col;
if(strcmp(xyztick,"x_ticks")==0)
{
old_prod = ppsubwin->axes.u_nxgrads; /* old size of the locations/labels vectors*/
ppsubwin->axes.auto_ticks[0] = FALSE;
ppsubwin->axes.u_nxgrads = prod;
FREE(ppsubwin->axes.u_xgrads); ppsubwin->axes.u_xgrads = NULL;
if((ppsubwin->axes.u_xgrads=(double *) MALLOC(prod*sizeof(double)))==NULL) return -1;
if(ppsubwin->logflags[0]=='l')
{
for(i=0;i< prod;i++)
ppsubwin->axes.u_xgrads[i] = log10(stk(ptrindex[0])[i]);
}
else
{
for(i=0;i< prod;i++)
ppsubwin->axes.u_xgrads[i] = stk(ptrindex[0])[i];
ppsubwin->axes.nbsubtics[0] = ComputeNbSubTics(psubwin,ppsubwin->axes.u_nxgrads,'n',NULL,ppsubwin->axes.nbsubtics[0]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
}
if(ppsubwin->axes.u_xlabels != NULL)
for(i=0;i<old_prod;i++) { /* we free the old vector components (size == old_prod) */
FREE(ppsubwin->axes.u_xlabels[i]);
ppsubwin->axes.u_xlabels[i] = NULL;}
FREE(ppsubwin->axes.u_xlabels); ppsubwin->axes.u_xlabels = NULL;
ppsubwin->axes.u_xlabels = *(char ***) &ptrindex[1];
}
else if(strcmp(xyztick,"y_ticks")==0)
{
old_prod = ppsubwin->axes.u_nygrads; /* old size of the locations/labels vectors*/
ppsubwin->axes.auto_ticks[1] = FALSE;
ppsubwin->axes.u_nygrads = prod;
FREE(ppsubwin->axes.u_ygrads); ppsubwin->axes.u_ygrads = NULL;
if((ppsubwin->axes.u_ygrads=(double *) MALLOC(prod*sizeof(double)))==NULL) return -1;
if(ppsubwin->logflags[1]=='l')
{
for(i=0;i< prod;i++)
ppsubwin->axes.u_ygrads[i] = log10(stk(ptrindex[0])[i]);
}
else
{
for(i=0;i< prod;i++)
ppsubwin->axes.u_ygrads[i] = stk(ptrindex[0])[i];
ppsubwin->axes.nbsubtics[1] = ComputeNbSubTics(psubwin,ppsubwin->axes.u_nygrads,'n',NULL,ppsubwin->axes.nbsubtics[1]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
}
if(ppsubwin->axes.u_ylabels != NULL)
for(i=0;i<old_prod;i++) { /* we free the old vector components (size == old_prod) */
FREE(ppsubwin->axes.u_ylabels[i]);
ppsubwin->axes.u_ylabels[i] = NULL;}
FREE(ppsubwin->axes.u_ylabels); ppsubwin->axes.u_ylabels = NULL;
ppsubwin->axes.u_ylabels = *(char ***) &ptrindex[1];
}
else if(strcmp(xyztick,"z_ticks")==0)
{
old_prod = ppsubwin->axes.u_nzgrads; /* old size of the locations/labels vectors*/
ppsubwin->axes.auto_ticks[2] = FALSE;
ppsubwin->axes.u_nzgrads = prod;
FREE(ppsubwin->axes.u_zgrads); ppsubwin->axes.u_zgrads = NULL;
if((ppsubwin->axes.u_zgrads=(double *) MALLOC(prod*sizeof(double)))==NULL) return -1;
if(ppsubwin->logflags[2]=='l')
{
for(i=0;i< prod;i++)
ppsubwin->axes.u_zgrads[i] = log10(stk(ptrindex[0])[i]);
}
else
{
for(i=0;i< prod;i++)
ppsubwin->axes.u_zgrads[i] = stk(ptrindex[0])[i];
ppsubwin->axes.nbsubtics[2] = ComputeNbSubTics(psubwin,ppsubwin->axes.u_nzgrads,'n',NULL,ppsubwin->axes.nbsubtics[2]); /* Nb of subtics computation and storage */ /* F.Leray 07.10.04 */
}
if(ppsubwin->axes.u_zlabels != NULL)
for(i=0;i<old_prod;i++) { /* we free the old vector components (size == old_prod) */
FREE(ppsubwin->axes.u_zlabels[i]);
ppsubwin->axes.u_zlabels[i] = NULL;}
FREE(ppsubwin->axes.u_zlabels); ppsubwin->axes.u_zlabels = NULL;
ppsubwin->axes.u_zlabels = *(char ***) &ptrindex[1];
}
return 0;
}
/*-----------------------------------------------------------------------------------*/
/* F.Leray 29.04.05 */
/* the champ data is now set as a tlist (like for surface objects) */
/* setchampdata(pobj,cstk(l2), &l3, &numrow3, &numcol3, fname) */
int setchampdata(sciPointObj *pobj, int *value, int *numrow, int *numcol, char *fname)
{
int i=0;
sciSegs * ppsegs = pSEGS_FEATURE (pobj);
integer m1, n1, l1, m2, n2, l2, m3, n3, l3, m4, n4, l4;
double * vx = NULL, * vy = NULL;
double * vfx = NULL, * vfy = NULL;
m1 = numrow[0];
m2 = numrow[1];
m3 = numrow[2];
m4 = numrow[3];
n1 = numcol[0];
n2 = numcol[1];
n3 = numcol[2];
n4 = numcol[3];
l1 = value[0];
l2 = value[1];
l3 = value[2];
l4 = value[3];
if (n1 != 1 || n2 != 1){
Scierror(999,"%s: Inside the Tlist : the first argument must be columns vectors\r\n",fname);
return 0;
}
if (m3 != m1 || n3 != m2 || m4 != m3 || n4 != n3) {
Scierror(999,"%s: Inside the Tlist : incompatible length in the third and/or fourth argument(s)\r\n",fname);
return 0;
}
if (m1 * n1 == 0 || m2 * n2 == 0 || m3 * n3 == 0 || m4 * n4 == 0) { LhsVar(1)=0; return 0;}
/* Update the dimensions Nbr1 and Nbr2 */
ppsegs->Nbr1 = m1;
ppsegs->Nbr2 = m2;
/* Free the old values... */
FREE(ppsegs->vx); ppsegs->vx = NULL;
FREE(ppsegs->vy); ppsegs->vy = NULL;
FREE(ppsegs->vfx); ppsegs->vfx = NULL;
FREE(ppsegs->vfy); ppsegs->vfy = NULL;
/* allocations:*/
if ((vx = MALLOC (m1 * sizeof (double))) == NULL) return -1;
if ((vy = MALLOC (m2 * sizeof (double))) == NULL) {
FREE(vx); vx = (double *) NULL;
return -1;
}
if ((vfx = MALLOC (m3*n3 * sizeof (double))) == NULL) return -1;
if ((vfy = MALLOC (m4*n4 * sizeof (double))) == NULL) {
FREE(vfx); vfx = (double *) NULL;
return -1;
}
/* Copy the new values F.Leray */
for(i=0;i< m1;i++)
vx[i] = stk(l1)[i];
for(i=0;i< m2;i++)
vy[i] = stk(l2)[i];
for(i=0;i< m3*n3;i++){ /* vfx and vfy must have the same dimensions */
vfx[i] = stk(l3)[i];
vfy[i] = stk(l4)[i];
}
ppsegs->vx = vx;
ppsegs->vy = vy;
ppsegs->vfx = vfx;
ppsegs->vfy = vfy;
return 0;
}
/*-----------------------------------------------------------------------------------*/
/* F.Leray 29.04.05 */
/* the grayplot data is now set as a tlist (like for surface and champ objects) */
/* setgrayplot(pobj,cstk(l2), &l3, &numrow3, &numcol3, fname) */
int setgrayplotdata(sciPointObj *pobj, int *value, int *numrow, int *numcol, char *fname)
{
int i=0;
sciGrayplot * ppgrayplot = pGRAYPLOT_FEATURE (pobj);
integer m1, n1, l1, m2, n2, l2, m3, n3, l3;
double * pvecx = NULL, * pvecy = NULL;
double * pvecz = NULL;
m1 = numrow[0];
m2 = numrow[1];
m3 = numrow[2];
n1 = numcol[0];
n2 = numcol[1];
n3 = numcol[2];
l1 = value[0];
l2 = value[1];
l3 = value[2];
if (n1 != 1 || n2 != 1){
Scierror(999,"%s: Inside the Tlist : the first argument must be columns vectors\r\n",fname);
return 0;
}
if (m3 != m1 || n3 != m2) {
Scierror(999,"%s: Inside the Tlist : incompatible length in the third argument\r\n",fname);
return 0;
}
if (m1 * n1 == 0 || m2 * n2 == 0 || m3 * n3 == 0 ) { LhsVar(1)=0; return 0;}
/* Update the dimensions nx and ny */
ppgrayplot->nx = m1;
ppgrayplot->ny = m2;
/* Free the old values... */
FREE(ppgrayplot->pvecx); ppgrayplot->pvecx = NULL;
FREE(ppgrayplot->pvecy); ppgrayplot->pvecy = NULL;
FREE(ppgrayplot->pvecz); ppgrayplot->pvecz = NULL;
/* allocations:*/
if ((pvecx = MALLOC (m1 * sizeof (double))) == NULL) return -1;
if ((pvecy = MALLOC (m2 * sizeof (double))) == NULL) {
FREE(pvecx); pvecx = (double *) NULL;
return -1;
}
if ((pvecz = MALLOC (m3*n3 * sizeof (double))) == NULL)
return -1;
/* Copy the new values F.Leray */
for(i=0;i< m1;i++)
pvecx[i] = stk(l1)[i];
for(i=0;i< m2;i++)
pvecy[i] = stk(l2)[i];
for(i=0;i< m3*n3;i++){ /* vfx and vfy must have the same dimensions */
pvecz[i] = stk(l3)[i];
}
ppgrayplot->pvecx = pvecx;
ppgrayplot->pvecy = pvecy;
ppgrayplot->pvecz = pvecz;
return 0;
}
/*-----------------------------------------------------------------------------------*/
/* set3ddata(pobj,cstk(l2), &l3, &numrow3, &numcol3) */
int set3ddata(sciPointObj *pobj, int *value, int *numrow, int *numcol, int flagc, char *fname)
{
int i=0,j,nc;
sciSurface * psurf = pSURFACE_FEATURE (pobj);
integer m1, n1, l1, m2, n2, l2, m3, n3, l3;
integer m3n, n3n, l3n, ii;
double * pvecx = NULL, * pvecy = NULL, * pvecz = NULL;
integer /* * zcol = NULL,*/ izcol = 0 ;
int dimvectx = 0;
int dimvecty = 0;
m1 = numrow[0];
m2 = numrow[1];
m3 = numrow[2];
m3n = numrow[3]; /* F.Leray for color */
n1 = numcol[0];
n2 = numcol[1];
n3 = numcol[2];
n3n = numcol[3]; /* F.Leray for color */
l1 = value[0];
l2 = value[1];
l3 = value[2];
l3n = value[3]; /* F.Leray for color */
if (m1 * n1 == m3 * n3 && m1 * n1 == m2 * n2 && m1 * n1 != 1) {
if (! (m1 == m2 && m2 == m3 && n1 == n2 && n2 == n3)) {
Scierror(999,"%s: Inside the Tlist (third argument): The three first arguments have incompatible length \r\n",fname);
return 0;
}
} else {
if (m2 * n2 != n3) {
Scierror(999,"%s: Inside the Tlist (third argument): The second and third arguments have incompatible length\r\n",fname);
return 0;
}
if (m1 * n1 != m3) {
Scierror(999,"%s: Inside the Tlist (third argument): The first and third arguments have incompatible length\r\n",fname);
return 0;
}
if ( m1*n1 <= 1 || m2*n2 <= 1 )
{
Scierror(999,"%s: Inside the Tlist (third argument):The first and second arguments should be of size >= 2\r\n",fname);
return 0;
}
}
if (m1 * n1 == 0 || m2 * n2 == 0 || m3 * n3 == 0) { LhsVar(1)=0; return 0;}
/* SciWin();
C2F(scigerase)();*/
if(flagc == 1)
{
/*psurf->nc = 1; */ /* Wrong!! */
/* psurf->nc = m3n*n3n;*/
izcol = 1;
if ( m3n*n3n == m3*n3 ) izcol=2 ;
psurf->izcol = izcol;
}
else
{
/*psurf->nc = 0;*/
psurf->izcol = 0;
}
if (m1 * n1 == m3 * n3 && m1 * n1 == m2 * n2 && m1 * n1 != 1) /* NG beg */
{ /* case isfac=1;*/
if(psurf->isfac != 1)
{
sciprint("Can not change the typeof3d of graphic object: its type is SCI_PLOT3D\r\n");
return 0;
}
}
else
{
/* case isfac=0;*/
if(psurf->isfac != 0)
{
sciprint("Can not change the typeof3d of graphic object: its type is SCI_FAC3D\r\n");
return 0;
}
}
/* check the monotony on x and y */
if(m1 == 1) /* x is a row vector */
dimvectx = n1;
else if(n1 == 1) /* x is a column vector */
dimvectx = m1;
else /* x is a matrix */
dimvectx = -1;
if(dimvectx>1){
/* test the monotony on x*/
if(stk(l1)[0] >= stk(l1)[1]) /* decreasing */
{
int i;
for(i=1;i<dimvectx-1;i++)
{
if(stk(l1)[i] < stk(l1)[i+1])
{
Scierror(999,"Objplot3d: x vector is not monotonous \t\n");
return 0;
}
}
psurf->flag_x = -1;
}
else /* x[0] < x[1]*/
{
for(i=1;i<dimvectx-1;i++)
{
if(stk(l1)[i] > stk(l1)[i+1])
{
Scierror(999,"Objplot3d: x vector is not monotonous \t\n");
return 0;
}
}
psurf->flag_x = 1;
}
}
if(m2 == 1) /* y is a row vector */
dimvecty = n2;
else if(n2 == 1) /* y is a column vector */
dimvecty = m2;
else /* y is a matrix */
dimvecty = -1;
if(dimvecty>1){
/* test the monotony on y*/
if(stk(l2)[0] >= stk(l2)[1]) /* decreasing */
{
int i;
for(i=1;i<dimvecty-1;i++)
{
if(stk(l2)[i] < stk(l2)[i+1])
{
Scierror(999,"Objplot3d: y vector is not monotonous \t\n");
return 0;
}
}
psurf->flag_y = -1;
}
else /* y[0] < y[1]*/
{
for(i=1;i<dimvecty-1;i++)
{
if(stk(l2)[i] > stk(l2)[i+1])
{
Scierror(999,"Objplot3d: y vector is not monotonous \t\n");
return 0;
}
}
psurf->flag_y = 1;
}
}
/* Update of the dimzx, dimzy depends on m3, n3: */
psurf->dimzx = m3;
psurf->dimzy = n3;
/* Free the old values... */
FREE(psurf->pvecx); psurf->pvecx = NULL;
FREE(psurf->pvecy); psurf->pvecy = NULL;
FREE(psurf->pvecz); psurf->pvecz = NULL;
/* ...even on zcol wich must have been initialized like others or set to NULL in case there was no color before
The FREE macro tests the NULL pointer existence... */
FREE(psurf->zcol); psurf->zcol = NULL;
/* If we had a previous color matrix/vector and we do not specify a new one, I consider we are losing it.*/
/* That's why we make a FREE as follows:*/
FREE(psurf->inputCMoV);psurf->inputCMoV = NULL; /* F.Leray 23.03.04*/
/* allocations:*/
if ((pvecx = MALLOC (m1*n1 * sizeof (double))) == NULL) return -1;
if ((pvecy = MALLOC (m2*n2 * sizeof (double))) == NULL) {
FREE(pvecx); pvecx = (double *) NULL;
return -1;
}
if ((pvecz = MALLOC (m3*n3 * sizeof (double))) == NULL) {
FREE(pvecx); pvecx = (double *) NULL;
FREE(pvecy); pvecy = (double *) NULL;
return -1;
}
/* Copy the new values F.Leray */
for(i=0;i< m1*n1;i++)
pvecx[i] = stk(l1)[i];
for(i=0;i< m2*n2;i++)
pvecy[i] = stk(l2)[i];
for(i=0;i< m3*n3;i++)
pvecz[i] = stk(l3)[i];
if(flagc ==1) /* F.Leray There is a color matrix */
{
if(m3n * n3n != 0) /* Normally useless test here: means we have a color vector or matrix */
{
if (((psurf->inputCMoV = MALLOC (( (m3n)*(n3n) * sizeof (double)))) == NULL))
{
FREE(pvecx); pvecx = (double *) NULL;
FREE(pvecy); pvecy = (double *) NULL;
FREE(pvecz); pvecz = (double *) NULL;
return -1;
}
for (j = 0;j < (m3n)*(n3n); j++)
psurf->inputCMoV[j] = stk(l3n)[j];
}
if(psurf->flagcolor == 2 || psurf->flagcolor == 4)
{ /* case of SCI_PLOT3D avoid */
nc = psurf->dimzy;
}
else if(psurf->flagcolor == 3)
{
nc = psurf->dimzx * psurf->dimzy;
}
else
nc=0;
if(nc>0){
if ((psurf->zcol = MALLOC (nc * sizeof (double))) == NULL) {
FREE(pvecx); pvecx = (double *) NULL;
FREE(pvecy); pvecy = (double *) NULL;
FREE(pvecz); pvecz = (double *) NULL;
return -1;
}
}
/* case flagcolor == 2*/
if(psurf->flagcolor==2 && ( m3n==1 || n3n ==1)) /* it means we have a vector in Color input: 1 color per facet in input*/
{
/* We have just enough information to fill the psurf->zcol array*/
for (j = 0;j < nc; j++) /* nc value is dimzx*dimzy == m3 * n3 */
psurf->zcol[j] = psurf->inputCMoV[j]; /* DJ.A 2003 */
}
else if(psurf->flagcolor==2 && !( m3n==1 || n3n ==1)) /* it means we have a matrix in Color input: 1 color per vertex in input*/
{
/* We have too much information and we take only the first dimzy colors to fill the psurf->zcol array*/
/* NO !! Let's do better; F.Leray 08.05.04 : */
/* We compute the average value (sum of the value of the nf=m3n vertices on a facet) / (nb of vertices per facet which is nf=m3n) */
/* in our example: m3n=4 and n3n=400 */
for (j = 0;j < nc; j++) /* nc value is dimzy*/
{
double tmp = 0;
for(ii=0;ii<m3n;ii++)
tmp = tmp + psurf->inputCMoV[j*m3n + ii];
tmp = tmp / m3n;
psurf->zcol[j] = tmp;
}
}
/* case flagcolor == 3*/
else if(psurf->flagcolor==3 && ( m3n==1 || n3n ==1)) /* it means we have a vector in Color input: 1 color per facet in input*/
{
/* We have insufficient info. to fill the entire zcol array of dimension nc = dimzx*dimzy*/
/* We repeat the data:*/
for(i = 0; i< psurf->dimzy; i++){
for (j = 0;j < psurf->dimzx; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[psurf->dimzx*i+j] = psurf->inputCMoV[i]; /* DJ.A 2003 */
}
}
else if(psurf->flagcolor==3 && !( m3n==1 || n3n ==1)) /* it means we have a matrix in Color input: 1 color per vertex in input*/
{
/* We have just enough information to fill the psurf->zcol array*/
for (j = 0;j < nc; j++) /* nc value is dimzy*/
psurf->zcol[j]= psurf->inputCMoV[j];
}
/* case flagcolor == 4*/
else if(psurf->flagcolor==4 && ( m3n==1 || n3n ==1)) /* it means we have a vector in Color input: 1 color per facet in input*/
{
/* We have insufficient info. to fill the entire zcol array of dimension nc = dimzx*dimzy*/
/* We repeat the data:*/
for (j = 0;j < nc; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[j] = psurf->inputCMoV[j];
}
else if(psurf->flagcolor==4 && !( m3n==1 || n3n ==1)) /* it means we have a matrix in Color input: 1 color per vertex in input*/
{
/* input : color matrix , we use 1 color per facet with Matlab selection mode (no average computed) */
/* HERE is the difference with case 2 */
for (j = 0;j < nc; j++) /* nc value is dimzy*/
psurf->zcol[j] = psurf->inputCMoV[j*m3n];
}
}
else /* else we put the value of the color_mode flag[0]*/
{
if(psurf->flagcolor == 2 || psurf->flagcolor == 4)
{ /* case of SCI_PLOT3D avoid */
nc = psurf->dimzy;
}
else if(psurf->flagcolor == 3)
{
nc = psurf->dimzx * psurf->dimzy;
}
else
nc=0;
if(nc>0){
if ((psurf->zcol = MALLOC (nc * sizeof (double))) == NULL) {
FREE(pvecx); pvecx = (double *) NULL;
FREE(pvecy); pvecy = (double *) NULL;
FREE(pvecz); pvecz = (double *) NULL;
return -1;
}
}
/* case flagcolor == 2*/
if(psurf->flagcolor==2 || psurf->flagcolor==4) /* we have to fill a Color vector */
{
for (j = 0;j < nc; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[j] = psurf->flag[0];
}
else if(psurf->flagcolor==3) /* we have to fill a color matrix */
{
for(i = 0; i< psurf->dimzy; i++){
for (j = 0;j < psurf->dimzx; j++)
psurf->zcol[psurf->dimzx*i+j] = psurf->flag[0];
}
}
else
{
/* case flagcolor == 0 or 1 */
psurf->zcol = NULL;
psurf->izcol = 0;
}
}
psurf->pvecx = pvecx;
psurf->pvecy = pvecy;
psurf->pvecz = pvecz;
psurf->nc = nc; /*Adding F.Leray 23.03.04*/
psurf->m1 = m1;
psurf->m2 = m2;
psurf->m3 = m3;
psurf->n1 = n1;
psurf->n2 = n2;
psurf->n3 = n3;
psurf->m3n = m3n; /* If m3n and n3n are 0, then it means that no color matrix/vector was in input*/
psurf->n3n = n3n;
/* We need to rebuild ...->color matrix */
if(psurf->flagcolor != 0 && psurf->flagcolor !=1){
if(psurf->cdatamapping == 0){ /* scaled */
FREE(psurf->color);
LinearScaling2Colormap(pobj);
}
else{
int nc = psurf->nc;
FREE(psurf->color);
if(nc>0){
if ((psurf->color = MALLOC (nc * sizeof (double))) == NULL)
return -1;
}
for(i=0;i<nc;i++)
psurf->color[i] = psurf->zcol[i];
/* copy zcol that has just been freed and re-alloc + filled in */
}
}
return 0;
}
/*-----------------------------------------------------------------------------------*/
/* removeNewStyleMenu */
/* remove the menu and toolbar which can not be used in old style */
/*-----------------------------------------------------------------------------------*/
void updateMenus( struct BCG * XGC )
{
#if WIN32
{
extern void RefreshGraphToolBar(struct BCG * ScilabGC);
extern void RefreshMenus(struct BCG * ScilabGC);
RefreshMenus(XGC);
RefreshGraphToolBar(XGC);
}
#else
{
#ifndef WITH_GTK
extern void refreshMenus( struct BCG * ScilabGC ) ;
refreshMenus( XGC ) ;
/* no toolbar under linux */
#endif
}
#endif
}
/*-----------------------------------------------------------------------------------*/
/**@name int sciset(sciPointObj *pobj,char *marker, long *x, long *y, long *w, long *h)
* Sets the value to the object
*/
int sciSet(sciPointObj *pobj, char *marker, int *value, int *numrow, int *numcol)
{
int xtmp;
int i,num,v=1,na,id,cur,verb=0;
double dv=0.0;
char **ptr;
sciPointObj *psubwin, *figure, *tmpobj;
struct BCG *XGC;
/* debug F.Leray 28.04.04 */
/* sciSubWindow * ppsubwin = NULL;*/
if ((strcmp(marker,"figure_model") !=0) && (strcmp(marker,"axes_model") !=0)
&& (pobj != pfiguremdl) && (pobj != paxesmdl)
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_title
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_x_label
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_y_label
&& pobj != pSUBWIN_FEATURE(paxesmdl)->mon_z_label ) /* Addings F.Leray 10.06.04 */
{
if (pobj != (sciPointObj *)NULL)
{
psubwin = sciGetSelectedSubWin (sciGetCurrentFigure ());
}
if ((pobj == (sciPointObj *)NULL) &&
(strcmp(marker,"old_style") !=0 ) &&
(strcmp(marker,"figure_style") != 0) &&
(strcmp(marker,"current_figure") != 0))
{
if (version_flag() == 0)
strcpy(error_message,"handle not valid");
else
strcpy(error_message,"function not valid under old graphics style");
return -1;
}
}
/***************** graphics mode *******************************/
if (strcmp(marker,"color_map") == 0)
sciSetColormap((sciPointObj *)pobj, stk(*value), *numrow, *numcol);
else if (strcmp(marker,"old_style") == 0) {
if ((strcmp(cstk(*value),"on") == 0))
versionflag = 1;
else if ((strcmp(cstk(*value),"off") == 0))
versionflag = 0;
else {
strcpy(error_message,"old_style must be 'on' or 'off'");
return -1;
}
}
else if (strcmp(marker,"figure_style") == 0) {
if (pobj != pfiguremdl)
{
if ((strcmp(cstk(*value),"old") == 0)) {
if (version_flag() == 0) {
/* versionflag = 1; */
sciXClearFigure();
#ifdef WITH_TK
/* close ged to prevent errors when using it */
sciDestroyGed() ;
#endif
C2F(dr)("xget","gc",&verb,&v,&v,&v,&v,&v,(double *)&XGC,&dv,&dv,&dv,5L,10L);
if (XGC->mafigure != (sciPointObj *)NULL) {
DestroyAllGraphicsSons(XGC->mafigure);
DestroyFigure (XGC->mafigure);
XGC->mafigure = (sciPointObj *)NULL;
}
XGC->graphicsversion = 1; /* Adding F.Leray 23.07.04 : we switch to old graphic mode */
/* remove the Insert menu and purge the Edit menu in old style */
/* A.Cornet, JB Silvy 12/2005 */
updateMenus( XGC ) ;
/*#if WIN32
{
extern void RefreshGraphToolBar(struct BCG * ScilabGC);
extern void RefreshMenus(struct BCG * ScilabGC);
RefreshMenus(XGC);
RefreshGraphToolBar(XGC);
}
#endif*/
C2F(dr1)("xset","default",&v,&v,&v,&v,&v,&v,&dv,&dv,&dv,&dv,5L,7L);
/* Add xclear to refresh toolbar for Windows */
C2F (dr) ("xclear", "v", PI0, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0,
PD0, 0L, 0L);
}
}
else if ((strcmp(cstk(*value),"new") == 0)) {
if (version_flag() == 1) {
C2F(dr1)("xset","default",&v,&v,&v,&v,&v,&v,&dv,&dv,&dv,&dv,5L,7L);
C2F(dr)("xget","window",&verb,&num,&na,&v,&v,&v,&dv,&dv,&dv,&dv,5L,7L);
C2F(dr)("xstart","v",&num,&v,&v,&v,&v,&v,&dv,&dv,&dv,&dv,7L,2L);
XGC=(struct BCG *) sciGetCurrentScilabXgc ();
if ((figure = ConstructFigure (XGC)) != NULL) {
/* Adding F.Leray 25.03.04*/
sciSetCurrentObj(figure);
XGC->mafigure = (sciPointObj *) figure;
XGC->graphicsversion = 0; /* new graphic mode */
cf_type=1;
/* Add xclear to refresh toolbar for Windows */
C2F(dr1)("xclear","v",&v,&v,&v,&v,&v,&v,&dv,&dv,&dv,&dv,7L,2L);
if ((psubwin = ConstructSubWin (figure, XGC->CurWindow)) != NULL){
sciSetCurrentObj(psubwin);
sciSetOriginalSubWin (figure, psubwin);
}
/* Refresh toolbar and Menus */
updateMenus( XGC ) ;
}
}
}
else {
strcpy(error_message,"Figure style must be 'old' or 'new'");
return -1;
}
}
else{
strcpy(error_message,"Cannot set the style of a model");
return -1;
}
}
else if (strcmp(marker,"pixel_drawing_mode") == 0) {
if (sciGetEntityType (pobj) == SCI_FIGURE) {
v=-1;
for (i=0;i<16;i++) {
if (strcmp(cstk(*value),pmodes[i])==0) {v=i;break;}
}
if (v>=0)
sciSetXorMode((sciPointObj *) pobj, v);
else {
strcpy(error_message,"Invalid value");
return -1;
}
}
else
{strcpy(error_message,"pixel_drawing_mode: unknown property for this handle");return -1;}
}
else if (strcmp(marker,"default_values") == 0) {
if (*stk(*value) == 1)
{
if (pobj == pfiguremdl)
InitFigureModel();
else if (pobj == paxesmdl)
InitAxesModel();
else
sciSetDefaultValues();
}
else {
strcpy(error_message,"Value must be 1 to set default values");
return -1;
}
}
else if (strcmp(marker,"visible") == 0) {
if ((strcmp(cstk(*value),"on") == 0))
sciSetVisibility((sciPointObj *)pobj, TRUE);
else if ((strcmp(cstk(*value),"off") == 0))
sciSetVisibility((sciPointObj *)pobj, FALSE);
else
{strcpy(error_message,"Value must be 'on' or 'off'");return -1;}
}
else if (strcmp(marker,"auto_resize") == 0) {
if ((strcmp(cstk(*value),"on") == 0))
sciSetResize((sciPointObj *) pobj, TRUE);
else if ((strcmp(cstk(*value),"off") == 0))
sciSetResize((sciPointObj *) pobj, FALSE);
else
{strcpy(error_message,"Value must be 'on' or 'off'");return -1;}
}
/*************************** Handles Properties ********/
else if ((strcmp(marker,"current_obj") == 0) || (strcmp(marker,"current_entity") == 0))
{
tmpobj=(sciPointObj *)sciGetPointerFromHandle((unsigned long)hstk(*value)[0]);
if (tmpobj == (sciPointObj *)NULL)
{strcpy(error_message,"Object is not valid");return -1;}
sciSetCurrentObj(tmpobj);
}
else if (strcmp(marker,"current_axes") == 0)
{
tmpobj =(sciPointObj *)sciGetPointerFromHandle((unsigned long)hstk(*value)[0]);
if (tmpobj == (sciPointObj *) NULL)
{strcpy(error_message,"Object is not valid");return -1;}
if (sciGetEntityType (tmpobj) == SCI_SUBWIN){
sciPointObj * pfigure = NULL;
sciSetSelectedSubWin(tmpobj);
/* F.Leray 11.02.05 : if the new selected subwin is not inside the current figure, */
/* we must also set the current figure to subwin->parent */
pfigure = sciGetParentFigure(tmpobj);
num=pFIGURE_FEATURE(pfigure)->number;
C2F(dr1)("xset","window",&num,&v,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,6L);
if (sciSwitchWindow(&num) != 0){
strcpy(error_message,"It was not possible to create the requested figure");return -1;
}
/* End modif. on the 11.02.05 */
}
else
{strcpy(error_message,"Object is not an Axes Entity");return -1;}
}
else if (strcmp(marker,"current_figure") == 0)
{
if (VarType(2) == 9) {
tmpobj =(sciPointObj *)sciGetPointerFromHandle((unsigned long)hstk(*value)[0]);
if (tmpobj == (sciPointObj *) NULL)
{strcpy(error_message,"Object is not valid");return -1;}
if (sciGetEntityType (tmpobj) != SCI_FIGURE)
{strcpy(error_message,"Object is not a handle on a figure");return -1;}
num=pFIGURE_FEATURE(tmpobj)->number;
}
else if (VarType(2) == 1){
num=(int)stk(*value)[0];
}
else{
strcpy(error_message,"Bad argument to determine the current figure: should be a window number or a handle (available under new graphics mode only)");return -1;
}
C2F(dr1)("xset","window",&num,&v,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,4L,6L);
if(version_flag() == 0){
if (sciSwitchWindow(&num) != 0){
strcpy(error_message,"It was not possible to create the requested figure");return -1;
}
}
}
/************************ figure Properties *****************************/
else if (strcmp(marker,"figure_position") == 0)
{
sciSetFigurePos ((sciPointObj *)pobj, (int)stk(*value)[0], (int)stk(*value)[1]);
}
else if (strcmp(marker,"axes_size") == 0)
{
if (sciGetEntityType (pobj) != SCI_FIGURE) {
sprintf(error_message,"%s property undefined for this object",marker);
return -1;
}
pFIGURE_FEATURE((sciPointObj *)pobj)->windowdimwidth=(int)stk(*value)[0];
pFIGURE_FEATURE((sciPointObj *)pobj)->windowdimheight=(int)stk(*value)[1];
if ((sciPointObj *)pobj != pfiguremdl) {
num=pFIGURE_FEATURE(pobj)->number;
C2F(dr)("xget","window",&verb,&cur,&na,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F(dr)("xset","window",&num,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F(dr)("xset","wdim",
&(pFIGURE_FEATURE((sciPointObj *)pobj)->windowdimwidth),
&(pFIGURE_FEATURE((sciPointObj *)pobj)->windowdimheight),
PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F(dr)("xset","window",&cur,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
}
}
else if (strcmp(marker,"figure_size") == 0)
{
if (sciGetEntityType (pobj) != SCI_FIGURE) {
sprintf(error_message,"%s property undefined for this object",marker);
return -1;
}
pFIGURE_FEATURE((sciPointObj *)pobj)->figuredimwidth=(int)stk(*value)[0];
pFIGURE_FEATURE((sciPointObj *)pobj)->figuredimheight=(int)stk(*value)[1];
if ((sciPointObj *)pobj != pfiguremdl) {
num=pFIGURE_FEATURE(pobj)->number;
C2F(dr)("xget","window",&verb,&cur,&na,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F(dr)("xset","window",&num,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F(dr)("xset","wpdim",
&(pFIGURE_FEATURE((sciPointObj *)pobj)->figuredimwidth),
&(pFIGURE_FEATURE((sciPointObj *)pobj)->figuredimheight),
PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
C2F(dr)("xset","window",&cur,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
}
}
else if (strcmp(marker,"figure_name") == 0) {
sciSetName((sciPointObj *) pobj, cstk(*value), (*numcol)*(*numrow));
}
else if (strcmp(marker,"figure_id") == 0){
if (sciGetEntityType (pobj) != SCI_FIGURE) {
sprintf(error_message,"%s property undefined for this object",marker);
return -1;
}
id = (int)stk(*value)[0];
if ((sciPointObj *)pobj != pfiguremdl)
{
C2F(dr)("xset","window",&id,&v,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,5L,7L);
if (sciSwitchWindow(&id) != 0){
strcpy(error_message,"It was not possible to create the requested figure");return -1;
}
}
else
sciSetNum(pfiguremdl, &id);
}
else if (strcmp(marker,"rotation_style") == 0)
{
if (sciGetEntityType (pobj) != SCI_FIGURE) {
sprintf(error_message,"%s property undefined for this object",marker);
return -1;
}
if (strcmp(cstk(*value),"unary")==0 )
pFIGURE_FEATURE((sciPointObj *)pobj)->rotstyle = 0 ;
else if (strcmp(cstk(*value),"multiple")==0 )
pFIGURE_FEATURE((sciPointObj *)pobj)->rotstyle = 1 ;
else {strcpy(error_message,"Nothing to do (value must be 'unary/multiple')"); return -1;}
}
else if (strcmp(marker,"immediate_drawing") == 0)
{
if (sciGetEntityType (pobj) != SCI_FIGURE) {
sprintf(error_message,"%s property undefined for this object",marker);
return -1;
}
if (strcmp(cstk(*value),"on")==0 )
pFIGURE_FEATURE((sciPointObj *)pobj)->auto_redraw = TRUE ;
else if (strcmp(cstk(*value),"off")==0 )
pFIGURE_FEATURE((sciPointObj *)pobj)->auto_redraw = FALSE ;
else {strcpy(error_message,"Nothing to do (value must be 'on/off')"); return -1;}
}
else if (strcmp(marker,"pixmap") == 0){
if (sciGetEntityType (pobj) != SCI_FIGURE) {
sprintf(error_message,"%s property undefined for this object",marker);
return -1;
}
if (strcmp(cstk(*value),"on")==0 )
pFIGURE_FEATURE(pobj)->pixmap =1;
else if (strcmp(cstk(*value),"off")==0 )
pFIGURE_FEATURE(pobj)->pixmap =0;
else {strcpy(error_message,"Nothing to do (value must be 'on/off')"); return -1;}
}
/********************** context graphique ******************************/
else if (strcmp(marker,"background") == 0)
{
/* I add this line under:*/
sciSetBackground((sciPointObj *)pobj, (int)stk(*value)[0]);
}
else if (strcmp(marker,"interp_color_vector") == 0)
{
if(sciGetEntityType(pobj) != SCI_POLYLINE)
{strcpy(error_message,"interp_color_vector can only be set on Polyline objects"); return -1;}
if(((*numcol) == 3 && pPOLYLINE_FEATURE(pobj)->dim_icv == 3) ||
((*numcol) == 4 && pPOLYLINE_FEATURE(pobj)->dim_icv == 4))
{
int tmp[4];
for(i=0;i<(*numcol);i++) tmp[i] = (int) stk(*value)[i];
sciSetInterpVector((sciPointObj *)pobj, (*numcol),tmp);
}
else
{strcpy(error_message,"Under interpolated color moden the column dimension of the color vector must match the number of points defining the line (which must be 3 or 4)"); return -1;}
}
else if (strcmp(marker,"interp_color_mode") == 0)
{
if((sciGetEntityType(pobj) != SCI_POLYLINE))
{strcpy(error_message,"interp_color_mode can only be set on Polyline objects"); return -1;}
if(strcmp(cstk(*value),"on")==0 ){
if(sciGetInterpVector(pobj) == NULL)
{strcpy(error_message,"You must first specify an interp_color_vector for this object"); return -1;}
else
pPOLYLINE_FEATURE (pobj)->isinterpshaded = TRUE;
}
else
pPOLYLINE_FEATURE (pobj)->isinterpshaded = FALSE;
}
else if (strcmp(marker,"foreground") == 0)
{
sciSetForeground((sciPointObj *)pobj, (int) stk(*value)[0]);
}
else if (strcmp(marker,"fill_mode") == 0)
{
if (strcmp(cstk(*value),"on")==0 )
sciSetIsFilled((sciPointObj *)pobj,TRUE);
else if (strcmp(cstk(*value),"off")==0 )
sciSetIsFilled((sciPointObj *)pobj,FALSE);
else {strcpy(error_message,"Nothing to do (value must be 'on/off')"); return -1;}
}
else if (strcmp(marker,"thickness") == 0) {
sciSetLineWidth((sciPointObj *) pobj,(int) *stk(*value));
}
else if (strcmp(marker,"arrow_size_factor") == 0) {
if(sciGetEntityType(pobj) == SCI_POLYLINE)
pPOLYLINE_FEATURE(pobj)->arsize_factor = *stk(*value);
}
else if (strcmp(marker,"line_style") == 0) {
sciSetLineStyle((sciPointObj *) pobj,(int) *stk(*value));
}
else if (strcmp(marker,"line_mode") == 0) {
if (strcmp(cstk(*value),"on")==0 )
sciSetIsLine((sciPointObj *) pobj,1);
else if (strcmp(cstk(*value),"off")==0 )
sciSetIsLine((sciPointObj *) pobj,0);
else {strcpy(error_message,"Value must be 'on/off'"); return -1;}
}
else if (strcmp(marker,"surface_mode") == 0) {
if((sciGetEntityType(pobj) == SCI_PLOT3D) ||
(sciGetEntityType(pobj) == SCI_FAC3D) ||
(sciGetEntityType(pobj) == SCI_SURFACE)){
if (strcmp(cstk(*value),"on")==0 )
sciSetIsLine((sciPointObj *) pobj,1);
else if (strcmp(cstk(*value),"off")==0 )
sciSetIsLine((sciPointObj *) pobj,0);
else {strcpy(error_message,"Value must be 'on/off'"); return -1;}
}
else {strcpy(error_message,"Surface_mode can not be set with this object, use line_mode"); return -1;}
}
else if (strcmp(marker,"mark_style") == 0) {
sciSetIsMark((sciPointObj *) pobj, TRUE);
sciSetMarkStyle((sciPointObj *) pobj,(int) *stk(*value));
}
else if (strcmp(marker,"mark_mode") == 0) {
if (strcmp(cstk(*value),"on")==0 )
sciSetIsMark((sciPointObj *) pobj,1);
else if (strcmp(cstk(*value),"off")==0 )
sciSetIsMark((sciPointObj *) pobj,0);
else {strcpy(error_message,"Value must be 'on/off'"); return -1;}
}
else if (strcmp(marker,"mark_size_unit") == 0) {
if (strcmp(cstk(*value),"point")==0 )
sciSetMarkSizeUnit((sciPointObj *) pobj, 1); /* 1 : points, 2 : tabulated */
else if (strcmp(cstk(*value),"tabulated")==0 )
sciSetMarkSizeUnit((sciPointObj *) pobj, 2);
else {strcpy(error_message,"Value must be 'point/tabulated'"); return -1;}
}
else if (strcmp(marker,"mark_size") == 0) {
/* sciSetIsMark((sciPointObj *) pobj, TRUE); */
/* F.Leray 27.01.05 commented because mark_size is automatically launched */
/* in tcl/tk editor (which causes marks appearance even when unwanted). */
sciSetMarkSize((sciPointObj *) pobj, (int)*stk(*value));
}
else if (strcmp(marker,"mark_foreground") == 0) {
/* sciSetIsMark((sciPointObj *) pobj, TRUE); */
/* F.Leray 27.01.05 commented because mark_size is automatically launched */
/* in tcl/tk editor (which causes marks appearance even when unwanted). */
sciSetMarkForeground((sciPointObj *) pobj, (int)*stk(*value));
}
else if (strcmp(marker,"mark_background") == 0) {
/* sciSetIsMark((sciPointObj *) pobj, TRUE); */
/* F.Leray 27.01.05 commented because mark_size is automatically launched */
/* in tcl/tk editor (which causes marks appearance even when unwanted). */
sciSetMarkBackground((sciPointObj *) pobj, (int)*stk(*value));
}
else if (strcmp(marker,"bar_width") == 0)
{
if (sciGetEntityType (pobj) == SCI_POLYLINE){
double valeur = stk(*value)[0];
pPOLYLINE_FEATURE (pobj)->bar_width = valeur;
}
else
{strcpy(error_message,"Object has no bar shift");return -1;}
}
else if (strcmp(marker,"bar_layout") == 0)
{
if (sciGetEntityType (pobj) == SCI_POLYLINE){
if(strcmp(cstk(*value),"grouped") == 0)
pPOLYLINE_FEATURE (pobj)->bar_layout = 0;
else if(strcmp(cstk(*value),"stacked") == 0)
pPOLYLINE_FEATURE (pobj)->bar_layout = 1;
else
{strcpy(error_message,"Bad property specified for bar_layout");return -1;}
}
else
{strcpy(error_message,"Object has no bar style");return -1;}
}
else if (strcmp(marker,"x_shift") == 0)
{
if (sciGetEntityType (pobj) == SCI_POLYLINE){
int num = 0;
if(*numcol > 1 && *numrow > 1){
strcpy(error_message,"Bad input, x_shift should be a row or column vector.");
return -1;
}
num = (*numrow)*(*numcol);
if (num != 0 && num!=pPOLYLINE_FEATURE (pobj)->n1) /* we can specify [] (null vector) to reset to default */
{
strcpy(error_message,"Wrong size for input vector.");
return -1;
}
FREE(pPOLYLINE_FEATURE (pobj)->x_shift);
pPOLYLINE_FEATURE (pobj)->x_shift = (double *) NULL;
if(num != 0){
if ((pPOLYLINE_FEATURE (pobj)->x_shift = (double *) MALLOC (num * sizeof (double))) == NULL){
strcpy(error_message,"No memory left for allocating temporary tics_coord");return -1;}
for (i=0;i<num;i++)
pPOLYLINE_FEATURE (pobj)->x_shift[i] = *stk(*value+i);
}
}
else
{strcpy(error_message,"Object has no x_shift");return -1;}
}
else if (strcmp(marker,"y_shift") == 0)
{
if (sciGetEntityType (pobj) == SCI_POLYLINE){
int num = 0;
if(*numcol > 1 && *numrow > 1){
strcpy(error_message,"Bad input, y_shift should be a row or column vector.");
return -1;
}
num = (*numrow)*(*numcol);
if (num != 0 && num!=pPOLYLINE_FEATURE (pobj)->n1) /* we can specify [] (null vector) to reset to default */
{
strcpy(error_message,"Wrong size for input vector.");
return -1;
}
FREE(pPOLYLINE_FEATURE (pobj)->y_shift);
pPOLYLINE_FEATURE (pobj)->y_shift = (double *) NULL;
if(num != 0){
if ((pPOLYLINE_FEATURE (pobj)->y_shift = (double *) MALLOC (num * sizeof (double))) == NULL){
strcpy(error_message,"No memory left for allocating temporary tics_coord");return -1;}
for (i=0;i<num;i++)
pPOLYLINE_FEATURE (pobj)->y_shift[i] = *stk(*value+i);
}
}
else
{strcpy(error_message,"Object has no y_shift");return -1;}
}
else if (strcmp(marker,"z_shift") == 0)
{
if (sciGetEntityType (pobj) == SCI_POLYLINE){
int num = 0;
if(*numcol > 1 && *numrow > 1){
strcpy(error_message,"Bad input, z_shift should be a row or column vector.");
return -1;
}
num = (*numrow)*(*numcol);
if (num != 0 && num!=pPOLYLINE_FEATURE (pobj)->n1) /* we can specify [] (null vector) to reset to default */
{
strcpy(error_message,"Wrong size for input vector.");
return -1;
}
FREE(pPOLYLINE_FEATURE (pobj)->z_shift);
pPOLYLINE_FEATURE (pobj)->z_shift = (double *) NULL;
if(num != 0){
if ((pPOLYLINE_FEATURE (pobj)->z_shift = (double *) MALLOC (num * sizeof (double))) == NULL){
strcpy(error_message,"No memory left for allocating temporary tics_coord");return -1;}
for (i=0;i<num;i++)
pPOLYLINE_FEATURE (pobj)->z_shift[i] = *stk(*value+i);
}
}
else
{strcpy(error_message,"Object has no z_shift");return -1;}
}
else if (strcmp(marker,"polyline_style") == 0)
{
if (sciGetEntityType (pobj) == SCI_POLYLINE){
int valeur = (int)stk(*value)[0];
if ((valeur==1) || (valeur==2) ||
(valeur==3) || (valeur==4) ||
(valeur==5) || (valeur==6) ||
(valeur==7)){
pPOLYLINE_FEATURE (pobj)->plot = valeur;
}
else
{strcpy(error_message,"Style must be 1,2,3,4,5,6 or 7");return -1;}
}
else
{strcpy(error_message,"Object is not a Polyline");return -1;}
}
/************* font properties *********/
else if (strcmp(marker,"font_size") == 0)
{
xtmp = (int)stk(*value)[0];
sciSetFontDeciWidth((sciPointObj *) pobj, xtmp*100);
}
else if (strcmp(marker,"font_angle") == 0)
{
xtmp = (int)stk(*value)[0];
if ( sciGetAutoRotation( pobj ) )
{
sciSetAutoRotation( pobj, FALSE ) ;
}
sciSetFontOrientation((sciPointObj *) pobj,(int) (*stk(*value)*10));
}
else if (strcmp(marker,"font_foreground") == 0)
{
xtmp = (int) *stk(*value);
sciSetFontForeground((sciPointObj *) pobj, xtmp);
}
else if (strcmp(marker,"font_color") == 0) {
if (sciGetEntityType (pobj) == SCI_AXES)
pAXES_FEATURE (pobj)->textcolor=(int)*stk(*value);
else if (sciGetEntityType (pobj) == SCI_SUBWIN || sciGetEntityType (pobj) == SCI_FIGURE){
sciSetFontForeground(pobj,(int)*stk(*value));} /* F.Leray 08.04.04 */
else
{strcpy(error_message,"font_color property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"font_style") == 0)
{
xtmp = (int) *stk(*value);
if ( (xtmp > 10) || xtmp < 0)
{strcpy(error_message,"The value must be in [0 10]");return -1;}
else
sciSetFontStyle((sciPointObj *) pobj, xtmp);
}
else if (strcmp(marker,"font_name") == 0) {
sciSetFontName((sciPointObj *)pobj, cstk(*value), (*numcol)*(*numrow));
}
else if (strcmp(marker,"text_box_mode") == 0)
{
if (sciGetEntityType (pobj) == SCI_TEXT) {
if (strcmp(cstk(*value),"off") == 0)
pTEXT_FEATURE (pobj)->fill = -1;
else if (strcmp(cstk(*value),"centered") == 0)
pTEXT_FEATURE (pobj)->fill = 0;
else if (strcmp(cstk(*value),"filled") == 0)
pTEXT_FEATURE (pobj)->fill = 1;
else
{strcpy(error_message,"Value must be 'off', 'centered' or 'filled'");
return -1;}
}
else
{strcpy(error_message,"text_box_mode property does not exist for this handle");
return -1;}
}
else if (strcmp(marker,"text_box") == 0)
{
if (sciGetEntityType (pobj) == SCI_TEXT)
{
if ( *numcol * *numrow != 2 )
{
strcpy(error_message,"text_box must be a 2D vector.");
return -1 ;
}
pTEXT_FEATURE (pobj)->wh[0]=*stk(*value);
pTEXT_FEATURE (pobj)->wh[1]=*stk(*value+1);
}
else
{
strcpy(error_message,"text_box property does not exist for this handle");
return -1;
}
}
else if (strcmp(marker,"text") == 0) {
sciSetText((sciPointObj *)pobj, cstk(*value), (*numcol)*(*numrow));
}
/******************/
else if (strcmp(marker,"auto_clear") == 0) {
if (strcmp(cstk(*value),"on")==0 )
sciSetAddPlot((sciPointObj *) pobj,FALSE);
else if (strcmp(cstk(*value),"off")==0 )
sciSetAddPlot((sciPointObj *) pobj,TRUE);
else {strcpy(error_message,"Value must be 'on/off'"); return -1;}
}
else if (strcmp(marker,"auto_scale") == 0) {
if (strcmp(cstk(*value),"on")==0 )
sciSetAutoScale((sciPointObj *) pobj, TRUE);
else if (strcmp(cstk(*value),"off")==0 )
sciSetAutoScale((sciPointObj *) pobj, FALSE);
else {strcpy(error_message,"Value must be 'on/off'"); return -1;}
}
else if ((strcmp(marker,"zoom_box") == 0) && (sciGetEntityType (pobj) == SCI_SUBWIN)) {
/* On doit avoir avoir une matrice 4x1 */
if (*numcol * *numrow == 4)
scizoom(stk(*value),pobj);
else if (*numcol * *numrow == 0)
unzoom();
else
{strcpy(error_message,"Argument must be a vector of size 4");return -1;}
}
else if ((strcmp(marker,"zoom_state") == 0) && (sciGetEntityType (pobj) == SCI_SUBWIN)){
if ((strcmp(cstk(*value),"on") == 0))
{
if (!sciGetZooming((sciPointObj *)pobj))
{strcpy(error_message,"set zoom box ( set('zoom_box',[xmin ymin xmax ymax]))");return -1;}
else
{strcpy(error_message,"Object is already zoomed");return -1;}
}
else if ((strcmp(cstk(*value),"off") == 0))
{ unzoom();
sciSetZooming((sciPointObj *)pobj,FALSE);
}
else
{strcpy(error_message,"Value must be 'on/off'"); return -1;}
}
/***********************************************/
else if (strcmp(marker,"clip_box") == 0) {
/* On doit avoir avoir une matrice 4x1 */
if (*numcol * *numrow == 4){
sciSetClipping((sciPointObj *)pobj, stk(*value));
sciSetIsClipping(pobj, 1);
}
else {strcpy(error_message,"Argument must be a vector of size 4");return -1;}
}
else if (strcmp(marker,"clip_state") == 0) {
if ((strcmp(cstk(*value),"clipgrf") == 0))
sciSetIsClipping( (sciPointObj *)pobj,0);
else if ((strcmp(cstk(*value),"off") == 0))
sciSetIsClipping( (sciPointObj *)pobj,-1);
else if ((strcmp(cstk(*value),"on") == 0))
/* if(sciGetClipping(pobj) != NULL){ */
if(sciGetIsClipRegionValuated(pobj) == 1){
sciSetIsClipping( (sciPointObj *)pobj,1);
}
else{
sciSetIsClipping( (sciPointObj *)pobj,0);
}
else
{strcpy(error_message,"Value must be 'clipgrf', 'on' or 'off'"); return -1;}
}
else if (strcmp(marker,"data") == 0){
CheckAndUpdate_x_shift(pobj,*numrow); /* used only on Polyline */
CheckAndUpdate_y_shift(pobj,*numrow); /* used only on Polyline */
CheckAndUpdate_z_shift(pobj,*numrow); /* used only on Polyline */
sciSetPoint((sciPointObj *)pobj, stk(*value), numrow, numcol);
}
/**************** callback *********************/
else if (strcmp(marker,"callbackmevent") == 0) {
sciSetCallbackMouseEvent((sciPointObj *)pobj,(int) *stk(*value));
}
else if (strcmp(marker,"callback") == 0) {
sciAddCallback((sciPointObj *)pobj, cstk(*value), (*numcol)*(*numrow),1);
}
/******** AXES *******************************/
else if (strcmp(marker,"x_label") == 0)
{
if (sciGetEntityType (pobj) != SCI_SUBWIN)
{strcpy(error_message,"x_label property undefined for this object");return -1;}
else{
{strcpy(error_message,"can not set directly a label object");return -1;}
}
}
else if (strcmp(marker,"y_label") == 0)
{
if (sciGetEntityType (pobj) != SCI_SUBWIN)
{strcpy(error_message,"y_label property undefined for this object");return -1;}
else{
{strcpy(error_message,"can not set directly a label object");return -1;}
}
}
else if (strcmp(marker,"z_label") == 0)
{
if (sciGetEntityType (pobj) != SCI_SUBWIN)
{strcpy(error_message,"z_label property undefined for this object");return -1;}
else{
{strcpy(error_message,"can not set directly a label object");return -1;}
}
}
else if (strcmp(marker,"title") == 0)
{
if (sciGetEntityType (pobj) != SCI_SUBWIN)
{strcpy(error_message,"title property undefined for this object");return -1;}
else{
{strcpy(error_message,"can not set directly a label object");return -1;}
}
}
else if (strcmp(marker,"tics_direction") == 0)
{
if (pAXES_FEATURE (pobj)->ny == 1)
{
if(strcmp(cstk(*value),"top") == 0)
strncpy(&(pAXES_FEATURE (pobj)->dir),"u",1);
else if (strcmp(cstk(*value),"bottom") == 0)
strncpy(&(pAXES_FEATURE (pobj)->dir),"d",1);
else
{strcpy(error_message,"Second argument must be 'top' or 'bottom'");return -1;}
}
else
{
if(strcmp(cstk(*value),"right") == 0)
strncpy(&(pAXES_FEATURE (pobj)->dir),"r",1);
else if (strcmp(cstk(*value),"left") == 0)
strncpy(&(pAXES_FEATURE (pobj)->dir),"l",1);
else
{strcpy(error_message,"Second argument must be 'right' or 'left' ");return -1;}
}
}
else if (strcmp(marker,"x_location") == 0)
{
char loc;
if(strcmp(cstk(*value),"top") == 0)
loc='u';
else if (strcmp(cstk(*value),"bottom") == 0)
loc='d';
else if (strcmp(cstk(*value),"middle") == 0)
loc='c';
else
{strcpy(error_message,"Second argument must be 'top', 'bottom' or 'middle'");return -1;}
if (sciGetEntityType (pobj) == SCI_SUBWIN)
pSUBWIN_FEATURE (pobj)->axes.xdir = loc;
else
{strcpy(error_message,"x_location property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"y_location") == 0)
{
char loc;
if(strcmp(cstk(*value),"left") == 0)
loc='l';
else if (strcmp(cstk(*value),"right") == 0)
loc='r';
else if (strcmp(cstk(*value),"middle") == 0)
loc='c';
else
{strcpy(error_message,"Second argument must be 'left', 'right' or 'middle'");return -1;}
if (sciGetEntityType (pobj) == SCI_SUBWIN)
pSUBWIN_FEATURE (pobj)->axes.ydir = loc;
else
{strcpy(error_message,"x_location property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"tight_limits") == 0)
{
if ((strcmp(cstk(*value),"off") == 0))
pSUBWIN_FEATURE (pobj)->tight_limits=FALSE;
else if ((strcmp(cstk(*value),"on") == 0))
pSUBWIN_FEATURE (pobj)->tight_limits=TRUE;
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
else if (strcmp(marker,"closed") == 0)
{
if(sciGetEntityType(pobj) != SCI_POLYLINE)
{strcpy(error_message,"closed property does not exist for this handle");return -1;}
if (strcmp(cstk(*value),"on")==0 )
pPOLYLINE_FEATURE(pobj)->closed = 1;
else if (strcmp(cstk(*value),"off")==0 )
pPOLYLINE_FEATURE(pobj)->closed = 0;
else {strcpy(error_message,"Nothing to do (value must be 'on/off')"); return -1;}
}
else if (strcmp(marker,"auto_position") == 0)
{
if(sciGetEntityType(pobj) != SCI_LABEL)
{strcpy(error_message,"auto_position does not exist for this handle");return -1;}
if (strcmp(cstk(*value),"on")==0 )
pLABEL_FEATURE(pobj)->auto_position = TRUE;
else if (strcmp(cstk(*value),"off")==0 )
pLABEL_FEATURE(pobj)->auto_position = FALSE;
else {strcpy(error_message,"Nothing to do (value must be 'on/off')"); return -1;}
}
else if (strcmp(marker,"auto_rotation") == 0)
{
if(sciGetEntityType(pobj) != SCI_LABEL)
{strcpy(error_message,"auto_rotation does not exist for this handle");return -1;}
if (strcmp(cstk(*value),"on")==0 )
pLABEL_FEATURE(pobj)->auto_rotation = TRUE;
else if (strcmp(cstk(*value),"off")==0 )
pLABEL_FEATURE(pobj)->auto_rotation = FALSE;
else {strcpy(error_message,"Nothing to do (value must be 'on/off')"); return -1;}
}
else if (strcmp(marker,"position") == 0)
{
if ( sciGetAutoPosition( pobj ) )
{
sciSetAutoPosition( pobj, FALSE ) ;
}
if (sciGetEntityType(pobj)== SCI_UIMENU)
{
pUIMENU_FEATURE(pobj)->MenuPosition=(int)stk(*value)[0];
}
else if(sciGetEntityType(pobj) == SCI_LABEL)
{
sciSetPosition(pobj,stk(*value)[0],stk(*value)[1]);
}
else
{
strcpy(error_message,"position does not exist for this handle");
return -1;
}
}
/* F.Leray adding auto_ticks flags */
else if (strcmp(marker,"auto_ticks") == 0)
{
if(*numcol == 1){
ptr= *(char ***)value;
if ((strcmp(ptr[0],"off") == 0))
{
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[0]=FALSE;
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[1]=FALSE;
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[2]=FALSE;
}
else if ((strcmp(ptr[0],"on") == 0))
{
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[0]=TRUE;
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[1]=TRUE;
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[2]=TRUE;
}
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
else if (*numcol == 2 || *numcol == 3){
ptr= *(char ***)value;
for (i = 0; i < *numcol; i++ )
{
if ((strcmp(ptr[i],"off") == 0))
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[i]=FALSE;
else if ((strcmp(ptr[i],"on") == 0))
pSUBWIN_FEATURE (pobj)->axes.auto_ticks[i]=TRUE;
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
}
else
{strcpy(error_message,"Number of the second argument must be taken between 1 to 3");return -1;}
}
else if (strcmp(marker,"axes_reverse") == 0)
{
if(*numcol == 1){
ptr= *(char ***)value;
if ((strcmp(ptr[0],"off") == 0))
{
pSUBWIN_FEATURE (pobj)->axes.reverse[0]=FALSE;
pSUBWIN_FEATURE (pobj)->axes.reverse[1]=FALSE;
pSUBWIN_FEATURE (pobj)->axes.reverse[2]=FALSE;
}
else if ((strcmp(ptr[0],"on") == 0))
{
pSUBWIN_FEATURE (pobj)->axes.reverse[0]=TRUE;
pSUBWIN_FEATURE (pobj)->axes.reverse[1]=TRUE;
pSUBWIN_FEATURE (pobj)->axes.reverse[2]=TRUE;
}
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
else if (*numcol == 2 || *numcol == 3){
ptr= *(char ***)value;
for (i = 0; i < *numcol; i++ )
{
if ((strcmp(ptr[i],"off") == 0))
pSUBWIN_FEATURE (pobj)->axes.reverse[i]=FALSE;
else if ((strcmp(ptr[i],"on") == 0))
pSUBWIN_FEATURE (pobj)->axes.reverse[i]=TRUE;
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
}
else
{strcpy(error_message,"Number of the second argument must be taken between 1 to 3");return -1;}
}
else if (strcmp(marker,"view") == 0)
{
/* DJ.A 2003 */
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
if ((strcmp(cstk(*value),"2d") == 0))
{
if(pSUBWIN_FEATURE (pobj)->is3d == FALSE) return 0; /* Adding F.Leray 18.0604 */
if (sciGetSurface(pobj) == (sciPointObj *) NULL)
{
pSUBWIN_FEATURE (pobj)->is3d = FALSE;
pSUBWIN_FEATURE (pobj)->project[2]= 0;
}
pSUBWIN_FEATURE (pobj)->theta_kp=pSUBWIN_FEATURE (pobj)->theta;
pSUBWIN_FEATURE (pobj)->alpha_kp=pSUBWIN_FEATURE (pobj)->alpha;
pSUBWIN_FEATURE (pobj)->alpha = 0.0;
pSUBWIN_FEATURE (pobj)->theta = 270.0;
if(sciGetCurrentScilabXgc () != (struct BCG *) NULL)
UpdateSubwinScale(pobj);
/* sciRedrawFigure(); /\* F.Leray 10.06.04 Adding 2 lines here... *\/ */
pSUBWIN_FEATURE (pobj)->is3d = FALSE; /*...and here */
}
else if ((strcmp(cstk(*value),"3d") == 0)){
if(pSUBWIN_FEATURE (pobj)->is3d == TRUE) return 0; /* Adding F.Leray 18.0604 */
pSUBWIN_FEATURE (pobj)->is3d = TRUE;
Obj_RedrawNewAngle(pobj,pSUBWIN_FEATURE (pobj)->theta_kp,pSUBWIN_FEATURE (pobj)->alpha_kp);
wininfo("alpha=%.1f,theta=%.1f",pSUBWIN_FEATURE (pobj)->alpha_kp,pSUBWIN_FEATURE (pobj)->theta_kp);
}
else
{strcpy(error_message,"Second argument must be '2d' or '3d'");return -1;}
}
else
{strcpy(error_message,"view property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"axes_bounds") == 0) {
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
if (*numrow * *numcol != 4)
{strcpy(error_message,"Second argument must have 4 elements r");return -1;}
for (i=0;i<4;i++) {
pSUBWIN_FEATURE (pobj)->WRect[i]=stk(*value)[i];
set_scale ("ttffff", pSUBWIN_FEATURE (pobj)->WRect,
NULL, NULL,
NULL, NULL);
}
}
else
{strcpy(error_message,"axes_bounds property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"data_bounds") == 0) {
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
/* JB Silvy 09/11/05 */
sciSubWindow * ppSubWin = pSUBWIN_FEATURE (pobj) ;
double * bounds = stk(*value) ;
double xMin ;
double xMax ;
double yMin ;
double yMax ;
double zMin = 1.0 ; /* initialize to avoid checking between 2D and 3D */
double zMax = 2.0 ;
/* get the bounds of the matrix */
/* only allowed 2x2, 2x3, 1x4, 4x1, 1x6 and 6x1 matrices */
char * errorMsg = "Second argument should be a 2x2, 2x3, 1x4, 4x1, 1x6 or 6x1 matrix." ;
switch ( *numrow )
{
case 1 : /* row vector */
if ( *numcol == 4 )
{
xMin = bounds[0] ;
xMax = bounds[1] ;
yMin = bounds[2] ;
yMax = bounds[3] ;
}
else if( *numcol == 6 )
{
xMin = bounds[0] ;
xMax = bounds[1] ;
yMin = bounds[2] ;
yMax = bounds[3] ;
zMin = bounds[4] ;
zMax = bounds[5] ;
}
else
{
strcpy( error_message, errorMsg ) ;
return -1 ;
}
break ;
case 2 : /* 2x2 or 2x3 matrix */
if ( *numcol == 2 )
{
xMin = bounds[0] ;
yMin = bounds[2] ;
xMax = bounds[1] ;
yMax = bounds[3] ;
}
else if ( *numcol == 3 )
{
xMin = bounds[0] ;
yMin = bounds[2] ;
zMin = bounds[4] ;
xMax = bounds[1] ;
yMax = bounds[3] ;
zMax = bounds[5] ;
}
else
{
strcpy( error_message, errorMsg ) ;
return -1 ;
}
break ;
case 4 : /* column vector for 2D */
if ( *numcol == 1 )
{
xMin = bounds[0] ;
xMax = bounds[1] ;
yMin = bounds[2] ;
yMax = bounds[3] ;
}
else
{
strcpy( error_message, errorMsg ) ;
return -1 ;
}
break ;
case 6 : /* column vector for 3D */
if ( *numcol == 1 )
{
xMin = bounds[0] ;
xMax = bounds[1] ;
yMin = bounds[2] ;
yMax = bounds[3] ;
zMin = bounds[4] ;
zMax = bounds[5] ;
}
else
{
strcpy( error_message, errorMsg ) ;
return -1 ;
}
break ;
default:
strcpy( error_message, errorMsg ) ;
return -1 ;
}
/* check if the bounds are corrects */
/* allows equality with bounds since it is working */
if ( xMin > xMax || yMin > yMax || zMin > zMax )
{
strcpy(error_message,"Error : Min and Max values for one axis do not verify Min <= Max.");
return -1 ;
}
/* check for logflags that values are greater then 0 */
if ( ( ppSubWin->logflags[0] == 'l' && xMin <= 0.0 )
|| ( ppSubWin->logflags[1] == 'l' && yMin <= 0.0 )
|| ( ppSubWin->logflags[2] == 'l' && zMin <= 0.0 ) )
{
strcpy(error_message,"Error: bounds on axis must be strictly positive to use logarithmic mode\n") ;
return -1 ;
}
/* copy the values in the axis */
if ( *numrow * *numcol == 4 )
{
/* 2D */
ppSubWin->SRect[0] = xMin ;
ppSubWin->SRect[1] = xMax ;
ppSubWin->SRect[2] = yMin ;
ppSubWin->SRect[3] = yMax ;
}
else
{
/* 3D */
ppSubWin->SRect[0] = xMin ;
ppSubWin->SRect[1] = xMax ;
ppSubWin->SRect[2] = yMin ;
ppSubWin->SRect[3] = yMax ;
ppSubWin->SRect[4] = zMin ;
ppSubWin->SRect[5] = zMax ;
}
/**DJ.Abdemouche 2003**/
/*if ((*numrow * *numcol != 4) && (*numrow * *numcol != 6))
{strcpy(error_message,"Second argument must have 4 elements (6 if 3d view)");return -1;} */
/* if(ppSubWin->logflags[0] == 'n'){ /\* General case for x : logflag='n' *\/ */
/* ppSubWin->SRect[0]=stk(*value)[0]; */
/* ppSubWin->SRect[1]=stk(*value)[1]; */
/* } */
/* else{/\* log. case *\/ */
/* /\*xmin*\/ */
/* if(stk(*value)[0] <= 0. || stk(*value)[1] <= 0.) */
/* {sciprint("Error: bounds on x axis must be strictly positive to use logarithmic mode\n");return -1;} */
/* else{ */
/* ppSubWin->SRect[0]=stk(*value)[0]; */
/* ppSubWin->SRect[1]=stk(*value)[1]; */
/* } */
/* } */
/* if( ppSubWin->logflags[1] == 'n'){ /\* General case for y : logflag='n' *\/ */
/* ppSubWin->SRect[2]=stk(*value)[2]; */
/* ppSubWin->SRect[3]=stk(*value)[3]; */
/* } */
/* else{/\* log. case *\/ */
/* /\*ymin*\/ */
/* if(stk(*value)[2] <= 0. || stk(*value)[3] <= 0.) */
/* {sciprint("Error: bounds on y axis must be strictly positive to use logarithmic mode\n");return -1;} */
/* else{ */
/* ppSubWin->SRect[2]=stk(*value)[2]; */
/* ppSubWin->SRect[3]=stk(*value)[3]; */
/* } */
/* } */
/* if (*numrow * *numcol == 6) */
/* { */
/* if(ppSubWin->logflags[2] == 'n'){ /\* General case for z : logflag='n' *\/ */
/* ppSubWin->SRect[4]=stk(*value)[4]; */
/* ppSubWin->SRect[5]=stk(*value)[5]; */
/* } */
/* else{/\* log. case *\/ */
/* /\*zmin*\/ */
/* if(stk(*value)[4] <= 0. || stk(*value)[5] <= 0.) */
/* {sciprint("Error: bounds on z axis must be strictly positive to use logarithmic mode\n");return -1;} */
/* else{ */
/* ppSubWin->SRect[4]=stk(*value)[4]; */
/* ppSubWin->SRect[5]=stk(*value)[5]; */
/* } */
/* } */
/* } */
/* to inform plotxx function to take this boundary into account */
ppSubWin->FirstPlot = FALSE;
}
else if (sciGetEntityType (pobj) == SCI_SURFACE) {
if (*numrow * *numcol != 6)
{strcpy(error_message,"Second argument must have 6 elements ");return -1;}
for (i=0;i<6;i++) {
pSURFACE_FEATURE (pobj)->ebox[i]=stk(*value)[i];
}
}
else
{strcpy(error_message,"data_bounds property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"margins") == 0) {
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
/**DJ.Abdemouche 2003**/
if (*numrow * *numcol != 4)
{strcpy(error_message,"Second argument must have 4 elements ");return -1;}
pSUBWIN_FEATURE (pobj)->ARect[0]=stk(*value)[0];
pSUBWIN_FEATURE (pobj)->ARect[1]=stk(*value)[1];
pSUBWIN_FEATURE (pobj)->ARect[2]=stk(*value)[2];
pSUBWIN_FEATURE (pobj)->ARect[3]=stk(*value)[3];}
else
{strcpy(error_message,"margins property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"tics_color") == 0) {
if (sciGetEntityType (pobj) == SCI_AXES)
pAXES_FEATURE (pobj)->ticscolor = (int)stk(*value)[0];
else if (sciGetEntityType (pobj) == SCI_SUBWIN){
sciprint("Warning: tics_color use is deprecated and no more taken into account, use foreground property to edit Axes color\n");
pSUBWIN_FEATURE (pobj)->axes.ticscolor = (int)stk(*value)[0];
}
else
{strcpy(error_message,"tics_color property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"tics_style") == 0) {
if((strcmp(cstk(*value),"v") != 0)&&
(strcmp(cstk(*value),"r") != 0)&&
(strcmp(cstk(*value),"i") != 0)) {
strcpy(error_message,"tics must be 'v' or 'r' or 'i'");return -1;
}
if (sciGetEntityType (pobj) == SCI_AXES){
double *vector = NULL;
int N = 0;
char xy_type = *cstk(*value);
if(pAXES_FEATURE (pobj)->str != NULL){
if(ComputeXIntervals(pobj,xy_type,&vector,&N,1) != 0){
Scierror(999,"Error: Bad size in tics_coord ; you must first increase the size of the tics_coord\n");
return 0;
}
if( pAXES_FEATURE (pobj)->nb_tics_labels < N){
Scierror(999,"Warning: tics_labels has been set by user ; you must first increase the size of the tics_labels string vector before switching to '%c' tics_style mode\n",xy_type);
return 0;
}
}
pAXES_FEATURE (pobj)->tics = xy_type;
}
else {
strcpy(error_message,"tics_style property does not exist for this handle");return -1;
}
}
/*Dj.A 17/12/2003*/
/* modified jb Silvy 01/2006 */
else if ((strcmp(marker,"sub_tics") == 0) || (strcmp(marker,"sub_ticks") == 0))
{
if (sciGetEntityType (pobj) == SCI_AXES)
{
pAXES_FEATURE (pobj)->subint= (int) *stk(*value);
}
else if (sciGetEntityType (pobj) == SCI_SUBWIN)
{
sciSubWindow * ppSubWin = pSUBWIN_FEATURE (pobj) ;
if ((*numcol != 3 )&& (*numcol != 2))
{
strcpy(error_message,"Value must have two elements (three if 3D universe) ");
return -1;
}
ppSubWin->flagNax = TRUE;
for ( i = 0; i < *numcol ; i++ )
{
char logflag = ppSubWin->logflags[i] ;
int nbTicks ;
if(logflag == 'l')
{
/* sciprint("Subtics number can not be set while using logarithmic scaling\n"); */
continue;
}
nbTicks = (int) *stk(*value+i);
if( nbTicks >= 0 )
{
ppSubWin->axes.nbsubtics[i] = nbTicks + 1 ;
}
else
{
ppSubWin->axes.nbsubtics[i] = 1 ;
}
}
}
else
{
strcpy(error_message,"sub_ticks property does not exist for this handle");
return -1 ;
}
}
else if (strcmp(marker,"format_n") == 0)
{
strncpy(pAXES_FEATURE (pobj)->format,cstk(*value),1);
}
else if (strcmp(marker,"tics_segment") == 0)
{
if (strcmp(cstk(*value),"on")==0 )
pAXES_FEATURE (pobj)->seg=1;
else if (strcmp(cstk(*value),"off")==0 )
pAXES_FEATURE (pobj)->seg=0;
else {strcpy(error_message,"Nothing to do (value must be 'on/off')");
return -1;}
}
else if (strcmp(marker,"labels_font_size") == 0) {
xtmp = (int) *stk(*value);
if (sciGetEntityType (pobj) == SCI_AXES)
pAXES_FEATURE (pobj)->fontsize = xtmp;
else if (sciGetEntityType (pobj) == SCI_SUBWIN || sciGetEntityType (pobj) == SCI_FIGURE){
/* pSUBWIN_FEATURE (pobj)->axes.fontsize = (int) *stk(*value);*/
sciSetFontDeciWidth(pobj,(int) (100*xtmp));} /* F.Leray 08.04.04 */
else
{strcpy(error_message,"labels_font_size property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"labels_font_color") == 0) {
if (sciGetEntityType (pobj) == SCI_AXES)
pAXES_FEATURE (pobj)->textcolor=(int)*stk(*value);
else if (sciGetEntityType (pobj) == SCI_SUBWIN || sciGetEntityType (pobj) == SCI_FIGURE){
/* pSUBWIN_FEATURE (pobj)->axes.textcolor=(int)*stk(*value);*/
sciSetFontForeground(pobj,(int)*stk(*value));} /* F.Leray 08.04.04 */
else
{strcpy(error_message,"labels_font_color property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"labels_font_style") == 0) { /* Adding F.Leray 09.04.04 : For the moment sciAxes have no style property*/
if (sciGetEntityType (pobj) == SCI_SUBWIN || sciGetEntityType (pobj) == SCI_FIGURE)
sciSetFontStyle(pobj,(int)*stk(*value));
else
{strcpy(error_message,"labels_font_style property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"tics_labels") == 0)
{
if (*numrow != 1)
{strcpy(error_message,"Second argument must be a vector"); return -1;}
else
{
ptr= *(char ***)value; /**DJ.Abdemouche 2003**/
if (pAXES_FEATURE(pobj)->nb_tics_labels > *numcol)
{sprintf(error_message,"Value must have at least %d elements",pAXES_FEATURE(pobj)->nb_tics_labels);
return -1;}
else
{
if(pAXES_FEATURE(pobj)->str != NULL)
for(i=0;i<pAXES_FEATURE(pobj)->nb_tics_labels;i++)
{ FREE(pAXES_FEATURE(pobj)->str[i]); pAXES_FEATURE(pobj)->str[i] = NULL;}
FREE(pAXES_FEATURE(pobj)->str);
pAXES_FEATURE(pobj)->str =ptr;
pAXES_FEATURE(pobj)->nb_tics_labels = *numcol; /* could be increased to support xy_type switching (i.e. xy_type='v' -> xy_type='r') */
}
}
}
else if (strcmp(marker,"xtics_coord") == 0)
{
if (*numrow != 1)
{strcpy(error_message,"Second argument must be a row vector");return -1;}
else if (( pAXES_FEATURE(pobj)->nx == 1) &&(*numcol!=1))
{strcpy(error_message,"Second argument must be a scalar");return -1;}
else if (( pAXES_FEATURE(pobj)->nx != 1) &&(*numcol==1))
{strcpy(error_message,"Second argument must be a vector");return -1;}
else
{
int N = 0;
double *vector = NULL;
char c_format[5];
char **foo = (char **) NULL;
/* what follows remains here as it was */
FREE(pAXES_FEATURE(pobj)->vx); pAXES_FEATURE(pobj)->vx = NULL;
if ((pAXES_FEATURE(pobj)->vx = (double *) MALLOC (*numcol * sizeof (double))) == NULL){
strcpy(error_message,"No memory left for allocating temporary tics_coord");return -1;}
pAXES_FEATURE(pobj)->nx= *numcol;
for (i = 0; i < *numcol;i++)
pAXES_FEATURE(pobj)->vx[i]=*stk(*value+i);
ComputeXIntervals(pobj,pAXES_FEATURE (pobj)->tics,&vector,&N,0);
ComputeC_format(pobj,c_format);
if(pAXES_FEATURE(pobj)->str != NULL)
for(i=0;i<pAXES_FEATURE(pobj)->nb_tics_labels;i++)
{ FREE(pAXES_FEATURE(pobj)->str[i]); pAXES_FEATURE(pobj)->str[i] = NULL;}
FREE(pAXES_FEATURE(pobj)->str); pAXES_FEATURE (pobj)->str = NULL;
if((foo=MALLOC(N*(sizeof(char *))))==NULL){
strcpy(error_message,"No memory left for allocating temporary tics_labels");return -1;}
for(i=0;i<N;i++){
if((foo[i]=MALLOC(256*(sizeof(char)+1)))==NULL){
strcpy(error_message,"No memory left for allocating temporary tics_labels");return -1;}
}
for(i=0;i<N;i++){
if(pAXES_FEATURE (pobj)->nx < (*numcol))
sprintf(foo[i],c_format,vector[i]);
else
sprintf(foo[i],c_format,vector[i]);
}
FREE(vector); vector = (double *) NULL;
/* I recompute the nb_tics_labels and save the new strings */
pAXES_FEATURE (pobj)->nb_tics_labels = N;
pAXES_FEATURE(pobj)->str=foo;
}
}
else if (strcmp(marker,"ytics_coord") == 0)
{
if (*numrow != 1)
{strcpy(error_message,"Second argument must be a row vector");return -1;}
else if (( pAXES_FEATURE(pobj)->ny ==1) &&( *numcol != 1))
{strcpy(error_message,"Second argument must be a scalar");return -1;}
else if (( pAXES_FEATURE(pobj)->ny !=1) && (*numcol == 1))
{strcpy(error_message,"Second argument must be a vector");return -1;}
else
{
int N = 0;
double *vector = NULL;
char c_format[5];
char **foo = (char **) NULL;
/* what follows remains here as it was */
FREE(pAXES_FEATURE(pobj)->vy); pAXES_FEATURE(pobj)->vy = NULL;
if ((pAXES_FEATURE(pobj)->vy = MALLOC (*numcol * sizeof (double))) == NULL)
return 0;
pAXES_FEATURE(pobj)->ny= *numcol;
for (i = 0; i < *numcol;i++)
pAXES_FEATURE(pobj)->vy[i]=*stk(*value+i);
ComputeXIntervals(pobj,pAXES_FEATURE (pobj)->tics,&vector,&N,0);
ComputeC_format(pobj,c_format);
if(pAXES_FEATURE(pobj)->str != NULL)
for(i=0;i<pAXES_FEATURE(pobj)->nb_tics_labels;i++)
{ FREE(pAXES_FEATURE(pobj)->str[i]); pAXES_FEATURE(pobj)->str[i] = NULL;}
FREE(pAXES_FEATURE(pobj)->str); pAXES_FEATURE (pobj)->str = NULL;
if((foo=MALLOC(N*(sizeof(char *))))==NULL){
strcpy(error_message,"No memory left for allocating temporary tics_labels");return -1;}
for(i=0;i<N;i++){
if((foo[i]=MALLOC(256*(sizeof(char)+1)))==NULL){
strcpy(error_message,"No memory left for allocating temporary tics_labels");return -1;}
}
for(i=0;i<N;i++){
if(pAXES_FEATURE (pobj)->ny < (*numcol))
sprintf(foo[i],c_format,vector[i]);
else
sprintf(foo[i],c_format,vector[i]);
}
FREE(vector); vector = (double *) NULL;
/* I recompute the nb_tics_labels and save the new strings */
pAXES_FEATURE (pobj)->nb_tics_labels = N;
pAXES_FEATURE(pobj)->str=foo;
}
}
else if (strcmp(marker,"box") == 0)
{
if ((strcmp(cstk(*value),"on") == 0))
sciSetIsBoxed(pobj,TRUE);
else if ((strcmp(cstk(*value),"off") == 0))
sciSetIsBoxed(pobj,FALSE);
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
else if (strcmp(marker,"grid") == 0) {/**DJ.Abdemouche 2003**/
for (i = 0; i < *numcol; i++ )
{
if (stk(*value)[i] < -1)
{strcpy(error_message,"Argument must be -1 (no grid) or number of color");return -1;}
else
{pSUBWIN_FEATURE (pobj)->grid[i]=(int) stk(*value)[i];}
}
}
else if (strcmp(marker,"axes_visible") == 0)
{
if(*numcol == 1){
ptr= *(char ***)value;
if ((strcmp(ptr[0],"off") == 0))
{
pSUBWIN_FEATURE (pobj)->axes.axes_visible[0]=FALSE;
pSUBWIN_FEATURE (pobj)->axes.axes_visible[1]=FALSE;
pSUBWIN_FEATURE (pobj)->axes.axes_visible[2]=FALSE;
/* pSUBWIN_FEATURE (pobj)->isaxes= FALSE; */
}
else if ((strcmp(ptr[0],"on") == 0))
{
pSUBWIN_FEATURE (pobj)->axes.axes_visible[0]=TRUE;
pSUBWIN_FEATURE (pobj)->axes.axes_visible[1]=TRUE;
pSUBWIN_FEATURE (pobj)->axes.axes_visible[2]=TRUE;
/* pSUBWIN_FEATURE (pobj)->isaxes= TRUE; */
}
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
else if (*numcol == 2 || *numcol == 3){
ptr= *(char ***)value;
for (i = 0; i < *numcol; i++ )
{
if ((strcmp(ptr[i],"off") == 0)) {
pSUBWIN_FEATURE (pobj)->axes.axes_visible[i]=FALSE;
/* pSUBWIN_FEATURE (pobj)->isaxes= FALSE; */ /* DO NOT PUT at all !*/
}
else if ((strcmp(ptr[i],"on") == 0)){
pSUBWIN_FEATURE (pobj)->axes.axes_visible[i]=TRUE;
/* pSUBWIN_FEATURE (pobj)->isaxes= TRUE; */
}
else
{strcpy(error_message,"Second argument must be 'on' or 'off'");return -1;}
}
}
else
{strcpy(error_message,"Number of the second argument must be taken between 1 to 3");return -1;}
}
else if (strcmp(marker,"hiddencolor") == 0)
{
if (sciGetEntityType (pobj) == SCI_SUBWIN)
pSUBWIN_FEATURE (pobj)->hiddencolor=(int) stk(*value)[0];
else if (sciGetEntityType (pobj) == SCI_SURFACE)
pSURFACE_FEATURE (pobj)->hiddencolor=(int) stk(*value)[0];
else
{strcpy(error_message,"hiddencolor property does not exist for this handle");return -1;}
}
/**DJ.Abdemouche 2003**/
else if (strcmp(marker,"isoview") == 0)
{ /* DJ.A 2003 */
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
if ((strcmp(cstk(*value),"on") == 0))
pSUBWIN_FEATURE (pobj)->isoview= TRUE;
else if ((strcmp(cstk(*value),"off") == 0))
pSUBWIN_FEATURE (pobj)->isoview= FALSE;
else
{strcpy(error_message,"Value must be 'on' or 'off'");return -1;}
}
else
{strcpy(error_message,"isoview property does not exist for this handle");return -1;}
} /**/
else if (strcmp(marker,"cube_scaling") == 0) /* F.Leray 22.04.04 */
{
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
if(pSUBWIN_FEATURE (pobj)->is3d == FALSE)
sciprint("Warning: cube_scaling property is only used in 3D mode\n");
if ((strcmp(cstk(*value),"on") == 0))
pSUBWIN_FEATURE (pobj)->cube_scaling= TRUE;
else if ((strcmp(cstk(*value),"off") == 0))
pSUBWIN_FEATURE (pobj)->cube_scaling= FALSE;
else
{strcpy(error_message,"Value must be 'on' or 'off' / Only use for 3D mode");return -1;}
}
else
{strcpy(error_message,"cube_scaling property does not exist for this handle");return -1;}
} /**/
else if (strcmp(marker,"log_flags") == 0)
{
char *flags;
flags=cstk(*value);
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
if (((*numrow * *numcol == 2) || (*numrow * *numcol == 3)) &&
(flags[0]=='n'||flags[0]=='l')&&
(flags[1]=='n'||flags[1]=='l')) {
/* Update the data_bounds values ?? NO we will see if data_bounds contains
negative boundaries and send an error message to the user */
if( (pSUBWIN_FEATURE (pobj)->SRect[0] <= 0. || pSUBWIN_FEATURE (pobj)->SRect[1] <= 0.)
&& flags[0] == 'l') {
strcpy(error_message,
"Error: data_bounds on x axis must be strictly positive to switch to logarithmic mode");
return -1;
}
else
{
pSUBWIN_FEATURE (pobj)->axes.u_xlabels = ReBuildUserTicks( pSUBWIN_FEATURE (pobj)->logflags[0], flags[0],
pSUBWIN_FEATURE (pobj)->axes.u_xgrads,
&pSUBWIN_FEATURE (pobj)->axes.u_nxgrads,
pSUBWIN_FEATURE (pobj)->axes.u_xlabels);
/* ReBuildUserTicks( pobj, pSUBWIN_FEATURE (pobj)->logflags[0], flags[0],'x'); */
pSUBWIN_FEATURE (pobj)->logflags[0]=flags[0];
}
if((pSUBWIN_FEATURE (pobj)->SRect[2] <= 0. || pSUBWIN_FEATURE (pobj)->SRect[3] <= 0.)
&& flags[1] == 'l'){
strcpy(error_message,
"Error: data_bounds on y axis must be strictly positive to switch to logarithmic mode");
return -1;
}
else
{
pSUBWIN_FEATURE (pobj)->axes.u_ylabels = ReBuildUserTicks( pSUBWIN_FEATURE (pobj)->logflags[1], flags[1],
pSUBWIN_FEATURE (pobj)->axes.u_ygrads,
&pSUBWIN_FEATURE (pobj)->axes.u_nygrads,
pSUBWIN_FEATURE (pobj)->axes.u_ylabels);
/* ReBuildUserTicks( pobj, pSUBWIN_FEATURE (pobj)->logflags[1], flags[1],'y'); */
pSUBWIN_FEATURE (pobj)->logflags[1]=flags[1];
}
/* third new case (for z) F.Leray 03.11.04 */
if((*numrow * *numcol == 3) &&
(flags[2]=='n'||flags[2]=='l')){
if( (pSUBWIN_FEATURE (pobj)->SRect[4] <= 0. || pSUBWIN_FEATURE (pobj)->SRect[5] <= 0.)
&& flags[2] == 'l')
{strcpy(error_message,"Error: data_bounds on z axis must be strictly positive to switch to logarithmic mode");return -1;}
else
{
pSUBWIN_FEATURE (pobj)->axes.u_zlabels = ReBuildUserTicks( pSUBWIN_FEATURE (pobj)->logflags[2], flags[2],
pSUBWIN_FEATURE (pobj)->axes.u_zgrads,
&pSUBWIN_FEATURE (pobj)->axes.u_nzgrads,
pSUBWIN_FEATURE (pobj)->axes.u_zlabels);
/* ReBuildUserTicks( pobj, pSUBWIN_FEATURE (pobj)->logflags[0], flags[0],'x'); */
pSUBWIN_FEATURE (pobj)->logflags[2]=flags[2];
}
}
}
else
{strcpy(error_message,"incorrect log_flags value");return -1;}
}
else
{strcpy(error_message,"log_flags property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"arrow_size") == 0) {
if(sciGetEntityType (pobj) == SCI_SEGS)
pSEGS_FEATURE (pobj)->arrowsize = *stk(*value);
else
{strcpy(error_message,"arrow_size property does not exist for this handle");return -1;}
}
else if ((strcmp(marker,"segs_color") == 0) && (sciGetEntityType (pobj) == SCI_SEGS)){
if (pSEGS_FEATURE (pobj)->ptype == 0){
if ((*numrow)* (*numcol)==1) {
pSEGS_FEATURE (pobj)->iflag=0;
for (i = 0; i < (pSEGS_FEATURE (pobj)->Nbr1)/2 ;i++)
pSEGS_FEATURE (pobj)->pstyle[i]=(int)*stk(*value);
}
else if (((*numrow)* (*numcol)== (pSEGS_FEATURE (pobj)->Nbr1)/2)) {
pSEGS_FEATURE (pobj)->iflag=1;
for (i = 0; i < (pSEGS_FEATURE (pobj)->Nbr1)/2 ;i++)
pSEGS_FEATURE (pobj)->pstyle[i]=(integer) *stk(*value+i);
}
else
{
sprintf(error_message,"segs color has a wrong size (%d), expecting 1 or (%d )",((*numrow)* (*numcol)) ,(pSEGS_FEATURE (pobj)->Nbr1)/2 );
return -1;
}
}
else
{strcpy(error_message,"segs_color property does not exist for this handle");return -1;}
}
else if ((strcmp(marker,"colored") == 0) && (sciGetEntityType (pobj) == SCI_SEGS)){
if (pSEGS_FEATURE (pobj)->ptype != 0){
if ((strcmp(cstk(*value),"on") == 0))
pSEGS_FEATURE (pobj)->typeofchamp = 1;
else if ((strcmp(cstk(*value),"off") == 0))
pSEGS_FEATURE (pobj)->typeofchamp = 0;
else
{strcpy(error_message,"Value must be 'on' or 'off'");return -1;}
}
else
{strcpy(error_message,"colored property does not exist for Segs");return -1;}
}
/**************** Matplot Grayplot *********************/
else if (strcmp(marker,"data_mapping") == 0) {
if (sciGetEntityType (pobj) == SCI_GRAYPLOT) {
if ((strcmp(cstk(*value),"scaled") == 0)||(strcmp(cstk(*value),"direct") == 0))
strncpy(pGRAYPLOT_FEATURE (pobj)->datamapping,cstk(*value),6);
else
{strcpy(error_message,"Value must be 'direct' or 'scaled'");return -1;}
}
else
{strcpy(error_message,"data_mapping property does not exist for this handle");return -1;}
}
/**************** Surface *******************************/
else if (strcmp(marker,"rotation_angles") == 0) {
/* DJ.A 2003 */
if (sciGetEntityType (pobj) == SCI_SUBWIN) {
Obj_RedrawNewAngle(pobj,*stk(*value+1),*stk(*value));
wininfo("alpha=%.1f,theta=%.1f",pSUBWIN_FEATURE (pobj)->alpha,pSUBWIN_FEATURE (pobj)->theta);
}
else
{strcpy(error_message,"rotation_angles property does not exist for this handle");return -1;}
}
/*DJ.A merge*/
else if (strcmp(marker,"color_mode") == 0) {
if (sciGetEntityType (pobj) == SCI_SURFACE) {
/* int m3n,n3n,nc,j; */
int flagcolor;
sciSurface * psurf = pSURFACE_FEATURE (pobj);
flagcolor = psurf->flagcolor;
psurf->flag[0]= (integer) stk(*value)[0];
if(flagcolor != 0 && flagcolor !=1){
if(psurf->m3n * psurf->n3n == 0) {/* There is no color matrix/vect. in input : update the fake color one */
int j,nc;
if(flagcolor == 2 || flagcolor == 4)
nc = psurf->dimzy; /* rappel: dimzy always equal n3*/
else if(flagcolor == 3)
nc = psurf->dimzx * psurf->dimzy;
FREE(psurf->zcol);
if ((psurf->zcol = MALLOC ( nc * sizeof (double))) == NULL)
return -1;
for (j = 0;j < nc; j++) /* nc value is dimzy*/
psurf->zcol[j]= psurf->flag[0];
if(flagcolor != 0 && flagcolor !=1){
/* We need to rebuild ...->color matrix */
if(psurf->cdatamapping == 0){ /* scaled */
FREE(psurf->color);
LinearScaling2Colormap(pobj);
}
else{
int nc = psurf->nc;
FREE(psurf->color);
if(nc>0){
if ((psurf->color = MALLOC (nc * sizeof (double))) == NULL)
return -1;
}
for(i=0;i<nc;i++)
psurf->color[i] = psurf->zcol[i];
/* copy zcol that has just been freed and re-alloc + filled in */
}
}
}
}
if(psurf->typeof3d==SCI_FAC3D) /* we have to deal with colors... and may be update because we just changed psurf->flag[0]*/
if(psurf->flagcolor == 0)
{
pSURFACE_FEATURE (pobj)->izcol = 0;
}
}
else
{strcpy(error_message,"color_mode property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"color_flag") == 0) {
if (sciGetEntityType (pobj) == SCI_SURFACE) {
if (*numrow * *numcol != 1)
{strcpy(error_message,"Second argument must have 1 elements ");return -1;}
if (pSURFACE_FEATURE (pobj)->typeof3d==SCI_PLOT3D) {
if ((*stk(*value)<0)||(*stk(*value)>1))
{strcpy(error_message,"Second argument must be equal to 0 or 1");return -1;}
pSURFACE_FEATURE (pobj)->flagcolor= (int)stk(*value)[0];
}
else if (pSURFACE_FEATURE (pobj)->typeof3d==SCI_FAC3D)
{
int m3n,n3n,nc,j,ii,flagcolor=(int)stk(*value)[0];
/*int *zcol;*/
/*F.Leray psurf for debug*/
sciSurface * psurf = pSURFACE_FEATURE (pobj);
if ((*stk(*value)<0)||(*stk(*value)>4))
{strcpy(error_message,"Second argument must be 0 1 2 3 or 4");return -1;}
/* F.Leray 18.03.04 Something goes wrong here: No need to re-build/re-alloc zcol normally!!*/
/* YES in fact but use of another fixed array named inputCMoV (inputColorMatrixorVector)*/
if (pSURFACE_FEATURE (pobj)->flagcolor == stk(*value)[0])
return 0;
if(flagcolor == 0)
{
pSURFACE_FEATURE (pobj)->izcol = 0;
}
else if(flagcolor == 1)
{
pSURFACE_FEATURE (pobj)->izcol = 0;
}
else if(flagcolor == 2) /* Warning: here we need a color vector (one color per facet). N = 1 x dimzy */
{
m3n = pSURFACE_FEATURE (pobj)->m3n;
n3n = pSURFACE_FEATURE (pobj)->n3n;
nc = psurf->dimzy; /* rappel: dimzy always equal n3*/
psurf->nc = nc;
FREE(psurf->zcol); psurf->zcol = NULL;
if(nc>0){
if ((psurf->zcol = MALLOC (nc * sizeof (double))) == NULL)
return -1;
}
if(m3n * n3n != 0 ){ /* There is either a color matrix or vector*/
if( m3n==1 || n3n ==1)
{
/* We have just enough information to fill the psurf->zcol array*/
for (j = 0;j < nc; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[j]= psurf->inputCMoV[j];
}
else if (!( m3n==1 || n3n ==1))
{
/* We have too much information and we take only the first dimzy colors to fill the psurf->zcol array*/
/* NO !! Let's do better; F.Leray 08.05.04 : */
/* We compute the average value (sum of the value of the nf=m3n vertices on a facet) / (nb of vertices per facet which is nf=m3n) */
/* in our example: m3n=4 and n3n=400 */
for (j = 0;j < nc; j++) /* nc value is dimzy*/
{
double tmp = 0;
for(ii=0;ii<m3n;ii++)
tmp = tmp + psurf->inputCMoV[j*m3n + ii];
tmp = tmp / m3n;
psurf->zcol[j]= tmp;
}
}
}
else if (m3n * n3n == 0) {/* There is no color matrix/vect. in input */
for (j = 0;j < psurf->dimzy; j++) /* nc value is dimzy*/
psurf->zcol[j]= psurf->flag[0];
}
}
else if (flagcolor == 3) /* interpolated (shading) case */
{
m3n = pSURFACE_FEATURE (pobj)->m3n;
n3n = pSURFACE_FEATURE (pobj)->n3n;
nc = psurf->dimzx * psurf->dimzy;
psurf->nc = nc;
FREE(psurf->zcol); psurf->zcol = NULL;
if ((psurf->zcol = MALLOC ( nc * sizeof (double))) == NULL)
return -1;
if(m3n * n3n != 0 ){ /* There is either a color matrix or vector*/
if( m3n==1 || n3n ==1) /* COLOR VECTOR */
{
/* We have insufficient info. to fill the entire zcol array of dimension nc = dimzx*dimzy*/
/* We repeat the data:*/
for(i = 0; i< psurf->dimzy; i++){
for (j = 0;j < psurf->dimzx; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[(psurf->dimzx)*i+j]= psurf->inputCMoV[i];
}
}
else if (!( m3n==1 || n3n ==1)) /* COLOR MATRIX */
{
/* We have just enough information to fill the psurf->zcol array*/
for (j = 0;j < (psurf->dimzx) * (psurf->dimzy); j++) /* nc value is dimzy*/
psurf->zcol[j]= psurf->inputCMoV[j];
}
}
else if (m3n * n3n == 0) {/* There is no color matrix/vect. in input */
for(i = 0; i< psurf->dimzy; i++){
for (j = 0;j < psurf->dimzx; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[( psurf->dimzx)*i+j]= psurf->flag[0];
}
}
}
/* New : case == 4 introduced on the 10.03.05 (F.Leray) to support faceted (flat) Matlab case */
else if(flagcolor == 4) /* Warning: here we need a color vector (one color per facet). N = 1 x dimzy */
{
m3n = pSURFACE_FEATURE (pobj)->m3n;
n3n = pSURFACE_FEATURE (pobj)->n3n;
nc = psurf->dimzy; /* rappel: dimzy always equal n3*/
psurf->nc = nc;
FREE(psurf->zcol); psurf->zcol = NULL;
if(nc>0){
if ((psurf->zcol = MALLOC (nc * sizeof (double))) == NULL)
return -1;
}
if(m3n * n3n != 0 ){ /* There is either a color matrix or vector */
if( m3n==1 || n3n ==1)
{
/* We have just enough information to fill the psurf->zcol array*/
for (j = 0;j < nc; j++) /* nc value is dimzx*dimzy == m3n * n3n */
psurf->zcol[j]= psurf->inputCMoV[j];
}
else if (!( m3n==1 || n3n ==1))
{
/* input : color matrix , we use 1 color per facet with Matlab selection mode (no average computed) */
/* HERE is the difference with case 2 */
for (j = 0;j < nc; j++) /* nc value is dimzy*/
psurf->zcol[j] = psurf->inputCMoV[j*m3n];
}
}
else if (m3n * n3n == 0) {/* There is no color matrix/vect. in input */
for (j = 0;j < psurf->dimzy; j++) /* nc value is dimzy*/
psurf->zcol[j]= psurf->flag[0];
}
}
if(flagcolor != 0 && flagcolor !=1){
/* We need to rebuild ...->color matrix */
if(psurf->cdatamapping == 0){ /* scaled */
FREE(psurf->color);
LinearScaling2Colormap(pobj);
}
else{
int nc = psurf->nc;
FREE(psurf->color);
if(nc>0){
if ((psurf->color = MALLOC (nc * sizeof (double))) == NULL)
return -1;
}
for(i=0;i<nc;i++)
psurf->color[i] = psurf->zcol[i];
/* copy zcol that has just been freed and re-alloc + filled in */
}
}
/* Finally, update the flagcolor */
pSURFACE_FEATURE (pobj)->flagcolor = flagcolor;
}
}
}
else if (strcmp(marker,"cdata_mapping") == 0) {
if (sciGetEntityType (pobj) == SCI_SURFACE) {
if (pSURFACE_FEATURE (pobj)->typeof3d==SCI_FAC3D) {
if ((strcmp(cstk(*value),"scaled") == 0)){
if(pSURFACE_FEATURE (pobj)->cdatamapping != 0){ /* not already scaled */
LinearScaling2Colormap(pobj);
pSURFACE_FEATURE (pobj)->cdatamapping = 0;
}
}
else if ((strcmp(cstk(*value),"direct") == 0)){
if(pSURFACE_FEATURE (pobj)->cdatamapping != 1){ /* not already direct */
int nc = pSURFACE_FEATURE (pobj)->nc;
FREE(pSURFACE_FEATURE (pobj)->color); pSURFACE_FEATURE (pobj)->color = NULL;
/* printf("pSURFACE_FEATURE (pobj)->color = %d\n",pSURFACE_FEATURE (pobj)->color); */
/* printf("nc = %d\n",nc); */
/* fflush(NULL); */
if(nc>0){
if ((pSURFACE_FEATURE (pobj)->color = MALLOC (nc * sizeof (double))) == NULL)
return -1;
}
for(i=0;i<nc;i++)
pSURFACE_FEATURE (pobj)->color[i] = pSURFACE_FEATURE (pobj)->zcol[i];
pSURFACE_FEATURE (pobj)->cdatamapping = 1;
}
}
else
{strcpy(error_message,"cdata_mapping value must be 'scaled' or 'direct'");return -1;}
}
else
{strcpy(error_message,"cdata_mapping property only exists for Fac3d surfaces");return -1;}
}
else
{strcpy(error_message,"cdata_mapping property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"surface_color") == 0) {
if (sciGetEntityType (pobj) == SCI_SURFACE) {
if (pSURFACE_FEATURE (pobj)->typeof3d == SCI_PARAM3D1) {
if (pSURFACE_FEATURE (pobj)->dimzy != *numrow * *numcol)
{sprintf(error_message,"Second argument must have %d elements ",
pSURFACE_FEATURE (pobj)->dimzy);return -1;}
for (i=0;i<pSURFACE_FEATURE (pobj)->dimzy;i++)
pSURFACE_FEATURE (pobj)->zcol[i]= (integer)stk(*value)[i];
}
else if (pSURFACE_FEATURE (pobj)->typeof3d == SCI_PLOT3D) {
strcpy(error_message,"surface_color cannot be set in this case");
return -1;
}
else if (pSURFACE_FEATURE (pobj)->typeof3d == SCI_FAC3D) {
if (pSURFACE_FEATURE (pobj)->flagcolor<2){
strcpy(error_message,"surface_color cannot be set in this case");
return -1;
}
else {
int N;
if (pSURFACE_FEATURE (pobj)->flagcolor==2)
N=pSURFACE_FEATURE (pobj)->dimzy;
else
N=pSURFACE_FEATURE (pobj)->dimzy * pSURFACE_FEATURE (pobj)->dimzx;
if (*numrow * *numcol != N)
{sprintf(error_message,"Second argument must have %d elements ",N);return -1;}
for (i=0;i<N;i++)
pSURFACE_FEATURE (pobj)->zcol[i]= (integer)stk(*value)[i];
}
}
}
else {
strcpy(error_message,"surface_color property does not exist for this handle");
return -1;
}
}
else if (strcmp(marker,"triangles") == 0) {
if (sciGetEntityType (pobj) == SCI_FEC) {
double *pnoeud;
if (*numcol != 5)
{strcpy(error_message,"Second argument must have 5 columns ");return -1;}
if (*numrow !=pFEC_FEATURE (pobj)->Ntr) {
pnoeud=pFEC_FEATURE(pobj)->pnoeud;
if ((pFEC_FEATURE(pobj)->pnoeud = MALLOC (*numrow * 5* sizeof (int))) == NULL){
strcpy(error_message,"Not enough memory");
pFEC_FEATURE(pobj)->pnoeud=pnoeud;
return -1;
}
}
for (i=0;i<*numrow*5;i++)
pFEC_FEATURE (pobj)->pnoeud[i]=stk(*value)[i];
}
else
{strcpy(error_message,"triangles property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"z_bounds") == 0) {
if (sciGetEntityType (pobj) == SCI_FEC) {
if (*numcol * *numrow!= 2)
{strcpy(error_message,"Second argument must have 2 elements ");return -1;}
for (i=0;i<2;i++)
pFEC_FEATURE (pobj)->zminmax[i]=stk(*value)[i];
}
else
{strcpy(error_message,"z_bounds property does not exist for this handle");return -1;}
}
else if (strcmp(marker,"handle_visible") == 0)
{
if (sciGetEntityType (pobj) == SCI_UIMENU)
{
if ((strcmp(cstk(*value),"on") == 0))
pUIMENU_FEATURE(pobj)->handle_visible=TRUE;
else if ((strcmp(cstk(*value),"off") == 0))
pUIMENU_FEATURE(pobj)->handle_visible=FALSE;
else
{
strcpy(error_message,"Value must be 'on' or 'off'");
return -1;
}
}
else
{
strcpy(error_message,"handle_visible property does not exist for this handle");
return -1;
}
}
else if (strcmp(marker,"callback_type") == 0)
{
if (sciGetEntityType (pobj) == SCI_UIMENU)
{
if ((strcmp(cstk(*value),"string") == 0))
{
pUIMENU_FEATURE(pobj)->CallbackType=0;
}
else
if ((strcmp(cstk(*value),"C") == 0))
{
pUIMENU_FEATURE(pobj)->CallbackType=1;
}
else
if ((strcmp(cstk(*value),"internal") == 0))
{
pUIMENU_FEATURE(pobj)->CallbackType=2;
}
else
if ((strcmp(cstk(*value),"addmenu") == 0))
{
pUIMENU_FEATURE(pobj)->CallbackType=3;
}
else
{
strcpy(error_message,"Value must be 'string','C','internal','addmenu'");
return -1;
}
}
else
{
strcpy(error_message,"callback_type property does not exist for this handle");
return -1;
}
}
else if (strcmp(marker,"menu_enable") == 0)
{
if (sciGetEntityType (pobj) == SCI_UIMENU)
{
if ((strcmp(cstk(*value),"on") == 0))
{
if (pUIMENU_FEATURE(pobj)->Enable != TRUE)
{
pUIMENU_FEATURE(pobj)->Enable=TRUE;
}
}
else
if ((strcmp(cstk(*value),"off") == 0))
{
if (pUIMENU_FEATURE(pobj)->Enable != FALSE)
{
pUIMENU_FEATURE(pobj)->Enable=FALSE;
}
}
else
{
strcpy(error_message,"Value must be 'on' or 'off'");
return -1;
}
}
else
{
strcpy(error_message,"menu_enable property does not exist for this handle");
return -1;
}
}
else
{
sprintf(error_message,"Unknown property %s",marker);
return -1;
}
return 0;
}
/*-----------------------------------------------------------------------------------*/
int LinearScaling2Colormap(sciPointObj* pobj)
{
int i;
int nbcol = sciGetNumColors (pobj); /* the number of the colors inside the current colormap */
sciSurface * psurf = pSURFACE_FEATURE (pobj);
double min,max;
double indexmin = 1.;
double indexmax = (double) nbcol;
int nc = psurf->nc; /* the number of colors contained inside zcol matrix */
if(psurf->zcol == NULL){
sciprint("Color matrix is NULL ; can not build color scaled linearly into the current colormap");
return -1;
}
if (((psurf->color = MALLOC (nc * sizeof (double))) == NULL)){
sciprint("Allocation failed for color in LinearScaling2Colormap");
return -1;
}
/* get the min inside zcol */
min = psurf->zcol[0];
for(i=0;i<nc;i++)
if(min > psurf->zcol[i]) min = psurf->zcol[i];
/* get the max inside zcol */
max = psurf->zcol[0];
for(i=0;i<nc;i++)
if(max < psurf->zcol[i]) max = psurf->zcol[i];
if(min != max)
{
/* linear interpolation */
double A = (indexmin-indexmax)/(min-max);
double B = (min*indexmax-indexmin*max)/(min-max);
for(i=0;i<nc;i++)
psurf->color[i] = A*psurf->zcol[i] + B + 0.1;
}
else
{
double C = (indexmin+indexmax)/2;
for(i=0;i<nc;i++)
psurf->color[i] = C;
}
return 0;
}
/*-----------------------------------------------------------------------------------*/
/* Called by a.log_flags='nn','ln','nl', or 'll'*/
/* For the moment, z has no logflag F.Leray 05.10.04 */
char ** ReBuildUserTicks( char old_logflag, char new_logflag, double * u_xgrads, int *u_nxgrads, char ** u_xlabels)
{
if(old_logflag==new_logflag) return u_xlabels; /* nothing to do l->l or n->n */
if(u_xgrads!=NULL)
{
if(old_logflag=='n' && new_logflag=='l') /* n->l */ /* 10-> 1, 100->2 ...*/
{
u_xlabels=CaseLogflagN2L(u_nxgrads,u_xgrads,u_xlabels);
}
else if(old_logflag=='l' && new_logflag=='n')
{
int nbtics = *u_nxgrads;
int i;
for(i=0;i<nbtics;i++) u_xgrads[i] = exp10(u_xgrads[i]);
}
}
return u_xlabels;
}
/*-----------------------------------------------------------------------------------*/
/* Remove negative graduations when switching from N (linear) to L (logarithmic) scale */
char ** CaseLogflagN2L(int * u_nxgrads, double *u_xgrads, char ** u_xlabels)
{
int nbtics = *u_nxgrads;
int i;
char ** ticklabel = (char **) NULL;
int cmpteur = 0, cmpteur2 = 0, offset = 0;
for(i=0;i<nbtics;i++)
{
if(u_xgrads[i]<=0){
sciprint("Warning: graduation number %d is ignored : when switching to logarithmic scale, we must have strictly positive graduations!\n",i);
}
else
{
u_xgrads[cmpteur] = log10(u_xgrads[i]);
cmpteur++;
}
}
if(cmpteur != nbtics)
{
if((ticklabel=(char **)MALLOC(cmpteur*sizeof(char *)))==NULL){
sciprint("No more place for allocating ticklabel");
}
cmpteur2 = 0;
offset = nbtics - cmpteur;
for(i=0;i<cmpteur;i++){
if((ticklabel[cmpteur2]=(char *)MALLOC((strlen(u_xlabels[i+offset])+1)*sizeof(char )))==NULL){
sciprint("No more place for allocating ticklabel");
}
strcpy(ticklabel[cmpteur2],u_xlabels[i+offset]);
cmpteur2++;
}
for(i=0;i<nbtics;i++){ FREE(u_xlabels[i]); u_xlabels[i] = NULL;}
FREE(u_xlabels); u_xlabels = NULL;
u_xlabels = ticklabel;
}
*u_nxgrads = cmpteur;
cmpteur = 0;
cmpteur2 = 0;
return u_xlabels;
}
int CheckAndUpdate_x_shift(sciPointObj * pobj, int numrow)
{
sciPolyline * ppolyline = NULL;
int i;
if(sciGetEntityType(pobj) != SCI_POLYLINE)
return 0;
ppolyline = pPOLYLINE_FEATURE(pobj);
if(ppolyline->x_shift == (double *) NULL)
return 0;
else
{
int size_x_old = ppolyline->n1; /* number of x data */
if(size_x_old == numrow)
return 0;
else if(size_x_old > numrow)
{
double * new_bar = NULL;
if((new_bar = (double *) MALLOC(numrow*sizeof(double))) == NULL)
{
strcpy(error_message,"No more place to allocate new_bar");
return -1;
}
for(i=0;i<numrow;i++)
new_bar[i] = ppolyline->x_shift[i];
FREE(ppolyline->x_shift);
ppolyline->x_shift = new_bar;
}
else /* case where size_x_old < numrow */
{
double * new_bar = NULL;
if((new_bar = (double *) MALLOC(numrow*sizeof(double))) == NULL)
{
strcpy(error_message,"No more place to allocate new_bar");
return -1;
}
for(i=0;i<size_x_old;i++)
new_bar[i] = ppolyline->x_shift[i];
for(i=size_x_old;i<numrow;i++)
new_bar[i] = 0.;
FREE(ppolyline->x_shift);
ppolyline->x_shift = new_bar;
}
}
return 0;
}
int CheckAndUpdate_y_shift(sciPointObj * pobj, int numrow)
{
sciPolyline * ppolyline = NULL;
int i;
if(sciGetEntityType(pobj) != SCI_POLYLINE)
return 0;
ppolyline = pPOLYLINE_FEATURE(pobj);
if(ppolyline->y_shift == (double *) NULL)
return 0;
else
{
int size_x_old = ppolyline->n1; /* number of x data */
if(size_x_old == numrow)
return 0;
else if(size_x_old > numrow)
{
double * new_bar = NULL;
if((new_bar = (double *) MALLOC(numrow*sizeof(double))) == NULL)
{
strcpy(error_message,"No more place to allocate new_bar");
return -1;
}
for(i=0;i<numrow;i++)
new_bar[i] = ppolyline->y_shift[i];
FREE(ppolyline->y_shift);
ppolyline->y_shift = new_bar;
}
else /* case where size_x_old < numrow */
{
double * new_bar = NULL;
if((new_bar = (double *) MALLOC(numrow*sizeof(double))) == NULL)
{
strcpy(error_message,"No more place to allocate new_bar");
return -1;
}
for(i=0;i<size_x_old;i++)
new_bar[i] = ppolyline->y_shift[i];
for(i=size_x_old;i<numrow;i++)
new_bar[i] = 0.;
FREE(ppolyline->y_shift);
ppolyline->x_shift = new_bar;
}
}
return 0;
}
int CheckAndUpdate_z_shift(sciPointObj * pobj, int numrow)
{
sciPolyline * ppolyline = NULL;
int i;
if(sciGetEntityType(pobj) != SCI_POLYLINE)
return 0;
ppolyline = pPOLYLINE_FEATURE(pobj);
if(ppolyline->z_shift == (double *) NULL)
return 0;
else
{
int size_x_old = ppolyline->n1; /* number of x data */
if(size_x_old == numrow)
return 0;
else if(size_x_old > numrow)
{
double * new_bar = NULL;
if((new_bar = (double *) MALLOC(numrow*sizeof(double))) == NULL)
{
strcpy(error_message,"No more place to allocate new_bar");
return -1;
}
for(i=0;i<numrow;i++)
new_bar[i] = ppolyline->z_shift[i];
FREE(ppolyline->z_shift);
ppolyline->z_shift = new_bar;
}
else /* case where size_x_old < numrow */
{
double * new_bar = NULL;
if((new_bar = (double *) MALLOC(numrow*sizeof(double))) == NULL)
{
strcpy(error_message,"No more place to allocate new_bar");
return -1;
}
for(i=0;i<size_x_old;i++)
new_bar[i] = ppolyline->z_shift[i];
for(i=size_x_old;i<numrow;i++)
new_bar[i] = 0.;
FREE(ppolyline->z_shift);
ppolyline->x_shift = new_bar;
}
}
return 0;
}
/*-----------------------------------------------------------------------------------*/
|