Show
Ignore:
Timestamp:
03/05/10 14:16:21 (6 months ago)
Author:
gm78
Message:

Added threaded loading of KML images.

Files:
1 modified

Legend:

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

    r2277 r2279  
    3131#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." 
    3232#endif 
     33 
     34class CKMLImageDataResource; 
     35 
     36class CKmlImageCache 
     37{ 
     38   std::map<std::string, CKMLImageDataResource*> m_imageCache; 
     39    
     40public: 
     41   void Insert(const std::string& imageId, CKMLImageDataResource *pResource); 
     42   CKMLImageDataResource* Find(const std::string& imageId); 
     43   void Clear(); 
     44}; 
    3345 
    3446// CLibkmlDataSource 
     
    4456   public IDispatchImpl<IFvDataSourceEdit, &__uuidof(IFvDataSourceEdit), &LIBID_FvDataSourcesLib, /* wMajor = */ 1, /* wMinor = */ 0>, 
    4557   public IDispatchImpl<IUIState, &__uuidof(IUIState), &LIBID_FvDataSourcesLib, /* wMajor = */ 1, /* wMinor = */ 0>, 
     58   public IDispatchImpl<IFvDataSourceCallback, &__uuidof(IUIState), &LIBID_FvDataSourcesLib, /* wMajor = */ 1, /* wMinor = */ 0>, 
    4659   public CComErrorHandler 
    4760{ 
     
    7184   COM_INTERFACE_ENTRY(IRegionatedKMLContainer) 
    7285    COM_INTERFACE_ENTRY(IUIState) 
     86   COM_INTERFACE_ENTRY(IFvDataSourceCallback) 
    7387END_COM_MAP() 
    7488 
     
    88102      CInternalObjectRegistry::UnregisterObject(m_handle); 
    89103      m_b_objectFinalReleased = true; 
     104 
     105      m_imageCache.Clear(); 
    90106    } 
    91107 
     
    157173   STDMETHOD(raw_GetImageByIdentifier)(BSTR identifier, VARIANT* imageData); 
    158174 
     175   // IFvDataSourceCallback Methods 
     176public: 
     177   STDMETHOD(raw_DataSourceChanged)(); 
     178 
    159179   // IFvDataSourceEdit Methods 
    160180public: 
     
    185205   kmlengine::KmzFilePtr m_kmz_file; // populate this if KMZ 
    186206   ULONG m_internalRefs; 
    187    STRING_TO_VARIANT_MAP m_imageCache; 
     207   CKmlImageCache m_imageCache; 
    188208   DATA_SOURCE_CALLBACK_VECTOR m_callbacks; 
    189209   bool m_b_objectFinalReleased; 
     
    200220   static std::string s_dumpFile; 
    201221   static void MaybeDumpKML(std::string& kml); 
    202  
    203    static ULONG s_nextMemFile; 
    204222}; 
    205223