VR-Forces 4.7 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  bool myRanOnce;
185 };
186 
189 {
190 public:
191  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
192  DtSimManager* mgr,
193  DtString navigationProfile,
194  DtLocation3D startPoint,
195  DtUUID hostUuid,
196  int navTag = -1);
197 
200 
203 
205  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
206 
210 
211  static DtAsciiSerializable* creator();
212 
213  //Returns LuaNavRandomPointJob
214  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
215 
216  //Initialize the job.
217  virtual void start();
218 
219  //Tick the job.
220  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
221 
222  //Returns true when the job is done.
223  virtual bool complete();
224 
226  virtual void taskComplete();
227 
228 protected:
229 
232  DtSimManager* mgr,
233  DtString navigationProfile,
234  DtLocation3D startPoint,
235  int navTag = -1);
236 
237  int myNavTag;
239 };
240 
243 {
244 public:
245  static boost::shared_ptr<DtLuaNavCoverPointJob> Make(
246  DtSimManager* mgr,
247  DtString navigationProfile,
248  DtLocation3D startPoint,
249  DtLocation3D coverFromPoint,
250  double threatRadius,
251  double distanceFromThreat,
252  double range,
253  unsigned numberOfPoints);
254 
257 
260 
262  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
263 
267 
268  static DtAsciiSerializable* creator();
269 
270  //Returns LuaNavCoverPointJob
271  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
272 
273  //Initialize the job.
274  virtual void start();
275 
276  //Tick the job.
277  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
278 
279  //Returns true when the job is done.
280  virtual bool complete();
281 
283  virtual void taskComplete();
284 
285 protected:
286 
289  DtSimManager* mgr,
290  DtString navigationProfile,
291  DtLocation3D startPoint,
292  DtLocation3D threatPoint,
293  double threatRadius,
294  double distanceFromThreat,
295  double range,
296  unsigned numberOfPoints);
297 
300  double myRange;
302  std::set<DtCoverPoint> myResultPoints;
304 
305  boost::shared_ptr<DtCoverPointFinder> myPendingCoverPointFinder;
306 };
307 
310 {
311 public:
312  static boost::shared_ptr<DtLuaNavFindPathJob> Make(DtSimManager* mgr,
313  DtString navigationProfile,
314  DtLocation3D startPoint,
315  DtLocation3D endPoint,
316  bool useAbstractGraphs,
317  const DtLocation3D& avoidLocation, double avoidanceRadius);
318 
321 
324 
326  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
327 
331 
332  static DtAsciiSerializable* creator();
333 
334  //Returns LuaNavCoverPointJob
335  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
336 
337  //Initialize the job.
338  virtual void start();
339 
340  //Tick the job.
341  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
342 
343  //Returns true when the job is done.
344  virtual bool complete();
345 
347  virtual void taskComplete();
348 
349 protected:
350 
353  DtString navigationProfile,
354  DtLocation3D startPoint,
355  DtLocation3D endPoint,
356  bool useAbstractGraphs,
357  const DtLocation3D& avoidLocation, double avoidanceRadius);
358 
364 };
365 
367 {
368 public:
371  virtual void tick();
372  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
373 protected:
374  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
375 };

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)