VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
shipClutterAreaController.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/aisTrack.h>
12 
15 
19 {
20 public:
21 
22  using DtMmsiList = std::list<DtAisDataServiceInterface::DtMmsi>;
25  using DtBorderCrossing = std::pair<double, DtVector>;
26  using DtBorderCrossingList = std::vector<DtBorderCrossing>;
27  using DtTrackEventMap = std::multimap<double, DtMmsi>;
28 
30  {
38  GeneralPhase
39  };
40 
43  DtSimulationServices* simManager, DtComponentDescriptor* desc=0, DtReaderWriterRegistry *parentRegistry=0);
44 
46  virtual ~DtShipClutterAreaController() override;
47 
49  virtual bool init() override;
50 
52  virtual bool postAddComponentsInit() override;
53 
55  virtual void preFirstTickInit() override;
56 
58  virtual const char* type() const override;
59 
61  virtual void registerTaskMsgCallbacks() override;
62 
64  virtual void tick() override;
65 
67  static void setMaxEntitiesCallback(DtSimMessage * msg, void * usr);
68  virtual void processSetMaxEntities(DtSimMessage* msg);
69 
71  static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
72  DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
73 
75  virtual bool taskVisualizationsActive() const override;
76 
77 protected:
78 
80  bool createPSR();
81 
83  virtual void requestPhaseTick();
84 
86  virtual void processTrackInfoPhaseTick();
87 
89  virtual void ownershipAcquisitionPhaseTick();
90 
92  virtual void creationPhaseTick();
93 
96  virtual void deletionPhaseTick();
97 
100  virtual void generalPhaseTick();
101 
103  virtual void requestTracksInArea();
104 
107  virtual bool processTrackAdditionEvents();
108 
111  virtual bool processTrackRemovalEvents();
112 
114  virtual void processTrackOwnershipResponse(const DtMmsiSet& tracks);
115 
117  virtual void updateKnownTracks(const DtMmsiSet& tracks);
118 
121  virtual void calculateAdditionAndRemovalTimes();
122 
124  virtual bool requestTrackOwnership(DtMmsiSet& tracks);
125 
127  virtual void releaseTrackOwnership(const DtMmsiSet& tracks);
128 
130  virtual bool createEntitiesForTracks();
131 
134  virtual void monitorNewEntities();
135 
137  virtual void processEntityDeleted(const DtSimObject* entity);
138 
140  virtual void processEntityPromoted(const DtSimObject* entity);
141 
143  void cleanupRemovedEntities();
144 
146  void recordPromotedEntities();
147 
149  virtual DtEntityType objectTypeForTrack(const DtAisTrack& track) const;
150 
155  virtual bool calculateTrackPositionAtTime(double simTime, const DtAisTrack& track,
156  DtVector& worldLocation, double& heading, DtVector& velocity,
157  const DtPathPoint** previousPathPoint) const;
158 
160  virtual bool findLastBorderCrossingTime(
161  const DtPathPoint& pt1, const DtPathPoint& pt2,
162  std::vector<DtVector>& areaBorder,
163  const DtMmsi trackId, double& crossingTime);
164 
166  virtual bool locationNear2IsInside(const DtVector& location1,
167  const DtVector& location2,
168  const DtLocalVertexList& areaVertices, Coordinate_System* coordSys);
169 
170 
174  virtual void trackPositionAtPoint(const DtAisTrack& track,
175  const DtAisPathPointMap::const_iterator point,
176  DtVector& worldLocation, double& heading, DtVector& worldVelocity) const;
177 
185  virtual bool approximateBorderCrossings(double startTime, const DtVector& startLocation,
186  double endTime, const DtVector& endLocation, std::vector<DtVector>& areaBorder,
187  DtBorderCrossingList& borderLocations) const;
188 
190  virtual void markAllEntitiesForDeletion();
191 
194  virtual void markEntitiesOutsideOfAreaForDeletion();
195 
198  virtual void markExcessEntitiesForDeletion();
199 
201  virtual void deleteMarkedEntities();
202 
204  virtual bool isTimeToRequestTracks(double simTime) const;
205 
207  virtual bool isTimeForTrackAdditionEvent(double simTime) const;
208 
210  virtual bool isTimeForTrackRemovalEvent(double simTime) const;
211 
213  virtual void logEntityCreationStatistics();
214 
216  virtual void updateTaskVisualizations() override;
217 
219  virtual void setPhase(ProcessingPhase);
220 
221 private:
228 
229 protected:
230 
232 
234 
242  std::list<DtUUID> myEntitiesToDelete;
243  std::list<DtUUID> myNewEntities;
244 
246 
247  tbb::spin_mutex myRemovedEntitiesMutex;
249 
250  tbb::spin_mutex myPromotedEntitiesMutex;
252 
256  mutable tbb::spin_mutex myExcludedModelsMutex;
257  mutable std::set<DtEntityType> excludedModels;
258 
259  using EntityDeletionSignalMap = std::map<DtMmsi, boost::signals2::connection>;
261 
262  using EntityPromotedSignalMap = std::map<DtMmsi, boost::signals2::connection>;
264 
268 
271 
275 
278  mutable std::vector<DtVector> myPreCreatePts;
279  mutable std::vector<DtVector> myPostCreatePts;
280  mutable std::vector<DtVector> myCreatePts;
281 
282  mutable std::vector<DtVector> myPreExitPts;
283  mutable std::vector<DtVector> myPostExitPts;
284  mutable std::vector<DtVector> myExitPts;
285 
286  mutable std::vector<DtVector> myPreEnterPts;
287  mutable std::vector<DtVector> myPostEnterPts;
288  mutable std::vector<DtVector> myEnterPts;
289 };
290 
std::vector< DtVector > myPreCreatePts
Definition: shipClutterAreaController.h:278
Instances of DtShipClutterAreaPSR are used to hold the checkpointable state data for the DtShipClutte...
Definition: shipClutterAreaPSR.h:15
DtMmsiSet myRemovedEntities
Definition: shipClutterAreaController.h:248
Definition: shipClutterAreaController.h:35
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
bool myDebugEnabled
The following are for debug purposes only.
Definition: shipClutterAreaController.h:277
Definition: shipClutterAreaController.h:33
DtTrackEventMap myTrackAdditionTimes
Definition: shipClutterAreaController.h:236
unsigned myNumberSkippedRecently
Definition: shipClutterAreaController.h:274
DtTime myDataEndTime
Definition: shipClutterAreaController.h:245
DtAisDataServiceInterface::DtMmsiSet DtMmsiSet
Definition: shipClutterAreaController.h:23
std::vector< DtVector > myPostEnterPts
Definition: shipClutterAreaController.h:287
Definition: shipClutterAreaController.h:37
virtual bool postAddComponentsInit() override
Calls enableTaskTypes()
Definition: shipClutterAreaController.h:32
int DtMmsi
Definition: aisDataServiceInterface.h:33
DtAisDataServiceInterface::DtAisDataJob::Ptr myAisOwnershipReq
Definition: shipClutterAreaController.h:267
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
std::vector< DtVector > myExitPts
Definition: shipClutterAreaController.h:284
virtual void registerTaskMsgCallbacks()
std::list< DtAisDataServiceInterface::DtMmsi > DtMmsiList
Definition: shipClutterAreaController.h:22
std::multimap< double, DtMmsi > DtTrackEventMap
Definition: shipClutterAreaController.h:27
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
std::map< DtMmsi, boost::signals2::connection > EntityDeletionSignalMap
Definition: shipClutterAreaController.h:259
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
DtShipClutterAreaPSR * myProcessState
Definition: shipClutterAreaController.h:233
This class hold ship data that is obtained from AIS messages. It is generated initially by the proces...
Definition: aisTrack.h:24
tbb::spin_mutex myPromotedEntitiesMutex
Definition: shipClutterAreaController.h:250
ProcessingPhase
Definition: shipClutterAreaController.h:29
virtual bool taskVisualizationsActive() const override
Returns true if task visualizations are currently active for this component. Default behavior for tas...
DtAisDataServiceInterface::DtAisDataJob::Ptr myAisTrackReq
Requests to the AIS data manager.
Definition: shipClutterAreaController.h:266
DtMmsiSet myPromotedEntities
Definition: shipClutterAreaController.h:251
EntityDeletionSignalMap myEntityDeletionSignals
Definition: shipClutterAreaController.h:260
std::set< DtMmsi > DtMmsiSet
Definition: aisDataServiceInterface.h:34
std::vector< DtVector > myPostExitPts
Definition: shipClutterAreaController.h:283
std::vector< DtVector > myPreExitPts
Definition: shipClutterAreaController.h:282
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:443
virtual bool init() override
Calls setRadio()
std::shared_ptr< DtAisDataJob > Ptr
Definition: aisDataServiceInterface.h:43
tbb::spin_mutex myRemovedEntitiesMutex
Definition: shipClutterAreaController.h:247
Definition: coordSystem.h:54
std::pair< double, DtVector > DtBorderCrossing
Definition: shipClutterAreaController.h:25
File: simMsg.h.
Definition: simMessage.h:35
Class definition for one track created from AIS messages, i.e. the identifying information and time-s...
Definition: aisTrack.h:60
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
Definition: shipClutterAreaController.h:34
std::set< DtEntityType > excludedModels
Definition: shipClutterAreaController.h:257
ProcessingPhase myPhase
Definition: shipClutterAreaController.h:269
std::list< DtUUID > myEntitiesToDelete
Definition: shipClutterAreaController.h:242
DtMmsiList myKnownTracksToProcess
Definition: shipClutterAreaController.h:235
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
DtMmsiList myTracksToCreate
Definition: shipClutterAreaController.h:241
DtMmsiSet myTracksToRequest
Definition: shipClutterAreaController.h:239
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:80
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
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: shipClutterAreaController.h:256
std::vector< DtVector > myCreatePts
Definition: shipClutterAreaController.h:280
std::vector< DtVector > myPostCreatePts
Definition: shipClutterAreaController.h:279
std::list< DtUUID > myNewEntities
Definition: shipClutterAreaController.h:243
/******************************************************************************* ** Copyright (c) 202...
Definition: shipClutterAreaControllerDescriptor.h:18
DtTrackEventMap myDelayedAdditionTimes
Definition: shipClutterAreaController.h:238
bool myCreatingEntitiesFromSave
Definition: shipClutterAreaController.h:270
Definition: shipClutterAreaController.h:31
Definition: shipClutterAreaController.h:36
DtMmsiSet myTracksRequested
Definition: shipClutterAreaController.h:240
DtShipClutterAreaController is a controller that runs on an area tactical graphic to create and manag...
Definition: shipClutterAreaController.h:18
DtShipClutterAreaControllerDescriptor * myShipClutterAreaDescriptor
Definition: shipClutterAreaController.h:231
EntityPromotedSignalMap myEntityPromotedSignals
Definition: shipClutterAreaController.h:263
class DtLocalVertexList:
Definition: localVertexList.h:20
std::vector< DtVector > myEnterPts
Definition: shipClutterAreaController.h:288
std::vector< DtBorderCrossing > DtBorderCrossingList
sim time and world location to cross a border
Definition: shipClutterAreaController.h:26
DtTrackEventMap myTrackRemovalTimes
Definition: shipClutterAreaController.h:237
std::map< DtMmsi, boost::signals2::connection > EntityPromotedSignalMap
Definition: shipClutterAreaController.h:262
A locally simulated VRF object.
Definition: localObject.h:98
std::vector< DtVector > myPreEnterPts
Definition: shipClutterAreaController.h:286
unsigned myNumberCreatedRecently
For logging purposes only.
Definition: shipClutterAreaController.h:273

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)