PageRenderTime 23ms CodeModel.GetById 2ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

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