Changeset 5974 for geovis/trunk


Ignore:
Timestamp:
Jan 27, 2016 5:47:42 PM (8 years ago)
Author:
ldelgass
Message:

Use fill attribute of PolygonSymbol? in placard style for backing quad color.

Location:
geovis/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Placard.cpp

    r5972 r5974  
    2525using namespace GeoVis;
    2626
    27 Placard::Placard() :
    28     _backdropColor(0.75, 0.75, 0.75, 0.75)
     27Placard::Placard()
    2928{
    3029    osgEarth::Symbology::TextSymbol *ts = _textStyle.getOrCreateSymbol<osgEarth::Symbology::TextSymbol>();
     
    3736    //ts->encoding() = osgEarth::Symbology::TextSymbol::ENCODING_UTF8;
    3837    double charSize = ts->size().isSet() ? ts->size()->eval() : 14.0;
     38
     39    // Set backdrop quad color as PolygonSymbol fill
     40    osgEarth::Symbology::PolygonSymbol *ps = _textStyle.getOrCreateSymbol<osgEarth::Symbology::PolygonSymbol>();
     41    ps->fill() = osgEarth::Symbology::Color(0.75, 0.75, 0.75, 0.75);
     42
    3943    _padding = (float)(charSize / 2.0);
    4044}
     
    189193        _backdropGeode->removeDrawables( 0, _backdropGeode->getNumDrawables() );
    190194        const osgEarth::Symbology::PolygonSymbol* gs = _style.get<osgEarth::Symbology::PolygonSymbol>();
    191         osg::Vec4 color(_placardConf.getBackdropColor());
     195        osg::Vec4 color(0.75, 0.75, 0.75, 0.75);
    192196        if (gs && gs->fill().isSet()) {
    193197            color = gs->fill().get().color();
     
    227231
    228232    const osgEarth::Symbology::PolygonSymbol* gs = _style.get<osgEarth::Symbology::PolygonSymbol>();
    229     osg::Vec4 color(_placardConf.getBackdropColor());
     233    osg::Vec4 color(0.75, 0.75, 0.75, 0.75);
    230234    if (gs && gs->fill().isSet()) {
    231235        color = gs->fill().get().color();
  • geovis/trunk/Placard.h

    r5969 r5974  
    6868        return _padding;
    6969    }
    70     void setBackdropColor(const osg::Vec4& color)
    71     {
    72         _backdropColor = color;
    73     }
    74     const osg::Vec4& getBackdropColor() const
    75     {
    76         return _backdropColor;
    77     }
     70
    7871private:
    7972    std::vector<std::string> _attrNames;
    8073    std::vector<std::string> _attrLabels;
    8174    float _padding;
    82     osg::Vec4 _backdropColor;
    8375    osgEarth::Symbology::Style _textStyle;
    8476};
     
    169161    osg::ref_ptr<osg::Geode>   _geode;
    170162    osg::ref_ptr<osg::Geode>   _backdropGeode;
    171     osg::Vec4 _backdropColor;
    172163
    173164    Placard _placardConf;
  • geovis/trunk/RendererCmd.cpp

    r5969 r5974  
    30433043    int namec;
    30443044    Tcl_Obj **namev = NULL;
    3045     const char *layerName = Tcl_GetString(objv[9]);
     3045    const char *layerName = Tcl_GetString(objv[5]);
    30463046
    30473047    if (Tcl_ListObjGetElements(interp, objv[2], &namec, &namev) != TCL_OK) {
     
    30623062    styleConf.add("type", "text/css");
    30633063    placardConf.setStyle(osgEarth::Symbology::Style(styleConf));
    3064     float r, g, b, a;
    3065     if (GetFloatFromObj(interp, objv[4], &r) != TCL_OK ||
    3066         GetFloatFromObj(interp, objv[5], &g) != TCL_OK ||
    3067         GetFloatFromObj(interp, objv[6], &b) != TCL_OK ||
    3068         GetFloatFromObj(interp, objv[7], &a) != TCL_OK) {
    3069         return TCL_ERROR;
    3070     }
    3071     placardConf.setBackdropColor(osg::Vec4(r, g, b, a));
     3064
    30723065    float padding;
    3073     if (GetFloatFromObj(interp, objv[8], &padding) != TCL_OK) {
     3066    if (GetFloatFromObj(interp, objv[4], &padding) != TCL_OK) {
    30743067        return TCL_ERROR;
    30753068    }
     
    30803073
    30813074static CmdSpec placardOps[] = {
    3082     {"config", 1, PlacardConfigOp, 10, 10, "attrlist textStyle bgColorR bgColorG bgColorB bgColorA padding layerName"},
     3075    {"config", 1, PlacardConfigOp, 6, 6, "attrlist style padding layerName"},
    30833076};
    30843077static int nPlacardOps = NumCmdSpecs(placardOps);
  • geovis/trunk/geovis_protocol.txt

    r5970 r5974  
    133133== Interaction Configuration ==
    134134
    135 placard config <attrlist> <textStyle> <bgR> <bgG> <bgB> <bgA> <padding> <layerName>
    136     <attrlist> - List of attributes.  The list should consist of alternating attribute names and attribute labels.  The names are the column names of the attributes in the feature data and the corresponding labels will be displayed on the info placard
    137     <textStyle> - CSS style attributes for TextSymbol
    138     <bgR>,<bgG>,<bgB>,<bgA> - RGBA color (floats [0,1]) for backdrop quad.
     135placard config <attrlist> <style> <padding> <layerName>
     136    <attrlist> - List of attributes.  The list should consist of alternating
     137    attribute names and attribute labels.  The names are the column names of the
     138    attributes in the feature data and the corresponding labels will be
     139    displayed on the info placard
     140    <style> - CSS style attributes for TextSymbol and PolygonSymbol (fill for
     141    backing quad)
    139142    <padding> - Pixels of padding between text and edge of backdrop quad.
    140143    <layerName> - The name of the layer containing the feature data.
     
    219222In the following:
    220223<driver> = db|ogr|tfs|wfs
    221 <url> = file/web service address, or for driver 'db' the postgis connection string
     224<url> = file/web service address, or for driver 'db' the postgis connection
     225string
    222226<format> = json|gml (for tfs or wfs driver)
    223227<typeName> = layer name for db or wfs driver
     
    226230
    227231map layer add <layerName> feature <driver> <format> <typeName> <url> <cache> <style> <?scripts?> <?selectors?> <?visibilityRangeMin?> <?visibilityRangeMax?>
    228     <style> = CSS styles (see http://docs.osgearth.org/en/latest/user/features.html and http://docs.osgearth.org/en/latest/references/symbology.html)
     232    <style> = CSS styles (see:
     233    http://docs.osgearth.org/en/latest/user/features.html and
     234    http://docs.osgearth.org/en/latest/references/symbology.html)
    229235    <scripts> = JavaScript (see references above)
    230236    <selectors> = List of name/value pairs
Note: See TracChangeset for help on using the changeset viewer.