diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llinventory/lllandmark.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llinventory/lllandmark.h')
-rw-r--r-- | linden/indra/llinventory/lllandmark.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/linden/indra/llinventory/lllandmark.h b/linden/indra/llinventory/lllandmark.h new file mode 100644 index 0000000..eea0600 --- /dev/null +++ b/linden/indra/llinventory/lllandmark.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /** | ||
2 | * @file lllandmark.h | ||
3 | * @brief Landmark asset class | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | |||
29 | #ifndef LL_LLLANDMARK_H | ||
30 | #define LL_LLLANDMARK_H | ||
31 | |||
32 | #include <map> | ||
33 | #include "llframetimer.h" | ||
34 | #include "lluuid.h" | ||
35 | #include "v3dmath.h" | ||
36 | |||
37 | class LLMessageSystem; | ||
38 | class LLHost; | ||
39 | |||
40 | // virutal base class used for calling back interested parties when a | ||
41 | // region handle comes back. | ||
42 | class LLRegionHandleCallback | ||
43 | { | ||
44 | public: | ||
45 | LLRegionHandleCallback() {} | ||
46 | virtual ~LLRegionHandleCallback() {} | ||
47 | virtual bool dataReady( | ||
48 | const LLUUID& region_id, | ||
49 | const U64& region_handle) | ||
50 | { | ||
51 | return true; | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | class LLLandmark | ||
56 | { | ||
57 | public: | ||
58 | ~LLLandmark() {} | ||
59 | |||
60 | // returns true if the position is known. | ||
61 | bool getGlobalPos(LLVector3d& pos); | ||
62 | |||
63 | // setter used in conjunction if more information needs to be | ||
64 | // collected from the server. | ||
65 | void setGlobalPos(const LLVector3d& pos); | ||
66 | |||
67 | // return true if the region is known | ||
68 | bool getRegionID(LLUUID& region_id); | ||
69 | |||
70 | // return the local coordinates if known | ||
71 | LLVector3 getRegionPos() const; | ||
72 | |||
73 | // constructs a new LLLandmark from a string | ||
74 | // return NULL if there's an error | ||
75 | static LLLandmark* constructFromString(const char *buffer); | ||
76 | |||
77 | // register callbacks that this class handles | ||
78 | static void registerCallbacks(LLMessageSystem* msg); | ||
79 | |||
80 | // request information about region_id to region_handle.Pass in a | ||
81 | // callback pointer which will be erase but NOT deleted after the | ||
82 | // callback is made. This function may call into the message | ||
83 | // system to get the information. | ||
84 | static void requestRegionHandle( | ||
85 | LLMessageSystem* msg, | ||
86 | const LLHost& upstream_host, | ||
87 | const LLUUID& region_id, | ||
88 | LLRegionHandleCallback* callback); | ||
89 | |||
90 | // Call this method to create a lookup for this region. This | ||
91 | // simplifies a lot of the code. | ||
92 | static void setRegionHandle(const LLUUID& region_id, U64 region_handle); | ||
93 | |||
94 | private: | ||
95 | LLLandmark(); | ||
96 | LLLandmark(const LLVector3d& pos); | ||
97 | |||
98 | static void processRegionIDAndHandle(LLMessageSystem* msg, void**); | ||
99 | static void expireOldEntries(); | ||
100 | |||
101 | private: | ||
102 | LLUUID mRegionID; | ||
103 | LLVector3 mRegionPos; | ||
104 | bool mGlobalPositionKnown; | ||
105 | LLVector3d mGlobalPos; | ||
106 | |||
107 | struct CacheInfo | ||
108 | { | ||
109 | U64 mRegionHandle; | ||
110 | LLFrameTimer mTimer; | ||
111 | }; | ||
112 | |||
113 | static std::pair<LLUUID, U64> mLocalRegion; | ||
114 | typedef std::map<LLUUID, CacheInfo> region_map_t; | ||
115 | static region_map_t mRegions; | ||
116 | typedef std::multimap<LLUUID, LLRegionHandleCallback*> region_callback_t; | ||
117 | static region_callback_t mRegionCallback; | ||
118 | }; | ||
119 | |||
120 | #endif | ||