VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
luaPathJob.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 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"
13 #include "vrfutil/railSegment.h"
14 
15 #include "vlutil/vlMutex.h"
16 
18 #include "features/pathPlanner.h"
19 #include "features/aStarGraph.h"
20 
22 class DtAsyncJobMapEntry;
23 
26 {
27 public:
28  typedef std::vector<DtLocation3D> Points;
29 
31 
34  typedef enum
35  {
38  UNKNOWN_PART
39  } PathPartType;
40 
41  class DtPathPart
42  {
43  public:
44  virtual PathPartType partType() { return UNKNOWN_PART; }
46  };
47 
48  class DtOnFeaturePart : public DtPathPart
49  {
50  public:
51  virtual PathPartType partType() override { return ON_FEATURE_PART; }
52 
53  std::vector<DtRailSegment> mySegments;
54  };
55 
57  {
58  public:
59  virtual PathPartType partType() override { return OFF_FEATURE_PART; }
60  std::vector<DtVector> myLocalLocations;
61  };
62 
63  class DtPartList
64  {
65  public:
66  virtual ~DtPartList();
67 
68  std::vector<DtPathPart*> myPartList;
69  };
70 
72 
76  static std::shared_ptr<DtLuaPathJob> Make(
78  DtString obstacleType,
79  DtString pathType,
80  const DtLocation3D& start,
81  const DtLocation3D& dest,
82  double buffer,
83  bool returnMultiPartPath = false);
84 
86  static std::shared_ptr<DtLuaPathJob> Make(
88  DtString obstacleType,
89  DtString pathType,
90  const DtLocation3D& start,
91  const DtLocation3D& dest,
92  double buffer,
94  const double offRoadPathWeight,
95  bool returnMultiPartPath = false);
96 
98  DtLuaPathJob();
99 
101  virtual ~DtLuaPathJob() override;
102 
104  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
105 
107  virtual luabind::object getDebugObject(lua_State* L) override { return luabind::newtable(L); }
108 
110  virtual void cancel(lua_State* L) override {};
111 
113  void addMessage(DtAlgorithmManager::Severity, std::string);
114 
117 
118  static DtAsciiSerializable* creator();
119 
120  virtual DtString serialize() override;
121  virtual bool deserialize(const DtString&) override;
122  virtual DtString objectType() const override;
123 
125 
126  std::shared_ptr<DtLuaPathJob> shared_from_this();
127  std::shared_ptr<const DtLuaPathJob> shared_from_this() const;
128 
129 protected:
130  class PathTask;
131  friend class PathTask;
132 
135  DtLuaPathJob(
137  DtString obstacles,
138  DtString paths,
139  const DtLocation3D& start,
140  const DtLocation3D& dest,
141  double buffer,
142  bool returnMultiPartPath = false);
143 
145  DtLuaPathJob(
147  DtString obstacles,
148  DtString paths,
149  const DtLocation3D& start,
150  const DtLocation3D& dest,
151  double buffer,
153  const double offRoadPathWeight,
154  bool returnMultiPartPath = false);
155 
156  void start();
157  void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
158 
160  void taskComplete();
161 
162  typedef DtMutex Mutex;
163 
164  mutable Mutex myMutex;
165  std::string myObstaclesType;
166  std::string myPathType;
169  double myBuffer;
175 
177  std::shared_ptr<DtAsyncJobMapEntry> myJobEntry;
178  std::string myMessage;
182 };
std::string myObstaclesType
Definition: luaPathJob.h:165
virtual luabind::object getDebugObject(lua_State *L) override
Retrieve debug data, if available. Default return value is an empty table.
Definition: luaPathJob.h:107
Definition: luaPathJob.h:36
Definition: luaPathJob.h:37
Severity
Definition: algorithmManager.h:29
DtMutex Mutex
Definition: luaPathJob.h:162
virtual PathPartType partType() override
Definition: luaPathJob.h:59
Points myPoints
Definition: luaPathJob.h:172
Definition: asciiSerializable.h:40
Interface for getting asynchronously computed data into Lua.
Definition: luaAsyncJob.h:27
virtual bool deserialize(const DtString &)=0
This function should take the string that was serialized via serialize() and fill this object with th...
std::string myMessage
Definition: luaPathJob.h:178
std::vector< DtRailSegment > mySegments
Definition: luaPathJob.h:53
virtual DtString serialize()=0
The following characters are reserved and cannot be used in serialization: &#39;|&#39;, &#39;:&#39;.
Definition: luaPathJob.h:56
std::vector< DtVector > myLocalLocations
Definition: luaPathJob.h:60
std::shared_ptr< DtAsyncJobMapEntry > myJobEntry
Definition: luaPathJob.h:177
Definition: luaPathJob.h:63
std::list< DtWeightFactor > DtWeightFactorsList
Definition: aStarGraph.h:229
DtPartList myPathParts
DtRailSegmentList mySegmentList;.
Definition: luaPathJob.h:174
std::vector< DtLocation3D > Points
Definition: luaPathJob.h:28
virtual PathPartType partType() override
Definition: luaPathJob.h:51
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
Definition: luaPathJob.h:48
virtual void cancel(lua_State *L) override
Currently a no-op.
Definition: luaPathJob.h:110
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve current value.
std::string myPathType
Definition: luaPathJob.h:166
DtLocation3D myDest
Definition: luaPathJob.h:168
double myOffRoadPathWeight
Definition: luaPathJob.h:171
virtual PathPartType partType()
Definition: luaPathJob.h:44
Handle to async job.
Definition: asyncJobMapEntry.h:29
virtual DtString objectType() const =0
Should return the string name of this object. The object name should not be part of the serialization...
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
Definition: luaPathJob.h:41
MAKVRinTerra::DtAStarGraph::DtWeightFactorsList myWeights
Definition: luaPathJob.h:170
bool myTaskComplete
Definition: luaPathJob.h:176
DtLocation3D myStart
Definition: luaPathJob.h:167
double myBuffer
Definition: luaPathJob.h:169
DtVector myLocalEndLocation
Definition: luaPathJob.h:45
bool myReturnMultiPartPath
If true, getObject fills out a multi part path. Otherwise, getObject just fills out a location list...
Definition: luaPathJob.h:181
Lua object class which represents a feature navigation task.
Definition: luaPathJob.h:25
Mutex myMutex
Definition: luaPathJob.h:164
std::vector< DtPathPart * > myPartList
Definition: luaPathJob.h:68
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
PathPartType
---—— Structures for returning multiPart Paths ——
Definition: luaPathJob.h:34
char * dest
Definition: lz4.h:440
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)