VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfStateViewCollectionManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include <vlutil/vlExceptions.h>
14 
15 #include <vrfGuiCore/vrfGuiCore.h>
19 #include <vrfGuiCore/orbatState.h>
21 #include <vrfutil/rwUUID.h>
24 #include <vrvUtil/signalslib.h>
25 
26 #include <vrvCore/DtElementEntry.h>
28 #include <vrvCore/DtEntityState.h>
30 #include <vrvCore/DtElementData.h>
31 
32 
33 #include <boost/function.hpp>
34 #include <boost/unordered_set.hpp>
35 
36 namespace makVrv
37 {
38  class DtDe;
39 }
40 
41 namespace makVrf
42 {
43  class DtVrfSelectionFilter;
44  class DtVrfGuiOrbatManager;
45 
46  class DtAggregateStateViewCollection;
47  class DtPropulsionNoiseStateDataViewCollection;
48  class DtIffStateDataViewCollection;
49  class DtEmitterSystemStateViewCollection;
50  class DtWeatherStateViewCollection;
51  class DtCloudLayerStateViewCollection;
52  class DtEnvironmentStateViewCollection;
53  class DtActiveSonarStateViewCollection;
54  class DtLaserDesignatorStateViewCollection;
56 
57  typedef boost::function<int (const DtEntityType&)> DtMaxMarkingTextLengthFunction;
58 
61  {
62  public:
64  DtStateViewMarkingTextProvider(const DtStateViewMarkingTextProvider& orig) : myStateView(orig.myStateView) {};
66  virtual DtString markingText() { return myStateView->state().myMarkingText.c_str(); };
67  virtual DtUUIDMarkingTextProvider* clone() const { return new DtStateViewMarkingTextProvider(*this); };
68 
69  operator DtString () { return markingText(); };
70 
71  protected:
73  };
74 
77  : public makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedEntityState>
78  {
79  public:
81  : makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedEntityState>(
82  de, makVrv::DtSimEntryUpdater::NoUpdates)
83  {
84  }
85  };
86 
91  : public makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>
92  {
93  public:
95  makVrv::DtStateViewCollection<makVrv::DtVrlinkSimulatedBaseState>(de, makVrv::DtSimEntryUpdater::NoUpdates)
96  {
97  }
98 
99  bool isCompatible(makVrv::DtSimObjectEntry& entry)
100  {
102  }
103  };
104 
127  {
128  public:
129  typedef boost::signal<void (const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*)> StateViewAddedOrRemovedSignal;
130 
131  public:
132 
135 
136  static DtVrfStateViewCollectionManager& instance(makVrv::DtDe& de);
137 
149 
150 
153  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(const makVrv::DtUniqueID& id);
154 
157  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupSpotReportData(const makVrv::DtUniqueID& id);
158 
161  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupVrfTDLData(const makVrv::DtUniqueID& id);
162 
165  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupSpotReportData(const std::string& name);
166 
169  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupVrfTDLData(const std::string& uniqueIdentifier);
170 
173  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupOrbatData(const makVrv::DtUniqueID& id);
174 
177  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupOrbatData(const std::string& name);
178 
181  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(const DtUUID&);
182 
184  virtual DtVector centerOfMass(const boost::unordered_set<DtUUID>& uuids,
185  bool ignoreEmbarked = true);
186 
190  template<typename T_ObjectDataInterfaceType>
191  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastObjectData(const makVrv::DtUniqueID& id)
192  {
193  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupObjectData(id));
194  }
195 
199  template<typename T_ObjectDataInterfaceType>
200  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastSpotReportData(const makVrv::DtUniqueID& id)
201  {
202  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupSpotReportData(id));
203  }
204 
208  template<typename T_ObjectDataInterfaceType>
209  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastVrfTDLData(const makVrv::DtUniqueID& id)
210  {
211  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupVrfTDLData(id));
212  }
213 
217  template<typename T_ObjectDataInterfaceType>
218  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastOrvatData(const makVrv::DtUniqueID& id)
219  {
220  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupOrbatData(id));
221  }
222 
226  template<typename T_ObjectDataInterfaceType>
227  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastObjectData(const DtUUID& uuid)
228  {
229  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupObjectData(uuid));
230  }
231 
235  template<typename T_ObjectDataInterfaceType>
236  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastSpotReportData(const std::string& name)
237  {
238  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupSpotReportData(name));
239  }
240 
244  template<typename T_ObjectDataInterfaceType>
245  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastVrfTDLData(const std::string& id)
246  {
247  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupVrfTDLData(id));
248  }
249 
253  template<typename T_ObjectDataInterfaceType>
254  DtBoost::shared_ptr<T_ObjectDataInterfaceType> lookupAndCastOrbatData(const std::string& name)
255  {
256  return DtObjectDataInterface::cast<T_ObjectDataInterfaceType>(lookupOrbatData(name));
257  }
258 
261  virtual DtBoost::shared_ptr<DtObjectDataInterface> lookupObjectData(makVrv::DtStateView<makVrv::DtSimState>* stateView);
263 
266  virtual makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* addMappingBasedOnMarkingTextAndUUID(const std::string& markingText, const DtUUID& uuid);
267 
270  virtual makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* findStateView(const DtUUID&, bool fullSearchIfMissing = false);
271 
273  virtual makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* findStealthStateView(const std::string& address,
274  const std::string& markingText);
275 
278  virtual makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* findStateViewByMarkingText(const std::string& markingText);
279 
281  virtual makVrv::DtStateView<DtSpotReportState>* findSpotReportStateView(const std::string& markingText);
282 
284  virtual makVrv::DtStateView<DtVrfTDLMessageDataState>* findVrfTDLDataStateView(const std::string& id);
285 
287  virtual makVrv::DtStateView<DtOrbatState>* findOrbatStateView(const std::string& markingText);
288 
292 
295  makVrv::DtStateView<DtSpotReportState>* findSpotReportStateView(const makVrv::DtUniqueID& id)
296  {
297  if (!mySpotReportStateViewCollection->hasStateView(id))
298  {
299  return 0;
300  }
301 
302  return const_cast<makVrv::DtStateView<DtSpotReportState>*>
303  (mySpotReportStateViewCollection->findStateView(id));
304  }
305 
309  {
310  if (!myVrfTDLDataStateViewCollection->hasStateView(id))
311  {
312  return 0;
313  }
314 
316  (myVrfTDLDataStateViewCollection->findStateView(id));
317  }
318 
321  makVrv::DtStateView<DtExternalDataState>* findExternalDataStateView(const makVrv::DtUniqueID& id)
322  {
323  if (!myExternalDataStateViewCollection->hasStateView(id))
324  {
325  return 0;
326  }
327 
328  return const_cast<makVrv::DtStateView<DtExternalDataState>*>
329  (myExternalDataStateViewCollection->findStateView(id));
330  }
331 
335  {
336  if (!myOrbatStateViewCollection->hasStateView(id))
337  {
338  return 0;
339  }
340 
341  return const_cast<makVrv::DtStateView<DtOrbatState>*>
342  (myOrbatStateViewCollection->findStateView(id));
343  }
344 
346  virtual void clearUUIDInformation();
347 
351  DtVrfSimulatedEntityStateViewCollection* simulatedEntityStateViewCollection()
352  {
353  return mySimulatedEntityStateView;
354  }
355 
356  DtVrlinkSimulatedBaseStateViewCollection* simulatedBaseStateViewCollection()
357  {
358  return mySimulatedBaseStateViewCollection;
359  }
360 
361  DtVrfObjectDataStateViewCollection* objectDataStateViewCollection()
362  {
363  return myObjectDataStateViewCollection;
364  }
365 
366  DtEnvironmentStateViewCollection* environmentStateViewCollection()
367  {
368  return myEnvironmentStateViewCollection;
369  }
370 
371  DtExtendedStateDataViewCollection* extendedStateDataViewCollection()
372  {
373  return myExtendedStateDataViewCollection;
374  }
375 
376  DtWeatherStateViewCollection* weatherStateViewCollection()
377  {
378  return myWeatherStateViewCollection;
379  }
380 
381  DtCloudLayerStateViewCollection* cloudLayerStateViewCollection()
382  {
383  return myCloudLayerStateViewCollection;
384  }
385 
386  DtIffStateDataViewCollection* iffStateDataViewCollection()
387  {
388  return myIffStateDataViewCollection;
389  }
390 
391  DtPropulsionNoiseStateDataViewCollection* propulsionNoiseStateDataViewCollection()
392  {
393  return myPropulsionNoiseStateDataViewCollection;
394  }
395 
396  DtEmitterSystemStateViewCollection* emitterSystemStateViewCollection()
397  {
398  return myEmitterSystemStateViewCollection;
399  }
400 
401  DtActiveSonarStateViewCollection* activeSonarStateViewCollection()
402  {
403  return myActiveSonarStateViewCollection;
404  }
405 
406  DtLaserDesignatorStateViewCollection* laserDesignatorStateViewCollection()
407  {
408  return myLaserDesignatorStateViewCollection;
409  }
410 
411  DtSpotReportStateViewCollection* spotReportStateViewCollection()
412  {
413  return mySpotReportStateViewCollection;
414  }
415 
416  DtExternalDataStateViewCollection* externalDataStateViewCollection()
417  {
418  return myExternalDataStateViewCollection;
419  }
420 
421  DtVrfTDLMessageDataStateViewCollection* vrfTDLDataStateViewCollection()
422  {
423  return myVrfTDLDataStateViewCollection;
424  }
425 
426  DtOrbatStateViewCollection* orbatStateViewCollection()
427  {
428  return myOrbatStateViewCollection;
429  }
430 
431  DtAggregateStateViewCollection* aggregateStateViewCollection()
432  {
433  return myAggregateStateViewCollection;
434  }
435 
436  makVrv::DtVrlinkSensorFieldsOfViewStateViewCollection* sensorFieldOfViewStateViewCollection()
437  {
438  return mySensorFieldOfViewStateViewCollection;
439  }
441 
444  makVrv::DtUniqueID parentId(const makVrv::DtUniqueID&) const;
445 
446  makVrv::DtUniqueID displayIdFromSimId(const makVrv::DtUniqueID& id, int modelSet = -1) const;
447  makVrv::DtElementData::SceneObjectIdList displayIdsFromSimId(const makVrv::DtUniqueID& id, int modelSet = -1) const;
448 
450  makVrv::DtUniqueID simIdFromDisplayId(const makVrv::DtUniqueID& id) const;
451 
453  const std::map<makVrv::DtUniqueID, const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*>&
454  stealthStates() const
455  {
456  return myStealthStates;
457  }
458 
460  virtual std::string entityName(const makVrv::DtUniqueID simId) const;
461 
463  virtual DtUUID objectUUID(makVrv::DtUniqueID simId) const;
464 
466  virtual std::string overlayName(const makVrv::DtUniqueID simId) const;
467 
469  virtual makVrv::DtElementEntry::ElementType elementType(const makVrv::DtElementID&) const;
470 
472  virtual makVrv::DtSimEntryUpdater::UpdateRate updateRateFor(const makVrv::DtBaseStateView* state) const;
473 
474  typedef std::vector<makVrv::DtSimEntryUpdater::UpdateRate> UpdateRates;
475  virtual makVrv::DtSimEntryUpdater::UpdateRate minimumRate(const UpdateRates&) const;
476  virtual makVrv::DtSimEntryUpdater::UpdateRate maximumRate(const UpdateRates&) const;
477 
481  virtual void setUpdateRate(makVrv::DtSimEntry*, makVrv::DtSimEntryUpdater::UpdateRate,
482  makVrv::DtBaseStateView* state);
483 
485  virtual void forceUpdateForRelevantInformation(makVrv::DtUniqueID id);
486 
489  virtual StateViewAddedOrRemovedSignal& signalWhenObjectAdded(const DtVrfSelectionFilter&);
490  virtual void processObjectAddedCallbacks(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*);
491  virtual void removeAddedSignalReference(const DtVrfSelectionFilter&);
492  virtual void waiting();
493 
494  virtual StateViewAddedOrRemovedSignal& signalWhenObjectRemoved(const DtVrfSelectionFilter&);
495  virtual void removeRemovalSignalReference(const DtVrfSelectionFilter&);
496 
497  virtual void processObjectRemovedCallbacks(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*);
498 
499  virtual void slot_simStateAdded(makVrv::DtSimObjectEntry& e);
500  virtual void slot_simStateToBeRemoved(makVrv::DtSimObjectEntry& e, makVrv::DtSimState&);
501 
502  virtual std::string lookupNameById(makVrv::DtUniqueID id);
503  virtual makVrv::DtUniqueID lookupIdByUUID(const DtUUID&);
504 
506  virtual bool getSupportsWeightVariations(makVrv::DtUniqueID id);
507 
511  virtual const std::set<makVrv::DtUniqueID>& dIGuyIds();
512 
515  virtual void signalWhenAllObjectsDiscovered(const std::map<short, int>&);
516 
519 
520  virtual DtUUID uuidFromState(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*) const;
521  virtual DtUUID uuidFromState(const makVrv::DtVrlinkSimulatedBaseState*) const;
522 
524  boost::signal <void (const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*)> signal_stateAdded;
525  boost::signal <void (const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*)> signal_stateRemoved;
526 
528  boost::signal<void (makVrv::DtUniqueID, const DtUUID& oldUUID, const DtUUID& newUUID)> signal_uuidChanged;
529 
532  boost::signal <void ()> signal_allObjectsDiscovered;
533 
535  boost::signal <void (const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*, const std::string& newName)> signal_nameChanged;
536 
537  const std::set<makVrv::DtUniqueID>& tacticalGraphicElements() const;
538 
542  virtual int maxMarkingTextLengthFor(const DtEntityType&) const;
543  virtual void setMaxMarkingTextLengthFunction(DtMaxMarkingTextLengthFunction);
544  virtual DtMaxMarkingTextLengthFunction maxMarkingTextLengthFunction() const;
545 
546  virtual int defaultMaxMarkingTextLengthFunction(const DtEntityType&);
547 
548  protected:
549  virtual void slot_onAttributesChanged( const makVrv::DtElementData::EntryAttributesList& signalList );
550 
551  DtVrfGuiOrbatManager* vrfGuiOrbatManager() const;
552 
554  virtual bool shouldProcessState(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*) const;
555 
557  virtual void slot_attributesChanged(const makVrv::DtElementData::EntryAttributesList& l);
558 
559  protected:
579 
580  std::map<short, int> myWaitingForDiscovery;
581 
582  typedef boost::unordered_map<makVrv::DtBaseStateView*, UpdateRates> UpdateRateMap;
583 
585 
588  {
594  };
595 
596  typedef std::vector<StateViewAddedOrRemovedStruct> StateViewAddedOrRemovedCallbacks;
598 
600  std::map<makVrv::DtElementID, bool> myWaiting;
601 
602  typedef boost::unordered_map<DtUUID, makVrv::DtUniqueID> UUIDToIdMap;
603  typedef boost::unordered_map<makVrv::DtUniqueID, DtUUID> IdToUUIDMap;
604 
607 
609 
610  std::map<makVrv::DtUniqueID, const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*> myStealthStates;
611  std::string myStealthType;
612 
613  std::set<makVrv::DtUniqueID> myTacticalGraphicElements;
614 
615  std::set<makVrv::DtUniqueID> myDIGuyIds;
616  boost::unordered_set<makVrv::DtUniqueID> myIdsToCheckForDIGuy;
617 
618  boost::unordered_set<DtUUID> myDidNotFindStateViewFor;
619 
621  };
622 
623  template<typename T> T findStateFor(makVrv::DtSimEntry* entry)
624  {
625  makVrv::DtSimEntry::SimStateVector::const_iterator pos = entry->simStates().begin();
626  makVrv::DtSimEntry::SimStateVector::const_iterator endPos = entry->simStates().end();
627  for(; pos != endPos; ++pos)
628  {
629  T tState = dynamic_cast<T>(*pos);
630  if(tState)
631  {
632  return tState;
633  }
634  }
635 
636  return 0;
637  }
638 
640  DT_DLL_VRFGUICORE std::vector<DtUUID> convertMarkingTextVectorToUUIDVector(const std::vector<DtString>& v);
641  DT_DLL_VRFGUICORE std::vector<DtUUID> convertMarkingTextVectorToUUIDVector(const std::vector<std::string>& v);
642 
644  DT_DLL_VRFGUICORE std::vector<std::string> convertUUIDVectorToUUIDStringVector(const std::vector<DtUUID>& v);
645 
647  DT_DLL_VRFGUICORE std::vector<std::string> convertUUIDVectorToMarkingTextVector(const std::vector<DtUUID>& v);
648 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)