summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLynx Linden <lynx@lindenlab.com>2009-12-14 15:53:03 +0000
committerLynx Linden <lynx@lindenlab.com>2009-12-14 15:53:03 +0000
commit94a9b1ed0d962d9d97c026b25c81aacca018d558 (patch)
tree7e91f47e66e1bbcd32e5263fdcd502528235cae8
parenta763409647a5a8d82f2f1c54223b998877c3b72d (diff)
EXT-3426: Enable Teleport/Map buttons for all Places.
When we open the Places side tray for a parcel, given a UUID, we now look up the parcel's global 3D position so that the teleport and map functions work correctly.
-rw-r--r--indra/newview/llpanelplaces.cpp78
-rw-r--r--indra/newview/llpanelplaces.h4
2 files changed, 78 insertions, 4 deletions
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index e21eb01da3..20f1864f9d 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -54,6 +54,7 @@
#include "llavatarpropertiesprocessor.h"
#include "llfloaterworldmap.h"
#include "llinventorybridge.h"
+#include "llinventoryobserver.h"
#include "llinventorymodel.h"
#include "lllandmarkactions.h"
#include "lllandmarklist.h"
@@ -62,6 +63,7 @@
#include "llpanelpick.h"
#include "llpanelplaceprofile.h"
#include "llpanelteleporthistory.h"
+#include "llremoteparcelrequest.h"
#include "llteleporthistorystorage.h"
#include "lltoggleablemenu.h"
#include "llviewerinventory.h"
@@ -85,8 +87,10 @@ static void onSLURLBuilt(std::string& slurl);
class LLPlacesParcelObserver : public LLParcelObserver
{
public:
- LLPlacesParcelObserver(LLPanelPlaces* places_panel)
- : mPlaces(places_panel) {}
+ LLPlacesParcelObserver(LLPanelPlaces* places_panel) :
+ LLParcelObserver(),
+ mPlaces(places_panel)
+ {}
/*virtual*/ void changed()
{
@@ -101,8 +105,10 @@ private:
class LLPlacesInventoryObserver : public LLInventoryObserver
{
public:
- LLPlacesInventoryObserver(LLPanelPlaces* places_panel)
- : mPlaces(places_panel) {}
+ LLPlacesInventoryObserver(LLPanelPlaces* places_panel) :
+ LLInventoryObserver(),
+ mPlaces(places_panel)
+ {}
/*virtual*/ void changed(U32 mask)
{
@@ -114,6 +120,59 @@ private:
LLPanelPlaces* mPlaces;
};
+class LLPlacesRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver
+{
+public:
+ LLPlacesRemoteParcelInfoObserver(LLPanelPlaces* places_panel) :
+ LLRemoteParcelInfoObserver(),
+ mPlaces(places_panel)
+ {}
+
+ ~LLPlacesRemoteParcelInfoObserver()
+ {
+ // remove any in-flight observers
+ std::set<LLUUID>::iterator it;
+ for (it = mParcelIDs.begin(); it != mParcelIDs.end(); ++it)
+ {
+ const LLUUID &id = *it;
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(id, this);
+ }
+ mParcelIDs.clear();
+ }
+
+ /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data)
+ {
+ if (mPlaces)
+ {
+ mPlaces->changedGlobalPos(LLVector3d(parcel_data.global_x,
+ parcel_data.global_y,
+ parcel_data.global_z));
+ }
+
+ mParcelIDs.erase(parcel_data.parcel_id);
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_data.parcel_id, this);
+ }
+ /*virtual*/ void setParcelID(const LLUUID& parcel_id)
+ {
+ if (!parcel_id.isNull())
+ {
+ mParcelIDs.insert(parcel_id);
+ LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this);
+ LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id);
+ }
+ }
+ /*virtual*/ void setErrorStatus(U32 status, const std::string& reason)
+ {
+ llerrs << "Can't complete remote parcel request. Http Status: "
+ << status << ". Reason : " << reason << llendl;
+ }
+
+private:
+ std::set<LLUUID> mParcelIDs;
+ LLPanelPlaces* mPlaces;
+};
+
+
static LLRegisterPanelClassWrapper<LLPanelPlaces> t_places("panel_places");
LLPanelPlaces::LLPanelPlaces()
@@ -131,6 +190,7 @@ LLPanelPlaces::LLPanelPlaces()
{
mParcelObserver = new LLPlacesParcelObserver(this);
mInventoryObserver = new LLPlacesInventoryObserver(this);
+ mRemoteParcelObserver = new LLPlacesRemoteParcelInfoObserver(this);
gInventory.addObserver(mInventoryObserver);
@@ -149,6 +209,7 @@ LLPanelPlaces::~LLPanelPlaces()
delete mInventoryObserver;
delete mParcelObserver;
+ delete mRemoteParcelObserver;
}
BOOL LLPanelPlaces::postBuild()
@@ -282,6 +343,10 @@ void LLPanelPlaces::onOpen(const LLSD& key)
{
LLUUID parcel_id = key["id"].asUUID();
mPlaceProfile->setParcelID(parcel_id);
+
+ // query the server to get the global 3D position of this
+ // parcel - we need this for teleport/mapping functions.
+ mRemoteParcelObserver->setParcelID(parcel_id);
}
else
{
@@ -837,6 +902,11 @@ void LLPanelPlaces::changedInventory(U32 mask)
gInventory.removeObserver(mInventoryObserver);
}
+void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos)
+{
+ mPosGlobal = global_pos;
+}
+
void LLPanelPlaces::updateVerbs()
{
bool is_place_info_visible;
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index 5f9aed6357..5ee8704992 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -47,6 +47,7 @@ class LLPanelPlacesTab;
class LLParcelSelection;
class LLPlacesInventoryObserver;
class LLPlacesParcelObserver;
+class LLRemoteParcelInfoObserver;
class LLTabContainer;
class LLToggleableMenu;
@@ -65,6 +66,8 @@ public:
void changedParcelSelection();
// Called on agent inventory change to find out when inventory gets usable.
void changedInventory(U32 mask);
+ // Called when we receive the global 3D position of a parcel.
+ void changedGlobalPos(const LLVector3d &global_pos);
void setItem(LLInventoryItem* item);
@@ -112,6 +115,7 @@ private:
LLPlacesInventoryObserver* mInventoryObserver;
LLPlacesParcelObserver* mParcelObserver;
+ LLRemoteParcelInfoObserver* mRemoteParcelObserver;
// Pointer to a landmark item or to a linked landmark
LLPointer<LLInventoryItem> mItem;