OpenSim compatible world map. YUCK!!!
This commit is contained in:
@@ -61,9 +61,7 @@
|
||||
#include "llviewermenu.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerstats.h"
|
||||
#include "llviewerimage.h"
|
||||
#include "llworldmap.h"
|
||||
#include "llworldmapmessage.h"
|
||||
#include "llworldmapview.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llappviewer.h"
|
||||
@@ -81,12 +79,6 @@
|
||||
//---------------------------------------------------------------------------
|
||||
static const F32 MAP_ZOOM_TIME = 0.2f;
|
||||
|
||||
// Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed
|
||||
// width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across
|
||||
// sessions and doesn't prevent the user to pan the world if it was to grow a lot beyond that limit.
|
||||
// Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
|
||||
static const S32 MAX_VISIBLE_REGIONS = 512;
|
||||
|
||||
enum EPanDirection
|
||||
{
|
||||
PAN_UP,
|
||||
@@ -175,6 +167,7 @@ LLFloaterWorldMap::LLFloaterWorldMap()
|
||||
{
|
||||
LLCallbackMap::map_t factory_map;
|
||||
factory_map["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
|
||||
factory_map["terrain_mapview"] = LLCallbackMap(createWorldMapView, NULL);
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &factory_map);
|
||||
}
|
||||
|
||||
@@ -186,7 +179,30 @@ void* LLFloaterWorldMap::createWorldMapView(void* data)
|
||||
|
||||
BOOL LLFloaterWorldMap::postBuild()
|
||||
{
|
||||
mPanel = getChild<LLPanel>("objects_mapview");
|
||||
mTabs = getChild<LLTabContainer>("maptab");
|
||||
if (!mTabs) return FALSE;
|
||||
|
||||
LLPanel *panel;
|
||||
|
||||
panel = mTabs->getChild<LLPanel>("objects_mapview");
|
||||
if (panel)
|
||||
{
|
||||
mTabs->setTabChangeCallback(panel, onCommitBackground);
|
||||
mTabs->setTabUserData(panel, this);
|
||||
}
|
||||
panel = mTabs->getChild<LLPanel>("terrain_mapview");
|
||||
if (panel)
|
||||
{
|
||||
mTabs->setTabChangeCallback(panel, onCommitBackground);
|
||||
mTabs->setTabUserData(panel, this);
|
||||
}
|
||||
|
||||
// The following callback syncs the worlmap tabs with the images.
|
||||
// Commented out since it was crashing when LLWorldMap became a singleton.
|
||||
// We should be fine without it but override the onOpen method and put it
|
||||
// there if it turns out to be needed. -MG
|
||||
//
|
||||
//onCommitBackground((void*)this, false);
|
||||
|
||||
childSetCommitCallback("friend combo", onAvatarComboCommit, this);
|
||||
|
||||
@@ -247,7 +263,7 @@ BOOL LLFloaterWorldMap::postBuild()
|
||||
LLFloaterWorldMap::~LLFloaterWorldMap()
|
||||
{
|
||||
// All cleaned up by LLView destructor
|
||||
mPanel = NULL;
|
||||
mTabs = NULL;
|
||||
|
||||
// Inventory deletes all observers on shutdown
|
||||
mInventory = NULL;
|
||||
@@ -280,7 +296,7 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target)
|
||||
gFloaterWorldMap->open(); /* Flawfinder: ignore */
|
||||
|
||||
LLWorldMapView* map_panel;
|
||||
map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
|
||||
map_panel = (LLWorldMapView*)gFloaterWorldMap->mTabs->getCurrentPanel();
|
||||
map_panel->clearLastClick();
|
||||
|
||||
if (!was_visible)
|
||||
@@ -292,8 +308,15 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target)
|
||||
}
|
||||
map_panel->updateVisibleBlocks();
|
||||
|
||||
// Reload items as they may have changed
|
||||
LLWorldMap::getInstance()->reloadItems();
|
||||
// Reload the agent positions when we show the window
|
||||
LLWorldMap::getInstance()->eraseItems();
|
||||
|
||||
// Reload any maps that may have changed
|
||||
LLWorldMap::getInstance()->clearSimFlags();
|
||||
|
||||
const S32 panel_num = gFloaterWorldMap->mTabs->getCurrentPanelIndex();
|
||||
const bool request_from_sim = true;
|
||||
LLWorldMap::getInstance()->setCurrentLayer(panel_num, request_from_sim);
|
||||
|
||||
// We may already have a bounding box for the regions of the world,
|
||||
// so use that to adjust the view.
|
||||
@@ -327,7 +350,9 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target)
|
||||
// static
|
||||
void LLFloaterWorldMap::reloadIcons(void*)
|
||||
{
|
||||
LLWorldMap::getInstance()->reloadItems();
|
||||
LLWorldMap::getInstance()->eraseItems();
|
||||
|
||||
LLWorldMap::getInstance()->sendMapLayerRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +390,7 @@ void LLFloaterWorldMap::setVisible( BOOL visible )
|
||||
|
||||
if( !visible )
|
||||
{
|
||||
// While we're not visible, discard the image tiles and overlays
|
||||
// While we're not visible, discard the overlay images we're using
|
||||
LLWorldMap::getInstance()->clearImageRefs();
|
||||
}
|
||||
}
|
||||
@@ -402,6 +427,12 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
|
||||
void LLFloaterWorldMap::reshape( S32 width, S32 height, BOOL called_from_parent )
|
||||
{
|
||||
LLFloater::reshape( width, height, called_from_parent );
|
||||
|
||||
// Might have changed size of world display area
|
||||
// JC: Technically, this is correct, but it makes the slider "pop"
|
||||
// if you resize the window, then draw the slider. Just leaving it
|
||||
// the way it was when you opened the window seems better.
|
||||
// adjustZoomSliderBounds();
|
||||
}
|
||||
|
||||
|
||||
@@ -480,7 +511,7 @@ void LLFloaterWorldMap::draw()
|
||||
|
||||
childSetEnabled("Teleport", (BOOL)tracking_status);
|
||||
// childSetEnabled("Clear", (BOOL)tracking_status);
|
||||
childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
|
||||
childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation);
|
||||
childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
|
||||
|
||||
setMouseOpaque(TRUE);
|
||||
@@ -501,18 +532,6 @@ void LLFloaterWorldMap::draw()
|
||||
F32 map_scale = 256.f*pow(2.f, mCurZoomVal);
|
||||
LLWorldMapView::setScale( map_scale );
|
||||
|
||||
// Enable/disable checkboxes depending on the zoom level
|
||||
// If above threshold level (i.e. low res) -> Disable all checkboxes
|
||||
// If under threshold level (i.e. high res) -> Enable all checkboxes
|
||||
bool enable = LLWorldMapView::showRegionInfo();
|
||||
childSetEnabled("people_chk", enable);
|
||||
childSetEnabled("infohub_chk", enable);
|
||||
childSetEnabled("telehubchk", enable);
|
||||
childSetEnabled("land_for_sale_chk", enable);
|
||||
childSetEnabled("event_chk", enable);
|
||||
childSetEnabled("event_mature_chk", enable);
|
||||
childSetEnabled("event_adult_chk", enable);
|
||||
|
||||
LLFloater::draw();
|
||||
}
|
||||
|
||||
@@ -600,14 +619,14 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
|
||||
void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info)
|
||||
{
|
||||
mTrackedStatus = LLTracker::TRACKING_LOCATION;
|
||||
LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT);
|
||||
LLTracker::trackLocation(event_info.mPosGlobal, event_info.mName, event_info.mToolTip, LLTracker::LOCATION_EVENT);
|
||||
setDefaultBtn("Teleport");
|
||||
}
|
||||
|
||||
void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item)
|
||||
{
|
||||
mTrackedStatus = LLTracker::TRACKING_LOCATION;
|
||||
LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM);
|
||||
LLTracker::trackLocation(item.mPosGlobal, item.mName, item.mToolTip, LLTracker::LOCATION_ITEM);
|
||||
setDefaultBtn("Teleport");
|
||||
}
|
||||
|
||||
@@ -616,27 +635,29 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
|
||||
LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
|
||||
if (!sim_info)
|
||||
{
|
||||
// We haven't found a region for that point yet, leave the tracking to the world map
|
||||
LLWorldMap::getInstance()->setTracking(pos_global);
|
||||
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
|
||||
LLWorldMap::getInstance()->mInvalidLocation = FALSE;
|
||||
LLWorldMap::getInstance()->mUnknownLocation = pos_global;
|
||||
LLTracker::stopTracking(NULL);
|
||||
S32 world_x = S32(pos_global.mdV[0] / 256);
|
||||
S32 world_y = S32(pos_global.mdV[1] / 256);
|
||||
LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
|
||||
LLWorldMap::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
|
||||
setDefaultBtn("");
|
||||
return;
|
||||
}
|
||||
if (sim_info->isDown())
|
||||
if (sim_info->mAccess == SIM_ACCESS_DOWN)
|
||||
{
|
||||
// Down region. Show the blue circle of death!
|
||||
// i.e. let the world map that this and tell it it's invalid
|
||||
LLWorldMap::getInstance()->setTracking(pos_global);
|
||||
LLWorldMap::getInstance()->setTrackingInvalid();
|
||||
// Down sim. Show the blue circle of death!
|
||||
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
|
||||
LLWorldMap::getInstance()->mUnknownLocation = pos_global;
|
||||
LLWorldMap::getInstance()->mInvalidLocation = TRUE;
|
||||
LLTracker::stopTracking(NULL);
|
||||
setDefaultBtn("");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string sim_name = sim_info->getName();
|
||||
std::string sim_name;
|
||||
LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
|
||||
F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
|
||||
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
|
||||
std::string full_name = llformat("%s (%d, %d, %d)",
|
||||
@@ -651,7 +672,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
|
||||
std::string tooltip("");
|
||||
mTrackedStatus = LLTracker::TRACKING_LOCATION;
|
||||
LLTracker::trackLocation(pos_global, full_name, tooltip);
|
||||
LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
|
||||
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
|
||||
LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE;
|
||||
LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;
|
||||
|
||||
setDefaultBtn("Teleport");
|
||||
}
|
||||
@@ -780,9 +803,9 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3
|
||||
|
||||
// pass sim name to combo box
|
||||
gFloaterWorldMap->mCompletingRegionName = region_name;
|
||||
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name);
|
||||
LLWorldMap::getInstance()->sendNamedRegionRequest(region_name);
|
||||
LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName);
|
||||
LLWorldMap::getInstance()->setTrackingCommit();
|
||||
LLWorldMap::getInstance()->mIsTrackingCommit = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -963,7 +986,7 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui)
|
||||
{
|
||||
childSetValue("spin z", 0);
|
||||
}
|
||||
LLWorldMap::getInstance()->cancelTracking();
|
||||
LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;
|
||||
mCompletingRegionName = "";
|
||||
mExactMatch = FALSE;
|
||||
}
|
||||
@@ -1000,16 +1023,18 @@ void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui)
|
||||
// can see the whole world, plus a little.
|
||||
void LLFloaterWorldMap::adjustZoomSliderBounds()
|
||||
{
|
||||
// Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed
|
||||
// width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across
|
||||
// sessions and doesn't prevent the user to pan the world if it was to grow a lot beyond that limit.
|
||||
// Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
|
||||
S32 world_width_regions = MAX_VISIBLE_REGIONS;
|
||||
S32 world_height_regions = MAX_VISIBLE_REGIONS;
|
||||
// World size in regions
|
||||
S32 world_width_regions = LLWorldMap::getInstance()->getWorldWidth() / REGION_WIDTH_UNITS;
|
||||
S32 world_height_regions = LLWorldMap::getInstance()->getWorldHeight() / REGION_WIDTH_UNITS;
|
||||
|
||||
// Pad the world size a little bit, so we have a nice border on
|
||||
// the edge
|
||||
world_width_regions++;
|
||||
world_height_regions++;
|
||||
|
||||
// Find how much space we have to display the world
|
||||
LLWorldMapView* map_panel;
|
||||
map_panel = (LLWorldMapView*)mPanel;
|
||||
map_panel = (LLWorldMapView*)mTabs->getCurrentPanel();
|
||||
LLRect view_rect = map_panel->getRect();
|
||||
|
||||
// View size in pixels
|
||||
@@ -1059,7 +1084,7 @@ void LLFloaterWorldMap::onPanBtn( void* userdata )
|
||||
}
|
||||
|
||||
LLWorldMapView* map_panel;
|
||||
map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
|
||||
map_panel = (LLWorldMapView*)gFloaterWorldMap->mTabs->getCurrentPanel();
|
||||
map_panel->translatePan( pan_x, pan_y );
|
||||
}
|
||||
|
||||
@@ -1259,16 +1284,16 @@ void LLFloaterWorldMap::onLocationCommit( void* userdata )
|
||||
|
||||
LLStringUtil::toLower(str);
|
||||
gFloaterWorldMap->mCompletingRegionName = str;
|
||||
LLWorldMap::getInstance()->setTrackingCommit();
|
||||
LLWorldMap::getInstance()->mIsTrackingCommit = TRUE;
|
||||
self->mExactMatch = FALSE;
|
||||
if (str.length() >= 3)
|
||||
{
|
||||
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
|
||||
LLWorldMap::getInstance()->sendNamedRegionRequest(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
str += "#";
|
||||
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
|
||||
LLWorldMap::getInstance()->sendNamedRegionRequest(str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1279,7 +1304,7 @@ void LLFloaterWorldMap::onClearBtn(void* data)
|
||||
LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
|
||||
self->mTrackedStatus = LLTracker::TRACKING_NOTHING;
|
||||
LLTracker::stopTracking((void *)(intptr_t)TRUE);
|
||||
LLWorldMap::getInstance()->cancelTracking();
|
||||
LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
|
||||
self->mSLURL = ""; // Clear the SLURL since it's invalid
|
||||
self->mSetToUserPosition = TRUE; // Revert back to the current user position
|
||||
}
|
||||
@@ -1354,9 +1379,9 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
|
||||
pos_global = LLTracker::getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal();
|
||||
}
|
||||
}
|
||||
else if(LLWorldMap::getInstance()->isTracking())
|
||||
else if(LLWorldMap::getInstance()->mIsTrackingUnknownLocation)
|
||||
{
|
||||
pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal();;
|
||||
pos_global = LLWorldMap::getInstance()->mUnknownLocation - gAgent.getCameraPositionGlobal();;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1364,8 +1389,8 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
|
||||
pos_global.clearVec();
|
||||
}
|
||||
|
||||
LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)),
|
||||
-llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)),
|
||||
LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * (F64)LLWorldMapView::sPixelsPerMeter)),
|
||||
-llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sPixelsPerMeter)),
|
||||
!animate);
|
||||
mWaitingForTracker = FALSE;
|
||||
}
|
||||
@@ -1541,6 +1566,17 @@ void LLFloaterWorldMap::flyToAvatar()
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterWorldMap::onCommitBackground(void* userdata, bool from_click)
|
||||
{
|
||||
LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata;
|
||||
|
||||
// Find my index
|
||||
S32 index = self->mTabs->getCurrentPanelIndex();
|
||||
|
||||
LLWorldMap::getInstance()->setCurrentLayer(index);
|
||||
}
|
||||
|
||||
void LLFloaterWorldMap::updateSims(bool found_null_sim)
|
||||
{
|
||||
if (mCompletingRegionName == "")
|
||||
@@ -1558,27 +1594,28 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
|
||||
BOOL match_found = FALSE;
|
||||
S32 num_results = 0;
|
||||
std::map<U64, LLSimInfo*>::const_iterator it;
|
||||
for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
|
||||
for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
|
||||
{
|
||||
LLSimInfo* info = it->second;
|
||||
std::string sim_name_lower = info->getName();
|
||||
LLSimInfo* info = (*it).second;
|
||||
std::string sim_name = info->mName;
|
||||
std::string sim_name_lower = sim_name;
|
||||
LLStringUtil::toLower(sim_name_lower);
|
||||
|
||||
if (sim_name_lower.substr(0, name_length) == mCompletingRegionName)
|
||||
{
|
||||
if (LLWorldMap::getInstance()->isTrackingCommit())
|
||||
if (LLWorldMap::getInstance()->mIsTrackingCommit)
|
||||
{
|
||||
if (info->isName(mCompletingRegionName))
|
||||
if (sim_name_lower == mCompletingRegionName)
|
||||
{
|
||||
selected_value = info->getName();
|
||||
selected_value = sim_name;
|
||||
match_found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
LLSD value;
|
||||
value["id"] = info->getName();
|
||||
value["id"] = sim_name;
|
||||
value["columns"][0]["column"] = "sim_name";
|
||||
value["columns"][0]["value"] = info->getName();
|
||||
value["columns"][0]["value"] = sim_name;
|
||||
list->addElement(value);
|
||||
num_results++;
|
||||
}
|
||||
@@ -1645,13 +1682,15 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata)
|
||||
LLStringUtil::toLower(sim_name);
|
||||
|
||||
std::map<U64, LLSimInfo*>::const_iterator it;
|
||||
for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
|
||||
for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
|
||||
{
|
||||
LLSimInfo* info = it->second;
|
||||
LLSimInfo* info = (*it).second;
|
||||
std::string info_sim_name = info->mName;
|
||||
LLStringUtil::toLower(info_sim_name);
|
||||
|
||||
if (info->isName(sim_name))
|
||||
if (sim_name == info_sim_name)
|
||||
{
|
||||
LLVector3d pos_global = info->getGlobalOrigin();
|
||||
LLVector3d pos_global = from_region_handle( info->mHandle );
|
||||
F64 local_x = self->childGetValue("spin x");
|
||||
F64 local_y = self->childGetValue("spin y");
|
||||
F64 local_z = self->childGetValue("spin z");
|
||||
|
||||
Reference in New Issue
Block a user