llfloaterworldmap.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. /**
  2. * @file llfloaterworldmap.h
  3. * @brief LLFloaterWorldMap class definition
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewergpl$
  6. *
  7. * Copyright (c) 2003-2009, Linden Research, Inc.
  8. * Copyright (c) 2009-2021, Henri Beauchamp.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. /*
  34. * Map of the entire world, with multiple background images,
  35. * avatar tracking, teleportation by double-click, etc.
  36. */
  37. #ifndef LL_LLFLOATERWORLDMAP_H
  38. #define LL_LLFLOATERWORLDMAP_H
  39. #include <vector>
  40. #include "boost/signals2.hpp"
  41. #include "hbfileselector.h"
  42. #include "llfloater.h"
  43. #include "llmemberlistener.h"
  44. #include "llpointer.h"
  45. #include "lltracker.h"
  46. class LLButton;
  47. class LLComboBox;
  48. class LLCheckBoxCtrl;
  49. class LLFriendObserver;
  50. class LLIconCtrl;
  51. class LLImageRaw;
  52. class LLInventoryModel;
  53. class LLInventoryObserver;
  54. class LLItemInfo;
  55. class LLLineEditor;
  56. class LLMapParcelInfoObserver;
  57. class LLScrollListCtrl;
  58. class LLSearchEditor;
  59. class LLSimInfo;
  60. class LLSliderCtrl;
  61. class LLSurface;
  62. class LLSpinCtrl;
  63. class LLTabContainer;
  64. class LLViewerFetchedTexture;
  65. struct LLParcelData;
  66. class LLFloaterWorldMap final : public LLFloater
  67. {
  68. protected:
  69. LOG_CLASS(LLFloaterWorldMap);
  70. public:
  71. LLFloaterWorldMap();
  72. ~LLFloaterWorldMap() override;
  73. static void* createWorldMapView(void* data);
  74. bool postBuild() override;
  75. void onOpen() override;
  76. void onClose(bool app_quitting) override;
  77. static void show(void*, bool center_on_target);
  78. static void reloadIcons(void*);
  79. static void toggle(void*);
  80. static void hide(void*);
  81. bool handleScrollWheel(S32 x, S32 y, S32 clicks) override;
  82. bool handleRightMouseDown(S32 x, S32 y, MASK mask) override;
  83. bool handleMouseUp(S32 x, S32 y, MASK mask) override;
  84. void setVisible(bool visible) override;
  85. void draw() override;
  86. // Methods for dealing with inventory. The observe() method is called
  87. // during program startup. inventoryUpdated() will be called by a helper
  88. // object when an interesting change has occurred.
  89. void observeInventory(LLInventoryModel* inventory);
  90. void inventoryChanged();
  91. // Calls for dealing with changes in friendship
  92. void observeFriends();
  93. void friendsChanged();
  94. // Tracking methods
  95. void trackAvatar(const LLUUID& avatar_id, const std::string& name);
  96. void trackLandmark(const LLUUID& landmark_item_id);
  97. void trackLocation(const LLVector3d& pos,
  98. const std::string& tooltip = LLStringUtil::null);
  99. void trackEvent(const LLItemInfo &event_info);
  100. void trackGenericItem(const LLItemInfo &item);
  101. void trackURL(const std::string& region_name, S32 x_coord, S32 y_coord,
  102. S32 z_coord);
  103. void clearParcelInfoRequest();
  104. LL_INLINE LLVector3d& getRequestedParcelInfoGlobalPos()
  105. {
  106. return mRequestedGlobalPos;
  107. }
  108. LL_INLINE static const LLUUID& getHomeID() { return sHomeID; }
  109. // A z_attenuation of 0.0f collapses the distance into the X-Y plane
  110. F32 getDistanceToDestination(const LLVector3d& pos_global,
  111. F32 z_attenuation = 0.5f) const;
  112. void clearLocationSelection(bool clear_ui = false);
  113. void clearAvatarSelection(bool clear_ui = false);
  114. void clearLandmarkSelection(bool clear_ui = false);
  115. // Adjust the maximally zoomed out limit of the zoom slider so you can
  116. // see the whole world, plus a little.
  117. void adjustZoomSliderBounds();
  118. // Catch changes in the sim list
  119. void updateSims(bool found_null_sim);
  120. // Teleport to the tracked item, if there is one
  121. void teleport();
  122. protected:
  123. static void onGoHome(void*);
  124. static void onLandmarkComboPrearrange(LLUICtrl*, void* data);
  125. static void onLandmarkComboCommit(LLUICtrl*, void* data);
  126. static void onAvatarComboPrearrange(LLUICtrl*, void* data);
  127. static void onAvatarComboCommit(LLUICtrl*, void* data);
  128. static void onTabChanged(void* data, bool from_click);
  129. static void onComboTextEntry(LLLineEditor*, void*);
  130. static void onSearchTextEntry(const std::string&, void*);
  131. static void onClearBtn(void*);
  132. static void onClickTeleportBtn(void*);
  133. static void onShowTargetBtn(void*);
  134. static void onShowAgentBtn(void*);
  135. static void onCopySLURL(void*);
  136. void requestParcelInfo(const LLVector3d& pos_global);
  137. void centerOnTarget(bool animate);
  138. void updateLocationSpinners(const LLVector3d& pos,
  139. LLVector3* local_pos = NULL);
  140. void updateLocation();
  141. void buildLandmarkIDLists();
  142. void setLandmarkVisited();
  143. void buildAvatarIDList();
  144. static void onTeleportArriving();
  145. static void updateSearchEnabled();
  146. static void onLocationFocusChanged(LLFocusableElement*, void*);
  147. static void onLocationCommit(void* userdata);
  148. static void onCommitLocation(LLUICtrl*, void* userdata);
  149. static void onCommitSearchResult(LLUICtrl*, void* userdata);
  150. void cacheLandmarkPosition();
  151. class LLReloadAllTiles final : public LLMemberListener<LLFloaterWorldMap>
  152. {
  153. public:
  154. bool handleEvent(LLPointer<LLOldEvents::LLEvent>,
  155. const LLSD&) override;
  156. };
  157. class LLReloadTile final : public LLMemberListener<LLFloaterWorldMap>
  158. {
  159. public:
  160. bool handleEvent(LLPointer<LLOldEvents::LLEvent>,
  161. const LLSD&) override;
  162. };
  163. class LLSaveMapTile final : public LLMemberListener<LLFloaterWorldMap>
  164. {
  165. public:
  166. bool handleEvent(LLPointer<LLOldEvents::LLEvent>,
  167. const LLSD& userdata) override;
  168. };
  169. class LLSaveSculpt final : public LLMemberListener<LLFloaterWorldMap>
  170. {
  171. public:
  172. bool handleEvent(LLPointer<LLOldEvents::LLEvent>,
  173. const LLSD& userdata) override;
  174. };
  175. static void saveTileCallback(HBFileSelector::ESaveFilter type,
  176. std::string& filename, void*);
  177. static void saveSculptCallback(HBFileSelector::ESaveFilter type,
  178. std::string& filename, void*);
  179. static void onTileLoadedForSave(bool success,
  180. LLViewerFetchedTexture* src_vi,
  181. LLImageRaw* src, LLImageRaw* aux,
  182. S32 discard_level, bool final,
  183. void* userdata);
  184. protected:
  185. LLTabContainer* mTabs;
  186. LLHandle<LLView> mPopupMenuHandle;
  187. // Sets sMapScale, in pixels per region
  188. F32 mCurZoomVal;
  189. LLFrameTimer mZoomTimer;
  190. std::vector<LLUUID> mLandmarkAssetIDList;
  191. std::vector<LLUUID> mLandmarkItemIDList;
  192. static const LLUUID sHomeID;
  193. LLInventoryModel* mInventory;
  194. LLInventoryObserver* mInventoryObserver;
  195. LLFriendObserver* mFriendObserver;
  196. LLMapParcelInfoObserver* mParcelInfoObserver;
  197. boost::signals2::connection mTeleportArrivingConnection;
  198. std::string mCompletingRegionName;
  199. std::string mLastRegionName;
  200. LLVector3d mTrackedLocation;
  201. LLTracker::ETrackingStatus mTrackedStatus;
  202. LLVector3d mRequestedGlobalPos;
  203. LLSearchEditor* mLocationEditor;
  204. LLSpinCtrl* mSpinX;
  205. LLSpinCtrl* mSpinY;
  206. LLSpinCtrl* mSpinZ;
  207. LLComboBox* mLandmarkCombo;
  208. LLComboBox* mFriendCombo;
  209. LLScrollListCtrl* mSearchResultsList;
  210. LLIconCtrl* mEventsMatureIcon;
  211. LLIconCtrl* mEventsAdultIcon;
  212. LLIconCtrl* mAvatarIcon;
  213. LLIconCtrl* mLandmarkIcon;
  214. LLIconCtrl* mLocationIcon;
  215. LLCheckBoxCtrl* mEventsMatureCheck;
  216. LLCheckBoxCtrl* mEventsAdultCheck;
  217. LLButton* mGoHomeButton;
  218. LLButton* mTeleportButton;
  219. LLButton* mShowDestinationButton;
  220. LLButton* mCopySLURLButton;
  221. LLSliderCtrl* mZoomSlider;
  222. LLUUID mTrackedAvatarId;
  223. std::string mTrackedSimName;
  224. std::string mSLURL;
  225. bool mFirstOpen;
  226. bool mWaitingForTracker;
  227. bool mExactMatch;
  228. bool mIsClosing;
  229. bool mSetToUserPosition;
  230. public:
  231. static LLSimInfo* sRightClickedSimInfo;
  232. static LLPointer<LLViewerFetchedTexture> sImageToSave;
  233. static LLSurface* sSurfaceToMap;
  234. static U32 sRegionWidth;
  235. static bool sSaveAsDecal;
  236. static bool sSaveAsSpheric;
  237. static std::string sSaveFileName;
  238. };
  239. extern LLFloaterWorldMap* gFloaterWorldMapp;
  240. #endif