Ignore:
Timestamp:
Aug 13, 2008, 1:33:28 PM (16 years ago)
Author:
gah
Message:

nanovis/heightmap update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/Command.cpp

    r1089 r1111  
    3333 *          the vector. 1) Use a list instead of a vector. 2) carry
    3434 *          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
    3736 *          1) id #  2) simulation # 3) include/exclude.  The include/exclude
    3837 *          is to indicate whether the item should contribute to the overall
     
    9089// in nanovis.cpp
    9190extern vector<PointSet*> g_pointSet;
     91extern int debug_flag;
    9292
    9393extern PlaneRenderer* plane_render;
     
    655655    char buffer[8096];
    656656
    657     clearerr(stdin);
     657    clearerr(NanoVis::stdin);
    658658    while (nBytes > 0) {
    659659        unsigned int chunk;
     
    662662        chunk = (sizeof(buffer) < (unsigned int) nBytes) ?
    663663            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)) {
    666666            Tcl_AppendResult(interp, "while reading data stream: ",
    667667                             Tcl_PosixError(interp), (char*)NULL);
    668668            return TCL_ERROR;
    669669        }
    670         if (feof(stdin)) {
     670        if (feof(NanoVis::stdin)) {
    671671            Tcl_AppendResult(interp, "premature EOF while reading data stream",
    672672                             (char*)NULL);
     
    925925        NanoVis::SetVolumeRanges();
    926926    }
    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);
    928930    return TCL_OK;
    929931}
     
    13321334        volPtr = NanoVis::volume[n];
    13331335        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(),
    13351337                Volume::valueMin, Volume::valueMax);
    13361338        write(0, info, strlen(info));
     
    17151717                volPtr->height / (float)volPtr->width,
    17161718                volPtr->depth  / (float)volPtr->width,
    1717                 volPtr->wAxis.Max());
     1719                volPtr->wAxis.max());
    17181720            NanoVis::initParticle();
    17191721        }
     
    17231725                1.0f / volPtr->aspect_ratio_height,
    17241726                1.0f / volPtr->aspect_ratio_depth,
    1725                 volPtr->wAxis.Max());
     1727                volPtr->wAxis.max());
    17261728            NanoVis::licRenderer->set_offset(NanoVis::lic_slice_z);
    17271729        }
     
    19301932    result = Tcl_Eval(interp, buf.bytes());
    19311933    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);
    19341937    }
    19351938    return result;
     
    22342237        case 2: axisPtr = &NanoVis::grid->zAxis; break;
    22352238        }
    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]));
    22382241    }
    22392242    return TCL_OK;
     
    25282531    HeightMap* hmPtr;
    25292532    hmPtr = new HeightMap();
     2533
    25302534    hmPtr->setHeight(xMin, yMin, xMax, yMax, xNum, yNum, zValues);
    25312535    hmPtr->setColorMap(NanoVis::get_transfunc("default"));
     
    25332537    hmPtr->setLineContourVisible(true);
    25342538    NanoVis::heightMap.push_back(hmPtr);
    2535     delete [] zValues;
    25362539    return TCL_OK;
    25372540}
     
    25722575    // create a default transfer function
    25732576    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));
    25762579    }
    25772580}
     
    26012604        //
    26022605        while (1) {
    2603             char c = getchar();
     2606            int c = fgetc(NanoVis::stdin);
     2607            char ch;
    26042608            if (c <= 0) {
    26052609                if (npass == 0) {
     
    26092613                }
    26102614            }
    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))) {
    26142619                break;
    26152620            }
    26162621        }
    2617 
    26182622        // no command? then we're done for now
    26192623        if (Tcl_DStringLength(&cmdbuffer) == 0) {
     
    26232627        // back to original flags during command evaluation...
    26242628        fcntl(0, F_SETFL, flags & ~O_NONBLOCK);
     2629        if (debug_flag) {
     2630            fprintf(NanoVis::logfile, "%s\n", Tcl_DStringValue(&cmdbuffer));
     2631        }
    26252632        status = Tcl_Eval(interp, Tcl_DStringValue(&cmdbuffer));
    26262633        Tcl_DStringSetLength(&cmdbuffer, 0);
     
    26352642        const char *string;
    26362643        int nBytes;
    2637         string = Tcl_GetStringFromObj(Tcl_GetObjResult(_interp), &nBytes);
    2638 
     2644
     2645        string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &nBytes);
    26392646        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;
    26432650        iov[1].iov_len = nBytes;
    2644         iov[2].iov_base = '\n';
     2651        iov[2].iov_base = (char *)'\n';
    26452652        iov[2].iov_len = 1;
    26462653        writev(0, iov, 3);
Note: See TracChangeset for help on using the changeset viewer.