[Gcblue-commits] gcb_wx/include/sim tcSensorMapTrack.h,NONE,1.1 tcSensorMap.h,1.13,1.14 tcSensorTrac
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-17 00:22:08
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32418/include/sim Modified Files: tcSensorMap.h tcSensorTrackIterator.h Added Files: tcSensorMapTrack.h Log Message: New feature to display 3D models for sensor tracks based on track position (only generic models for now) Index: tcSensorMap.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorMap.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcSensorMap.h 5 May 2005 02:14:20 -0000 1.13 --- tcSensorMap.h 17 May 2005 00:20:39 -0000 1.14 *************** *** 33,36 **** --- 33,37 ---- #include "tcFile.h" #include <vector> + #include "tcSensorMapTrack.h" class tcSimState; *************** *** 50,191 **** { - /** - * stores all state information needed by sensor for surveillance tracks - */ - class tcSensorReport - { - public: - float mfLon_rad; - float mfLat_rad; - float mfAlt_m; - float mfSpeed_kts; - float mfHeading_rad; - double mfTimestamp; - double mfStartTime; ///< birth time of track from report - long mnTrackID; - long trackDatabaseID; ///< database id of track (usually from visual ident), -1 is unknown - long mnSensorPlatformID; ///< id of contributing sensor - UINT8 mnFlags; - std::vector<UINT32> maEmitter; - unsigned mbClassified : 1; - unsigned isIdentified : 1; - - void Clear() - { - mfLon_rad=0;mfLat_rad=0;mfAlt_m=0; - mfSpeed_kts=0;mfHeading_rad=0; - mfTimestamp=0;mfStartTime=0; - mfStartTime = 0; - mnTrackID = -1; - mnSensorPlatformID = -1; - mnFlags=0; - mbClassified = 0; - isIdentified = 0; - } - bool IsIdentified() const {return isIdentified != 0;} - bool IsNew() {return (mfTimestamp == 0);} - }; - - struct tsEmitterInfo - { - tnPoolIndex mnEmitterID; ///< database ID of emitter - double mfTimestamp; - int mnMode; - }; - - /** - * State info for track stored in alliance sensor map. - * The targetedRating is used by the AI to avoid inefficient ganging up on track. - * engageRating controls how much ordance - */ - class tcSensorMapTrack : public tcTrack - { - enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; - - public: - tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; ///< most recent data from contributing sensors - int mnContributors; - tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; - int mnEmitters; - long mnDatabaseID; ///< database ID of track, -1 for unknown - float assessedDamage; - std::vector<long> intercepts; ///< vector of platform ids that are intercepting this track - std::vector<long> engaged; ///< vector of weapon ids that are tracking / engaging - std::vector<long> ambiguityList; ///< vector of platform ids consistent with detected emitters - static unsigned int ambiguityListUpdates; - - /// called to indicate weapon launched at target - bool AddEngagement(long id); - - /// called to indicate platform intercepting target - bool AddIntercept(long id); - - bool AddReport(const tcSensorReport& report); - void RemoveReport(int n); - - ///< static method to set pointer to tcSimState object - static void AttachDatabase(tcDatabase* db) {database = db;} - static void AttachSimState(tcSimState* ss) {simState = ss;} - - virtual void Clear(); - - int GetEmitterCount() {return mnEmitters;} - const tsEmitterInfo* GetEmitter(int anIdx) - { - if ((anIdx < 0)||(anIdx >= mnEmitters)) {return NULL;} - return &maEmitterInfo[anIdx]; - } - - /// gets number of weapons engaging this track - unsigned GetEngagedCount() const; - - /// gets number of platforms intercepting this track - unsigned GetInterceptCount() const; - - unsigned GetContributorCount() const; - const char* GetContributorName(unsigned idx) const; - - const tcTrack* GetTrack() {return this;} - bool IsNew() {return mfTimestamp == 0;} - bool IsDestroyed() const; - bool IsStale() const; - void MarkDestroyed(); - void MarkStale(); - void ClearStale(); - - bool UpdateActiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); - void UpdateAmbiguityList(); - void UpdateClassification(UINT16 mnClassification, teAffiliation meAffiliation, - tnPoolIndex databaseID); - bool UpdateEmitter(tsEmitterInfo*& rpEmitterInfo, tnPoolIndex anEmitterID); - - /// removes engagement ids for weapons no longer engaging this track - void UpdateEngagements(); - - /// removes intercept ids for platforms no longer intercepting this track - void UpdateIntercepts(); - - bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); - void UpdateTrack(); - - - tcUpdateStream& operator<<(tcUpdateStream& stream); - tcUpdateStream& operator>>(tcUpdateStream& stream); - - tcSensorMapTrack* operator= (tcSensorMapTrack *pa) {return pa;} - tcSensorMapTrack& operator= (const tcSensorMapTrack&); - tcSensorMapTrack(); - ~tcSensorMapTrack(); - - static void SetAutoKillAssess(bool state); - private: - static tcSimState* simState; - static tcDatabase* database; - static bool autoKillAssess; ///< set to true to automatically mark destroyed tracks - enum {TRACK_STALE = 1, TRACK_DESTROYED = 2}; - unsigned char sensorFlags; ///< 1 - stale, 2 - destroyed - - void KillAssess(); - }; --- 51,54 ---- Index: tcSensorTrackIterator.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorTrackIterator.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSensorTrackIterator.h 11 Dec 2004 01:09:05 -0000 1.1 --- tcSensorTrackIterator.h 17 May 2005 00:20:39 -0000 1.2 *************** *** 52,55 **** --- 52,56 ---- tcSensorTrackIterator(unsigned int alliance_, unsigned int classificationMask, const tcGeoRect& filterRegion); + tcSensorTrackIterator(unsigned int alliance_, unsigned int classificationMask = 0xFFFF); tcSensorTrackIterator(); virtual ~tcSensorTrackIterator(); --- NEW FILE: tcSensorMapTrack.h --- /** ** @file tcSensorMapTrack.h */ /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SENSORMAPTRACK_H_ #define _SENSORMAPTRACK_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "simmath.h" #include "tcFile.h" #include <vector> class tcSimState; class tcUpdateStream; namespace Database { class tcDatabase; } using Database::tcDatabase; /** * Sensor track management code. This is older code * that needs refactoring. */ namespace Sensor { /** * stores all state information needed by sensor for surveillance tracks */ class tcSensorReport { public: float mfLon_rad; float mfLat_rad; float mfAlt_m; float mfSpeed_kts; float mfHeading_rad; double mfTimestamp; double mfStartTime; ///< birth time of track from report long mnTrackID; long trackDatabaseID; ///< database id of track (usually from visual ident), -1 is unknown long mnSensorPlatformID; ///< id of contributing sensor UINT8 mnFlags; std::vector<UINT32> maEmitter; unsigned mbClassified : 1; unsigned isIdentified : 1; void Clear() { mfLon_rad=0;mfLat_rad=0;mfAlt_m=0; mfSpeed_kts=0;mfHeading_rad=0; mfTimestamp=0;mfStartTime=0; mfStartTime = 0; mnTrackID = -1; mnSensorPlatformID = -1; mnFlags=0; mbClassified = 0; isIdentified = 0; } bool IsIdentified() const {return isIdentified != 0;} bool IsNew() {return (mfTimestamp == 0);} }; struct tsEmitterInfo { tnPoolIndex mnEmitterID; ///< database ID of emitter double mfTimestamp; int mnMode; }; /** * State info for track stored in alliance sensor map. * The targetedRating is used by the AI to avoid inefficient ganging up on track. * engageRating controls how much ordance */ class tcSensorMapTrack : public tcTrack { enum {MAX_SENSOR_REPORTS = 2, MAX_EMITTERS = 4}; public: tcSensorReport maSensorReport[MAX_SENSOR_REPORTS]; ///< most recent data from contributing sensors int mnContributors; tsEmitterInfo maEmitterInfo[MAX_EMITTERS]; int mnEmitters; long mnDatabaseID; ///< database ID of track, -1 for unknown float assessedDamage; std::vector<long> intercepts; ///< vector of platform ids that are intercepting this track std::vector<long> engaged; ///< vector of weapon ids that are tracking / engaging std::vector<long> ambiguityList; ///< vector of platform ids consistent with detected emitters static unsigned int ambiguityListUpdates; /// called to indicate weapon launched at target bool AddEngagement(long id); /// called to indicate platform intercepting target bool AddIntercept(long id); bool AddReport(const tcSensorReport& report); void RemoveReport(int n); ///< static method to set pointer to tcSimState object static void AttachDatabase(tcDatabase* db) {database = db;} static void AttachSimState(tcSimState* ss) {simState = ss;} virtual void Clear(); int GetEmitterCount() {return mnEmitters;} const tsEmitterInfo* GetEmitter(int anIdx) { if ((anIdx < 0)||(anIdx >= mnEmitters)) {return NULL;} return &maEmitterInfo[anIdx]; } /// gets number of weapons engaging this track unsigned GetEngagedCount() const; /// gets number of platforms intercepting this track unsigned GetInterceptCount() const; unsigned GetContributorCount() const; const char* GetContributorName(unsigned idx) const; tc3DModel* GetModel() const; void SetModel(tc3DModel* model_); const tcTrack* GetTrack() {return this;} bool IsNew() {return mfTimestamp == 0;} bool IsDestroyed() const; bool IsStale() const; void MarkDestroyed(); void MarkStale(); void ClearStale(); bool UpdateActiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateAmbiguityList(); void UpdateClassification(UINT16 mnClassification, teAffiliation meAffiliation, tnPoolIndex databaseID); bool UpdateEmitter(tsEmitterInfo*& rpEmitterInfo, tnPoolIndex anEmitterID); /// removes engagement ids for weapons no longer engaging this track void UpdateEngagements(); /// removes intercept ids for platforms no longer intercepting this track void UpdateIntercepts(); bool UpdatePassiveReport(tcSensorReport*& rpReport, tnPoolIndex anSensorID); void UpdateTrack(); tcUpdateStream& operator<<(tcUpdateStream& stream); tcUpdateStream& operator>>(tcUpdateStream& stream); tcSensorMapTrack* operator= (tcSensorMapTrack *pa) {return pa;} tcSensorMapTrack& operator= (const tcSensorMapTrack&); tcSensorMapTrack(const tcSensorMapTrack& src); tcSensorMapTrack(); ~tcSensorMapTrack(); static void SetAutoKillAssess(bool state); private: static tcSimState* simState; static tcDatabase* database; static bool autoKillAssess; ///< set to true to automatically mark destroyed tracks enum {TRACK_STALE = 1, TRACK_DESTROYED = 2}; unsigned char sensorFlags; ///< 1 - stale, 2 - destroyed tc3DModel* model; void KillAssess(); }; } #endif |