VR-Forces 4.8 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  const 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  const 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  unsigned int queryQueuePriority);
255 
258 
261 
263  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
264 
268 
269  static DtAsciiSerializable* creator();
270 
271  //Returns LuaNavCoverPointJob
272  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
273 
274  //Initialize the job.
275  virtual void start();
276 
277  //Tick the job.
278  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
279 
280  //Returns true when the job is done.
281  virtual bool complete();
282 
284  virtual void taskComplete();
285 
286 protected:
287 
290  DtSimManager* mgr,
291  DtString navigationProfile,
292  DtLocation3D startPoint,
293  DtLocation3D threatPoint,
294  double threatRadius,
295  double distanceFromThreat,
296  double range,
297  unsigned numberOfPoints,
298  unsigned int queryQueuePriority);
299 
302  double myRange;
304  std::set<DtCoverPoint> myResultPoints;
307 
308  boost::shared_ptr<DtCoverPointFinder> myPendingCoverPointFinder;
309 };
310 
313 {
314 public:
315  static boost::shared_ptr<DtLuaNavFindPathJob> Make(DtSimManager* mgr,
316  DtString navigationProfile,
317  DtLocation3D startPoint,
318  DtLocation3D endPoint,
319  bool useAbstractGraphs,
320  const DtLocation3D& avoidLocation, double avoidanceRadius);
321 
324 
327 
329  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
330 
334 
335  static DtAsciiSerializable* creator();
336 
337  //Returns LuaNavCoverPointJob
338  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
339 
340  //Initialize the job.
341  virtual void start();
342 
343  //Tick the job.
344  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
345 
346  //Returns true when the job is done.
347  virtual bool complete();
348 
350  virtual void taskComplete();
351 
352 protected:
353 
356  DtString navigationProfile,
357  DtLocation3D startPoint,
358  DtLocation3D endPoint,
359  bool useAbstractGraphs,
360  const DtLocation3D& avoidLocation, double avoidanceRadius);
361 
367 };
368 
370 {
371 public:
374  virtual void tick();
375  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
376 protected:
377  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
378 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:222
const DtString DtLuaNavCoverPointJobType
Definition: asciiSerializable.h:23
const char DtMovementModeFree[]
Definition: movementModes.h:11
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
int myNavTag
Definition: luaNavJob.h:237
Severity
Definition: algorithmManager.h:29
virtual void addJob(boost::shared_ptr< DtLuaNavJob > job)
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:188
double myMinDistanceBetweenPoints
Definition: luaNavJob.h:174
bool myRanOnce
Definition: luaNavJob.h:184
DtLocation3D myThreatPoint
Definition: luaNavJob.h:303
std::list< DtLocation3D > Points
Definition: luaNavJob.h:29
Lua object class which finds a path to the specified location.
Definition: luaNavJob.h:312
virtual void run(const DtAlgorithmManager &mgr=DtAlgorithmManager())=0
unsigned myQueryQueuePriority
Definition: luaNavJob.h:306
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:26
bool myIsStrict
Definition: luaNavJob.h:176
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve value.
Points myPathPoints
Definition: luaNavJob.h:363
Definition: asciiSerializable.h:33
Interface for getting asynchronously computed data into Lua.
Definition: luaAsyncJob.h:29
virtual bool deserialize(const DtString &)=0
This function should take the string that was serialized via serialize() and fill this object with th...
unsigned myNumberOfPoints
Definition: luaNavJob.h:305
int myNumberOfPoints
Definition: luaNavJob.h:171
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:136
boost::shared_ptr< DtCoverPointFinder > myPendingCoverPointFinder
Definition: luaNavJob.h:308
std::list< boost::shared_ptr< DtLuaNavJob > > myJobs
Definition: luaNavJob.h:377
virtual void taskComplete()=0
Called by task object whenever it is done.
virtual DtString serialize()=0
The following characters are reserved and cannot be used in serialization: &#39;|&#39;, &#39;:&#39;.
const DtVrfObject * myParentObject
Definition: luaNavJob.h:183
double myAvoidanceRadius
Definition: luaNavJob.h:366
virtual void start()
double myThreatRadius
Definition: luaNavJob.h:300
virtual void cancel(lua_State *L)
Cancels the job. By default this is a no-op, we let the job finish on its own.
Definition: luaNavJob.h:44
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:338
DtLocation3D myStartPoint
Definition: luaNavJob.h:81
Points myBoundingArea
Definition: luaNavJob.h:83
std::set< DtCoverPoint > myResultPoints
Definition: luaNavJob.h:304
DtLocation3D myEndPoint
Definition: luaNavJob.h:362
Definition: asyncJobServer.h:37
DtLocation3D myAvoidLocation
Definition: luaNavJob.h:365
Lua object class for finding random points within a nav area.
Definition: luaNavJob.h:92
double myMinDistanceFromStart
Definition: luaNavJob.h:172
bool myUseAbstractGraphs
Definition: luaNavJob.h:364
DtLocation3D myResultPoint
Definition: luaNavJob.h:238
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
Lua object class which finds a cover point from the specified location.
Definition: luaNavJob.h:242
const DtString DtLuaNavRandomPointJobType
Definition: asciiSerializable.h:22
double myMaxDistanceFromStart
Definition: luaNavJob.h:173
std::string myMessage
Definition: luaNavJob.h:85
DtLocation3D myAccessPoint
Definition: luaNavJob.h:82
boost::shared_ptr< DtNavAreaQuery > Ptr
Definition: navArea.h:59
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve current value.
double myRange
Definition: luaNavJob.h:302
Points myResultPoints
Definition: luaNavJob.h:181
virtual DtString objectType() const =0
Should return the string name of this object.
bool myTightlyPack
Definition: luaNavJob.h:177
double myDistanceFromThreat
Definition: luaNavJob.h:301
bool myNeedLos
Definition: luaNavJob.h:178
virtual void tick()
bool myGroundClamp
Definition: luaNavJob.h:179
virtual luabind::object getDebugObject(lua_State *L)
Retrieve debug data, if available. Default behavior is an empty table.
Definition: luaNavJob.h:41
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:102
Points myLeftOfLine
Definition: luaNavJob.h:180
DtString myNavigationProfile
Definition: luaNavJob.h:80
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:272
DtNavAreaQuery::Ptr myQuery
Definition: luaNavJob.h:87
Definition: luaNavJob.h:369
Points myDebugPoints
Definition: luaNavJob.h:182
virtual DtString objectType() const
Should return the string name of this object.
Definition: luaNavJob.h:214
Used to find the best cover point(s) to take cover from attacker at a specified location.
Definition: coverPointFinder.h:36
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
virtual bool complete()=0
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22
DtString myPlacementRestriction
Definition: luaNavJob.h:175

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)