VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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"
16 #include "vrfutil/rwUUID.h"
17 #include "vrfutil/movementModes.h"
18 
19 #include <luabind/luabind.hpp>
20 
21 class DtSimManager;
22 class DtVrfObject;
23 class DtCoverPointFinder;
24 
27 {
28 public:
29  typedef std::list<DtLocation3D> Points;
30 
32  DtLuaNavJob();
33 
35  ~DtLuaNavJob();
36 
38  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) = 0;
39 
41  virtual luabind::object getDebugObject(lua_State* L) { return luabind::newtable(L); };
42 
44  virtual void cancel(lua_State* L) {};
45 
47  void addMessage(DtAlgorithmManager::Severity, std::string);
48 
52 
53  virtual DtString serialize();
54  virtual bool deserialize(const DtString&);
55 
56  virtual DtString objectType() const = 0;
57 
58  //Tick the job.
59  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) = 0;
60 
61  virtual bool complete() = 0;
62 
63 protected:
64 
67  DtSimManager* mgr,
68  DtString navigationProfile,
69  DtLocation3D startPoint,
70  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
71  Points boundingArea = Points());
72 
73  //Initialize the job. This version must be called by derived start functions.
74  virtual void start();
75 
77  virtual void taskComplete() = 0;
78 
79  //Common parameters for nav jobs.
84 
85  std::string myMessage;
86 
88 };
89 
93 {
94 public:
95  static boost::shared_ptr<DtLuaNavRandomPointJob> Make(
96  DtSimManager* mgr,
97  DtString navigationProfile,
98  DtLocation3D startPoint,
99  double minDistanceFromStart,
100  double maxDistanceFromStart,
101  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
102  Points boundingArea = Points(),
103  int numberOfPoints = 1,
104  double minDistanceBetweenPoints = 0.0,
105  DtString placementRestriction = DtMovementModeFree,
106  bool isStrict = true,
107  bool tightlyPack = false,
108  bool needLos = false,
109  bool groundClamp = false,
110  Points leftOfLine = Points(),
111  DtVrfObject* parentObject = 0);
112 
115 
118 
120  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
121 
124  virtual luabind::object getDebugObject(lua_State* L);
125 
127  virtual void cancel(lua_State* L);
128 
132 
133  static DtAsciiSerializable* creator();
134 
135  //Returns LuaNavRandomPointJob
136  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
137 
138  //Initialize the job.
139  virtual void start();
140 
141  //Tick the job.
142  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
143 
144  //Returns true when the job is done.
145  virtual bool complete();
146 
148  virtual void taskComplete();
149 
150 protected:
151 
154  DtSimManager* mgr,
155  DtString navigationProfile,
156  DtLocation3D startPoint,
157  double minDistanceFromStart,
158  double maxDistanceFromStart,
159  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
160  Points boundingArea = Points(),
161  int numberOfPoints = 1,
162  double minDistanceBetweenPoints = 0.0,
163  DtString placementRestriction = DtMovementModeFree,
164  bool isStrict = true,
165  bool tightlyPack = false,
166  bool needLos = false,
167  bool groundClamp = false,
168  Points leftOfLine = Points(),
169  DtVrfObject* parentObject = 0);
170 
178  bool myNeedLos;
184 };
185 
188 {
189 public:
190  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
191  DtSimManager* mgr,
192  DtString navigationProfile,
193  DtLocation3D startPoint,
194  DtUUID hostUuid,
195  int navTag = -1);
196 
199 
202 
204  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
205 
209 
210  static DtAsciiSerializable* creator();
211 
212  //Returns LuaNavRandomPointJob
213  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
214 
215  //Initialize the job.
216  virtual void start();
217 
218  //Tick the job.
219  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
220 
221  //Returns true when the job is done.
222  virtual bool complete();
223 
225  virtual void taskComplete();
226 
227 protected:
228 
231  DtSimManager* mgr,
232  DtString navigationProfile,
233  DtLocation3D startPoint,
234  int navTag = -1);
235 
236  int myNavTag;
238 };
239 
242 {
243 public:
244  static boost::shared_ptr<DtLuaNavCoverPointJob> Make(
245  DtSimManager* mgr,
246  DtString navigationProfile,
247  DtLocation3D startPoint,
248  DtLocation3D coverFromPoint,
249  double threatRadius,
250  double distanceFromThreat,
251  double range,
252  unsigned numberOfPoints);
253 
256 
259 
261  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
262 
266 
267  static DtAsciiSerializable* creator();
268 
269  //Returns LuaNavCoverPointJob
270  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
271 
272  //Initialize the job.
273  virtual void start();
274 
275  //Tick the job.
276  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
277 
278  //Returns true when the job is done.
279  virtual bool complete();
280 
282  virtual void taskComplete();
283 
284 protected:
285 
288  DtSimManager* mgr,
289  DtString navigationProfile,
290  DtLocation3D startPoint,
291  DtLocation3D threatPoint,
292  double threatRadius,
293  double distanceFromThreat,
294  double range,
295  unsigned numberOfPoints);
296 
299  double myRange;
301  std::set<DtCoverPoint> myResultPoints;
303 
304  boost::shared_ptr<DtCoverPointFinder> myPendingCoverPointFinder;
305 };
306 
309 {
310 public:
311  static boost::shared_ptr<DtLuaNavFindPathJob> Make(DtSimManager* mgr,
312  DtString navigationProfile,
313  DtLocation3D startPoint,
314  DtLocation3D endPoint,
315  bool useAbstractGraphs,
316  const DtLocation3D& avoidLocation, double avoidanceRadius);
317 
320 
323 
325  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
326 
330 
331  static DtAsciiSerializable* creator();
332 
333  //Returns LuaNavCoverPointJob
334  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
335 
336  //Initialize the job.
337  virtual void start();
338 
339  //Tick the job.
340  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
341 
342  //Returns true when the job is done.
343  virtual bool complete();
344 
346  virtual void taskComplete();
347 
348 protected:
349 
352  DtString navigationProfile,
353  DtLocation3D startPoint,
354  DtLocation3D endPoint,
355  bool useAbstractGraphs,
356  const DtLocation3D& avoidLocation, double avoidanceRadius);
357 
363 };
364 
366 {
367 public:
370  virtual void tick();
371  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
372 protected:
373  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
374 };

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)