Show
Ignore:
Timestamp:
03/05/10 11:44:10 (6 months ago)
Author:
gm78
Message:

Added threaded loading of KML NetworkLinks?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FalconView/trunk/public/fvw_core/GeodataDataSources/LibkmlDataSource.cpp

    r2267 r2277  
    387387      std::string resolved_path(path); 
    388388 
    389       if (m_kml_file_path) 
     389      if (m_kml_file_path.size()) 
    390390      { 
    391391         // path is possibly relative to the path / URL of the file from which this was loaded 
    392          resolved_path = CUtilityMethods::ResolveURI(m_kml_file_path, path); 
     392         resolved_path = CUtilityMethods::ResolveURI(m_kml_file_path.c_str(), path); 
    393393      } 
    394394       
     
    441441 
    442442      // return a cached image, if there is one 
    443       STRING_TO_VARIANT_MAP::iterator iter = m_imageCache.find(identifierAsChar); 
     443      STRING_TO_VARIANT_MAP::iterator iter = m_imageCache.begin(); //find(identifierAsChar); 
    444444      if (iter != m_imageCache.end()) 
    445445      { 
     
    528528 
    529529      // load the KML into this object 
    530       LoadKML(file_data, url_cstr); 
     530      WrapKMLFile(LoadKML(file_data, url_cstr)); 
    531531   } 
    532532   CATCH_BLOCK_RET 
     
    563563   __ensure_not_released(); 
    564564 
    565    if (m_kml_file_path) 
    566    { 
    567       _bstr_t u(m_kml_file_path); 
    568       *url = u.Detach(); 
     565   if (m_kml_file_path.size()) 
     566   { 
     567      *url = _bstr_t(m_kml_file_path.c_str()).Detach(); 
    569568   } 
    570569   else 
     
    607606} 
    608607 
    609 void CLibkmlDataSource::LoadKML(std::string &kml, const char* path) // path may be a URL, if this was opened from a URL 
     608kmlengine::KmlFilePtr CLibkmlDataSource::LoadKML(std::string &kml, const char* path) // path may be a URL, if this was opened from a URL 
    610609{ 
    611610   // CreateFromParse creates some pseudo-memory leaks.  These "leaks" do not grow and are not a problem. 
     
    652651   // save the path to the file 
    653652 
    654    if (m_kml_file_path) 
    655       delete[] m_kml_file_path; 
    656  
    657653   if (path) 
    658    { 
    659       size_t s = strlen(path) + 1; 
    660       m_kml_file_path = new char[s]; 
    661       memcpy(m_kml_file_path, path, s); 
    662    } 
    663  
     654      m_kml_file_path = path; 
     655 
     656   return kml_file; 
     657} 
     658 
     659void CLibkmlDataSource::WrapKMLFile(const kmlengine::KmlFilePtr& kml_file) 
     660{ 
    664661   // wrap the root element (must be a data source type) 
    665662   kmldom::ElementPtr root = kml_file->get_root(); 
     
    923920         (*iter)->DataSourceChanged(); 
    924921      } 
    925       catch (...) 
     922      catch (_com_error& ) 
    926923      { 
    927924         std::string msg("an exception was caught in making a callback on IFvDataSourceCallback");