Skip to content

Commit

Permalink
RE 6805 Refactor SelectionNotificationService class
Browse files Browse the repository at this point in the history
Added bool parameter to message, to indicate whether the
Q-vector is in lab or sample coordinates.

refs #6805
  • Loading branch information
DennisMikkelson committed May 14, 2013
1 parent 18889ad commit 7e66cbc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include "MantidQtAPI/UserSubWindow.h"
#include "MantidQtAPI/SelectionNotificationService.h"

//#include "MantidAPI/SelectionNotificationService.h"

namespace MantidQt
{
namespace CustomInterfaces
Expand Down Expand Up @@ -307,15 +305,8 @@ private slots:
/// Slot to enable/disable the ellipse size options controls
void setEnabledEllipseSizeOptions_slot();

/*
/// Methods to handle pointed at message from any source
void handleQpointNotification(const Poco::AutoPtr<Mantid::API::SelectionNotificationServiceImpl::AddNotification> & message );
void handleQpointNotification1(const Poco::AutoPtr<Mantid::API::SelectionNotificationServiceImpl::AfterReplaceNotification> & message );
*/

/// Method to get and display info about the specified Q-vector
void showInfo( Mantid::Kernel::V3D q_point );
void showInfo( bool lab_coords, Mantid::Kernel::V3D q_point );

private:
/// super class pure virtual method we MUST implement
Expand Down Expand Up @@ -382,11 +373,6 @@ private slots:
/// allow running precisely one operation
/// at a time in a separate thread.

/*
Poco::NObserver<MantidEV, Mantid::API::SelectionNotificationServiceImpl::AddNotification> observer;
Poco::NObserver<MantidEV, Mantid::API::SelectionNotificationServiceImpl::AfterReplaceNotification> observer1;
*/

};

} // namespace CustomInterfaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ class DLLExport MantidEVWorker
/// Get Info about a Q-Vector from a PeaksWorkspace
std::vector< std::pair< std::string, std::string > >
PointInfo( const std::string & peaks_ws_name,
Mantid::Kernel::V3D Q);
bool lab_coords,
Mantid::Kernel::V3D Q);


private:
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MantidEV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ void MantidEV::showInfo_slot()
getDouble( m_uiForm.Qz_ledt, qz );

/// loop back test of SelectionNotificationService
MantidQt::API::SelectionNotificationService::Instance().sendQPointSelection( false, qx, qy, qz );
MantidQt::API::SelectionNotificationService::Instance().sendQPointSelection( true, qx, qy, qz );
}


Expand All @@ -1078,17 +1078,19 @@ void MantidEV::showInfo_slot()
void MantidEV::QPointSelection_slot( bool lab_coords, double qx, double qy, double qz )
{
Mantid::Kernel::V3D q_point( qx, qy, qz );
showInfo( q_point );
showInfo( lab_coords, q_point );
}


/**
* Use the peaks workspace to get information about the specified
* Q-vector.
*
* @param lab_coords Will be true if the Q-components are in lab coordinates
* and false if they are in sample coordinates.
* @param q_point Vector containing the Q-coordinates.
*/
void MantidEV::showInfo( Mantid::Kernel::V3D q_point )
void MantidEV::showInfo( bool lab_coords, Mantid::Kernel::V3D q_point )
{
std::string peaks_ws_name = m_uiForm.PeaksWorkspace_ledt->text().toStdString();
if ( peaks_ws_name.length() == 0 )
Expand All @@ -1102,7 +1104,7 @@ void MantidEV::showInfo( Mantid::Kernel::V3D q_point )
errorMessage("Requested Peaks Workspace Doesn't Exist");
}

std::vector< std::pair< std::string, std::string > > info = worker->PointInfo( peaks_ws_name, q_point );
std::vector< std::pair< std::string, std::string > > info = worker->PointInfo( peaks_ws_name, lab_coords, q_point );

m_uiForm.SelectedPoint_tbl->setRowCount((int)info.size());
m_uiForm.SelectedPoint_tbl->setColumnCount(2);
Expand Down
11 changes: 11 additions & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,18 @@ bool MantidEVWorker::showUB( const std::string & peaks_ws_name )
}


/**
* Get information about a specified Q-position from the specified peaks
* workspace.
*
* @param peaks_ws_name The name of the peaks workspace
* @param lab_coords This will be true if the Q-vector is
* in lab coordinates and will be false if
* it is in sample coordinates.
* @param Q The Q-vector.
*/
std::vector< std::pair<std::string,std::string> >MantidEVWorker::PointInfo( const std::string & peaks_ws_name,
bool lab_coords,
Mantid::Kernel::V3D Q)
{
const auto& ADS = AnalysisDataService::Instance();
Expand Down

0 comments on commit 7e66cbc

Please sign in to comment.