PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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