Changeset 5930


Ignore:
Timestamp:
Nov 3, 2015 5:17:48 AM (8 years ago)
Author:
ldelgass
Message:

Add stub for select features protocol command.

Location:
geovis/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Renderer.cpp

    r5916 r5930  
    15271527            _picker->addChild(_placeNodes.get());
    15281528        }
     1529    }
     1530}
     1531
     1532void Renderer::selectFeatures(std::vector<unsigned long>& featureIDs, const char *layerName)
     1533{
     1534    TRACE("Select layer '%s', num features: %u", layerName, featureIDs.size());
     1535    osgEarth::ModelLayer *layer = _map->getModelLayerByName(layerName);
     1536    if (layer == NULL) {
     1537        ERROR("Unknown layer '%s'", layerName);
     1538        return;
     1539    }
     1540    for (unsigned int i = 0; i < featureIDs.size(); i++) {
     1541        TRACE("feature ID: %u", featureIDs.at(i));
    15291542    }
    15301543}
     
    28492862    }
    28502863
     2864#if 0
    28512865    TRACE("w1: %g %g %g w2: %g %g %g",
    28522866          world1.x(), world1.y(), world1.z(),
    28532867          world2.x(), world2.y(), world2.z());
     2868#endif
    28542869
    28552870    double meters;
     
    28952910    //double scaleUSSurveyMiles = scale / 1609.347218694; // US survey mile = 5280 US survey feet
    28962911    //double scaleUSSurveyFeet = scale * 3937.0/1200.0; // US survey foot = 1200/3937 m
     2912#if 0
    28972913    TRACE("m: %g px: %g m/px: %g", meters, pixelWidth, scale);
     2914#endif
    28982915    _mapScale = scale;
    28992916    switch (_scaleBarUnits) {
  • geovis/trunk/Renderer.h

    r5915 r5930  
    514514
    515515    void writeScene(const std::string& file);
     516
     517    void selectFeatures(std::vector<unsigned long>& featureIDs, const char *layerName);
    516518
    517519    void addRhumbBox(double latMin, double latMax, double longMin, double longMax);
  • geovis/trunk/RendererCmd.cpp

    r5923 r5930  
    32213221}
    32223222
     3223static int
     3224SelectFeatureOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3225                Tcl_Obj *const *objv)
     3226{
     3227    int numIDs;
     3228    Tcl_Obj **ids;
     3229    if (Tcl_ListObjGetElements(interp, objv[2], &numIDs, &ids) != TCL_OK) {
     3230        return TCL_ERROR;
     3231    }
     3232    if (numIDs == 0) {
     3233        Tcl_AppendResult(interp, "no IDs in list", (char *)NULL);
     3234        return TCL_ERROR;
     3235    }
     3236    std::vector<unsigned long> featureIDs;
     3237    for (int i = 0; i < numIDs; i++) {
     3238        long id;
     3239        if (Tcl_GetLongFromObj(interp, ids[i], &id) != TCL_OK) {
     3240            return TCL_ERROR;
     3241        }
     3242        featureIDs.push_back((unsigned long)id);
     3243    }
     3244    const char *layerName = Tcl_GetString(objv[3]);
     3245
     3246    g_renderer->selectFeatures(featureIDs, layerName);
     3247    return TCL_OK;
     3248}
     3249
     3250static CmdSpec selectOps[] = {
     3251    {"feature", 1, SelectFeatureOp, 4, 4, "idlist layerName"},
     3252};
     3253static int nSelectOps = NumCmdSpecs(selectOps);
     3254
     3255static int
     3256SelectCmd(ClientData clientData, Tcl_Interp *interp, int objc,
     3257          Tcl_Obj *const *objv)
     3258{
     3259    Tcl_ObjCmdProc *proc;
     3260
     3261    proc = GetOpFromObj(interp, nSelectOps, selectOps,
     3262                        CMDSPEC_ARG1, objc, objv, 0);
     3263    if (proc == NULL) {
     3264        return TCL_ERROR;
     3265    }
     3266    return (*proc) (clientData, interp, objc, objv);
     3267}
     3268
    32233269#ifdef USE_READ_THREAD
    32243270int
     
    34563502    Tcl_CreateObjCommand(interp, "renderer",   RendererCmd,   clientData, NULL);
    34573503    Tcl_CreateObjCommand(interp, "screen",     ScreenCmd,     clientData, NULL);
     3504    Tcl_CreateObjCommand(interp, "select",     SelectCmd,     clientData, NULL);
    34583505}
    34593506
     
    34743521    Tcl_DeleteCommand(interp, "renderer");
    34753522    Tcl_DeleteCommand(interp, "screen");
     3523    Tcl_DeleteCommand(interp, "select");
    34763524
    34773525    Tcl_DeleteInterp(interp);
  • geovis/trunk/ResponseQueue.cpp

    r5915 r5930  
    6666            itr = _list.erase(itr);
    6767        } else {
     68#ifdef TRACE_RESPONSE_QUEUE
    6869            TRACE("Found queued response of type %d", (*itr)->type());
     70#endif
    6971            ++itr;
    7072        }
Note: See TracChangeset for help on using the changeset viewer.