Changeset 1282 for trunk/packages/vizservers/nanovis/Command.cpp
- Timestamp:
- Mar 2, 2009, 10:30:04 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r1250 r1282 33 33 * the vector. 1) Use a list instead of a vector. 2) carry 34 34 * an id field that's a number that gets incremented each new volume. 35 * x Create R2, matrix, etc. libraries. (done) * o Add bookkeeping for volumes, heightmaps, flows, etc. to track 35 * x Create R2, matrix, etc. libraries. (done) 36 * o Add bookkeeping for volumes, heightmaps, flows, etc. to track 36 37 * 1) id # 2) simulation # 3) include/exclude. The include/exclude 37 38 * is to indicate whether the item should contribute to the overall … … 52 53 #include <RpOutcome.h> 53 54 #include <RpBuffer.h> 55 #include <RpAVTranslate.h> 54 56 55 57 #include "transfer-function/TransferFunctionMain.h" … … 676 678 } 677 679 if (NanoVis::recfile != NULL) { 678 679 680 fwrite(buf.bytes(), sizeof(char), buf.size(), NanoVis::recfile); 681 fflush(NanoVis::recfile); 680 682 } 681 683 { … … 696 698 static int 697 699 CameraAimOp(ClientData cdata, Tcl_Interp *interp, int objc, 698 700 Tcl_Obj *const *objv) 699 701 { 700 702 float x, y, z; … … 712 714 static int 713 715 CameraAngleOp(ClientData cdata, Tcl_Interp *interp, int objc, 714 716 Tcl_Obj *const *objv) 715 717 { 716 718 float theta, phi, psi; … … 727 729 static int 728 730 CameraPanOp(ClientData cdata, Tcl_Interp *interp, int objc, 729 731 Tcl_Obj *const *objv) 730 732 { 731 733 float x, y; … … 740 742 static int 741 743 CameraZoomOp(ClientData cdata, Tcl_Interp *interp, int objc, 742 744 Tcl_Obj *const *objv) 743 745 { 744 746 float zoom; … … 931 933 tf = NanoVis::get_transfunc(string); 932 934 if (tf == NULL) { 933 Tcl_AppendResult(interp, "unknown transfer function \"", string, "\"", 934 935 Tcl_AppendResult(interp, "unknown transfer function \"", string, "\"", 936 (char*)NULL); 935 937 return TCL_ERROR; 936 938 } … … 945 947 NanoVis::SetVolumeRanges(); 946 948 } 947 NanoVis::render_legend(tf, 948 NanoVis::grid->yAxis.min(), 949 NanoVis::grid->yAxis.max(), w, h, label); 949 NanoVis::render_legend(tf, NanoVis::grid->yAxis.min(), 950 NanoVis::grid->yAxis.max(), w, h, label); 950 951 return TCL_OK; 951 952 } … … 1354 1355 } 1355 1356 volPtr = NanoVis::volume[n]; 1357 // FIXME: strlen(info) is the return value of sprintf 1356 1358 sprintf(info, "nv>data id %d min %g max %g vmin %g vmax %g\n", 1357 1359 n, volPtr->wAxis.min(), volPtr->wAxis.max(), … … 1712 1714 } 1713 1715 1716 // ========================= VOLUME END ================================== 1717 1718 // ============================= FLOW ================================== 1719 1720 static int 1721 FlowDataFollowsOp(ClientData cdata, Tcl_Interp *interp, int objc, 1722 Tcl_Obj *const *objv) 1723 { 1724 Trace("Flow Data Loading\n"); 1725 1726 int nbytes; 1727 if (Tcl_GetIntFromObj(interp, objv[3], &nbytes) != TCL_OK) { 1728 return TCL_ERROR; 1729 } 1730 1731 Rappture::Buffer buf; 1732 if (GetDataStream(interp, buf, nbytes) != TCL_OK) { 1733 return TCL_ERROR; 1734 } 1735 int n = NanoVis::n_volumes; 1736 std::stringstream fdata; 1737 fdata.write(buf.bytes(),buf.size()); 1738 load_vector_stream(n, fdata); 1739 Volume *volPtr = NanoVis::volume[n]; 1740 1741 // 1742 // BE CAREFUL: Set the number of slices to something 1743 // slightly different for each volume. If we have 1744 // identical volumes at exactly the same position 1745 // with exactly the same number of slices, the second 1746 // volume will overwrite the first, so the first won't 1747 // appear at all. 1748 // 1749 if (volPtr != NULL) { 1750 //volPtr->set_n_slice(256-n); 1751 volPtr->set_n_slice(512-n); 1752 volPtr->disable_cutplane(0); 1753 volPtr->disable_cutplane(1); 1754 volPtr->disable_cutplane(2); 1755 1756 NanoVis::vol_renderer->add_volume(volPtr, 1757 NanoVis::get_transfunc("default")); 1758 } 1759 1760 return TCL_OK; 1761 } 1762 1763 static Rappture::CmdSpec flowDataOps[] = { 1764 {"follows", 1, FlowDataFollowsOp, 4, 4, "size",}, 1765 }; 1766 static int nFlowDataOps = NumCmdSpecs(flowDataOps); 1767 1768 static int 1769 FlowDataOp(ClientData cdata, Tcl_Interp *interp, int objc, 1770 Tcl_Obj *const *objv) 1771 { 1772 Tcl_ObjCmdProc *proc; 1773 1774 proc = Rappture::GetOpFromObj(interp, nFlowDataOps, flowDataOps, 1775 Rappture::CMDSPEC_ARG2, objc, objv, 0); 1776 if (proc == NULL) { 1777 return TCL_ERROR; 1778 } 1779 return (*proc) (cdata, interp, objc, objv); 1780 } 1781 1782 static int 1783 FlowCaptureOp(ClientData cdata, Tcl_Interp *interp, int objc, 1784 Tcl_Obj *const *objv) 1785 { 1786 int total_frame_count; 1787 1788 if (Tcl_GetIntFromObj(interp, objv[2], &total_frame_count) != TCL_OK) { 1789 return TCL_ERROR; 1790 } 1791 if (NanoVis::licRenderer) { 1792 NanoVis::licRenderer->activate(); 1793 } 1794 if (NanoVis::particleRenderer) { 1795 NanoVis::particleRenderer->activate(); 1796 } 1797 1798 const char *fileName = Tcl_GetString(objv[3]); 1799 1800 Trace("FLOW started\n"); 1801 1802 Rappture::AVTranslate movie(NanoVis::win_width,NanoVis::win_height); 1803 1804 int pad = 0; 1805 if ((3*NanoVis::win_width) % 4 > 0) { 1806 pad = 4 - ((3*NanoVis::win_width) % 4); 1807 } 1808 1809 movie.init(fileName); 1810 1811 for (int frame_count = 0; frame_count < total_frame_count; frame_count++) { 1812 1813 // Generate the latest frame and send it back to the client 1814 if (NanoVis::licRenderer && 1815 NanoVis::licRenderer->isActivated()) { 1816 NanoVis::licRenderer->convolve(); 1817 } 1818 if (NanoVis::particleRenderer && 1819 NanoVis::particleRenderer->isActivated()) { 1820 NanoVis::particleRenderer->advect(); 1821 } 1822 NanoVis::offscreen_buffer_capture(); //enable offscreen render 1823 NanoVis::display(); 1824 1825 NanoVis::read_screen(); 1826 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 1827 1828 // this is done before bmp_write_to_file because bmp_write_to_file 1829 // turns rgb data to bgr 1830 movie.append(NanoVis::screen_buffer,pad); 1831 // NanoVis::bmp_write_to_file(frame_count, fileName); 1832 } 1833 1834 movie.close(); 1835 Trace("FLOW end\n"); 1836 1837 if (NanoVis::licRenderer) { 1838 NanoVis::licRenderer->deactivate(); 1839 } 1840 if (NanoVis::particleRenderer) { 1841 NanoVis::particleRenderer->deactivate(); 1842 } 1843 NanoVis::initParticle(); 1844 return TCL_OK; 1845 } 1846 1847 static int 1848 FlowLicOp(ClientData cdata, Tcl_Interp *interp, int objc, 1849 Tcl_Obj *const *objv) 1850 { 1851 bool state; 1852 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1853 return TCL_ERROR; 1854 } 1855 NanoVis::lic_on = state; 1856 return TCL_OK; 1857 } 1858 1859 static int 1860 FlowParticleVisibleOp(ClientData cdata, Tcl_Interp *interp, int objc, 1861 Tcl_Obj *const *objv) 1862 { 1863 bool state; 1864 if (GetBooleanFromObj(interp, objv[3], &state) != TCL_OK) { 1865 return TCL_ERROR; 1866 } 1867 NanoVis::particle_on = state; 1868 return TCL_OK; 1869 } 1870 1871 static int 1872 FlowParticleSliceOp(ClientData cdata, Tcl_Interp *interp, int objc, 1873 Tcl_Obj *const *objv) 1874 { 1875 int axis; 1876 if (GetAxisFromObj(interp, objv[3], &axis) != TCL_OK) { 1877 return TCL_ERROR; 1878 } 1879 NanoVis::lic_axis = axis; 1880 return TCL_OK; 1881 } 1882 1883 static int 1884 FlowParticleSliceposOp(ClientData cdata, Tcl_Interp *interp, int objc, 1885 Tcl_Obj *const *objv) 1886 { 1887 float pos; 1888 if (GetFloatFromObj(interp, objv[2], &pos) != TCL_OK) { 1889 return TCL_ERROR; 1890 } 1891 if (pos < 0.0f) { 1892 pos = 0.0f; 1893 } else if (pos > 1.0f) { 1894 pos = 1.0f; 1895 } 1896 switch (NanoVis::lic_axis) { 1897 case 0 : 1898 NanoVis::lic_slice_x = pos; 1899 break; 1900 case 1 : 1901 NanoVis::lic_slice_y = pos; 1902 break; 1903 case 2 : 1904 NanoVis::lic_slice_z = pos; 1905 break; 1906 } 1907 return TCL_OK; 1908 } 1909 1910 static Rappture::CmdSpec flowParticleOps[] = { 1911 {"slice", 1, FlowParticleSliceOp, 4, 4, "index",}, 1912 {"slicepos", 1, FlowParticleSliceposOp, 4, 4, "value",}, 1913 {"visible", 1, FlowParticleVisibleOp, 4, 4, "on|off",}, 1914 }; 1915 static int nFlowParticleOps = NumCmdSpecs(flowParticleOps); 1916 1917 static int 1918 FlowParticleOp(ClientData cdata, Tcl_Interp *interp, int objc, 1919 Tcl_Obj *const *objv) 1920 { 1921 Tcl_ObjCmdProc *proc; 1922 1923 proc = Rappture::GetOpFromObj(interp, nFlowParticleOps, flowParticleOps, 1924 Rappture::CMDSPEC_ARG2, objc, objv, 0); 1925 if (proc == NULL) { 1926 return TCL_ERROR; 1927 } 1928 return (*proc) (cdata, interp, objc, objv); 1929 } 1930 1931 static int 1932 FlowResetOp(ClientData cdata, Tcl_Interp *interp, int objc, 1933 Tcl_Obj *const *objv) 1934 { 1935 NanoVis::initParticle(); 1936 return TCL_OK; 1937 } 1938 1939 static int 1940 FlowVectorIdOp(ClientData cdata, Tcl_Interp *interp, int objc, 1941 Tcl_Obj *const *objv) 1942 { 1943 Volume *volPtr; 1944 if (GetVolumeFromObj(interp, objv[2], &volPtr) != TCL_OK) { 1945 return TCL_ERROR; 1946 } 1947 if (NanoVis::particleRenderer != NULL) { 1948 NanoVis::particleRenderer->setVectorField(volPtr->id, 1.0f, 1949 volPtr->height / (float)volPtr->width, 1950 volPtr->depth / (float)volPtr->width, 1951 volPtr->wAxis.max()); 1952 NanoVis::initParticle(); 1953 } 1954 if (NanoVis::licRenderer != NULL) { 1955 NanoVis::licRenderer->setVectorField(volPtr->id, 1956 1.0f / volPtr->aspect_ratio_width, 1957 1.0f / volPtr->aspect_ratio_height, 1958 1.0f / volPtr->aspect_ratio_depth, 1959 volPtr->wAxis.max()); 1960 NanoVis::licRenderer->set_offset(NanoVis::lic_slice_z); 1961 } 1962 return TCL_OK; 1963 } 1964 1965 static Rappture::CmdSpec flowOps[] = { 1966 {"capture", 1, FlowCaptureOp, 4, 4, "frames filename",}, 1967 {"data", 1, FlowDataOp, 3, 0, "oper ?args?",}, 1968 {"lic", 1, FlowLicOp, 3, 3, "on|off",}, 1969 {"particle", 1, FlowParticleOp, 3, 0, "oper ?args?",}, 1970 {"reset", 1, FlowResetOp, 2, 2, "",}, 1971 {"vectorid", 1, FlowVectorIdOp, 3, 3, "index",}, 1972 }; 1973 static int nFlowOps = NumCmdSpecs(flowOps); 1974 1975 /* 1976 * ---------------------------------------------------------------------- 1977 * CLIENT COMMAND: 1978 * flow data follows <value> 1979 * flow capture 1980 * flow lic on|off 1981 * flow particle visible on|off 1982 * flow particle slice <volumeId> 1983 * flow particle slicepos <value> 1984 * flow reset 1985 * flow vectorid <volumeId> 1986 * 1987 * Clients send these commands to manipulate the flow. 1988 * ---------------------------------------------------------------------- 1989 */ 1714 1990 static int 1715 1991 FlowCmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) 1716 1992 { 1717 Rappture::Outcome err; 1718 1719 if (objc < 2) { 1720 Tcl_AppendResult(interp, "wrong # args: should be \"", 1721 Tcl_GetString(objv[0]), " option ?arg arg?", (char *)NULL); 1722 return TCL_ERROR; 1723 } 1724 const char *string = Tcl_GetString(objv[1]); 1725 char c = string[0]; 1726 if ((c == 'v') && (strcmp(string, "vectorid") == 0)) { 1727 if (objc != 3) { 1728 Tcl_AppendResult(interp, "wrong # args: should be \"", 1729 Tcl_GetString(objv[0]), " vectorid volume", (char *)NULL); 1730 return TCL_ERROR; 1731 } 1732 Volume *volPtr; 1733 if (GetVolumeFromObj(interp, objv[2], &volPtr) != TCL_OK) { 1734 return TCL_ERROR; 1735 } 1736 if (NanoVis::particleRenderer != NULL) { 1737 NanoVis::particleRenderer->setVectorField(volPtr->id, 1.0f, 1738 volPtr->height / (float)volPtr->width, 1739 volPtr->depth / (float)volPtr->width, 1740 volPtr->wAxis.max()); 1741 NanoVis::initParticle(); 1742 } 1743 if (NanoVis::licRenderer != NULL) { 1744 NanoVis::licRenderer->setVectorField(volPtr->id, 1745 1.0f / volPtr->aspect_ratio_width, 1746 1.0f / volPtr->aspect_ratio_height, 1747 1.0f / volPtr->aspect_ratio_depth, 1748 volPtr->wAxis.max()); 1749 NanoVis::licRenderer->set_offset(NanoVis::lic_slice_z); 1750 } 1751 } else if (c == 'l' && strcmp(string, "lic") == 0) { 1752 if (objc != 3) { 1753 Tcl_AppendResult(interp, "wrong # args: should be \"", 1754 Tcl_GetString(objv[0]), " lic on|off\"", (char*)NULL); 1755 return TCL_ERROR; 1756 } 1757 bool state; 1758 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1759 return TCL_ERROR; 1760 } 1761 NanoVis::lic_on = state; 1762 } else if ((c == 'p') && (strcmp(string, "particle") == 0)) { 1763 if (objc < 3) { 1764 Tcl_AppendResult(interp, "wrong # args: should be \"", 1765 Tcl_GetString(objv[0]), " particle visible|slice|slicepos arg \"", 1766 (char*)NULL); 1767 return TCL_ERROR; 1768 } 1769 const char *string = Tcl_GetString(objv[2]); 1770 c = string[0]; 1771 if ((c == 'v') && (strcmp(string, "visible") == 0)) { 1772 if (objc != 4) { 1773 Tcl_AppendResult(interp, "wrong # args: should be \"", 1774 Tcl_GetString(objv[0]), " particle visible on|off\"", 1775 (char*)NULL); 1776 return TCL_ERROR; 1777 } 1778 bool state; 1779 if (GetBooleanFromObj(interp, objv[3], &state) != TCL_OK) { 1780 return TCL_ERROR; 1781 } 1782 NanoVis::particle_on = state; 1783 } else if ((c == 's') && (strcmp(string, "slice") == 0)) { 1784 if (objc != 4) { 1785 Tcl_AppendResult(interp, "wrong # args: should be \"", 1786 Tcl_GetString(objv[0]), 1787 " particle slice volume\"", (char*)NULL); 1788 return TCL_ERROR; 1789 } 1790 int axis; 1791 if (GetAxisFromObj(interp, objv[3], &axis) != TCL_OK) { 1792 return TCL_ERROR; 1793 } 1794 NanoVis::lic_axis = axis; 1795 } else if ((c == 's') && (strcmp(string, "slicepos") == 0)) { 1796 if (objc != 4) { 1797 Tcl_AppendResult(interp, "wrong # args: should be \"", 1798 Tcl_GetString(objv[0]), " particle slicepos value\"", 1799 (char*)NULL); 1800 return TCL_ERROR; 1801 } 1802 float pos; 1803 if (GetFloatFromObj(interp, objv[2], &pos) != TCL_OK) { 1804 return TCL_ERROR; 1805 } 1806 if (pos < 0.0f) { 1807 pos = 0.0f; 1808 } else if (pos > 1.0f) { 1809 pos = 1.0f; 1810 } 1811 switch (NanoVis::lic_axis) { 1812 case 0 : 1813 NanoVis::lic_slice_x = pos; 1814 break; 1815 case 1 : 1816 NanoVis::lic_slice_y = pos; 1817 break; 1818 case 2 : 1819 NanoVis::lic_slice_z = pos; 1820 break; 1821 } 1822 } else { 1823 Tcl_AppendResult(interp, "unknown option \"", string, 1824 "\": should be \"", Tcl_GetString(objv[0]), 1825 " visible, slice, or slicepos\"", (char *)NULL); 1826 return TCL_ERROR; 1827 } 1828 } else if ((c == 'r') && (strcmp(string, "reset") == 0)) { 1829 NanoVis::initParticle(); 1830 } else if ((c == 'c') && (strcmp(string, "capture") == 0)) { 1831 if (objc > 4 || objc < 3) { 1832 Tcl_AppendResult(interp, "wrong # args: should be \"", 1833 Tcl_GetString(objv[0]), " capture numframes [directory]\"", 1834 (char*)NULL); 1835 return TCL_ERROR; 1836 } 1837 int total_frame_count; 1838 1839 if (Tcl_GetIntFromObj(interp, objv[2], &total_frame_count) != TCL_OK) { 1840 return TCL_ERROR; 1841 } 1842 if (NanoVis::licRenderer) { 1843 NanoVis::licRenderer->activate(); 1844 } 1845 if (NanoVis::particleRenderer) { 1846 NanoVis::particleRenderer->activate(); 1847 } 1848 // Karl 1849 // 1850 Trace("FLOW started\n"); 1851 const char *fileName; 1852 fileName = (objc < 4) ? NULL : Tcl_GetString(objv[3]); 1853 for (int frame_count = 0; frame_count < total_frame_count; 1854 frame_count++) { 1855 1856 // Generate the latest frame and send it back to the client 1857 if (NanoVis::licRenderer && 1858 NanoVis::licRenderer->isActivated()) { 1859 NanoVis::licRenderer->convolve(); 1860 } 1861 if (NanoVis::particleRenderer && 1862 NanoVis::particleRenderer->isActivated()) { 1863 NanoVis::particleRenderer->advect(); 1864 } 1865 NanoVis::offscreen_buffer_capture(); //enable offscreen render 1866 NanoVis::display(); 1867 1868 // printf("Read Screen for Writing to file...\n"); 1869 1870 NanoVis::read_screen(); 1871 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 1872 1873 NanoVis::bmp_write_to_file(frame_count, fileName); 1874 } 1875 Trace("FLOW end\n"); 1876 // put your code... 1877 if (NanoVis::licRenderer) { 1878 NanoVis::licRenderer->deactivate(); 1879 } 1880 if (NanoVis::particleRenderer) { 1881 NanoVis::particleRenderer->deactivate(); 1882 } 1883 NanoVis::initParticle(); 1884 } else if ((c == 'd') && (strcmp(string, "data") == 0)) { 1885 if (objc < 3) { 1886 Tcl_AppendResult(interp, "wrong # args: should be \"", 1887 Tcl_GetString(objv[0]), " data follows ?args?", (char *)NULL); 1888 return TCL_ERROR; 1889 } 1890 const char *string = Tcl_GetString(objv[2]);; 1891 c = string[0]; 1892 if ((c == 'f') && (strcmp(string,"follows") == 0)) { 1893 if (objc != 4) { 1894 Tcl_AppendResult(interp, "wrong # args: should be \"", 1895 Tcl_GetString(objv[0]), " data follows length", 1896 (char *)NULL); 1897 return TCL_ERROR; 1898 } 1899 int nbytes; 1900 if (Tcl_GetIntFromObj(interp, objv[3], &nbytes) != TCL_OK) { 1901 return TCL_ERROR; 1902 } 1903 Rappture::Buffer buf; 1904 if (GetDataStream(interp, buf, nbytes) != TCL_OK) { 1905 return TCL_ERROR; 1906 } 1907 int n = NanoVis::n_volumes; 1908 std::stringstream fdata; 1909 fdata.write(buf.bytes(),buf.size()); 1910 load_vector_stream(n, fdata); 1911 Volume *volPtr = NanoVis::volume[n]; 1912 1913 // 1914 // BE CAREFUL: Set the number of slices to something 1915 // slightly different for each volume. If we have 1916 // identical volumes at exactly the same position 1917 // with exactly the same number of slices, the second 1918 // volume will overwrite the first, so the first won't 1919 // appear at all. 1920 // 1921 if (volPtr != NULL) { 1922 //volPtr->set_n_slice(256-n); 1923 volPtr->set_n_slice(512-n); 1924 volPtr->disable_cutplane(0); 1925 volPtr->disable_cutplane(1); 1926 volPtr->disable_cutplane(2); 1927 1928 NanoVis::vol_renderer->add_volume(volPtr, 1929 NanoVis::get_transfunc("default")); 1930 } 1931 } 1932 } else { 1933 return TCL_ERROR; 1934 } 1935 return TCL_OK; 1936 } 1993 Tcl_ObjCmdProc *proc; 1994 1995 proc = Rappture::GetOpFromObj(interp, nFlowOps, flowOps, 1996 Rappture::CMDSPEC_ARG1, objc, objv, 0); 1997 if (proc == NULL) { 1998 return TCL_ERROR; 1999 } 2000 return (*proc) (cdata, interp, objc, objv); 2001 } 2002 2003 // ============================ FLOW END ================================== 1937 2004 1938 2005 static int … … 1953 2020 result = Tcl_Eval(interp, buf.bytes()); 1954 2021 if (result != TCL_OK) { 1955 fprintf(NanoVis::logfile, "error in command: %s\n", 1956 2022 fprintf(NanoVis::logfile, "error in command: %s\n", 2023 Tcl_GetStringResult(interp)); 1957 2024 fflush(NanoVis::logfile); 1958 2025 } … … 2153 2220 2154 2221 NanoVis::render_2d_contour(heightmap, image_width, image_height); 2155 2222 2156 2223 return TCL_OK; 2157 2224 } … … 2470 2537 static int nPlaneOps = NumCmdSpecs(planeOps); 2471 2538 2472 static int 2539 static int 2473 2540 PlaneCmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) 2474 { 2541 { 2475 2542 Tcl_ObjCmdProc *proc; 2476 2543 … … 2518 2585 for (i = 1; i < objc; i += 2) { 2519 2586 const char *string; 2520 2587 char c; 2521 2588 2522 2589 string = Tcl_GetString(objv[i]); 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2590 c = string[0]; 2591 if ((c == 'x') && (strcmp(string, "xmin") == 0)) { 2592 if (GetFloatFromObj(interp, objv[i+1], &xMin) != TCL_OK) { 2593 return TCL_ERROR; 2594 } 2595 } else if ((c == 'x') && (strcmp(string, "xmax") == 0)) { 2596 if (GetFloatFromObj(interp, objv[i+1], &xMax) != TCL_OK) { 2597 return TCL_ERROR; 2598 } 2599 } else if ((c == 'x') && (strcmp(string, "xnum") == 0)) { 2600 if (Tcl_GetIntFromObj(interp, objv[i+1], &xNum) != TCL_OK) { 2601 return TCL_ERROR; 2602 } 2603 if (xNum <= 0) { 2604 Tcl_AppendResult(interp, "bad xnum value: must be > 0", 2605 (char *)NULL); 2606 return TCL_ERROR; 2607 } 2608 } else if ((c == 'x') && (strcmp(string, "xunits") == 0)) { 2609 xUnits = Tcl_GetString(objv[i+1]); 2610 } else if ((c == 'y') && (strcmp(string, "ymin") == 0)) { 2544 2611 if (GetFloatFromObj(interp, objv[i+1], &yMin) != TCL_OK) { 2545 2612 return TCL_ERROR; … … 2558 2625 return TCL_ERROR; 2559 2626 } 2560 2561 2627 } else if ((c == 'y') && (strcmp(string, "yunits") == 0)) { 2628 yUnits = Tcl_GetString(objv[i+1]); 2562 2629 } else if ((c == 'z') && (strcmp(string, "zvalues") == 0)) { 2563 2630 Tcl_Obj **zObj; … … 2573 2640 } 2574 2641 } 2575 2576 2642 } else if ((c == 'z') && (strcmp(string, "zunits") == 0)) { 2643 zUnits = Tcl_GetString(objv[i+1]); 2577 2644 } else { 2578 2645 Tcl_AppendResult(interp, "unknown key \"", string,
Note: See TracChangeset
for help on using the changeset viewer.