- Timestamp:
- 03/05/10 11:44:10 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
FalconView/trunk/public/fvw_core/GeodataDataSources/LibkmlDataSource.cpp
r2267 r2277 387 387 std::string resolved_path(path); 388 388 389 if (m_kml_file_path )389 if (m_kml_file_path.size()) 390 390 { 391 391 // 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); 393 393 } 394 394 … … 441 441 442 442 // 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); 444 444 if (iter != m_imageCache.end()) 445 445 { … … 528 528 529 529 // load the KML into this object 530 LoadKML(file_data, url_cstr);530 WrapKMLFile(LoadKML(file_data, url_cstr)); 531 531 } 532 532 CATCH_BLOCK_RET … … 563 563 __ensure_not_released(); 564 564 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(); 569 568 } 570 569 else … … 607 606 } 608 607 609 voidCLibkmlDataSource::LoadKML(std::string &kml, const char* path) // path may be a URL, if this was opened from a URL608 kmlengine::KmlFilePtr CLibkmlDataSource::LoadKML(std::string &kml, const char* path) // path may be a URL, if this was opened from a URL 610 609 { 611 610 // CreateFromParse creates some pseudo-memory leaks. These "leaks" do not grow and are not a problem. … … 652 651 // save the path to the file 653 652 654 if (m_kml_file_path)655 delete[] m_kml_file_path;656 657 653 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 659 void CLibkmlDataSource::WrapKMLFile(const kmlengine::KmlFilePtr& kml_file) 660 { 664 661 // wrap the root element (must be a data source type) 665 662 kmldom::ElementPtr root = kml_file->get_root(); … … 923 920 (*iter)->DataSourceChanged(); 924 921 } 925 catch ( ...)922 catch (_com_error& ) 926 923 { 927 924 std::string msg("an exception was caught in making a callback on IFvDataSourceCallback");
