Changeset 6254 for geovis


Ignore:
Timestamp:
Apr 7, 2016 12:01:13 PM (8 years ago)
Author:
ldelgass
Message:

Implement enable/disable placard.

Location:
geovis/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Placard.cpp

    r6245 r6254  
    2626using namespace GeoVis;
    2727
    28 Placard::Placard()
     28Placard::Placard() :
     29    _enabled(true)
    2930{
    3031    osgEarth::Symbology::TextSymbol *ts = _textStyle.getOrCreateSymbol<osgEarth::Symbology::TextSymbol>();
  • geovis/trunk/Placard.h

    r6245 r6254  
    7272        return _padding;
    7373    }
     74    bool enabled()
     75    {
     76        return _enabled;
     77    }
     78    void setEnabled(bool state)
     79    {
     80        _enabled = state;
     81    }
    7482
    7583private:
     
    7886    float _padding;
    7987    osgEarth::Symbology::Style _textStyle;
     88    bool _enabled;
    8089};
    8190
  • geovis/trunk/Renderer.cpp

    r6253 r6254  
    15891589}
    15901590
     1591void Renderer::enablePlacard(const char *layerName, bool state)
     1592{
     1593    osgEarth::ModelLayer *layer = _map->getModelLayerByName(layerName);
     1594    if (layer == NULL) {
     1595        ERROR("Unknown layer '%s'", layerName);
     1596        return;
     1597    }
     1598    _placardConfigs[layerName].setEnabled(state);
     1599}
     1600
    15911601void Renderer::setPlacardConfig(const Placard& placardConf, const char *layerName)
    15921602{
     
    17121722{
    17131723    if (feature == NULL) return;
     1724    Placard placard = getPlacardConfig(layerName);
     1725    if (!placard.enabled())
     1726        return;
    17141727
    17151728    const osgEarth::Features::AttributeTable &attrs = feature->getAttrs();
    1716     Placard placard = getPlacardConfig(layerName);
    17171729    if (placard.getNumEntries() == 0) {
    17181730        placard.addAllAttributes(attrs);
  • geovis/trunk/Renderer.h

    r6253 r6254  
    525525
    526526    void writeScene(const std::string& file);
     527
     528    void enablePlacard(const char *layerName, bool state);
    527529
    528530    void setPlacardConfig(const Placard& placardConf, const char *layerName);
  • geovis/trunk/RendererCmd.cpp

    r6220 r6254  
    32723272        return TCL_ERROR;
    32733273    }
    3274     //g_renderer->enablePlacard(layerName, enable);
     3274    g_renderer->enablePlacard(layerName, enable);
    32753275    return TCL_OK;
    32763276}
Note: See TracChangeset for help on using the changeset viewer.