Changeset 4629 for geovis/trunk/RendererCmd.cpp
- Timestamp:
- Sep 4, 2014, 11:18:26 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/RendererCmd.cpp
r4628 r4629 107 107 std::string cmd(str); 108 108 cmd.erase(cmd.find_last_not_of(" \n\r\t")+1); 109 TRACE("command %lu: '%s'", g_stats.nCommands +1, cmd.c_str());109 TRACE("command %lu: '%s'", g_stats.nCommands, cmd.c_str()); 110 110 #endif 111 111 lastCmdStatus = TCL_OK; … … 772 772 { 773 773 int x, y; 774 if (Tcl_GetIntFromObj(interp, objv[ 2], &x) != TCL_OK ||775 Tcl_GetIntFromObj(interp, objv[ 3], &y) != TCL_OK) {774 if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK || 775 Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) { 776 776 return TCL_ERROR; 777 777 } … … 779 779 osgEarth::GeoPoint mapPoint; 780 780 size_t length; 781 char mesg[ 256];781 char mesg[512]; 782 782 if (g_renderer->mapMouseCoords(x, y, mapPoint)) { 783 783 std::string srsInit; 784 784 std::string verticalDatum; 785 if (objc > 4) {786 srsInit = Tcl_GetString(objv[ 4]);787 if (objc > 5) {788 verticalDatum = Tcl_GetString(objv[ 5]);785 if (objc > 5) { 786 srsInit = Tcl_GetString(objv[5]); 787 if (objc > 6) { 788 verticalDatum = Tcl_GetString(objv[6]); 789 789 } 790 790 osgEarth::SpatialReference *outSRS = … … 802 802 // send coords to client 803 803 length = snprintf(mesg, sizeof(mesg), 804 "nv>map coords %g %g %g %d %d {%s} {%s}\n", 804 "nv>map coords %s %g %g %g %d %d {%s} {%s}\n", 805 Tcl_GetString(objv[2]), //g_stats.nCommands, 805 806 mapPoint.x(), mapPoint.y(), mapPoint.z(), 806 807 x, y, … … 812 813 // Out of range 813 814 length = snprintf(mesg, sizeof(mesg), 814 "nv>map coords invalid %d %d\n", x, y); 815 "nv>map coords %s invalid %d %d\n", 816 Tcl_GetString(objv[2]), //g_stats.nCommands, 817 x, y); 815 818 816 819 queueResponse(mesg, length, Response::VOLATILE); … … 1547 1550 1548 1551 static CmdSpec mapOps[] = { 1549 {"coords", 1, MapCoordsOp, 4, 6, "x y ?srs? ?verticalDatum?"},1552 {"coords", 1, MapCoordsOp, 5, 7, "token x y ?srs? ?verticalDatum?"}, 1550 1553 {"grid", 1, MapGraticuleOp, 3, 4, "bool ?type?"}, 1551 1554 {"layer", 2, MapLayerOp, 3, 0, "op ?params...?"}, … … 1750 1753 { 1751 1754 double x, y, z; 1752 if (Tcl_GetDoubleFromObj(interp, objv[ 2], &x) != TCL_OK ||1753 Tcl_GetDoubleFromObj(interp, objv[ 3], &y) != TCL_OK ||1754 Tcl_GetDoubleFromObj(interp, objv[ 4], &z) != TCL_OK) {1755 if (Tcl_GetDoubleFromObj(interp, objv[3], &x) != TCL_OK || 1756 Tcl_GetDoubleFromObj(interp, objv[4], &y) != TCL_OK || 1757 Tcl_GetDoubleFromObj(interp, objv[5], &z) != TCL_OK) { 1755 1758 return TCL_ERROR; 1756 1759 } 1757 1760 const osgEarth::SpatialReference *srs = NULL; 1758 if (objc < 6) {1761 if (objc < 7) { 1759 1762 srs = g_renderer->getMapSRS(); 1760 1763 if (srs == NULL) { … … 1763 1766 } 1764 1767 } else { 1765 std::string srsInit(Tcl_GetString(objv[ 5]));1768 std::string srsInit(Tcl_GetString(objv[6])); 1766 1769 std::string verticalDatum; 1767 if (objc > 6) {1768 verticalDatum = Tcl_GetString(objv[ 6]);1770 if (objc > 7) { 1771 verticalDatum = Tcl_GetString(objv[7]); 1769 1772 } 1770 1773 srs = osgEarth::SpatialReference::get(srsInit, verticalDatum); … … 1785 1788 // send coords to client 1786 1789 length = snprintf(mesg, sizeof(mesg), 1787 "nv>screen coords %g %g %g %g %g %g\n", 1790 "nv>screen coords %s %g %g %g %g %g %g\n", 1791 Tcl_GetString(objv[2]), 1788 1792 screen.x(), screen.y(), screen.z(), 1789 1793 x, y, z); … … 1793 1797 // Out of range 1794 1798 length = snprintf(mesg, sizeof(mesg), 1795 "nv>screen coords invalid %g %g %g\n", x, y, z); 1799 "nv>screen coords %s invalid %g %g %g\n", 1800 Tcl_GetString(objv[2]), 1801 x, y, z); 1796 1802 1797 1803 queueResponse(mesg, length, Response::VOLATILE); … … 1817 1823 static CmdSpec screenOps[] = { 1818 1824 {"bgcolor", 1, ScreenBgColorOp, 5, 5, "r g b"}, 1819 {"coords", 1, ScreenCoordsOp, 5, 7, "x y z ?srs? ?verticalDatum?"},1825 {"coords", 1, ScreenCoordsOp, 6, 8, "token x y z ?srs? ?verticalDatum?"}, 1820 1826 {"size", 1, ScreenSizeOp, 4, 4, "width height"} 1821 1827 };
Note: See TracChangeset
for help on using the changeset viewer.