Changeset 4629 for geovis


Ignore:
Timestamp:
Sep 4, 2014 11:18:26 AM (6 years ago)
Author:
ldelgass
Message:

add token to map/screen coord commands

Location:
geovis/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Makefile.in

    r4628 r4629  
    99USE_THROTTLING_SLEEP    = #yes
    1010SLEEP_AFTER_QUEUE_FRAME = yes
     11QUEUE_ONLY_ONE_FRAME    = yes
    1112
    1213bindir          = @bindir@
     
    111112DEFINES         += -DSLEEP_AFTER_QUEUE_FRAME
    112113endif
     114ifdef QUEUE_ONLY_ONE_FRAME
     115DEFINES         += -DQUEUE_ONLY_ONE_FRAME
     116endif
    113117
    114118CXX_SWITCHES    = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(DEFINES) $(INCLUDES)
  • geovis/trunk/RenderServer.h

    r4349 r4629  
    2121class Stats;
    2222
    23 #define GEOVIS_VERSION_STRING "0.4"
     23#define GEOVIS_VERSION_STRING "0.5.0"
    2424
    2525#define MSECS_ELAPSED(t1, t2) \
  • geovis/trunk/Renderer.cpp

    r4628 r4629  
    8787    _bgColor[2] = 0;
    8888    //setMaximumFrameRateInHertz(15.0);
    89     // 100MBit
     89    // 100Mbit
    9090    setMaximumBitrate(1.0e8);
    9191    _lastFrameTime = _minFrameTime;
    92     TRACE("Bandwidth target: %.2f MBit", (float)(getMaximumBitrate()/1.0e6));
     92    TRACE("Bandwidth target: %.2f Mbps", (float)(getMaximumBitrate()/1.0e6));
    9393    TRACE("Frame rate target: %.2f Hz", (float)getMaximumFrameRateInHertz());
    9494
     
    10411041    }
    10421042    osgEarth::ImageLayerOptions layerOpts(name, opts);
     1043#ifdef USE_OSGEARTH_TRUNK
     1044    layerOpts.textureCompression() = osg::Texture::USE_IMAGE_DATA_FORMAT;
     1045#endif
    10431046    if (makeShared) {
    10441047        layerOpts.shared() = true;
     
    13211324
    13221325    setMaximumBitrate(origBitrate);
    1323     TRACE("Bandwidth target: %.2f MBit", (float)(getMaximumBitrate()/1.0e6));
     1326    TRACE("Bandwidth target: %.2f Mbps", (float)(getMaximumBitrate()/1.0e6));
    13241327    TRACE("Frame rate target: %.2f Hz", (float)getMaximumFrameRateInHertz());
    13251328
  • geovis/trunk/Renderer.h

    r4628 r4629  
    2020#include <osgViewer/Viewer>
    2121#include <osgGA/StateSetManipulator>
     22#include <osgUtil/IncrementalCompileOperation>
    2223
    2324#include <osgEarth/StringUtils>
     
    365366            rate = 0.25;
    366367        _minFrameTime = 1.0/rate;
     368        if (_viewer.valid()) {
     369            osgUtil::IncrementalCompileOperation *op =
     370                _viewer->getDatabasePager()->getIncrementalCompileOperation();
     371            if (op != NULL) {
     372                TRACE("Setting DB Pager target frame rate to %g", rate);
     373                op->setTargetFrameRate(rate);
     374            }
     375        }
    367376    }
    368377
  • geovis/trunk/RendererCmd.cpp

    r4628 r4629  
    107107    std::string cmd(str);
    108108    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());
    110110#endif
    111111    lastCmdStatus = TCL_OK;
     
    772772{
    773773    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) {
    776776        return TCL_ERROR;
    777777    }
     
    779779    osgEarth::GeoPoint mapPoint;
    780780    size_t length;
    781     char mesg[256];
     781    char mesg[512];
    782782    if (g_renderer->mapMouseCoords(x, y, mapPoint)) {
    783783        std::string srsInit;
    784784        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]);
    789789            }
    790790            osgEarth::SpatialReference *outSRS =
     
    802802        // send coords to client
    803803        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,
    805806                          mapPoint.x(), mapPoint.y(), mapPoint.z(),
    806807                          x, y,
     
    812813        // Out of range
    813814        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);
    815818
    816819        queueResponse(mesg, length, Response::VOLATILE);
     
    15471550
    15481551static CmdSpec mapOps[] = {
    1549     {"coords",   1, MapCoordsOp,          4, 6, "x y ?srs? ?verticalDatum?"},
     1552    {"coords",   1, MapCoordsOp,          5, 7, "token x y ?srs? ?verticalDatum?"},
    15501553    {"grid",     1, MapGraticuleOp,       3, 4, "bool ?type?"},
    15511554    {"layer",    2, MapLayerOp,           3, 0, "op ?params...?"},
     
    17501753{
    17511754    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) {
    17551758        return TCL_ERROR;
    17561759    }
    17571760    const osgEarth::SpatialReference *srs = NULL;
    1758     if (objc < 6) {
     1761    if (objc < 7) {
    17591762        srs = g_renderer->getMapSRS();
    17601763        if (srs == NULL) {
     
    17631766        }
    17641767    } else {
    1765         std::string srsInit(Tcl_GetString(objv[5]));
     1768        std::string srsInit(Tcl_GetString(objv[6]));
    17661769        std::string verticalDatum;
    1767         if (objc > 6) {
    1768             verticalDatum = Tcl_GetString(objv[6]);
     1770        if (objc > 7) {
     1771            verticalDatum = Tcl_GetString(objv[7]);
    17691772        }
    17701773        srs = osgEarth::SpatialReference::get(srsInit, verticalDatum);
     
    17851788        // send coords to client
    17861789        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]),
    17881792                          screen.x(), screen.y(), screen.z(),
    17891793                          x, y, z);
     
    17931797        // Out of range
    17941798        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);
    17961802
    17971803        queueResponse(mesg, length, Response::VOLATILE);
     
    18171823static CmdSpec screenOps[] = {
    18181824    {"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?"},
    18201826    {"size",    1, ScreenSizeOp, 4, 4, "width height"}
    18211827};
  • geovis/trunk/ResponseQueue.cpp

    r3998 r4629  
    2626}
    2727
    28 ResponseQueue::~ResponseQueue() 
     28ResponseQueue::~ResponseQueue()
    2929{
    3030    TRACE("Deleting ResponseQueue");
     
    4545    if (pthread_mutex_lock(&_idle) != 0) {
    4646        ERROR("can't lock mutex: %s", strerror(errno));
    47     }   
     47    }
     48#ifdef QUEUE_ONLY_ONE_FRAME
    4849    /* Examine the list and remove any queued responses of the same type. */
    4950    TRACE("Before # of elements is %d", _list.size());
    5051    for (std::list<Response *>::iterator itr = _list.begin();
    5152         itr != _list.end();) {
    52         /* Remove any duplicate image or legend responses. There should be no 
    53          * more than one.  Note that if the client starts using multiple legends 
     53        /* Remove any duplicate image or legend responses. There should be no
     54         * more than one.  Note that if the client starts using multiple legends
    5455         * for different fields, this optimization should be disabled for legends.
    5556         * We may also need to differentiate between screen images and "hardcopy"
     
    6768        }
    6869    }
     70#endif
    6971    /* Add the new response to the end of the list. */
    7072    _list.push_back(response);
     
    7577    if (pthread_mutex_unlock(&_idle) != 0) {
    7678        ERROR("can't unlock mutex: %s", strerror(errno));
    77     }   
     79    }
    7880}
    7981
     
    105107    if (pthread_mutex_unlock(&_idle) != 0) {
    106108        ERROR("can't unlock mutex: %s", strerror(errno));
    107     }   
     109    }
    108110    return response;
    109111}
  • geovis/trunk/geovis_protocol.txt

    r4578 r4629  
    9090
    9191screen bgcolor <r> <g> <b>
    92 screen coords <x> <y> <z> <?srs?> <?verticalDatum?>
     92screen coords <token> <x> <y> <z> <?srs?> <?verticalDatum?>
    9393       Transate map coordinates to screen/mouse coordinates.
     94       <token> - String token, included in response
    9495       <x>,<y>,<z> - Map coordinates.  If srs not given, these are in the map's
    9596       coordinate system.
     
    114115== Map Commands ==
    115116
    116 map coords <x> <y> <?srs?> <?verticalDatum?>
     117map coords <token> <x> <y> <?srs?> <?verticalDatum?>
    117118    Translate screen/mouse coordinates into map coordinates.
     119    <token> - String token, included in response
    118120    <x>,<y> - Screen/mouse coordinates
    119121    <srs> - Optional horizontal srs init string for coordinate system to return
     
    207209nv>image -type image -bytes <nbytes>
    208210  <binary RGB data>
    209 nv>map coords <mapX> <mapY> <mapZ> <screenX> <screenY> <?srs?> <?verticalDatum?>
     211nv>map coords <token> <mapX> <mapY> <mapZ> <screenX> <screenY> <?srs?> <?verticalDatum?>
    210212   Reply to query of map coordinates from screen coordinates.  srs of the map
    211213   coordinates may be included if not in map's native coordinate system
    212 nv>map coords invalid <mouseX> <mouseY>
     214nv>map coords <token> invalid <mouseX> <mouseY>
    213215   Reply indicating an off-map click/query
    214 nv>screen coords <screenX> <screenY> <screenZ> <mapX> <mapY> <mapZ>
     216nv>screen coords <token> <screenX> <screenY> <screenZ> <mapX> <mapY> <mapZ>
    215217   Reply to query of screen coordinates from map coordinates
    216 nv>screen coords invalid <mapX> <mapY> <mapZ>
     218nv>screen coords <token> invalid <mapX> <mapY> <mapZ>
    217219   Reply indicating requested point is out of the view frustum
    218220nv>ok -token <seqnum>
    219    Reply indicated commands through <seqnum> (numbered beginning at 1) have been
     221   Reply indicated commands through <seqnum> (numbered beginning at 0) have been
    220222   processed, but no new image was rendered
    221223================================================================================
Note: See TracChangeset for help on using the changeset viewer.