Changeset 6347 for geovis


Ignore:
Timestamp:
May 17, 2016 12:43:56 AM (8 years ago)
Author:
ldelgass
Message:

Move stylesheet, script, selector definition to data payload in protocol for
adding feature layers.

Location:
geovis/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/RenderServer.h

    r6281 r6347  
    2121class Stats;
    2222
    23 #define GEOVIS_VERSION_STRING "0.7.2"
     23#define GEOVIS_VERSION_STRING "0.7.3"
    2424
    2525#define MSECS_ELAPSED(t1, t2) \
  • geovis/trunk/RendererCmd.cpp

    r6319 r6347  
    9393SocketRead(char *bytes, size_t len)
    9494{
     95    if (len == 0) return true;
    9596    ReadBuffer::BufferStatus status;
    9697    status = g_inBufPtr->followingData((unsigned char *)bytes, len);
     
    17051706        }
    17061707
     1708        long ssSize;
     1709        if (Tcl_GetLongFromObj(interp, objv[10], &ssSize) != TCL_OK) {
     1710            return TCL_ERROR;
     1711        }
     1712
    17071713        bool lighting = true;
    17081714        osgEarth::Drivers::FeatureGeomModelOptions geomOpts;
    1709         osgEarth::Config styleConf("style", Tcl_GetString(objv[10]));
     1715        char *styleSheetStr = (char *)malloc((size_t)ssSize);
     1716        if (!SocketRead(styleSheetStr, ssSize)) {
     1717            free(styleSheetStr);
     1718            return TCL_ERROR;
     1719        }
     1720        osgEarth::Config styleConf("style", styleSheetStr);
     1721        free(styleSheetStr);
    17101722        styleConf.add("type", "text/css");
    17111723        TRACE("style CSS: %s", styleConf.value().c_str());
     
    17611773
    17621774        if (objc > 11) {
    1763             std::string scripts(Tcl_GetString(objv[11]));
     1775            long scriptSize;
     1776            if (Tcl_GetLongFromObj(interp, objv[11], &scriptSize) != TCL_OK) {
     1777                return TCL_ERROR;
     1778            }
     1779            char *scriptStr = NULL;
     1780            if (scriptSize > 0) {
     1781                scriptStr = (char *)malloc((size_t)scriptSize);
     1782                if (!SocketRead(scriptStr, scriptSize)) {
     1783                    free(scriptStr);
     1784                    return TCL_ERROR;
     1785                }
     1786            }
     1787            std::string scripts(scriptStr, scriptSize);
     1788            free(scriptStr);
    17641789            if (!scripts.empty()) {
    17651790                TRACE("script: %s", scripts.c_str());
     
    17721797        }
    17731798        if (objc > 12) {
     1799            long selectorsSize;
     1800            if (Tcl_GetLongFromObj(interp, objv[12], &selectorsSize) != TCL_OK) {
     1801                return TCL_ERROR;
     1802            }
     1803            char *selectorsStr = (char *)malloc((size_t)selectorsSize);
     1804            if (!SocketRead(selectorsStr, selectorsSize)) {
     1805                free(selectorsStr);
     1806                return TCL_ERROR;
     1807            }
     1808            Tcl_Obj *selectorsObj = Tcl_NewStringObj(selectorsStr, selectorsSize);
    17741809            int numSelectors;
    17751810            Tcl_Obj **selectors;
    1776             if (Tcl_ListObjGetElements(interp, objv[12], &numSelectors, &selectors) != TCL_OK) {
     1811            if (Tcl_ListObjGetElements(interp, selectorObj, &numSelectors, &selectors) != TCL_OK) {
    17771812                return TCL_ERROR;
    17781813            }
     
    18281863                geomOpts.styles()->selectors().push_back(ss);
    18291864            }
     1865            Tcl_DecrRefCount(selectorsObj);
    18301866        }
    18311867        geomOpts.enableLighting() = lighting;
  • geovis/trunk/geovis_protocol.txt

    r6276 r6347  
    266266<clamptechnique> = drape|gpu|scene|map
    267267
    268 map layer add <layerName> feature <driver> <format> <typeName> <url> <cache> <style> <?scripts?> <?selectors?> <?visibilityRangeMin?> <?visibilityRangeMax?>
    269     <style> = CSS styles (see:
     268map layer add <layerName> feature <driver> <format> <typeName> <url> <cache> <styleLen> <?scriptLen?> <?selectorsLen?> <?visibilityRangeMin?> <?visibilityRangeMax?>
     269    Data payload follows command: style, then script, then selectors
     270    <styleLen> = Number of bytes in style sheet. Stylesheet payload consists of
     271    CSS-formatted styles (see:
    270272    http://docs.osgearth.org/en/latest/user/features.html and
    271273    http://docs.osgearth.org/en/latest/references/symbology.html)
    272     <scripts> = JavaScript (see references above)
    273     <selectors> = List of name/value pairs
     274    <scriptLen> = Number of bytes in scripts.  Scripts payload consists of
     275    JavaScript code (see references above)
     276    <selectorsLen> = Number of bytes in selectors.  Selectors payload consists
     277    of a Tcl list of name/value pairs
    274278map layer add <layerName> icon <driver> <format> <typeName> <url> <cache> <icon> <scale> <heading> <declutter> <placement> <alignment> <?visibilityRangeMin?> <?visibilityRangeMax?>
    275279    Add an icon feature layer from a file or URL
Note: See TracChangeset for help on using the changeset viewer.