summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llfloaterworldmap.cpp135
-rw-r--r--indra/newview/llfloaterworldmap.h29
-rw-r--r--indra/newview/llworldmap.h8
-rw-r--r--indra/newview/skins/default/xui/en/floater_world_map.xml3
4 files changed, 161 insertions, 14 deletions
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 8d74a99539..fc2cfbcf2b 100755
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -261,6 +261,48 @@ void LLMapFriendObserver::changed(U32 mask)
}
}
+LLWorldMapParcelInfoObserver::LLWorldMapParcelInfoObserver(const LLVector3d& pos_global)
+ : LLRemoteParcelInfoObserver(),
+ mPosGlobal(pos_global),
+ mParcelID(LLUUID::null)
+{ }
+
+LLWorldMapParcelInfoObserver::~LLWorldMapParcelInfoObserver()
+{
+ if (mParcelID.notNull())
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this);
+ }
+}
+
+void LLWorldMapParcelInfoObserver::processParcelInfo(const LLParcelData& parcel_data)
+{
+ if (parcel_data.parcel_id == mParcelID)
+ {
+ LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this);
+
+ if (gFloaterWorldMap)
+ {
+ gFloaterWorldMap->processParcelInfo(parcel_data, mPosGlobal);
+ }
+ }
+}
+
+// virtual
+void LLWorldMapParcelInfoObserver::setParcelID(const LLUUID& parcel_id)
+{
+ mParcelID = parcel_id;
+ auto instance = LLRemoteParcelInfoProcessor::getInstance();
+ instance->addObserver(mParcelID, this);
+ instance->sendParcelInfoRequest(mParcelID);
+}
+
+// virtual
+void LLWorldMapParcelInfoObserver::setErrorStatus(S32 status, const std::string& reason)
+{
+ LL_WARNS("LLWorldMapParcelInfoObserver") << "Can't handle remote parcel request." << " Http Status: " << status << ". Reason : " << reason << LL_ENDL;
+}
+
//---------------------------------------------------------------------------
// Statics
//---------------------------------------------------------------------------
@@ -275,23 +317,25 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001"
LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
: LLFloater(key),
- mInventory(NULL),
- mInventoryObserver(NULL),
- mFriendObserver(NULL),
+ mInventory(nullptr),
+ mInventoryObserver(nullptr),
+ mFriendObserver(nullptr),
mCompletingRegionName(),
mCompletingRegionPos(),
mWaitingForTracker(false),
mIsClosing(false),
mSetToUserPosition(true),
- mTrackedLocation(0,0,0),
+ mTrackedLocation(0.0,0.0,0.0),
mTrackedStatus(LLTracker::TRACKING_NOTHING),
- mListFriendCombo(NULL),
- mListLandmarkCombo(NULL),
- mListSearchResults(NULL)
+ mListFriendCombo(nullptr),
+ mListLandmarkCombo(nullptr),
+ mListSearchResults(nullptr),
+ mParcelInfoObserver(nullptr),
+ mShowParcelInfo(false)
{
gFloaterWorldMap = this;
- mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
+ mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, nullptr);
mCommitCallbackRegistrar.add("WMap.Coordinates", boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this));
mCommitCallbackRegistrar.add("WMap.Location", boost::bind(&LLFloaterWorldMap::onLocationCommit, this));
@@ -374,6 +418,11 @@ bool LLFloaterWorldMap::postBuild()
// virtual
LLFloaterWorldMap::~LLFloaterWorldMap()
{
+ if (mParcelInfoObserver)
+ {
+ delete mParcelInfoObserver;
+ }
+
// All cleaned up by LLView destructor
mMapView = NULL;
@@ -584,9 +633,73 @@ void LLFloaterWorldMap::draw()
// Internal utility functions
//-------------------------------------------------------------------------
+void LLFloaterWorldMap::processParcelInfo(const LLParcelData& parcel_data, const LLVector3d& pos_global) const
+{
+ LLVector3d tracker_pos = LLTracker::getTrackedPositionGlobal();
+ if (!mShowParcelInfo ||
+ (tracker_pos.mdV[VX] != pos_global.mdV[VX] && tracker_pos.mdV[VY] != pos_global.mdV[VY]) ||
+ LLTracker::getTrackedLocationType() != LLTracker::LOCATION_NOTHING ||
+ LLTracker::getTrackingStatus() != LLTracker::TRACKING_LOCATION)
+ {
+ return;
+ }
+
+ LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
+ if (!sim_info)
+ {
+ return;
+ }
+
+ std::string sim_name = sim_info->getName();
+ U32 locX, locY;
+ from_region_handle(sim_info->getHandle(), &locX, &locY);
+ F32 region_x = (F32)(pos_global.mdV[VX] - locX);
+ F32 region_y = (F32)(pos_global.mdV[VY] - locY);
+ std::string full_name = llformat("%s (%d, %d, %d)",
+ sim_name.c_str(),
+ ll_round(region_x),
+ ll_round(region_y),
+ ll_round((F32)pos_global.mdV[VZ]));
+
+ LLTracker::trackLocation(pos_global, parcel_data.name.empty() ? getString("UnnamedParcel") : parcel_data.name, full_name);
+}
+
+void LLFloaterWorldMap::requestParcelInfo(const LLVector3d& pos_global, const LLVector3d& region_origin)
+{
+ if (pos_global == mRequestedGlobalPos)
+ {
+ return;
+ }
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ {
+ return;
+ }
+
+ if (std::string url = region->getCapability("RemoteParcelRequest"); !url.empty())
+ {
+ mRequestedGlobalPos = pos_global;
+ if (mParcelInfoObserver)
+ {
+ delete mParcelInfoObserver;
+ }
+ mParcelInfoObserver = new LLWorldMapParcelInfoObserver(pos_global);
+
+ auto pos_region = LLVector3(pos_global - region_origin);
+ LLRemoteParcelInfoProcessor::instance().requestRegionParcelInfo(url,
+ region->getRegionID(), pos_region, pos_global,
+ mParcelInfoObserver->getObserverHandle());
+ }
+ else
+ {
+ LL_WARNS() << "Cannot request parcel details: Cap not found" << LL_ENDL;
+ }
+}
void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& name )
{
+ mShowParcelInfo = false;
LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo");
if (!iface) return;
@@ -617,6 +730,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string&
void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
{
+ mShowParcelInfo = false;
LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo");
if (!iface) return;
@@ -662,6 +776,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info)
{
+ mShowParcelInfo = false;
mTrackedStatus = LLTracker::TRACKING_LOCATION;
LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT);
setDefaultBtn("Teleport");
@@ -669,6 +784,7 @@ void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info)
void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item)
{
+ mShowParcelInfo = false;
mTrackedStatus = LLTracker::TRACKING_LOCATION;
LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM);
setDefaultBtn("Teleport");
@@ -721,6 +837,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
LLTracker::trackLocation(pos_global, full_name, tooltip);
+ mShowParcelInfo = true;
+ requestParcelInfo(pos_global, sim_info->getGlobalOrigin());
+
LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
updateTeleportCoordsDisplay( coord_pos );
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index a99100f5bd..2f2b2b7a0d 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -34,8 +34,9 @@
#include "llfloater.h"
#include "llmapimagetype.h"
-#include "lltracker.h"
+#include "llremoteparcelrequest.h"
#include "llslurl.h"
+#include "lltracker.h"
class LLCtrlListInterface;
class LLFriendObserver;
@@ -51,6 +52,21 @@ class LLSliderCtrl;
class LLSpinCtrl;
class LLSearchEditor;
+class LLWorldMapParcelInfoObserver : public LLRemoteParcelInfoObserver
+{
+public:
+ LLWorldMapParcelInfoObserver(const LLVector3d& pos_global);
+ ~LLWorldMapParcelInfoObserver();
+
+ void processParcelInfo(const LLParcelData& parcel_data);
+ void setParcelID(const LLUUID& parcel_id);
+ void setErrorStatus(S32 status, const std::string& reason);
+
+protected:
+ LLVector3d mPosGlobal;
+ LLUUID mParcelID;
+};
+
class LLFloaterWorldMap : public LLFloater
{
public:
@@ -119,6 +135,8 @@ public:
//Slapp instigated avatar tracking
void avatarTrackFromSlapp( const LLUUID& id );
+ void processParcelInfo(const LLParcelData& parcel_data, const LLVector3d& pos_global) const;
+
protected:
void onGoHome();
@@ -169,8 +187,13 @@ private:
// enable/disable teleport destination coordinates
void enableTeleportCoordsDisplay( bool enabled );
- std::vector<LLUUID> mLandmarkAssetIDList;
- std::vector<LLUUID> mLandmarkItemIDList;
+ void requestParcelInfo(const LLVector3d& pos_global, const LLVector3d& region_origin);
+ LLVector3d mRequestedGlobalPos;
+ bool mShowParcelInfo;
+ LLWorldMapParcelInfoObserver* mParcelInfoObserver;
+
+ uuid_vec_t mLandmarkAssetIDList;
+ uuid_vec_t mLandmarkItemIDList;
static const LLUUID sHomeID;
diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h
index fb9d140851..aab19a4d5f 100644
--- a/indra/newview/llworldmap.h
+++ b/indra/newview/llworldmap.h
@@ -128,9 +128,9 @@ public:
LLPointer<LLViewerFetchedTexture> getLandForSaleImage(); // Get the overlay image, fetch it if necessary
bool isName(const std::string& name) const;
- bool isDown() { return (mAccess == SIM_ACCESS_DOWN); }
- bool isPG() { return (mAccess <= SIM_ACCESS_PG); }
- bool isAdult() { return (mAccess == SIM_ACCESS_ADULT); }
+ bool isDown() const { return (mAccess == SIM_ACCESS_DOWN); }
+ bool isPG() const { return (mAccess <= SIM_ACCESS_PG); }
+ bool isAdult() const { return (mAccess == SIM_ACCESS_ADULT); }
// Debug only
void dump() const; // Print the region info to the standard output
@@ -157,6 +157,8 @@ public:
const LLSimInfo::item_info_list_t& getLandForSaleAdult() const { return mLandForSaleAdult; }
const LLSimInfo::item_info_list_t& getAgentLocation() const { return mAgentLocations; }
+ const U64& getHandle() const { return mHandle; }
+
private:
U64 mHandle; // This is a hash of the X and Y world coordinates of the SW corner of the sim
std::string mName; // Region name
diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml
index 7efa81d263..b0b818cde5 100644
--- a/indra/newview/skins/default/xui/en/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_world_map.xml
@@ -14,6 +14,9 @@
single_instance="true"
title="WORLD MAP"
width="650">
+ <string name="UnnamedParcel">
+ (Unnamed Parcel)
+ </string>
<string
name="collapse_icon"
value="map_ui_collapse_icon.png"/>