Changeset 3696 for trunk/packages/vizservers/vtkvis/RendererCmd.cpp
- Timestamp:
- Jun 17, 2013, 1:48:27 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/RendererCmd.cpp
r3695 r3696 13 13 #include <string> 14 14 #include <sstream> 15 #include <vector> 15 16 #include <unistd.h> 16 17 #include <sys/select.h> … … 131 132 Tcl_Obj *const *objv) 132 133 { 133 double center[3], pt1[3], pt2[3];134 double center[3], pt1[3], norm[3], angle; 134 135 if (Tcl_GetDoubleFromObj(interp, objv[2], ¢er[0]) != TCL_OK || 135 136 Tcl_GetDoubleFromObj(interp, objv[3], ¢er[1]) != TCL_OK || … … 138 139 Tcl_GetDoubleFromObj(interp, objv[6], &pt1[1]) != TCL_OK || 139 140 Tcl_GetDoubleFromObj(interp, objv[7], &pt1[2]) != TCL_OK || 140 Tcl_GetDoubleFromObj(interp, objv[8], &pt2[0]) != TCL_OK || 141 Tcl_GetDoubleFromObj(interp, objv[9], &pt2[1]) != TCL_OK || 142 Tcl_GetDoubleFromObj(interp, objv[10], &pt2[2]) != TCL_OK) { 143 return TCL_ERROR; 144 } 145 const char *name = Tcl_GetString(objv[11]); 146 if (!g_renderer->addArc(name, center, pt1, pt2)) { 141 Tcl_GetDoubleFromObj(interp, objv[8], &norm[0]) != TCL_OK || 142 Tcl_GetDoubleFromObj(interp, objv[9], &norm[1]) != TCL_OK || 143 Tcl_GetDoubleFromObj(interp, objv[10], &norm[2]) != TCL_OK || 144 Tcl_GetDoubleFromObj(interp, objv[11], &angle) != TCL_OK) { 145 return TCL_ERROR; 146 } 147 const char *name = Tcl_GetString(objv[12]); 148 if (!g_renderer->addArc(name, center, pt1, norm, angle)) { 147 149 Tcl_AppendResult(interp, "Failed to create arc", (char*)NULL); 148 150 return TCL_ERROR; … … 329 331 330 332 static Rappture::CmdSpec arcOps[] = { 331 {"add", 1, ArcAddOp, 1 2, 12, "centerX centerY centerZ x1 y1 z1 x2 y2 z2name"},333 {"add", 1, ArcAddOp, 13, 13, "centerX centerY centerZ startX startY startZ normX normY normZ angle name"}, 332 334 {"color", 1, ArcColorOp, 5, 6, "r g b ?name?"}, 333 335 {"delete", 1, ArcDeleteOp, 2, 3, "?name?"}, … … 721 723 {"orient", 4, ArrowOrientOp, 6, 7, "qw qx qy qz ?name?"}, 722 724 {"origin", 4, ArrowOriginOp, 5, 6, "x y z ?name?"}, 723 {"pos", 2, ArrowPositionOp, 5, 6, "x y z ?name?"},725 {"pos", 1, ArrowPositionOp, 5, 6, "x y z ?name?"}, 724 726 {"resolution",1, ArrowResolutionOp, 4, 5, "tipRes shaftRes ?name?"}, 725 727 {"scale", 2, ArrowScaleOp, 5, 6, "sx sy sz ?name?"}, … … 7075 7077 Tcl_Obj *const *objv) 7076 7078 { 7077 double pt1[3]; 7078 double pt2[3]; 7079 if (Tcl_GetDoubleFromObj(interp, objv[2], &pt1[0]) != TCL_OK || 7080 Tcl_GetDoubleFromObj(interp, objv[3], &pt1[1]) != TCL_OK || 7081 Tcl_GetDoubleFromObj(interp, objv[4], &pt1[2]) != TCL_OK || 7082 Tcl_GetDoubleFromObj(interp, objv[5], &pt2[0]) != TCL_OK || 7083 Tcl_GetDoubleFromObj(interp, objv[6], &pt2[1]) != TCL_OK || 7084 Tcl_GetDoubleFromObj(interp, objv[7], &pt2[2]) != TCL_OK) { 7085 return TCL_ERROR; 7086 } 7087 const char *name = Tcl_GetString(objv[8]); 7088 if (!g_renderer->addLine(name, pt1, pt2)) { 7079 std::vector<double> points; 7080 int ptlistc; 7081 Tcl_Obj **ptlistv; 7082 if (Tcl_ListObjGetElements(interp, objv[2], &ptlistc, &ptlistv) != TCL_OK) { 7083 return TCL_ERROR; 7084 } 7085 if (ptlistc < 6 || ptlistc % 3 != 0) { 7086 Tcl_AppendResult(interp, "Points list size must be 6 or more and a multiple of 3", (char*)NULL); 7087 return TCL_ERROR; 7088 } 7089 for (int i = 0; i < ptlistc; i++) { 7090 double val; 7091 if (Tcl_GetDoubleFromObj(interp, ptlistv[i], &val) != TCL_OK) { 7092 return TCL_ERROR; 7093 } 7094 points.push_back(val); 7095 } 7096 const char *name = Tcl_GetString(objv[3]); 7097 if (!g_renderer->addLine(name, points)) { 7089 7098 Tcl_AppendResult(interp, "Failed to create line", (char*)NULL); 7090 7099 return TCL_ERROR; … … 7254 7263 7255 7264 static Rappture::CmdSpec lineOps[] = { 7256 {"add", 1, LineAddOp, 9, 9, "x1 y1 z1 x2 y2 z2name"},7265 {"add", 1, LineAddOp, 4, 4, "points name"}, 7257 7266 {"color", 1, LineColorOp, 5, 6, "r g b ?name?"}, 7258 7267 {"delete", 1, LineDeleteOp, 2, 3, "?name?"},
Note: See TracChangeset
for help on using the changeset viewer.