VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
luaNavJob.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include "vrfLua/vrfLuaDefines.h"
9 #include "vrfLua/luaAsyncJob.h"
10 #include "vrfutil/scriptGeometry.h"
14 #include "vrfNavigation/navArea.h"
15 #include "vrfutil/rwUUID.h"
16 
17 #include <luabind/luabind.hpp>
18 
19 class DtSimManager;
20 class DtVrfObject;
21 
24 {
25 public:
26  typedef std::list<DtLocation3D> Points;
27 
29  DtLuaNavJob();
30 
32  ~DtLuaNavJob();
33 
35  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) = 0;
36 
38  void addMessage(DtAlgorithmManager::Severity, std::string);
39 
43 
44  virtual DtString serialize();
45  virtual bool deserialize(const DtString&);
46 
47  virtual DtString objectType() const = 0;
48 
49  //Tick the job.
50  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) = 0;
51 
52  virtual bool complete() = 0;
53 
54 protected:
55 
58  DtSimManager* mgr,
59  DtString navigationProfile,
60  DtLocation3D startPoint,
61  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
62  Points boundingArea = Points());
63 
64  //Initialize the job. This version must be called by derived start functions.
65  virtual void start();
66 
68  virtual void taskComplete() = 0;
69 
70  //Common parameters for nav jobs.
75 
76  std::string myMessage;
77 
79 };
80 
84 {
85 public:
86  static boost::shared_ptr<DtLuaNavRandomPointJob> Make(
87  DtSimManager* mgr,
88  DtString navigationProfile,
89  DtLocation3D startPoint,
90  double maxDistanceFromStart,
91  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
92  Points boundingArea = Points(),
93  int numberOfPoints = 1,
94  double minDistanceBetweenPoints = 0.0,
95  DtVrfObject* parentObject = 0);
96 
99 
102 
104  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
105 
109 
110  static DtAsciiSerializable* creator();
111 
112  //Returns LuaNavRandomPointJob
113  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
114 
115  //Initialize the job.
116  virtual void start();
117 
118  //Tick the job.
119  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
120 
121  //Returns true when the job is done.
122  virtual bool complete();
123 
125  virtual void taskComplete();
126 
127 protected:
128 
131  DtSimManager* mgr,
132  DtString navigationProfile,
133  DtLocation3D startPoint,
134  double maxDistanceFromStart,
135  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
136  Points boundingArea = Points(),
137  int numberOfPoints = 1,
138  double minDistanceBetweenPoints = 0.0,
139  DtVrfObject* parentObject = 0);
140 
146 };
147 
150 {
151 public:
152  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
153  DtSimManager* mgr,
154  DtString navigationProfile,
155  DtLocation3D startPoint,
156  DtUUID hostUuid,
157  int navTag = -1);
158 
161 
164 
166  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
167 
171 
172  static DtAsciiSerializable* creator();
173 
174  //Returns LuaNavRandomPointJob
175  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
176 
177  //Initialize the job.
178  virtual void start();
179 
180  //Tick the job.
181  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
182 
183  //Returns true when the job is done.
184  virtual bool complete();
185 
187  virtual void taskComplete();
188 
189 protected:
190 
193  DtSimManager* mgr,
194  DtString navigationProfile,
195  DtLocation3D startPoint,
196  int navTag = -1);
197 
198  int myNavTag;
200 };
201 
203 {
204 public:
207  virtual void tick();
208  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
209 protected:
210  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
211 };

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)