Changeset 5974 for geovis/trunk
- Timestamp:
- Jan 27, 2016 5:47:42 PM (8 years ago)
- Location:
- geovis/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/Placard.cpp
r5972 r5974 25 25 using namespace GeoVis; 26 26 27 Placard::Placard() : 28 _backdropColor(0.75, 0.75, 0.75, 0.75) 27 Placard::Placard() 29 28 { 30 29 osgEarth::Symbology::TextSymbol *ts = _textStyle.getOrCreateSymbol<osgEarth::Symbology::TextSymbol>(); … … 37 36 //ts->encoding() = osgEarth::Symbology::TextSymbol::ENCODING_UTF8; 38 37 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 39 43 _padding = (float)(charSize / 2.0); 40 44 } … … 189 193 _backdropGeode->removeDrawables( 0, _backdropGeode->getNumDrawables() ); 190 194 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); 192 196 if (gs && gs->fill().isSet()) { 193 197 color = gs->fill().get().color(); … … 227 231 228 232 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); 230 234 if (gs && gs->fill().isSet()) { 231 235 color = gs->fill().get().color(); -
geovis/trunk/Placard.h
r5969 r5974 68 68 return _padding; 69 69 } 70 void setBackdropColor(const osg::Vec4& color) 71 { 72 _backdropColor = color; 73 } 74 const osg::Vec4& getBackdropColor() const 75 { 76 return _backdropColor; 77 } 70 78 71 private: 79 72 std::vector<std::string> _attrNames; 80 73 std::vector<std::string> _attrLabels; 81 74 float _padding; 82 osg::Vec4 _backdropColor;83 75 osgEarth::Symbology::Style _textStyle; 84 76 }; … … 169 161 osg::ref_ptr<osg::Geode> _geode; 170 162 osg::ref_ptr<osg::Geode> _backdropGeode; 171 osg::Vec4 _backdropColor;172 163 173 164 Placard _placardConf; -
geovis/trunk/RendererCmd.cpp
r5969 r5974 3043 3043 int namec; 3044 3044 Tcl_Obj **namev = NULL; 3045 const char *layerName = Tcl_GetString(objv[ 9]);3045 const char *layerName = Tcl_GetString(objv[5]); 3046 3046 3047 3047 if (Tcl_ListObjGetElements(interp, objv[2], &namec, &namev) != TCL_OK) { … … 3062 3062 styleConf.add("type", "text/css"); 3063 3063 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 3072 3065 float padding; 3073 if (GetFloatFromObj(interp, objv[ 8], &padding) != TCL_OK) {3066 if (GetFloatFromObj(interp, objv[4], &padding) != TCL_OK) { 3074 3067 return TCL_ERROR; 3075 3068 } … … 3080 3073 3081 3074 static CmdSpec placardOps[] = { 3082 {"config", 1, PlacardConfigOp, 10, 10, "attrlist textStyle bgColorR bgColorG bgColorB bgColorApadding layerName"},3075 {"config", 1, PlacardConfigOp, 6, 6, "attrlist style padding layerName"}, 3083 3076 }; 3084 3077 static int nPlacardOps = NumCmdSpecs(placardOps); -
geovis/trunk/geovis_protocol.txt
r5970 r5974 133 133 == Interaction Configuration == 134 134 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. 135 placard 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) 139 142 <padding> - Pixels of padding between text and edge of backdrop quad. 140 143 <layerName> - The name of the layer containing the feature data. … … 219 222 In the following: 220 223 <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 225 string 222 226 <format> = json|gml (for tfs or wfs driver) 223 227 <typeName> = layer name for db or wfs driver … … 226 230 227 231 map 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) 229 235 <scripts> = JavaScript (see references above) 230 236 <selectors> = List of name/value pairs
Note: See TracChangeset
for help on using the changeset viewer.