EXT-1232 Implement \"You are Here\" banner for Place Profile - Parcel Characteristics

Note:
\"YouAreHereDistance\" setting has been added to setting.xml

--HG--
branch : product-engine
master
Denis Serdjuk 2009-10-28 13:56:02 +02:00
parent f71f8ecdf9
commit 2bb9751d0a
5 changed files with 40 additions and 10 deletions

View File

@ -10482,6 +10482,17 @@
<key>Value</key>
<real>90.0</real>
</map>
<key>YouAreHereDistance</key>
<map>
<key>Comment</key>
<string>Radius of distance for banner that indicates if the resident is "on" the Place.(meters from avatar to requested place)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>10.0</real>
</map>
<key>YieldTime</key>
<map>
<key>Comment</key>

View File

@ -89,6 +89,11 @@ std::string LLAgentUI::buildSLURL(const bool escaped /*= true*/)
return slurl;
}
//static
BOOL LLAgentUI::checkAgentDistance(const LLVector3& pole, F32 radius)
{
return (gAgent.getPositionAgent() - pole).length() < radius;
}
BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region)
{
LLViewerRegion* region = gAgent.getRegion();

View File

@ -52,6 +52,11 @@ public:
static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
//build location string using a region position of the avatar.
static BOOL buildLocationString(std::string& str, ELocationFormat fmt,const LLVector3& agent_pos_region);
/**
* @brief Check whether the agent is in neighborhood of the pole Within same region
* @return true if the agent is in neighborhood.
*/
static BOOL checkAgentDistance(const LLVector3& local_pole, F32 radius);
};
#endif //LLAGENTUI_H

View File

@ -55,6 +55,7 @@
#include "llagent.h"
#include "llagentui.h"
#include "llavatarpropertiesprocessor.h"
#include "llcallbacklist.h"
#include "llfloaterworldmap.h"
#include "llfloaterbuycurrency.h"
#include "llinventorymodel.h"
@ -65,6 +66,7 @@
#include "llviewerinventory.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewercontrol.h"
#include "llviewertexteditor.h"
#include "llworldmap.h"
#include "llsdutil_math.h"
@ -110,7 +112,7 @@ BOOL LLPanelPlaceInfo::postBuild()
mForSalePanel = getChild<LLPanel>("for_sale_panel");
mYouAreHerePanel = getChild<LLPanel>("here_panel");
LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLPanelPlaceInfo::updateYouAreHereBanner,this));
gIdleCallbacks.addFunction(&LLPanelPlaceInfo::updateYouAreHereBanner, this);
//Icon value should contain sale price of last selected parcel.
mForSalePanel->getChild<LLIconCtrl>("icon_for_sale")->
@ -609,6 +611,9 @@ void LLPanelPlaceInfo::displaySelectedParcelInfo(LLParcel* parcel,
parcel_data.name = parcel->getName();
parcel_data.sim_name = region->getName();
parcel_data.snapshot_id = parcel->getSnapshotID();
mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
(F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
(F32)pos_global.mdV[VZ]);
parcel_data.global_x = pos_global.mdV[VX];
parcel_data.global_y = pos_global.mdV[VY];
parcel_data.global_z = pos_global.mdV[VZ];
@ -985,18 +990,22 @@ void LLPanelPlaceInfo::populateFoldersList()
mFolderCombo->add(it->second, LLSD(it->first));
}
void LLPanelPlaceInfo::updateYouAreHereBanner()
//static
void LLPanelPlaceInfo::updateYouAreHereBanner(void* userdata)
{
//YouAreHere Banner should be displayed only for selected places,
// If you want to display it for landmark or teleport history item, you should check by mParcelId
bool is_you_are_here = false;
if (mSelectedParcelID != S32(-1) && !mLastSelectedRegionID.isNull())
{
is_you_are_here = gAgent.getRegion()->getRegionID()== mLastSelectedRegionID &&
mSelectedParcelID == LLViewerParcelMgr::getInstance()->getAgentParcel()->getLocalID();
}
mYouAreHerePanel->setVisible(is_you_are_here);
LLPanelPlaceInfo* self = static_cast<LLPanelPlaceInfo*>(userdata);
if(!self->getVisible())
return;
static F32 radius = gSavedSettings.getF32("YouAreHereDistance");
BOOL display_banner = self->mLastSelectedRegionID == gAgent.getRegion()->getRegionID() &&
LLAgentUI::checkAgentDistance(self->mPosRegion, radius);
self->mYouAreHerePanel->setVisible(display_banner);
}
void LLPanelPlaceInfo::onForSaleBannerClick()

View File

@ -138,7 +138,7 @@ public:
private:
void populateFoldersList();
void updateYouAreHereBanner();
static void updateYouAreHereBanner(void*);// added to gIdleCallbacks
void onForSaleBannerClick();
/**