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 ~DtPathPart() = default;
45  virtual PathPartType partType() { return UNKNOWN_PART; }
47  };
48 
49  class DtOnFeaturePart : public DtPathPart
50  {
51  public:
52  virtual PathPartType partType() override { return ON_FEATURE_PART; }
53 
54  std::vector<DtRailSegment> mySegments;
55  };
56 
58  {
59  public:
60  virtual PathPartType partType() override { return OFF_FEATURE_PART; }
61  std::vector<DtVector> myLocalLocations;
62  };
63 
64  class DtPartList
65  {
66  public:
67  virtual ~DtPartList();
68 
69  std::vector<DtPathPart*> myPartList;
70  };
71 
73 
75  static std::shared_ptr<DtLuaPathJob> Make(
77  DtString obstacleType,
78  DtString pathType,
79  const DtLocation3D& start,
80  const DtLocation3D& dest,
81  double buffer,
82  DtLocalObject* owningObject,
83  bool returnMultiPartPath = false,
84  bool adjustStartIfInObstacle = false);
85 
87  DtLuaPathJob();
88 
90  virtual ~DtLuaPathJob() override;
91 
93  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
94 
96  virtual luabind::object getDebugObject(lua_State* L) override { return luabind::newtable(L); }
97 
99  virtual void cancel(lua_State* L) override {};
100 
102  void addMessage(DtAlgorithmManager::Severity, std::string);
103 
106 
107  static DtAsciiSerializable* creator();
108 
110  virtual void setOwningObject(DtLocalObject* owningObject) override;
111 
112  virtual DtString serialize() override;
113  virtual bool deserialize(const DtString&) override;
114  virtual DtString objectType() const override;
115 
117 
120  void setWeightsFromObject(DtLocalObject* owningObject);
121 
122  std::shared_ptr<DtLuaPathJob> shared_from_this();
123  std::shared_ptr<const DtLuaPathJob> shared_from_this() const;
124 
125 
126 
127 
128 protected:
129  class PathTask;
130  friend class PathTask;
131 
134  DtLuaPathJob(
136  DtString obstacles,
137  DtString paths,
138  const DtLocation3D& start,
139  const DtLocation3D& dest,
140  double buffer,
141  bool returnMultiPartPath = false);
142 
144  DtLuaPathJob(
146  DtString obstacles,
147  DtString paths,
148  const DtLocation3D& start,
149  const DtLocation3D& dest,
150  double buffer,
152  const double offRoadPathWeight,
153  bool returnMultiPartPath = false);
154 
155  void start();
156  void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
157 
159  void taskComplete();
160 
161  typedef DtMutex Mutex;
162 
163  mutable Mutex myMutex;
164  std::string myObstaclesType;
165  std::string myPathType;
168  double myBuffer;
174 
176  std::shared_ptr<DtAsyncJobMapEntry> myJobEntry;
177  std::string myMessage;
182 };
std::string myObstaclesType
Definition: luaPathJob.h:164
bool myAdjustStartIfInObstacle
Definition: luaPathJob.h:181
virtual luabind::object getDebugObject(lua_State *L) override
Retrieve debug data, if available. Default return value is an empty table.
Definition: luaPathJob.h:96
Definition: luaPathJob.h:36
Definition: luaPathJob.h:37
Severity
Definition: algorithmManager.h:29
DtMutex Mutex
Definition: luaPathJob.h:161
virtual PathPartType partType() override
Definition: luaPathJob.h:60
Points myPoints
Definition: luaPathJob.h:171
Definition: asciiSerializable.h:42
Interface for getting asynchronously computed data into Lua.
Definition: luaAsyncJob.h:50
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:177
std::vector< DtRailSegment > mySegments
Definition: luaPathJob.h:54
virtual DtString serialize()=0
The following characters are reserved and cannot be used in serialization: &#39;|&#39;, &#39;:&#39;.
Definition: luaPathJob.h:57
std::vector< DtVector > myLocalLocations
Definition: luaPathJob.h:61
std::shared_ptr< DtAsyncJobMapEntry > myJobEntry
Definition: luaPathJob.h:176
Definition: luaPathJob.h:64
std::list< DtWeightFactor > DtWeightFactorsList
Definition: aStarGraph.h:268
virtual void setOwningObject(DtLocalObject *owningObject)
Called by framework when deserializing to inform of the owning object.
DtPartList myPathParts
DtRailSegmentList mySegmentList;.
Definition: luaPathJob.h:173
std::vector< DtLocation3D > Points
Definition: luaPathJob.h:28
virtual PathPartType partType() override
Definition: luaPathJob.h:52
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
Definition: luaPathJob.h:49
virtual void cancel(lua_State *L) override
Currently a no-op.
Definition: luaPathJob.h:99
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve current value.
std::string myPathType
Definition: luaPathJob.h:165
DtLocation3D myDest
Definition: luaPathJob.h:167
double myOffRoadPathWeight
Definition: luaPathJob.h:170
virtual PathPartType partType()
Definition: luaPathJob.h:45
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:97
Definition: luaPathJob.h:41
MAKVRinTerra::DtAStarGraph::DtWeightFactorsList myWeights
Definition: luaPathJob.h:169
bool myTaskComplete
Definition: luaPathJob.h:175
DtLocation3D myStart
Definition: luaPathJob.h:166
double myBuffer
Definition: luaPathJob.h:168
DtVector myLocalEndLocation
Definition: luaPathJob.h:46
bool myReturnMultiPartPath
If true, getObject fills out a multi part path. Otherwise, getObject just fills out a location list...
Definition: luaPathJob.h:180
Lua object class which represents a feature navigation task.
Definition: luaPathJob.h:25
Mutex myMutex
Definition: luaPathJob.h:163
std::vector< DtPathPart * > myPartList
Definition: luaPathJob.h:69
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 locally simulated VRF object.
Definition: localObject.h:98
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)