Ignore:
Timestamp:
Sep 14, 2009, 2:17:49 PM (15 years ago)
Author:
gah
Message:

add cartoon to representation, background color to print command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/pymolproxy/pymolproxy.c

    r1557 r1563  
    358358        return proxyPtr->status;
    359359    }
    360 #ifdef notdef
     360#ifndef notdef
    361361    trace("Entering Expect(want=%s, maxSize=%d)\n", match, maxSize);
    362362#endif
     
    369369        line = GetLine(&proxyPtr->server, &nBytes);
    370370        if (line != NULL) {
    371 #ifdef notdef
     371#ifndef notdef
    372372            trace("pymol says:%.*s", nBytes, out);
    373373#endif
     
    378378                memcpy(out, line, nBytes);
    379379                clear_error(proxyPtr);
    380 #ifdef notdef
     380#ifndef notdef
    381381                trace("Leaving Expect: got (%.*s)\n", nBytes, out);
    382382#endif
     
    664664   
    665665    va_start(ap, format);
    666     vsnprintf(buffer, BUFSIZ-1, format, ap);
     666    result = vsnprintf(buffer, BUFSIZ-1, format, ap);
    667667    va_end(ap);
    668668   
    669     trace("to-pymol>(%s)", buffer);
     669    trace("to-pymol>(%s) code=%d", buffer, result);
    670670   
    671671    /* Write the command out to the server. */
     
    12251225    Image *imgPtr;
    12261226    int width, height;
    1227     const char *token;
     1227    const char *token, *bgcolor;
    12281228
    12291229    clear_error(proxyPtr);
     
    12341234    proxyPtr->flags &= ~(UPDATE_PENDING | FORCE_UPDATE | INVALIDATE_CACHE);
    12351235
    1236     if (argc != 4) {
     1236    if (argc != 5) {
    12371237        Tcl_AppendResult(interp, "wrong # arguments: should be \"",
    1238                          argv[0], " token width height\"", (char *)NULL);
     1238                         argv[0], " token width height color\"", (char *)NULL);
    12391239        return TCL_ERROR;
    12401240    }
     
    12461246        return TCL_ERROR;
    12471247    }
     1248    bgcolor = argv[4];
    12481249    /* Force pymol to update the current scene. */
    1249     Pymol(proxyPtr, "refresh\n");
    1250     Pymol(proxyPtr,
    1251           "ray %d,%d\n"
    1252           "png -,dpi=300\n",
    1253           width, height);
     1250    Pymol(proxyPtr, "bg_color %s\nrefresh\n", bgcolor);
     1251    Pymol(proxyPtr, "ray %d,%d\n", width, height);
     1252    Expect(proxyPtr, " Ray:", buffer, 800);
     1253
     1254    Pymol(proxyPtr, "png -,dpi=300\nbg_color black\n");
    12541255    Expect(proxyPtr, "png image follows: ", buffer, 800);
    12551256
     
    12611262    sprintf(buffer, "nv>image %d print \"%s\" %d\n", nBytes, token,
    12621263            proxyPtr->rockOffset);
     1264    trace("header is png is (%s)\n", buffer);
    12631265    length = strlen(buffer);
    12641266    imgPtr = NewImage(proxyPtr, nBytes + length);
     
    14051407        proxyPtr->flags |= FORCE_UPDATE;
    14061408    }
    1407     if (strcmp(rep, "ballnstick") == 0) {
    1408         /* Ball 'n Stick */
    1409         Pymol(proxyPtr, "set stick_color,white,%s\n", model);
     1409    if (strcmp(rep, "ballnstick") == 0) { /* Ball 'n Stick */
    14101410        Pymol(proxyPtr,
     1411              "set stick_color,white,%s\n"
     1412              "show sticks,%s\n"
     1413              "show spheres,%s\n"
    14111414              "hide lines,%s\n"
    1412               "show sticks,%s\n"
    1413               "show spheres,%s\n",
    1414               model, model, model);
    1415     } else if (strcmp(rep, "spheres") == 0) {
    1416         /* spheres */   
     1415              "hide cartoon,%s\n",
     1416              model, model, model, model, model);
     1417    } else if (strcmp(rep, "spheres") == 0) { /* spheres */   
    14171418        Pymol(proxyPtr,
    14181419              "hide sticks,%s\n"
     1420              "show spheres,%s\n"
    14191421              "hide lines,%s\n"
    1420               "show spheres,%s\n",
    1421               model, model, model);
    1422         Pymol(proxyPtr,
     1422              "hide cartoon,%s\n"
    14231423              "set sphere_quality,2,%s\n"
    14241424              "set ambient,.2,%s\n",
    1425               model, model);
    1426     } else if (strcmp(rep, "none") == 0) {
    1427         /* nothing */   
     1425              model, model, model, model, model, model);
     1426    } else if (strcmp(rep, "none") == 0) { /* nothing */   
    14281427        Pymol(proxyPtr,
     1428              "hide sticks,%s\n",
    14291429              "hide spheres,%s\n"
    14301430              "hide lines,%s\n"
    1431               "hide sticks,%s\n",
    1432               model, model, model);
    1433     } else if (strcmp(rep, "sticks") == 0) {
    1434         /* sticks */   
    1435         Pymol(proxyPtr, "set stick_color,white,%s\n", model);
     1431              "hide cartoon,%s\n",
     1432              model, model, model, model);
     1433    } else if (strcmp(rep, "sticks") == 0) { /* sticks */   
    14361434        Pymol(proxyPtr,
     1435              "set stick_color,white,%s\n"
     1436              "show sticks,%s\n"
    14371437              "hide spheres,%s\n"
    14381438              "hide lines,%s\n"
    1439               "show sticks,%s\n",
    1440               model, model, model);
    1441     } else if (strcmp(rep, "lines") == 0) {
    1442         /* lines */   
     1439              "hide cartoon,%s\n",
     1440              model, model, model, model, model);
     1441    } else if (strcmp(rep, "lines") == 0) { /* lines */   
    14431442        Pymol(proxyPtr,
     1443              "hide sticks,%s\n"
    14441444              "hide spheres,%s\n"
     1445              "show lines,%s\n"
     1446              "hide cartoon,%s\n",
     1447              model, model, model, model);
     1448    } else if (strcmp(rep, "cartoon") == 0) { /* cartoon */   
     1449        Pymol(proxyPtr,
    14451450              "hide sticks,%s\n"
    1446               "show lines,%s\n",
    1447               model, model, model);
    1448     }
     1451              "hide spheres,%s\n"
     1452              "hide lines,%s\n"
     1453              "show cartoon,%s\n",
     1454              model, model, model, model);
     1455    }
    14491456    return proxyPtr->status;
    14501457}
Note: See TracChangeset for help on using the changeset viewer.