PageRenderTime 35ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llnetmap.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 142 lines | 89 code | 28 blank | 25 comment | 0 complexity | cd9e34fe0c3b026f4d6ecb7ce6096994 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llnetmap.h
  3. * @brief A little map of the world with network information
  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. #ifndef LL_LLNETMAP_H
  27. #define LL_LLNETMAP_H
  28. #include "llmath.h"
  29. #include "lluictrl.h"
  30. #include "v3math.h"
  31. #include "v3dmath.h"
  32. #include "v4color.h"
  33. #include "llpointer.h"
  34. class LLColor4U;
  35. class LLCoordGL;
  36. class LLImageRaw;
  37. class LLViewerTexture;
  38. class LLFloaterMap;
  39. class LLMenuGL;
  40. class LLNetMap : public LLUICtrl
  41. {
  42. public:
  43. struct Params
  44. : public LLInitParam::Block<Params, LLUICtrl::Params>
  45. {
  46. Optional<LLUIColor> bg_color;
  47. Params()
  48. : bg_color("bg_color")
  49. {}
  50. };
  51. protected:
  52. LLNetMap (const Params & p);
  53. friend class LLUICtrlFactory;
  54. friend class LLFloaterMap;
  55. public:
  56. virtual ~LLNetMap();
  57. static const F32 MAP_SCALE_MIN;
  58. static const F32 MAP_SCALE_MID;
  59. static const F32 MAP_SCALE_MAX;
  60. /*virtual*/ void draw();
  61. /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
  62. /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  63. /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  64. /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask );
  65. /*virtual*/ BOOL handleToolTip( S32 x, S32 y, MASK mask);
  66. /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
  67. /*virtual*/ BOOL postBuild();
  68. /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
  69. /*virtual*/ BOOL handleClick(S32 x, S32 y, MASK mask);
  70. /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
  71. void setScale( F32 scale );
  72. void setToolTipMsg(const std::string& msg) { mToolTipMsg = msg; }
  73. void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
  74. private:
  75. const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; }
  76. void renderPoint(const LLVector3 &pos, const LLColor4U &color,
  77. S32 diameter, S32 relative_height = 0);
  78. LLVector3 globalPosToView(const LLVector3d& global_pos);
  79. LLVector3d viewPosToGlobal(S32 x,S32 y);
  80. void drawTracking( const LLVector3d& pos_global,
  81. const LLColor4& color,
  82. BOOL draw_arrow = TRUE);
  83. BOOL handleToolTipAgent(const LLUUID& avatar_id);
  84. static void showAvatarInspector(const LLUUID& avatar_id);
  85. void createObjectImage();
  86. static bool outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop);
  87. private:
  88. bool mUpdateNow;
  89. LLUIColor mBackgroundColor;
  90. F32 mScale; // Size of a region in pixels
  91. F32 mPixelsPerMeter; // world meters to map pixels
  92. F32 mObjectMapTPM; // texels per meter on map
  93. F32 mObjectMapPixels; // Width of object map in pixels
  94. F32 mDotRadius; // Size of avatar markers
  95. bool mPanning; // map is being dragged
  96. LLVector2 mTargetPan;
  97. LLVector2 mCurPan;
  98. LLVector2 mStartPan; // pan offset at start of drag
  99. LLCoordGL mMouseDown; // pointer position at start of drag
  100. LLVector3d mObjectImageCenterGlobal;
  101. LLPointer<LLImageRaw> mObjectRawImagep;
  102. LLPointer<LLViewerTexture> mObjectImagep;
  103. LLUUID mClosestAgentToCursor;
  104. LLUUID mClosestAgentAtLastRightClick;
  105. std::string mToolTipMsg;
  106. public:
  107. void setSelected(uuid_vec_t uuids) { gmSelected=uuids; };
  108. private:
  109. void handleZoom(const LLSD& userdata);
  110. void handleStopTracking (const LLSD& userdata);
  111. LLMenuGL* mPopupMenu;
  112. uuid_vec_t gmSelected;
  113. };
  114. #endif