Changeset 5026


Ignore:
Timestamp:
Feb 16, 2015 2:08:54 AM (5 years ago)
Author:
ldelgass
Message:

Add protocol to set map attribution/copyright

Location:
geovis/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/Renderer.cpp

    r4973 r5026  
    396396}
    397397
     398void Renderer::setAttribution(const std::string& attrib)
     399{
     400    _attribution = attrib;
     401    if (_copyrightLabel.valid()) {
     402        _copyrightLabel->setText(_attribution);
     403        _needsRedraw = true;
     404    }
     405}
     406
    398407void Renderer::initControls()
    399408{
     
    404413                                           osgEarth::Util::Controls::Control::ALIGN_BOTTOM,
    405414                                           osgEarth::Util::Controls::Gutter(0, 2, 2, 0), 2.0f);
     415    _attribution = "Map data © OpenStreetMap";
    406416    _copyrightLabel =
    407         new osgEarth::Util::Controls::LabelControl("Map data © 2014 ACME Corp.", 12.0f);
     417        new osgEarth::Util::Controls::LabelControl(_attribution, 12.0f);
    408418    _copyrightLabel->setForeColor(osg::Vec4f(1, 1, 1, 1));
    409419    _copyrightLabel->setHaloColor(osg::Vec4f(0, 0, 0, 1));
     
    815825}
    816826
     827void Renderer::setEphemerisTime(time_t utcTime)
     828{
     829    if (_skyNode.valid()) {
     830        osgEarth::DateTime time(utcTime);
     831        _skyNode->setDateTime(time);
     832        _needsRedraw = true;
     833    }
     834}
     835
    817836void Renderer::setEphemerisTime(int year, int month, int day, double hours)
    818837{
  • geovis/trunk/Renderer.h

    r4973 r5026  
    99#define GEOVIS_RENDERER_H
    1010
     11#include <ctime> // For time_t
    1112#include <string>
    1213#include <vector>
     
    157158    std::string getPinIcon();
    158159
     160    void setAttribution(const std::string& attrib);
     161
    159162    // Colormaps
    160163
     
    200203
    201204    void setTerrainWireframe(bool state);
     205
     206    void setEphemerisTime(time_t utcTime);
    202207
    203208    void setEphemerisTime(int year, int month, int day, double hours);
     
    514519    std::string _cacheDir;
    515520    std::string _baseURI;
     521    std::string _attribution;
    516522
    517523    osg::ref_ptr<osg::Group> _sceneRoot;
  • geovis/trunk/RendererCmd.cpp

    r4973 r5026  
    769769}
    770770
     771static int
     772MapAttributionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     773                 Tcl_Obj *const *objv)
     774{
     775    g_renderer->setAttribution(Tcl_GetString(objv[2]));
     776    return TCL_OK;
     777}
    771778
    772779static int
     
    775782{
    776783    g_renderer->clearBoxSelection();
    777 
    778784    return TCL_OK;
    779785}
     
    17641770
    17651771static CmdSpec mapOps[] = {
     1772    {"attrib",   1, MapAttributionOp,     3, 3, "string"},
    17661773    {"box",      1, MapBoxOp,             3, 0, "op ?params..."},
    17671774    {"coords",   1, MapCoordsOp,          4, 6, "token coords ?srs? ?verticalDatum?"},
  • geovis/trunk/geovis_protocol.txt

    r4976 r5026  
    115115== Map Commands ==
    116116
     117map attrib <string>
     118    <string> - Attribution/copyright to display in corner of map
     119
    117120map coords <token> <coordList> <?srs?> <?verticalDatum?>
    118121    Translate screen/mouse coordinates into map coordinates.
Note: See TracChangeset for help on using the changeset viewer.