All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MapsceneService.h
1 // Copyright eeGeo Ltd (2012-2017), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IMapsceneService.h"
6 #include "Mapscenes.h"
7 #include "Web.h"
8 #include "CallbackCollection.h"
9 #include "WebLoadRequestCompletionCallback.h"
10 #include "MapsceneRequestIdGenerator.h"
11 #include <map>
12 #include <string>
13 
14 
15 namespace Eegeo
16 {
17  namespace Mapscenes
18  {
20  {
21  public:
22 
24  MapsceneApplier& mapsceneApplier);
25  ~MapsceneService();
26 
27  MapsceneRequestId LoadMapscene(
28  const std::string& urlOrShortlink,
29  bool applyMapsceneOnSuccess);
30 
31  void CancelRequest(MapsceneRequestId requestId);
32 
33  void RegisterRequestCompletedCallback(MapsceneRequestCompletedCallback& callback);
34  void UnregisterRequestCompletedCallback(MapsceneRequestCompletedCallback& callback);
35 
36  private:
37 
38  struct MapsceneRequest
39  {
40  public:
41 
42  MapsceneRequest(Web::IWebLoadRequest* pWebRequest,
43  bool shouldApplyOnSuccess)
44  : pWebRequest(pWebRequest)
45  , shouldApplyOnSuccess(shouldApplyOnSuccess)
46  {
47  }
48 
49  Web::IWebLoadRequest* pWebRequest;
50  bool shouldApplyOnSuccess;
51  };
52 
53 
54  void OnRequestComplete(Web::IWebResponse& webResponse);
55 
56  Web::IWebLoadRequestFactory& m_webRequestFactory;
57  MapsceneApplier& m_mapsceneApplier;
59  MapsceneRequestIdGenerator m_requestIdGenerator;
60  std::map<MapsceneRequestId, MapsceneRequest> m_requestsMap;
62  };
63  }
64 
65 }