/indra/newview/lllandmarkactions.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 138 lines · 38 code · 20 blank · 80 comment · 0 complexity · 80a62aa34c7d1f271e82b2c0cc01170f MD5 · raw file

  1. /**
  2. * @file lllandmarkactions.h
  3. * @brief LLLandmark class declaration
  4. *
  5. * $LicenseInfo:firstyear=2000&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_LLLANDMARKACTIONS_H
  27. #define LL_LLLANDMARKACTIONS_H
  28. #include "llinventorymodel.h"
  29. #include "lllandmarklist.h"
  30. class LLLandmark;
  31. /**
  32. * @brief Provides helper functions to manage landmarks
  33. */
  34. class LLLandmarkActions
  35. {
  36. public:
  37. typedef boost::function<void(std::string& slurl)> slurl_callback_t;
  38. typedef boost::function<void(std::string& slurl, S32 x, S32 y, S32 z)> region_name_and_coords_callback_t;
  39. /**
  40. * @brief Fetches landmark LLViewerInventoryItems for the given landmark name.
  41. */
  42. static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, BOOL if_use_substring);
  43. /**
  44. * @brief Checks whether landmark exists for current agent position.
  45. */
  46. static bool landmarkAlreadyExists();
  47. /**
  48. * @brief Checks whether landmark exists for current agent parcel.
  49. */
  50. static bool hasParcelLandmark();
  51. /**
  52. * @brief Searches landmark for global position.
  53. * @return Returns landmark or NULL.
  54. *
  55. * *TODO: dzaporozhan: There can be many landmarks for single parcel.
  56. */
  57. static LLViewerInventoryItem* findLandmarkForGlobalPos(const LLVector3d &pos);
  58. /**
  59. * @brief Searches landmark for agent global position.
  60. * @return Returns landmark or NULL.
  61. *
  62. * *TODO: dzaporozhan: There can be many landmarks for single parcel.
  63. */
  64. static LLViewerInventoryItem* findLandmarkForAgentPos();
  65. /**
  66. * @brief Checks whether agent has rights to create landmark for current parcel.
  67. */
  68. static bool canCreateLandmarkHere();
  69. /**
  70. * @brief Creates landmark for current parcel.
  71. */
  72. static void createLandmarkHere();
  73. /**
  74. * @brief Creates landmark for current parcel.
  75. */
  76. static void createLandmarkHere(
  77. const std::string& name,
  78. const std::string& desc,
  79. const LLUUID& folder_id);
  80. /**
  81. * @brief Creates SLURL for given global position.
  82. */
  83. static void getSLURLfromPosGlobal(const LLVector3d& global_pos, slurl_callback_t cb, bool escaped = true);
  84. static void getRegionNameAndCoordsFromPosGlobal(const LLVector3d& global_pos, region_name_and_coords_callback_t cb);
  85. /**
  86. * @brief Gets landmark global position specified by inventory LLUUID.
  87. * Found position is placed into "posGlobal" variable.
  88. *.
  89. * @return - true if specified item exists in Inventory and an appropriate landmark found.
  90. * and its position is known, false otherwise.
  91. */
  92. // *TODO: mantipov: profide callback for cases, when Landmark is not loaded yet.
  93. static bool getLandmarkGlobalPos(const LLUUID& landmarkInventoryItemID, LLVector3d& posGlobal);
  94. /**
  95. * @brief Retrieve a landmark from gLandmarkList by inventory item's id
  96. * If a landmark is not currently in the gLandmarkList a callback "cb" is called when it is loaded.
  97. *
  98. * @return pointer to loaded landmark from gLandmarkList or NULL if landmark does not exist or wasn't loaded.
  99. */
  100. static LLLandmark* getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb = NULL);
  101. /**
  102. * @brief Performs standard action of copying of SLURL from landmark to user's clipboard.
  103. * This action requires additional server request. The user will be notified by info message,
  104. * when URL is copied .
  105. */
  106. static void copySLURLtoClipboard(const LLUUID& landmarkInventoryItemID);
  107. private:
  108. LLLandmarkActions();
  109. LLLandmarkActions(const LLLandmarkActions&);
  110. static void onRegionResponseSLURL(slurl_callback_t cb,
  111. const LLVector3d& global_pos,
  112. bool escaped,
  113. const std::string& url);
  114. static void onRegionResponseNameAndCoords(region_name_and_coords_callback_t cb,
  115. const LLVector3d& global_pos,
  116. U64 region_handle);
  117. };
  118. #endif //LL_LLLANDMARKACTIONS_H