diff options
author | callum <none@none> | 2010-07-26 15:55:49 -0700 |
---|---|---|
committer | callum <none@none> | 2010-07-26 15:55:49 -0700 |
commit | f531dd2bc566e6ddb74954bf853eed424dbddab9 (patch) | |
tree | a7481c08e7d2771f22e0643b4ea4d621a0d59784 /indra/newview | |
parent | 6ad892aa95b50a4bbcd369657d47d428ee248f96 (diff) |
Implementation for EXT-7291 (World Map in the Viewer2 needs a way to type in region coordinates)
Reviewed by PB
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterworldmap.cpp | 68 | ||||
-rw-r--r-- | indra/newview/llfloaterworldmap.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_world_map.xml | 123 |
3 files changed, 134 insertions, 64 deletions
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 983fd97b0b..031294ad56 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -206,6 +206,7 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key) mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", FALSE); + mCommitCallbackRegistrar.add("WMap.Coordinates", boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this)); mCommitCallbackRegistrar.add("WMap.Location", boost::bind(&LLFloaterWorldMap::onLocationCommit, this)); mCommitCallbackRegistrar.add("WMap.AvatarCombo", boost::bind(&LLFloaterWorldMap::onAvatarComboCommit, this)); mCommitCallbackRegistrar.add("WMap.Landmark", boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit, this)); @@ -336,8 +337,6 @@ void LLFloaterWorldMap::onOpen(const LLSD& key) } } - - // static void LLFloaterWorldMap::reloadIcons(void*) { @@ -582,6 +581,10 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) S32 world_y = S32(pos_global.mdV[1] / 256); LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true); setDefaultBtn(""); + + // clicked on a non-region - turn off coord display + enableTeleportCoordsDisplay( false ); + return; } if (sim_info->isDown()) @@ -592,6 +595,10 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) LLWorldMap::getInstance()->setTrackingInvalid(); LLTracker::stopTracking(NULL); setDefaultBtn(""); + + // clicked on a down region - turn off coord display + enableTeleportCoordsDisplay( false ); + return; } @@ -609,9 +616,40 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) LLTracker::trackLocation(pos_global, full_name, tooltip); LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking + LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal(); + updateTeleportCoordsDisplay( coord_pos ); + + // we have a valid region - turn on coord display + enableTeleportCoordsDisplay( true ); + setDefaultBtn("Teleport"); } +// enable/disable teleport destination coordinates +void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled ) +{ + childSetEnabled("teleport_coordinate_x", enabled ); + childSetEnabled("teleport_coordinate_y", enabled ); + childSetEnabled("teleport_coordinate_z", enabled ); +} + +// update display of teleport destination coordinates - pos is in global coordinates +void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos ) +{ + // if we're going to update their value, we should also enable them + enableTeleportCoordsDisplay( true ); + + // convert global specified position to a local one + F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS ); + F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS ); + F32 region_local_z = (F32)fmod( pos.mdV[VZ], (F64)REGION_WIDTH_METERS ); + + // write in the values + childSetValue("teleport_coordinate_x", region_local_x ); + childSetValue("teleport_coordinate_y", region_local_y ); + childSetValue("teleport_coordinate_z", region_local_z ); +} + void LLFloaterWorldMap::updateLocation() { bool gotSimName; @@ -638,6 +676,9 @@ void LLFloaterWorldMap::updateLocation() // Fill out the location field childSetValue("location", agent_sim_name); + // update the coordinate display with location of avatar in region + updateTeleportCoordsDisplay( agentPos ); + // Figure out where user is // Set the current SLURL mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal()); @@ -668,6 +709,10 @@ void LLFloaterWorldMap::updateLocation() childSetValue("location", sim_name); + // refresh coordinate display to reflect where user clicked. + LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal(); + updateTeleportCoordsDisplay( coord_pos ); + // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL if ( gotSimName ) { @@ -1139,6 +1184,22 @@ void LLFloaterWorldMap::onLocationCommit() } } +void LLFloaterWorldMap::onCoordinatesCommit() +{ + if( mIsClosing ) + { + return; + } + + F32 x_coord = (F32)childGetValue("teleport_coordinate_x").asReal(); + F32 y_coord = (F32)childGetValue("teleport_coordinate_y").asReal(); + F32 z_coord = (F32)childGetValue("teleport_coordinate_z").asReal(); + + const std::string region_name = childGetValue("location").asString(); + + trackURL( region_name, x_coord, y_coord, z_coord ); +} + void LLFloaterWorldMap::onClearBtn() { mTrackedStatus = LLTracker::TRACKING_NOTHING; @@ -1199,6 +1260,9 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) else if(LLWorldMap::getInstance()->isTracking()) { pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();; + + + } else { diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 550b4ef689..e31bafaf9b 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -149,6 +149,7 @@ protected: void updateSearchEnabled(); void onLocationFocusChanged( LLFocusableElement* ctrl ); void onLocationCommit(); + void onCoordinatesCommit(); void onCommitSearchResult(); void cacheLandmarkPosition(); @@ -160,6 +161,12 @@ private: F32 mCurZoomVal; LLFrameTimer mZoomTimer; + // update display of teleport destination coordinates - pos is in global coordinates + void updateTeleportCoordsDisplay( const LLVector3d& pos ); + + // enable/disable teleport destination coordinates + void enableTeleportCoordsDisplay( bool enabled ); + LLDynamicArray<LLUUID> mLandmarkAssetIDList; LLDynamicArray<LLUUID> mLandmarkItemIDList; 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 a59db1420f..20629018e2 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -395,7 +395,7 @@ <panel follows="right|top|bottom" - height="310" + height="330" top_pad="0" width="238" name="layout_panel_4"> @@ -534,7 +534,66 @@ <scroll_list.commit_callback function="WMap.SearchResult" /> </scroll_list> - <button + <text + type="string" + length="1" + follows="right|bottom" + halign="right" + height="16" + layout="topleft" + left="25" + name="events_label" + top_pad="16" + width="70"> + Location: + </text> + <spinner + control_name="Teleport_Coordinate_X" + decimal_digits="0" + follows="right|bottom" + height="23" + increment="1" + initial_value="128" + layout="topleft" + left_delta="74" + max_val="255" + min_val="0" + name="teleport_coordinate_x" + width="44" > + <spinner.commit_callback + function="WMap.Coordinates" /> + </spinner> + <spinner + control_name="Teleport_Coordinate_Y" + decimal_digits="0" + follows="right|bottom" + height="23" + increment="1" + initial_value="128" + layout="topleft" + left_delta="47" + max_val="255" + min_val="0" + name="teleport_coordinate_y" > + <spinner.commit_callback + function="WMap.Coordinates" /> + </spinner> + <spinner + control_name="Teleport_Coordinate_Z" + decimal_digits="0" + follows="right|bottom" + height="23" + increment="1" + initial_value="128" + layout="topleft" + left_delta="47" + max_val="255" + min_val="0" + name="teleport_coordinate_z"> + <spinner.commit_callback + function="WMap.Coordinates" /> + </spinner> + <button follows="right|bottom" height="23" image_unselected="PushButton_On" @@ -574,66 +633,6 @@ <button.commit_callback function="WMap.ShowTarget" /> </button> - -<!-- <text - type="string" - length="1" - follows="bottom|right" - halign="left" - height="16" - top_pad="4" - left="25" - layout="topleft" - name="land_sale_label" - width="250"> - Location: - </text> - <spinner - decimal_digits="0" - follows="bottom|right" - increment="1" - initial_value="128" - layout="topleft" - top_pad="0" - left="25" - max_val="255" - name="spin x" - tool_tip="X coordinate of location to show on map" - width="48"> - <spinner.commit_callback - function="WMap.CommitLocation" /> - </spinner> - <spinner - decimal_digits="0" - follows="bottom|right" - height="16" - increment="1" - initial_value="128" - layout="topleft" - left_pad="2" - max_val="255" - name="spin y" - tool_tip="Y coordinate of location to show on map" - top_delta="0" - width="48" > - <spinner.commit_callback - function="WMap.CommitLocation" /> - </spinner> - <spinner - decimal_digits="0" - follows="bottom|right" - increment="1" - initial_value="0" - layout="topleft" - left_pad="2" - max_val="4096" - name="spin z" - tool_tip="Z coordinate of location to show on map" - top_delta="0" - width="48"> - <spinner.commit_callback - function="WMap.CommitLocation" /> - </spinner>--> </panel> <panel follows="right|bottom" |