Ignore:
Timestamp:
Jun 16, 2016, 3:31:43 PM (8 years ago)
Author:
ldelgass
Message:

Use hub url if supplied to get idata URL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/IData.cpp

    r5856 r6382  
    3535};
    3636#endif
    37 static const char *serviceURL = "http://mygeohub.org/api/idata/collection/";
    38 static std::string g_iDataUsername;
     37
     38static const char *defaultHubURL = "https://mygeohub.org";
     39static const std::string servicePath = "/api/idata/collection/";
     40static std::string serviceURL;
     41static std::string iDataUsername;
    3942
    4043using namespace IData;
    4144using namespace osgEarth;
    4245
    43 void IData::iDataInit(const char *username, const char *hub)
    44 {
    45     TRACE("user: %s hub: %s", username, hub);
     46void IData::iDataInit(const char *username, const char *hubURL)
     47{
     48    TRACE("user: %s hub: %s", username, hubURL);
    4649    static bool first = true;
    47     g_iDataUsername = username;
     50    std::ostringstream oss;
     51    std::string hubHost;
     52    if (hubURL != NULL) {
     53        hubHost = hubURL;
     54    } else {
     55        hubHost = defaultHubURL;
     56    }
     57    oss << hubHost << servicePath;
     58    serviceURL = oss.str();
     59    iDataUsername = username;
    4860    if (first) {
    4961        curl_global_init(CURL_GLOBAL_DEFAULT);
     
    7385{
    7486    std::ostringstream oss;
    75     oss << serviceURL << commandNames[cmd] << "?username=" << g_iDataUsername;
     87    oss << serviceURL << commandNames[cmd] << "?username=" << iDataUsername;
    7688    for (std::vector<std::string>::iterator itr = params.begin();
    7789         itr != params.end(); ++itr) {
Note: See TracChangeset for help on using the changeset viewer.