All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BuildRouteWorkItem.h
1 // Copyright eeGeo Ltd (2016), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Routes.h"
6 #include "RouteStyle.h"
7 #include "RouteVertex.h"
8 #include "ClippedRoute.h"
9 #include "WorkItem.h"
10 #include "Helpers.h"
11 #include "PendingWorkItemContainer.h"
12 
13 #include <string>
14 #include <vector>
15 
16 
17 namespace Eegeo
18 {
19  namespace Routes
20  {
21  namespace Webservice
22  {
24  {
25  private:
26 
27  struct BuiltRoute
28  {
29  Routes::Clipping::ClippedRoute clippedRoute;
30  std::vector<Routes::RouteVertex> routeVertices;
31  };
32 
33 
34 
35  std::string m_json;
36  long long m_start;
37 
38  // only accessed on main thread
39  Routes::RouteService& m_routeService;
40  // only accessed on main thread
42 
43  std::vector<BuiltRoute> m_builtRoutes;
44 
45  Eegeo::Concurrency::PendingWorkItemContainer* m_pPendingWorkItemContainer;
46 
47  BuiltRoute BuildRoute(const RouteData& route) const;
48  Eegeo::v4 m_color;
49 
50  public:
51 
52  BuildRouteWorkItem(const std::string& m_json,
53  Routes::RouteService& routeService,
54  const Eegeo::Routes::Style::RouteStyle& routeStyle);
55 
56  BuildRouteWorkItem(const std::string& m_json,
57  Routes::RouteService& routeService,
58  const Eegeo::Routes::Style::RouteStyle& routeStyle,
59  Eegeo::Concurrency::PendingWorkItemContainer* pPendingWorkItemContainer);
60 
61  void SetColor(Eegeo::v4 color);
62 
63  virtual ~BuildRouteWorkItem() {}
64 
65  void DoWork();
66 
67  void DoFinalizeOnMainThread();
68  };
69  }
70  }
71 }