Changeset 2306

Show
Ignore:
Timestamp:
03/09/10 13:44:09 (5 months ago)
Author:
JO94
Message:

added dumping to debug KML file when network links loaded

Location:
FalconView/trunk/public/fvw_core/GeodataDataSources
Files:
3 modified

Legend:

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

    r2286 r2306  
    2121      WriteToLogFile(_bstr_t(msg.c_str())); 
    2222   } 
     23 
     24   CLibkmlDataSource::MaybeDumpKML(kml_data); 
    2325 
    2426   std::string errors; 
  • FalconView/trunk/public/fvw_core/GeodataDataSources/LibkmlDataSource.cpp

    r2279 r2306  
    591591      if (s_dumpFile.length() > 0) 
    592592      { 
    593          // dump kml to a file 
    594          std::ofstream f(s_dumpFile.c_str(), std::ios::app); 
    595          f << kml << "\n\n********\n\n"; 
    596          f.close(); 
     593         std::string todump = kml; 
     594 
     595         // if this is KMZ, unpack it 
     596         if (kmlengine::KmzFile::IsKmz(kml)) 
     597         { 
     598            kmlengine::KmzFilePtr kmz_file = kmlengine::KmzFile::OpenFromString(kml); 
     599            ASSERT(kmz_file); 
     600            bool b = kmz_file->ReadKml(&todump); 
     601            ASSERT(b); 
     602         } 
     603 
     604           // make sure only one person writing to the file at a time 
     605           HANDLE h = ::CreateMutexW(NULL, false, L"MaybeDumpKMLSem"); 
     606         if (h == NULL) 
     607         { 
     608            //DWORD rc = GetLastError(); 
     609            ASSERT(0); 
     610         } 
     611           DWORD d = ::WaitForSingleObject(h, INFINITE); 
     612           _ASSERT(d == WAIT_OBJECT_0); 
     613 
     614         try 
     615         { 
     616            // dump kml to a file 
     617            std::ofstream f(s_dumpFile.c_str(), std::ios::app); 
     618            f << todump << "\n\n********\n\n"; 
     619            f.close(); 
     620         } 
     621         catch (...) { } // rare exception to rule about ignoring exceptions 
     622 
     623         // release mutex 
     624         ::ReleaseMutex(h); 
     625           ::CloseHandle(h); 
    597626      } 
    598627   } 
  • FalconView/trunk/public/fvw_core/GeodataDataSources/LibkmlDataSource.h

    r2279 r2306  
    130130   static kmldom::GeometryPtr WrapGeometryInGeometry(IGeometry* geometry, kmldom::KmlFactory* factory); 
    131131   static kmldom::PlacemarkPtr WrapFeatureInPlacemark(IFeature* feature, kmldom::KmlFactory* factory); 
     132   static void MaybeDumpKML(std::string& kml); 
    132133 
    133134   static void FireDataSourceChanged(LONG sourceHandle); 
     
    219220   static BOOL s_bEnvironmentTested; 
    220221   static std::string s_dumpFile; 
    221    static void MaybeDumpKML(std::string& kml); 
    222222}; 
    223223