VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
aircraftClutterAreaController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 #include <vrfutil/adsbTrack.h>
12 
15 
19 {
20 public:
21 
22  using DtAddressList = std::list<DtAdsbDataServiceInterface::DtIcaoAddress>;
25  using DtBorderCrossing = std::pair<double, DtVector>;
26  using DtBorderCrossingList = std::vector<DtBorderCrossing>;
27  using DtTrackEventMap = std::multimap<double, DtAddress>;
28 
30  {
37  GeneralPhase
38  };
39 
42  DtSimulationServices* simManager, DtComponentDescriptor* desc=0, DtReaderWriterRegistry *parentRegistry=0);
43 
46 
48  virtual bool init() override;
49 
51  virtual bool postAddComponentsInit() override;
52 
54  virtual void preFirstTickInit() override;
55 
57  virtual const char* type() const override;
58 
60  virtual void registerTaskMsgCallbacks() override;
61 
63  virtual void tick() override;
64 
66  static void setMaxEntitiesCallback(DtSimMessage * msg, void * usr);
67  virtual void processSetMaxEntities(DtSimMessage* msg);
68 
70  static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
71  DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
72 
74  virtual bool taskVisualizationsActive() const override;
75 
76 protected:
77 
79  bool createPSR();
80 
82  virtual void requestPhaseTick();
83 
85  virtual void processTrackInfoPhaseTick();
86 
88  virtual void ownershipAcquisitionPhaseTick();
89 
91  virtual void creationPhaseTick();
92 
95  virtual void deletionPhaseTick();
96 
99  virtual void generalPhaseTick();
100 
102  virtual void requestTracksInArea();
103 
106  virtual bool processTrackAdditionEvents();
107 
110  virtual bool processTrackRemovalEvents();
111 
113  virtual void processTrackOwnershipResponse(const DtAddressSet& tracks);
114 
116  virtual void updateKnownTracks(const DtAddressSet& tracks);
117 
120  virtual void calculateAdditionAndRemovalTimes();
121 
124  virtual void calculateAddAndRemoveTimesForTrack(
125  const DtAddress trackId, const std::vector<DtVector>& areaWorldVertices,
126  const double requestPeriodEndSimTime);
127 
137  virtual void checkForAddAndRemoveEventsForPoint(
138  const DtAddress trackId,
139  const DtPointHandlePtr& pPtHandle,
140  const DtPointHandlePtr& pPreviousPtHandle,
141  const bool ignorePreviousPoint,
142  const std::vector<DtVector>& areaWorldVertices,
143  bool& isAlive
144  );
145 
151  virtual double calculateAdditionTimeAtPoint(
152  const DtAddress trackId,
153  const DtPointHandlePtr& pPtHandle,
154  const DtVector& ptLocalLocation,
155  const DtPointHandlePtr& pPreviousPtHandle,
156  const std::vector<DtVector>& areaWorldVertices,
157  const DtLocalVertexList& areaLocalVertices);
158 
164  virtual double calculateRemovalTimeAtPoint(const DtAddress trackId,
165  const DtPointHandlePtr& pPtHandle,
166  const DtVector& ptLocalLocation,
167  const bool isFlyingAtPt,
168  const DtPointHandlePtr& pPreviousPtHandle,
169  const std::vector<DtVector>& areaWorldVertices,
170  const DtLocalVertexList& areaLocalVertices);
171 
173  virtual bool requestTrackOwnership(DtAddressSet& tracks);
174 
176  virtual void releaseTrackOwnership(const DtAddressSet& tracks);
177 
179  virtual bool createEntitiesForTracks();
180 
183  virtual void overrideVisualMarkings(DtVrfLocalObjectCreateInformation& info, std::string iataCode = "Null");
184 
187  virtual void monitorNewEntities();
188 
190  virtual void processEntityDeleted(const DtSimObject* entity);
191 
193  virtual void processEntityPromoted(const DtSimObject* entity);
194 
196  void cleanupRemovedEntities();
197 
199  void recordPromotedEntities();
200 
202  virtual DtObjectType objectTypeForTrack(const DtTrackHandlePtr track) const;
203 
208  virtual std::string objectNameForTrack(const DtTrackHandlePtr track, const DtPointHandlePtr refPoint) const;
209 
214  virtual bool calculateTrackPositionAtTime(double simTime, const DtTrackHandlePtr track,
215  DtVector& worldLocation, double& heading, DtVector& velocity,
216  DtPointHandlePtr& previousPathPoint) const;
217 
222  virtual bool findLastBorderCrossingTime(const DtPointHandlePtr pt1,
223  const DtPointHandlePtr pt2, const std::vector<DtVector>& areaBorder,
224  const DtAdsbDataServiceInterface::DtIcaoAddress trackId, double& crossingTime);
225 
228  virtual bool locationNear2IsInside(const DtVector& location1, const DtVector& location2,
229  const DtLocalVertexList& areaVertices, Coordinate_System* coordSys);
230 
234  virtual void trackPositionAtPoint(const DtTrackHandlePtr track,
235  const DtPointHandlePtr point,
236  DtVector& worldLocation, double& heading, DtVector& worldVelocity) const;
237 
241  virtual void trackPositionOnGround(const DtPointHandlePtr point, DtVector& worldLocation,
242  double& heading, DtVector& worldVelocity) const;
243 
245  virtual void markAllEntitiesForDeletion();
246 
249  virtual void markEntitiesOutsideOfAreaForDeletion();
250 
253  virtual void markExcessEntitiesForDeletion();
254 
256  virtual void deleteMarkedEntities();
257 
259  virtual bool isTimeToRequestTracks(double simTime) const;
260 
262  virtual bool isTimeForTrackAdditionEvent(double simTime) const;
263 
265  virtual bool isTimeForTrackRemovalEvent(double simTime) const;
266 
268  virtual void logEntityCreationStatistics();
269 
271  virtual void updateTaskVisualizations() override;
272 
274  virtual void setPhase(ProcessingPhase);
275 
276 private:
283 
284 protected:
285 
287 
289 
291 
297 
301  std::list<DtUUID> myEntitiesToDelete;
302  std::list<DtUUID> myNewEntities;
303 
305 
306  tbb::spin_mutex myRemovedEntitiesMutex;
308 
309  tbb::spin_mutex myPromotedEntitiesMutex;
311 
315  mutable tbb::spin_mutex myExcludedModelsMutex;
316  mutable std::set<DtObjectType> excludedModels;
317 
318  using EntityDeletionSignalMap = std::map<DtAddress, boost::signals2::connection>;
320 
321  using EntityPromotedSignalMap = std::map<DtAddress, boost::signals2::connection>;
323 
327 
334 
338 
341  mutable std::vector<DtVector> myPreCreatePts;
342  mutable std::vector<DtVector> myPostCreatePts;
343  mutable std::vector<DtVector> myCreatePts;
344 
345  mutable std::vector<DtVector> myPreExitPts;
346  mutable std::vector<DtVector> myPostExitPts;
347  mutable std::vector<DtVector> myExitPts;
348 
349  mutable std::vector<DtVector> myPreEnterPts;
350  mutable std::vector<DtVector> myPostEnterPts;
351  mutable std::vector<DtVector> myEnterPts;
352 
354 };
355 
Definition: aircraftClutterAreaController.h:34
std::vector< DtBorderCrossing > DtBorderCrossingList
sim time and world location to cross a border
Definition: aircraftClutterAreaController.h:26
std::list< DtUUID > myEntitiesToDelete
Definition: aircraftClutterAreaController.h:301
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtAircraftClutterAreaController is a controller that runs on an area tactical graphic to create and m...
Definition: aircraftClutterAreaController.h:18
bool myIsProcessingInitialData
Indicates whether the calculateAdditionAndRemovalTimes function is looking at the first data that the...
Definition: aircraftClutterAreaController.h:333
Definition: aircraftClutterAreaController.h:31
bool myDebugEnabled
The following are for debug purposes only.
Definition: aircraftClutterAreaController.h:340
ProcessingPhase myPhase
Definition: aircraftClutterAreaController.h:328
virtual bool postAddComponentsInit() override
Calls enableTaskTypes()
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
Definition: aircraftClutterAreaController.h:32
std::map< DtAddress, boost::signals2::connection > EntityDeletionSignalMap
Definition: aircraftClutterAreaController.h:318
virtual void registerTaskMsgCallbacks()
DtAddressSet myKnownTracksToProcess
Definition: aircraftClutterAreaController.h:290
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
DtTrackEventMap myTrackAdditionTimes
Map of sim time to track ID. When to add or delete tracks.
Definition: aircraftClutterAreaController.h:294
DtTrackEventMap myDelayedAdditionTimes
Definition: aircraftClutterAreaController.h:296
The DtLocalObjectCreateInformation class is a subset of the information used in the DtIfCreateVrfObje...
Definition: vrfLocalObjectCreateInformation.h:26
virtual bool taskVisualizationsActive() const override
Returns true if task visualizations are currently active for this component. Default behavior for tas...
DtTrackEventMap myTrackRemovalTimes
Definition: aircraftClutterAreaController.h:295
std::vector< DtVector > myPreCreatePts
Definition: aircraftClutterAreaController.h:341
std::vector< DtVector > myEnterPts
Definition: aircraftClutterAreaController.h:351
DtAddressSet myTracksRequested
Definition: aircraftClutterAreaController.h:299
std::map< DtAddress, boost::signals2::connection > EntityPromotedSignalMap
Definition: aircraftClutterAreaController.h:321
DtAddressSet myPromotedEntities
Definition: aircraftClutterAreaController.h:310
std::vector< DtVector > myPostEnterPts
Definition: aircraftClutterAreaController.h:350
std::vector< DtVector > myPostCreatePts
Definition: aircraftClutterAreaController.h:342
DtAddressSet myRemovedEntities
Definition: aircraftClutterAreaController.h:307
Definition: objectType.h:27
std::vector< DtVector > myCreatePts
Definition: aircraftClutterAreaController.h:343
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:437
virtual bool init() override
Calls setRadio()
ProcessingPhase
Definition: aircraftClutterAreaController.h:29
Definition: coordSystem.h:54
DtAddressSet myTracksToRequest
Definition: aircraftClutterAreaController.h:298
std::list< DtAdsbDataServiceInterface::DtIcaoAddress > DtAddressList
Definition: aircraftClutterAreaController.h:22
std::shared_ptr< DtAdsbTrackHandle > DtTrackHandlePtr
Shared_ptr so that copy constructor will work on the pointer without destroying the rhs...
Definition: adsbDataServiceInterface.h:60
File: simMsg.h.
Definition: simMessage.h:35
DtAdsbDataServiceInterface::DtAdsbDataJob::Ptr myAdsbOwnershipReq
Definition: aircraftClutterAreaController.h:326
std::vector< DtVector > myExitPts
Definition: aircraftClutterAreaController.h:347
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
unsigned myNumberSkippedRecently
Definition: aircraftClutterAreaController.h:337
std::multimap< double, DtAddress > DtTrackEventMap
Definition: aircraftClutterAreaController.h:27
std::vector< DtVector > myPostExitPts
Definition: aircraftClutterAreaController.h:346
Definition: aircraftClutterAreaController.h:36
Definition: aircraftClutterAreaController.h:35
tbb::spin_mutex myPromotedEntitiesMutex
Definition: aircraftClutterAreaController.h:309
std::set< DtObjectType > excludedModels
Definition: aircraftClutterAreaController.h:316
tbb::spin_mutex myExcludedModelsMutex
A cache of object type patterns that are to be excluded. An empty set is also valid. This is compared against to limit the object types possible to be represented for a track.
Definition: aircraftClutterAreaController.h:315
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:94
std::set< DtIcaoAddress > DtIcaoAddrSet
Definition: adsbDataServiceInterface.h:127
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
DtAddressList myTracksToCreate
Definition: aircraftClutterAreaController.h:300
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:88
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
unsigned myNumberCreatedRecently
For logging purposes only.
Definition: aircraftClutterAreaController.h:336
EntityDeletionSignalMap myEntityDeletionSignals
Definition: aircraftClutterAreaController.h:319
Definition: aircraftClutterAreaController.h:33
std::shared_ptr< DtAdsbPathPointHandle > DtPointHandlePtr
Shared_ptr so that copy constructor will work on the pointer without destroying the rhs...
Definition: adsbDataServiceInterface.h:113
std::list< DtUUID > myNewEntities
Definition: aircraftClutterAreaController.h:302
DtAdsbDataServiceInterface::DtIcaoAddrSet DtAddressSet
Definition: aircraftClutterAreaController.h:23
std::pair< double, DtVector > DtBorderCrossing
Definition: aircraftClutterAreaController.h:25
std::shared_ptr< DtAdsbDataJob > Ptr
Definition: adsbDataServiceInterface.h:134
/******************************************************************************* ** Copyright (c) 202...
Definition: aircraftClutterAreaControllerDescriptor.h:19
DtAircraftClutterAreaPSR * myProcessState
Definition: aircraftClutterAreaController.h:288
DtTime myDataEndTime
Definition: aircraftClutterAreaController.h:304
DtAircraftClutterAreaControllerDescriptor * myAircraftClutterAreaDescriptor
Definition: aircraftClutterAreaController.h:286
class DtLocalVertexList:
Definition: localVertexList.h:20
bool myCreatingEntitiesFromSave
Definition: aircraftClutterAreaController.h:329
Instances of DtAircraftClutterAreaPSR are used to hold the checkpointable state data for the DtAircra...
Definition: aircraftClutterAreaPSR.h:15
std::vector< DtVector > myPreExitPts
Definition: aircraftClutterAreaController.h:345
std::vector< DtVector > myPreEnterPts
Definition: aircraftClutterAreaController.h:349
DtAdsbDataServiceInterface::DtAdsbDataJob::Ptr myAdsbTrackReq
Requests to the ADSB data manager.
Definition: aircraftClutterAreaController.h:325
int DtIcaoAddress
Definition: adsbDataServiceInterface.h:126
EntityPromotedSignalMap myEntityPromotedSignals
Definition: aircraftClutterAreaController.h:322
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
int myIcaoAddressToDebug
Definition: aircraftClutterAreaController.h:353
tbb::spin_mutex myRemovedEntitiesMutex
Definition: aircraftClutterAreaController.h:306

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)