LLNetMap::LLNetMap(const std::string& name) :
	LLPanel(name),
	mScale(128.f),
	mObjectMapTPM(1.f),
	mObjectMapPixels(255.f),
	mTargetPanX( 0.f ),
	mTargetPanY( 0.f ),
	mCurPanX( 0.f ),
	mCurPanY( 0.f ),
	mUpdateNow( FALSE )
{
	mScale = gSavedSettings.getF32("MiniMapScale");
	mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
	mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);

	mObjectImageCenterGlobal = gAgentCamera.getCameraPositionGlobal();
	
	// Register event listeners for popup menu
	(new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel");
	(new LLCenterMap())->registerListener(this, "MiniMap.Center");
	(new LLCheckCenterMap())->registerListener(this, "MiniMap.CheckCenter");
	(new LLRotateMap())->registerListener(this, "MiniMap.Rotate");
	(new LLCheckRotateMap())->registerListener(this, "MiniMap.CheckRotate");
	(new LLStopTracking())->registerListener(this, "MiniMap.StopTracking");
	(new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking");
	(new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile");
	(new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile");
	(new LLCamFollow())->registerListener(this, "MiniMap.CamFollow"); //moymod - add cam follow crap thingie
	(new mmsetred())->registerListener(this, "MiniMap.setred");
	(new mmsetgreen())->registerListener(this, "MiniMap.setgreen");
	(new mmsetblue())->registerListener(this, "MiniMap.setblue");
	(new mmsetyellow())->registerListener(this, "MiniMap.setyellow");
	(new mmsetcustom())->registerListener(this, "MiniMap.setcustom");
	(new mmsetunmark())->registerListener(this, "MiniMap.setunmark");
	(new mmenableunmark())->registerListener(this, "MiniMap.enableunmark");

	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml");

	updateMinorDirections();

	LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this);
	if (!menu)
	{
		menu = new LLMenuGL(LLStringUtil::null);
	}
	menu->setVisible(FALSE);
	mPopupMenuHandle = menu->getHandle();
}
示例#2
0
LLNetMap::LLNetMap(
	const std::string& name,
	const LLRect& rect,
	const LLColor4& bg_color )
	:
	LLUICtrl(name, rect, FALSE, NULL, NULL), mBackgroundColor( bg_color ),
	mObjectMapTPM(1.f),
	mObjectMapPixels(255.f),
	mTargetPanX( 0.f ),
	mTargetPanY( 0.f ),
	mCurPanX( 0.f ),
	mCurPanY( 0.f ),
	mUpdateNow( FALSE )
{
	mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS;

	LLNetMap::sRotateMap = gSavedSettings.getBOOL( "MiniMapRotate" );
	
	// Surface texture is dynamically generated/updated.
// 	createObjectImage();

	mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
	
	// TODO: exteralize hardcoded constants.
	const S32 DIR_WIDTH = 10;
	const S32 DIR_HEIGHT = 10;
	LLRect major_dir_rect(  0, DIR_HEIGHT, DIR_WIDTH, 0 );
	const LLColor4 minor_color( 1.f, 1.f, 1.f, .7f );
	const LLRect minor_dir_rect(  0, DIR_HEIGHT, DIR_WIDTH * 2, 0 );

	// Note: removing special treatment for north compass point (DEV-10559). -MG
	//mTextBoxNorth = new LLTextBox( "N", major_dir_rect );
	//mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT);
	//addChild( mTextBoxNorth );
	mTextBoxNorth =	new LLTextBox( std::string("N"), major_dir_rect );
	mTextBoxNorth->setColor( minor_color );
	addChild( mTextBoxNorth );
	
	mTextBoxEast =	new LLTextBox( std::string("E"), major_dir_rect );
	mTextBoxEast->setColor( minor_color );
	addChild( mTextBoxEast );
	
	major_dir_rect.mRight += 1 ;
	mTextBoxWest =	new LLTextBox( std::string("W"), major_dir_rect );
	mTextBoxWest->setColor( minor_color );
	addChild( mTextBoxWest );
	major_dir_rect.mRight -= 1 ;

	mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect );
	mTextBoxSouth->setColor( minor_color );
	addChild( mTextBoxSouth );

	mTextBoxSouthEast =	new LLTextBox( std::string("SE"), minor_dir_rect );
	mTextBoxSouthEast->setColor( minor_color );
	addChild( mTextBoxSouthEast );
	
	mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect );
	mTextBoxNorthEast->setColor( minor_color );
	addChild( mTextBoxNorthEast );
	
	mTextBoxSouthWest =	new LLTextBox( std::string("SW"), minor_dir_rect );
	mTextBoxSouthWest->setColor( minor_color );
	addChild( mTextBoxSouthWest );

	mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect );
	mTextBoxNorthWest->setColor( minor_color );
	addChild( mTextBoxNorthWest );

	// Right-click menu
	LLMenuGL* menu;
	menu = new LLMenuGL(std::string("popup"));
	menu->setCanTearOff(FALSE);
	menu->append(new LLMenuItemCallGL(std::string("Zoom Close"), handleZoomLevel,
										NULL, (void*)2) );
	menu->append(new LLMenuItemCallGL(std::string("Zoom Medium"), handleZoomLevel,
										NULL, (void*)1) );
	menu->append(new LLMenuItemCallGL(std::string("Zoom Far"), handleZoomLevel,
										NULL, (void*)0) );
	menu->appendSeparator();
	menu->append(new LLMenuItemCallGL(std::string("Stop Tracking"), &LLTracker::stopTracking,
										&LLTracker::isTracking, NULL) );
	menu->setVisible(FALSE);
	addChild(menu);
	mPopupMenuHandle = menu->getHandle();

	sInstance = this;
}