PageRenderTime 60ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lltracker.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 154 lines | 90 code | 31 blank | 33 comment | 2 complexity | 391cce70b1a7916ce4ef31a8a4fbd6f1 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltracker.h
  3. * @brief Container for objects user is tracking.
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. // A singleton class for tracking stuff.
  27. //
  28. // TODO -- LLAvatarTracker functionality should probably be moved
  29. // to the LLTracker class.
  30. #ifndef LL_LLTRACKER_H
  31. #define LL_LLTRACKER_H
  32. #include "lldarray.h"
  33. #include "llpointer.h"
  34. #include "llstring.h"
  35. #include "lluuid.h"
  36. #include "v3dmath.h"
  37. class LLHUDText;
  38. class LLTracker
  39. {
  40. public:
  41. enum ETrackingStatus
  42. {
  43. TRACKING_NOTHING = 0,
  44. TRACKING_AVATAR = 1,
  45. TRACKING_LANDMARK = 2,
  46. TRACKING_LOCATION = 3,
  47. };
  48. enum ETrackingLocationType
  49. {
  50. LOCATION_NOTHING,
  51. LOCATION_EVENT,
  52. LOCATION_ITEM,
  53. };
  54. static LLTracker* instance()
  55. {
  56. if (!sTrackerp)
  57. {
  58. sTrackerp = new LLTracker();
  59. }
  60. return sTrackerp;
  61. }
  62. static void cleanupInstance() { delete sTrackerp; sTrackerp = NULL; }
  63. //static void drawTrackerArrow();
  64. // these are static so that they can be used a callbacks
  65. static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
  66. static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
  67. static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
  68. static void stopTracking(void*);
  69. static void clearFocus();
  70. static const LLUUID& getTrackedLandmarkAssetID() { return instance()->mTrackedLandmarkAssetID; }
  71. static const LLUUID& getTrackedLandmarkItemID() { return instance()->mTrackedLandmarkItemID; }
  72. static void trackAvatar( const LLUUID& avatar_id, const std::string& name );
  73. static void trackLandmark( const LLUUID& landmark_asset_id, const LLUUID& landmark_item_id , const std::string& name);
  74. static void trackLocation(const LLVector3d& pos, const std::string& full_name, const std::string& tooltip, ETrackingLocationType location_type = LOCATION_NOTHING);
  75. // returns global pos of tracked thing
  76. static LLVector3d getTrackedPositionGlobal();
  77. static BOOL hasLandmarkPosition();
  78. static const std::string& getTrackedLocationName();
  79. static void drawHUDArrow();
  80. // Draw in-world 3D tracking stuff
  81. static void render3D();
  82. static BOOL handleMouseDown(S32 x, S32 y);
  83. static LLTracker* sTrackerp;
  84. static BOOL sCheesyBeacon;
  85. static const std::string& getLabel() { return instance()->mLabel; }
  86. static const std::string& getToolTip() { return instance()->mToolTip; }
  87. protected:
  88. LLTracker();
  89. ~LLTracker();
  90. static void renderBeacon( LLVector3d pos_global,
  91. const LLColor4& color,
  92. LLHUDText* hud_textp,
  93. const std::string& label );
  94. void stopTrackingAll(BOOL clear_ui = FALSE);
  95. void stopTrackingAvatar(BOOL clear_ui = FALSE);
  96. void stopTrackingLocation(BOOL clear_ui = FALSE);
  97. void stopTrackingLandmark(BOOL clear_ui = FALSE);
  98. void drawMarker(const LLVector3d& pos_global, const LLColor4& color);
  99. void setLandmarkVisited();
  100. void cacheLandmarkPosition();
  101. void purgeBeaconText();
  102. protected:
  103. ETrackingStatus mTrackingStatus;
  104. ETrackingLocationType mTrackingLocationType;
  105. LLPointer<LLHUDText> mBeaconText;
  106. S32 mHUDArrowCenterX;
  107. S32 mHUDArrowCenterY;
  108. LLVector3d mTrackedPositionGlobal;
  109. std::string mLabel;
  110. std::string mToolTip;
  111. std::string mTrackedLandmarkName;
  112. LLUUID mTrackedLandmarkAssetID;
  113. LLUUID mTrackedLandmarkItemID;
  114. LLDynamicArray<LLUUID> mLandmarkAssetIDList;
  115. LLDynamicArray<LLUUID> mLandmarkItemIDList;
  116. BOOL mHasReachedLandmark;
  117. BOOL mHasLandmarkPosition;
  118. BOOL mLandmarkHasBeenVisited;
  119. std::string mTrackedLocationName;
  120. BOOL mIsTrackingLocation;
  121. BOOL mHasReachedLocation;
  122. };
  123. #endif