Changeset 1111 for trunk/packages/vizservers/nanovis/Command.cpp
- Timestamp:
- Aug 13, 2008, 1:33:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r1089 r1111 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) 36 * o Add bookkeeping for volumes, heightmaps, flows, etc. to track 35 * x Create R2, matrix, etc. libraries. (done) * o Add bookkeeping for volumes, heightmaps, flows, etc. to track 37 36 * 1) id # 2) simulation # 3) include/exclude. The include/exclude 38 37 * is to indicate whether the item should contribute to the overall … … 90 89 // in nanovis.cpp 91 90 extern vector<PointSet*> g_pointSet; 91 extern int debug_flag; 92 92 93 93 extern PlaneRenderer* plane_render; … … 655 655 char buffer[8096]; 656 656 657 clearerr( stdin);657 clearerr(NanoVis::stdin); 658 658 while (nBytes > 0) { 659 659 unsigned int chunk; … … 662 662 chunk = (sizeof(buffer) < (unsigned int) nBytes) ? 663 663 sizeof(buffer) : nBytes; 664 nRead = fread(buffer, sizeof(char), chunk, stdin);665 if (ferror( stdin)) {664 nRead = fread(buffer, sizeof(char), chunk, NanoVis::stdin); 665 if (ferror(NanoVis::stdin)) { 666 666 Tcl_AppendResult(interp, "while reading data stream: ", 667 667 Tcl_PosixError(interp), (char*)NULL); 668 668 return TCL_ERROR; 669 669 } 670 if (feof( stdin)) {670 if (feof(NanoVis::stdin)) { 671 671 Tcl_AppendResult(interp, "premature EOF while reading data stream", 672 672 (char*)NULL); … … 925 925 NanoVis::SetVolumeRanges(); 926 926 } 927 NanoVis::render_legend(tf, Volume::valueMin, Volume::valueMax, w, h, label); 927 NanoVis::render_legend(tf, 928 NanoVis::grid->yAxis.min(), 929 NanoVis::grid->yAxis.max(), w, h, label); 928 930 return TCL_OK; 929 931 } … … 1332 1334 volPtr = NanoVis::volume[n]; 1333 1335 sprintf(info, "nv>data id %d min %g max %g vmin %g vmax %g\n", 1334 n, volPtr->wAxis. Min(), volPtr->wAxis.Max(),1336 n, volPtr->wAxis.min(), volPtr->wAxis.max(), 1335 1337 Volume::valueMin, Volume::valueMax); 1336 1338 write(0, info, strlen(info)); … … 1715 1717 volPtr->height / (float)volPtr->width, 1716 1718 volPtr->depth / (float)volPtr->width, 1717 volPtr->wAxis. Max());1719 volPtr->wAxis.max()); 1718 1720 NanoVis::initParticle(); 1719 1721 } … … 1723 1725 1.0f / volPtr->aspect_ratio_height, 1724 1726 1.0f / volPtr->aspect_ratio_depth, 1725 volPtr->wAxis. Max());1727 volPtr->wAxis.max()); 1726 1728 NanoVis::licRenderer->set_offset(NanoVis::lic_slice_z); 1727 1729 } … … 1930 1932 result = Tcl_Eval(interp, buf.bytes()); 1931 1933 if (result != TCL_OK) { 1932 fprintf(stderr, "error in command: %s\n", Tcl_GetStringResult(interp)); 1933 fflush(stderr); 1934 fprintf(NanoVis::logfile, "error in command: %s\n", 1935 Tcl_GetStringResult(interp)); 1936 fflush(NanoVis::logfile); 1934 1937 } 1935 1938 return result; … … 2234 2237 case 2: axisPtr = &NanoVis::grid->zAxis; break; 2235 2238 } 2236 axisPtr-> SetName(Tcl_GetString(objv[3]));2237 axisPtr-> SetUnits(Tcl_GetString(objv[4]));2239 axisPtr->name(Tcl_GetString(objv[3])); 2240 axisPtr->units(Tcl_GetString(objv[4])); 2238 2241 } 2239 2242 return TCL_OK; … … 2528 2531 HeightMap* hmPtr; 2529 2532 hmPtr = new HeightMap(); 2533 2530 2534 hmPtr->setHeight(xMin, yMin, xMax, yMax, xNum, yNum, zValues); 2531 2535 hmPtr->setColorMap(NanoVis::get_transfunc("default")); … … 2533 2537 hmPtr->setLineContourVisible(true); 2534 2538 NanoVis::heightMap.push_back(hmPtr); 2535 delete [] zValues;2536 2539 return TCL_OK; 2537 2540 } … … 2572 2575 // create a default transfer function 2573 2576 if (Tcl_Eval(interp, def_transfunc) != TCL_OK) { 2574 fprintf( stdin, "WARNING: bad default transfer function\n");2575 fprintf( stdin, Tcl_GetStringResult(interp));2577 fprintf(NanoVis::logfile, "WARNING: bad default transfer function\n"); 2578 fprintf(NanoVis::logfile, Tcl_GetStringResult(interp)); 2576 2579 } 2577 2580 } … … 2601 2604 // 2602 2605 while (1) { 2603 char c = getchar(); 2606 int c = fgetc(NanoVis::stdin); 2607 char ch; 2604 2608 if (c <= 0) { 2605 2609 if (npass == 0) { … … 2609 2613 } 2610 2614 } 2611 Tcl_DStringAppend(&cmdbuffer, &c, 1); 2612 2613 if (c=='\n' && Tcl_CommandComplete(Tcl_DStringValue(&cmdbuffer))) { 2615 ch = (char)c; 2616 Tcl_DStringAppend(&cmdbuffer, &ch, 1); 2617 2618 if (ch=='\n' && Tcl_CommandComplete(Tcl_DStringValue(&cmdbuffer))) { 2614 2619 break; 2615 2620 } 2616 2621 } 2617 2618 2622 // no command? then we're done for now 2619 2623 if (Tcl_DStringLength(&cmdbuffer) == 0) { … … 2623 2627 // back to original flags during command evaluation... 2624 2628 fcntl(0, F_SETFL, flags & ~O_NONBLOCK); 2629 if (debug_flag) { 2630 fprintf(NanoVis::logfile, "%s\n", Tcl_DStringValue(&cmdbuffer)); 2631 } 2625 2632 status = Tcl_Eval(interp, Tcl_DStringValue(&cmdbuffer)); 2626 2633 Tcl_DStringSetLength(&cmdbuffer, 0); … … 2635 2642 const char *string; 2636 2643 int nBytes; 2637 string = Tcl_GetStringFromObj(Tcl_GetObjResult(_interp), &nBytes); 2638 2644 2645 string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &nBytes); 2639 2646 struct iovec iov[3]; 2640 iov[0].iov_base = "NanoVis Server Error: ";2641 iov[0].iov_len = strlen( iov[0].iov_base);2642 iov[1].iov_base = string;2647 iov[0].iov_base = (char *)"NanoVis Server Error: "; 2648 iov[0].iov_len = strlen((char *)iov[0].iov_base); 2649 iov[1].iov_base = (char *)string; 2643 2650 iov[1].iov_len = nBytes; 2644 iov[2].iov_base = '\n';2651 iov[2].iov_base = (char *)'\n'; 2645 2652 iov[2].iov_len = 1; 2646 2653 writev(0, iov, 3);
Note: See TracChangeset
for help on using the changeset viewer.