PageRenderTime 28ms CodeModel.GetById 14ms app.highlight 11ms RepoModel.GetById 1ms 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
  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
 27#ifndef LL_LLNETMAP_H
 28#define LL_LLNETMAP_H
 29
 30#include "llmath.h"
 31#include "lluictrl.h"
 32#include "v3math.h"
 33#include "v3dmath.h"
 34#include "v4color.h"
 35#include "llpointer.h"
 36
 37class LLColor4U;
 38class LLCoordGL;
 39class LLImageRaw;
 40class LLViewerTexture;
 41class LLFloaterMap;
 42class LLMenuGL;
 43
 44class LLNetMap : public LLUICtrl
 45{
 46public:
 47	struct Params 
 48	:	public LLInitParam::Block<Params, LLUICtrl::Params>
 49	{
 50		Optional<LLUIColor>	bg_color;
 51
 52		Params()
 53		:	bg_color("bg_color") 
 54		{}
 55	};
 56
 57protected:
 58	LLNetMap (const Params & p);
 59	friend class LLUICtrlFactory;
 60	friend class LLFloaterMap;
 61
 62public:
 63	virtual ~LLNetMap();
 64
 65	static const F32 MAP_SCALE_MIN;
 66	static const F32 MAP_SCALE_MID;
 67	static const F32 MAP_SCALE_MAX;
 68
 69	/*virtual*/ void	draw();
 70	/*virtual*/ BOOL	handleScrollWheel(S32 x, S32 y, S32 clicks);
 71	/*virtual*/ BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
 72	/*virtual*/ BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
 73	/*virtual*/ BOOL	handleHover( S32 x, S32 y, MASK mask );
 74	/*virtual*/ BOOL	handleToolTip( S32 x, S32 y, MASK mask);
 75	/*virtual*/ void	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 76
 77	/*virtual*/ BOOL 	postBuild();
 78	/*virtual*/ BOOL	handleRightMouseDown( S32 x, S32 y, MASK mask );
 79	/*virtual*/ BOOL	handleClick(S32 x, S32 y, MASK mask);
 80	/*virtual*/ BOOL	handleDoubleClick( S32 x, S32 y, MASK mask );
 81
 82	void			setScale( F32 scale );
 83	void			setToolTipMsg(const std::string& msg) { mToolTipMsg = msg; }
 84	void			renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
 85
 86private:
 87	const LLVector3d& getObjectImageCenterGlobal()	{ return mObjectImageCenterGlobal; }
 88	void 			renderPoint(const LLVector3 &pos, const LLColor4U &color, 
 89								S32 diameter, S32 relative_height = 0);
 90
 91	LLVector3		globalPosToView(const LLVector3d& global_pos);
 92	LLVector3d		viewPosToGlobal(S32 x,S32 y);
 93
 94	void			drawTracking( const LLVector3d& pos_global, 
 95								  const LLColor4& color,
 96								  BOOL draw_arrow = TRUE);
 97	BOOL			handleToolTipAgent(const LLUUID& avatar_id);
 98	static void		showAvatarInspector(const LLUUID& avatar_id);
 99
100	void			createObjectImage();
101
102	static bool		outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y, S32 slop);
103
104private:
105	bool			mUpdateNow;
106
107	LLUIColor		mBackgroundColor;
108
109	F32				mScale;					// Size of a region in pixels
110	F32				mPixelsPerMeter;		// world meters to map pixels
111	F32				mObjectMapTPM;			// texels per meter on map
112	F32				mObjectMapPixels;		// Width of object map in pixels
113	F32				mDotRadius;				// Size of avatar markers
114
115	bool			mPanning;			// map is being dragged
116	LLVector2		mTargetPan;
117	LLVector2		mCurPan;
118	LLVector2		mStartPan;		// pan offset at start of drag
119	LLCoordGL		mMouseDown;			// pointer position at start of drag
120
121	LLVector3d		mObjectImageCenterGlobal;
122	LLPointer<LLImageRaw> mObjectRawImagep;
123	LLPointer<LLViewerTexture>	mObjectImagep;
124
125	LLUUID			mClosestAgentToCursor;
126	LLUUID			mClosestAgentAtLastRightClick;
127
128	std::string		mToolTipMsg;
129
130public:
131	void			setSelected(uuid_vec_t uuids) { gmSelected=uuids; };
132
133private:
134	void handleZoom(const LLSD& userdata);
135	void handleStopTracking (const LLSD& userdata);
136
137	LLMenuGL*		mPopupMenu;
138	uuid_vec_t		gmSelected;
139};
140
141
142#endif