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 #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  Points leftOfLine = Points(),
108  DtVrfObject* parentObject = 0);
109 
112 
115 
117  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
118 
121  virtual luabind::object getDebugObject(lua_State* L);
122 
124  virtual void cancel(lua_State* L);
125 
129 
130  static DtAsciiSerializable* creator();
131 
132  //Returns LuaNavRandomPointJob
133  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
134 
135  //Initialize the job.
136  virtual void start();
137 
138  //Tick the job.
139  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
140 
141  //Returns true when the job is done.
142  virtual bool complete();
143 
145  virtual void taskComplete();
146 
147 protected:
148 
151  DtSimManager* mgr,
152  DtString navigationProfile,
153  DtLocation3D startPoint,
154  double minDistanceFromStart,
155  double maxDistanceFromStart,
156  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
157  Points boundingArea = Points(),
158  int numberOfPoints = 1,
159  double minDistanceBetweenPoints = 0.0,
160  DtString placementRestriction = DtMovementModeFree,
161  bool isStrict = true,
162  bool tightlyPack = false,
163  bool needLos = false,
164  Points leftOfLine = Points(),
165  DtVrfObject* parentObject = 0);
166 
174  bool myNeedLos;
179 };
180 
183 {
184 public:
185  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
186  DtSimManager* mgr,
187  DtString navigationProfile,
188  DtLocation3D startPoint,
189  DtUUID hostUuid,
190  int navTag = -1);
191 
194 
197 
199  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
200 
204 
205  static DtAsciiSerializable* creator();
206 
207  //Returns LuaNavRandomPointJob
208  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
209 
210  //Initialize the job.
211  virtual void start();
212 
213  //Tick the job.
214  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
215 
216  //Returns true when the job is done.
217  virtual bool complete();
218 
220  virtual void taskComplete();
221 
222 protected:
223 
226  DtSimManager* mgr,
227  DtString navigationProfile,
228  DtLocation3D startPoint,
229  int navTag = -1);
230 
231  int myNavTag;
233 };
234 
236 {
237 public:
240  virtual void tick();
241  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
242 protected:
243  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
244 };

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)