/indra/newview/llworldmapview.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 197 lines · 125 code · 36 blank · 36 comment · 0 complexity · e7361ff91aa51ec12a30939d2d494019 MD5 · raw file

  1. /**
  2. * @file llworldmapview.h
  3. * @brief LLWorldMapView class header file
  4. *
  5. * $LicenseInfo:firstyear=2001&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. // View of the global map of the world
  27. // The data (model) for the global map (a singleton, unique to the application instance) is
  28. // in LLWorldMap and is typically accessed using LLWorldMap::getInstance()
  29. #ifndef LL_LLWORLDMAPVIEW_H
  30. #define LL_LLWORLDMAPVIEW_H
  31. #include "llpanel.h"
  32. #include "llworldmap.h"
  33. #include "v4color.h"
  34. const S32 DEFAULT_TRACKING_ARROW_SIZE = 16;
  35. class LLUUID;
  36. class LLVector3d;
  37. class LLVector3;
  38. class LLTextBox;
  39. class LLWorldMapView : public LLPanel
  40. {
  41. public:
  42. static void initClass();
  43. static void cleanupClass();
  44. LLWorldMapView();
  45. virtual ~LLWorldMapView();
  46. virtual BOOL postBuild();
  47. virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
  48. virtual void setVisible(BOOL visible);
  49. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  50. virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  51. virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
  52. virtual BOOL handleHover( S32 x, S32 y, MASK mask );
  53. virtual BOOL handleToolTip( S32 x, S32 y, MASK mask);
  54. bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track);
  55. void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id);
  56. // Scale and pan are shared across all instances! (i.e. Terrain and Objects maps are always registered)
  57. static void setScale( F32 scale );
  58. static void translatePan( S32 delta_x, S32 delta_y );
  59. static void setPan( S32 x, S32 y, BOOL snap = TRUE );
  60. // Return true if the current scale level is above the threshold for accessing region info
  61. static bool showRegionInfo();
  62. LLVector3 globalPosToView(const LLVector3d& global_pos);
  63. LLVector3d viewPosToGlobal(S32 x,S32 y);
  64. virtual void draw();
  65. void drawGenericItems(const LLSimInfo::item_info_list_t& items, LLUIImagePtr image);
  66. void drawGenericItem(const LLItemInfo& item, LLUIImagePtr image);
  67. void drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white);
  68. void drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color);
  69. void drawAgents();
  70. void drawItems();
  71. void drawFrustum();
  72. void drawMipmap(S32 width, S32 height);
  73. bool drawMipmapLevel(S32 width, S32 height, S32 level, bool load = true);
  74. static void cleanupTextures();
  75. // Draw the tracking indicator, doing the right thing if it's outside
  76. // the view area.
  77. void drawTracking( const LLVector3d& pos_global, const LLColor4& color, BOOL draw_arrow = TRUE,
  78. const std::string& label = std::string(), const std::string& tooltip = std::string(),
  79. S32 vert_offset = 0);
  80. static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y,
  81. const LLColor4& color,
  82. S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE);
  83. static void drawTrackingDot(F32 x_pixels,
  84. F32 y_pixels,
  85. const LLColor4& color,
  86. F32 relative_z = 0.f,
  87. F32 dot_radius = 5.f);
  88. static void drawTrackingCircle( const LLRect& rect, S32 x, S32 y,
  89. const LLColor4& color,
  90. S32 min_thickness,
  91. S32 overlap );
  92. static void drawAvatar( F32 x_pixels,
  93. F32 y_pixels,
  94. const LLColor4& color,
  95. F32 relative_z = 0.f,
  96. F32 dot_radius = 3.f);
  97. static void drawIconName(F32 x_pixels,
  98. F32 y_pixels,
  99. const LLColor4& color,
  100. const std::string& first_line,
  101. const std::string& second_line);
  102. // Prevents accidental double clicks
  103. static void clearLastClick() { sHandledLastClick = FALSE; }
  104. // if the view changes, download additional sim info as needed
  105. void updateVisibleBlocks();
  106. protected:
  107. void setDirectionPos( LLTextBox* text_box, F32 rotation );
  108. void updateDirections();
  109. public:
  110. LLColor4 mBackgroundColor;
  111. static LLUIImagePtr sAvatarSmallImage;
  112. static LLUIImagePtr sAvatarYouImage;
  113. static LLUIImagePtr sAvatarYouLargeImage;
  114. static LLUIImagePtr sAvatarLevelImage;
  115. static LLUIImagePtr sAvatarAboveImage;
  116. static LLUIImagePtr sAvatarBelowImage;
  117. static LLUIImagePtr sTelehubImage;
  118. static LLUIImagePtr sInfohubImage;
  119. static LLUIImagePtr sHomeImage;
  120. static LLUIImagePtr sEventImage;
  121. static LLUIImagePtr sEventMatureImage;
  122. static LLUIImagePtr sEventAdultImage;
  123. static LLUIImagePtr sTrackCircleImage;
  124. static LLUIImagePtr sTrackArrowImage;
  125. static LLUIImagePtr sClassifiedsImage;
  126. static LLUIImagePtr sForSaleImage;
  127. static LLUIImagePtr sForSaleAdultImage;
  128. static F32 sMapScale; // scale = size of a region in pixels
  129. BOOL mItemPicked;
  130. static F32 sPanX; // in pixels
  131. static F32 sPanY; // in pixels
  132. static F32 sTargetPanX; // in pixels
  133. static F32 sTargetPanY; // in pixels
  134. static S32 sTrackingArrowX;
  135. static S32 sTrackingArrowY;
  136. static bool sVisibleTilesLoaded;
  137. // Are we mid-pan from a user drag?
  138. BOOL mPanning;
  139. S32 mMouseDownPanX; // value at start of drag
  140. S32 mMouseDownPanY; // value at start of drag
  141. S32 mMouseDownX;
  142. S32 mMouseDownY;
  143. LLTextBox* mTextBoxEast;
  144. LLTextBox* mTextBoxNorth;
  145. LLTextBox* mTextBoxWest;
  146. LLTextBox* mTextBoxSouth;
  147. LLTextBox* mTextBoxSouthEast;
  148. LLTextBox* mTextBoxNorthEast;
  149. LLTextBox* mTextBoxNorthWest;
  150. LLTextBox* mTextBoxSouthWest;
  151. LLTextBox* mTextBoxScrollHint;
  152. static BOOL sHandledLastClick;
  153. S32 mSelectIDStart;
  154. // Keep the list of regions that are displayed on screen. Avoids iterating through the whole region map after draw().
  155. typedef std::vector<U64> handle_list_t;
  156. handle_list_t mVisibleRegions; // set every frame
  157. static std::map<std::string,std::string> sStringsMap;
  158. private:
  159. void drawTileOutline(S32 level, F32 top, F32 left, F32 bottom, F32 right);
  160. };
  161. #endif