Changeset 6281


Ignore:
Timestamp:
Apr 20, 2016, 3:20:44 PM (9 years ago)
Author:
ldelgass
Message:

Update select protocol response to use add|delete|set sub-command

Location:
geovis/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Picker.cpp

    r6253 r6281  
    179179
    180180SelectCallback::SelectCallback(Renderer *renderer) :
    181     _renderer(renderer)
     181    _renderer(renderer),
     182    _modifier(false)
    182183{
    183184    installHighlighter(renderer->getMapNode()->getOrCreateStateSet(),
     
    202203            }
    203204        }
    204         TRACE("Hit feature ID: %lu (of %d) layer: %s", feature->getFID(), index->size(), layerName.c_str());
     205        TRACE("Hit FID: %lu (of %d) layer: %s", feature->getFID(), index->size(), layerName.c_str());
    205206
    206207        std::vector<unsigned long> fids;
    207208        fids.push_back(feature->getFID());
    208         _renderer->selectFeatures(fids, layerName.c_str(), true);
     209        _renderer->selectFeatures(fids, layerName.c_str(), !_modifier);
    209210        _renderer->addPlacard(_pickPoint, feature, layerName.c_str());
    210211
    211212        char mesg[256];
    212         snprintf(mesg, sizeof(mesg), "nv>select feature %u %lu %d {%s}\n", id, feature->getFID(), index->size(), layerName.c_str());
     213        if (_modifier) {
     214            // Check if already selected
     215            snprintf(mesg, sizeof(mesg), "nv>select feature add {%lu} {%s}\n", feature->getFID(), layerName.c_str());
     216        } else {
     217            snprintf(mesg, sizeof(mesg), "nv>select feature set {%lu} {%s}\n", feature->getFID(), layerName.c_str());
     218        }
    213219        size_t length = strlen(mesg);
    214220        queueResponse(mesg, length, Response::VOLATILE, Response::DATA);
     
    220226            TRACE("Hit AnnotationNode: %p, \"%s\"", anno, anno->getName().c_str());
    221227            char mesg[256];
    222             snprintf(mesg, sizeof(mesg), "nv>select annotation %u {%s}\n", id, anno->getName().c_str());
     228            snprintf(mesg, sizeof(mesg), "nv>select annotation {%s}\n", anno->getName().c_str());
    223229            size_t length = strlen(mesg);
    224230            queueResponse(mesg, length, Response::VOLATILE, Response::DATA);
     
    248254        _x = ea.getX();
    249255        _y = ea.getY();
     256        // Modifier-click?
     257        _modifier = (ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_CTRL) != 0;
    250258        return false;
    251259    } else if (ea.getEventType() == ea.RELEASE) {
  • geovis/trunk/Picker.h

    r6013 r6281  
    3838    Renderer *_renderer;
    3939    float _x, _y;
     40    bool _modifier;
    4041    osgEarth::GeoPoint _pickPoint;
    4142};
  • geovis/trunk/RenderServer.h

    r6002 r6281  
    2121class Stats;
    2222
    23 #define GEOVIS_VERSION_STRING "0.7.1"
     23#define GEOVIS_VERSION_STRING "0.7.2"
    2424
    2525#define MSECS_ELAPSED(t1, t2) \
Note: See TracChangeset for help on using the changeset viewer.