VR-Forces 4.5 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 #include "vrfutil/movementModes.h"
17 
18 #include <luabind/luabind.hpp>
19 
20 class DtSimManager;
21 class DtVrfObject;
22 
25 {
26 public:
27  typedef std::list<DtLocation3D> Points;
28 
30  DtLuaNavJob();
31 
33  ~DtLuaNavJob();
34 
36  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) = 0;
37 
39  virtual luabind::object getDebugObject(lua_State* L) { return luabind::newtable(L); };
40 
42  virtual void cancel(lua_State* L) {};
43 
45  void addMessage(DtAlgorithmManager::Severity, std::string);
46 
50 
51  virtual DtString serialize();
52  virtual bool deserialize(const DtString&);
53 
54  virtual DtString objectType() const = 0;
55 
56  //Tick the job.
57  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) = 0;
58 
59  virtual bool complete() = 0;
60 
61 protected:
62 
65  DtSimManager* mgr,
66  DtString navigationProfile,
67  DtLocation3D startPoint,
68  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
69  Points boundingArea = Points());
70 
71  //Initialize the job. This version must be called by derived start functions.
72  virtual void start();
73 
75  virtual void taskComplete() = 0;
76 
77  //Common parameters for nav jobs.
82 
83  std::string myMessage;
84 
86 };
87 
91 {
92 public:
93  static boost::shared_ptr<DtLuaNavRandomPointJob> Make(
94  DtSimManager* mgr,
95  DtString navigationProfile,
96  DtLocation3D startPoint,
97  double minDistanceFromStart,
98  double maxDistanceFromStart,
99  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
100  Points boundingArea = Points(),
101  int numberOfPoints = 1,
102  double minDistanceBetweenPoints = 0.0,
103  DtString placementRestriction = DtMovementModeFree,
104  bool isStrict = true,
105  bool tightlyPack = false,
106  bool needLos = false,
107  bool groundClamp = false,
108  Points leftOfLine = Points(),
109  DtVrfObject* parentObject = 0);
110 
113 
116 
118  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
119 
122  virtual luabind::object getDebugObject(lua_State* L);
123 
125  virtual void cancel(lua_State* L);
126 
130 
131  static DtAsciiSerializable* creator();
132 
133  //Returns LuaNavRandomPointJob
134  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
135 
136  //Initialize the job.
137  virtual void start();
138 
139  //Tick the job.
140  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
141 
142  //Returns true when the job is done.
143  virtual bool complete();
144 
146  virtual void taskComplete();
147 
148 protected:
149 
152  DtSimManager* mgr,
153  DtString navigationProfile,
154  DtLocation3D startPoint,
155  double minDistanceFromStart,
156  double maxDistanceFromStart,
157  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
158  Points boundingArea = Points(),
159  int numberOfPoints = 1,
160  double minDistanceBetweenPoints = 0.0,
161  DtString placementRestriction = DtMovementModeFree,
162  bool isStrict = true,
163  bool tightlyPack = false,
164  bool needLos = false,
165  bool groundClamp = false,
166  Points leftOfLine = Points(),
167  DtVrfObject* parentObject = 0);
168 
176  bool myNeedLos;
182 };
183 
186 {
187 public:
188  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
189  DtSimManager* mgr,
190  DtString navigationProfile,
191  DtLocation3D startPoint,
192  DtUUID hostUuid,
193  int navTag = -1);
194 
197 
200 
202  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
203 
207 
208  static DtAsciiSerializable* creator();
209 
210  //Returns LuaNavRandomPointJob
211  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
212 
213  //Initialize the job.
214  virtual void start();
215 
216  //Tick the job.
217  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
218 
219  //Returns true when the job is done.
220  virtual bool complete();
221 
223  virtual void taskComplete();
224 
225 protected:
226 
229  DtSimManager* mgr,
230  DtString navigationProfile,
231  DtLocation3D startPoint,
232  int navTag = -1);
233 
234  int myNavTag;
236 };
237 
239 {
240 public:
243  virtual void tick();
244  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
245 protected:
246  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
247 };

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)