Skip to content

Commit

Permalink
Refs #3882: SliceViewerDemo target moved from MantidPlot to MantidQt
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Nov 1, 2011
1 parent ae6f4c5 commit 3c22432
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 38 deletions.
21 changes: 0 additions & 21 deletions Code/Mantid/MantidPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -764,27 +764,6 @@ target_link_libraries ( MantidPlot




if ( WIN32 )
else ()
include_directories ( ../Framework/MDEvents/inc )
include_directories ( ../Framework/DataObjects/inc )
include_directories ( ../Framework/Algorithms/inc )
include_directories ( ../Framework/API/inc )
include_directories ( ../Framework/DataHandling/inc )
include_directories ( ../Framework/TestHelpers/inc )
include_directories ( ../Framework/Geometry/inc )

# Extra, optional target for demoing a GUI element
add_executable ( SliceViewerDemo EXCLUDE_FROM_ALL ${WIN_CONSOLE} MACOSX_BUNDLE ${ALL_SRC} ../MantidQt/SliceViewer/src/main.cpp
${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS} ${RES_FILES} ${MANTID_RC_FILE} )
target_link_libraries ( SliceViewerDemo
${CORE_MANTIDLIBS} MantidQtAPI MantidWidgets MantidQtSliceViewer
MDEvents Geometry
QtPropertyBrowser ${QT_LIBRARIES} ${ZLIB_LIBRARIES}
${QWT_LIBRARIES} ${QWTPLOT3D_LIBRARIES} ${QSCINTILLA_LIBRARIES} ${PYTHON_LIBRARIES} )
endif ()

###########################################################################
# Entry point flag for Windows to ensure we always link to standard main
###########################################################################
Expand Down
27 changes: 25 additions & 2 deletions Code/Mantid/MantidQt/SliceViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,33 @@ add_library ( MantidQtSliceViewer ${ALL_SRC} ${INC_FILES} ${UI_HDRS} )

target_link_libraries ( MantidQtSliceViewer MantidQtAPI QtPropertyBrowser ${QT_LIBRARIES} ${QWT_LIBRARIES} )

# Extra, optional target for demoing a GUI element
add_executable ( ColorBarWidgetDemo EXCLUDE_FROM_ALL ${ALL_SRC} src/main_ColorBarWidget.cpp ${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS})
###########################################################################
# DEMO/GUI TESTING APPLICATIONS
###########################################################################

add_executable ( ColorBarWidgetDemo EXCLUDE_FROM_ALL ${ALL_SRC} src/main_ColorBarWidgetDemo.cpp ${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS})
target_link_libraries ( ColorBarWidgetDemo MantidQtAPI QtPropertyBrowser ${QT_LIBRARIES} ${QWT_LIBRARIES} )

if ( WIN32 )
else ()
include_directories ( ../../Framework/MDEvents/inc )
include_directories ( ../../Framework/DataObjects/inc )
include_directories ( ../../Framework/Algorithms/inc )
include_directories ( ../../Framework/API/inc )
include_directories ( ../../Framework/DataHandling/inc )
include_directories ( ../../Framework/TestHelpers/inc )
include_directories ( ../../Framework/Geometry/inc )

# Extra, optional target for demoing a GUI element
add_executable ( SliceViewerDemo EXCLUDE_FROM_ALL ${WIN_CONSOLE} MACOSX_BUNDLE ${ALL_SRC} src/main_SliceViewerDemo.cpp
${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS} ${RES_FILES} ${MANTID_RC_FILE} )
target_link_libraries ( SliceViewerDemo
${CORE_MANTIDLIBS} MantidQtAPI MantidWidgets MantidQtSliceViewer
MDEvents Geometry
QtPropertyBrowser ${QT_LIBRARIES} ${ZLIB_LIBRARIES}
${QWT_LIBRARIES} ${QWTPLOT3D_LIBRARIES} ${QSCINTILLA_LIBRARIES} ${PYTHON_LIBRARIES} )
endif ()

###########################################################################
# Installation settings
###########################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#ifndef SLICEVIEWER_H
#define SLICEVIEWER_H

#include "ui_SliceViewer.h"
#include "DimensionSliceWidget.h"
#include "DllOption.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "ColorBarWidget.h"
#include "QwtRasterDataMD.h"
#include "ui_SliceViewer.h"
#include <QtCore/QtCore>
#include <QtGui/qdialog.h>
#include <QtGui/QWidget>
Expand Down Expand Up @@ -69,10 +70,10 @@ public slots:
QHBoxLayout * m_spectLayout;

/// Color map in use
QwtLinearColorMap m_colorMap;
QwtColorMap * m_colorMap;

/// Color bar indicating the color scale
QwtScaleWidget * m_colorBar;
ColorBarWidget * m_colorBar;

/// Vector of the widgets for slicing dimensions
std::vector<DimensionSliceWidget *> m_dimWidgets;
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/MantidQt/SliceViewer/src/ColorBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void ColorBarWidget::setViewRange(double min, double max)
void ColorBarWidget::changedLogState(int log)
{
this->setLog(log);
emit changedColorRange(m_min,m_max,m_log);
}

//-------------------------------------------------------------------------------------------------
Expand Down
25 changes: 16 additions & 9 deletions Code/Mantid/MantidQt/SliceViewer/src/SliceViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,26 @@ SliceViewer::SliceViewer(QWidget *parent)
m_spect = new QwtPlotSpectrogram();
m_spect->attach(m_plot);

m_colorMap = QwtLinearColorMap(Qt::blue, Qt::red);
m_colorMap = new QwtLinearColorMap(Qt::blue, Qt::red);
QwtDoubleInterval range(0.0, 10.0);

m_data = new QwtRasterDataMD();
m_spect->setColorMap(m_colorMap);
m_spect->setColorMap(*m_colorMap);
m_plot->autoRefresh();

// --- Create a color bar on the right axis ---------------
m_colorBar = m_plot->axisWidget(QwtPlot::yRight);
m_colorBar->setColorBarEnabled(true);
m_colorBar->setColorMap(range, m_colorMap);
m_plot->setAxisScale(QwtPlot::yRight, range.minValue(), range.maxValue() );
m_plot->enableAxis(QwtPlot::yRight);
m_colorBar = new ColorBarWidget(this);
m_colorBar->setColorMap(m_colorMap);
m_colorBar->setDataRange( range.minValue(), range.maxValue() );
m_colorBar->setViewRange( range.minValue(), range.maxValue() );
m_colorBar->setLog(true);
m_spectLayout->addWidget(m_colorBar, 0, 0);

// m_colorBar = m_plot->axisWidget(QwtPlot::yRight);
// m_colorBar->setColorBarEnabled(true);
// m_colorBar->setColorMap(range, m_colorMap);
// m_plot->setAxisScale(QwtPlot::yRight, range.minValue(), range.maxValue() );
// m_plot->enableAxis(QwtPlot::yRight);

// Make the splitter use the minimum size for the controls and not stretch out
ui.splitter->setStretchFactor(0, 0);
Expand Down Expand Up @@ -505,8 +512,8 @@ void SliceViewer::updateDisplay(bool resetAxes)

// Set the color range
m_data->setRange(m_colorRange);
m_colorBar->setColorMap(m_colorRange, m_colorMap);
m_plot->setAxisScale(QwtPlot::yRight, m_colorRange.minValue(), m_colorRange.maxValue() );
// m_colorBar->setColorMap(m_colorRange, m_colorMap);
// m_plot->setAxisScale(QwtPlot::yRight, m_colorRange.minValue(), m_colorRange.maxValue() );

// Notify the graph that the underlying data changed
m_spect->setData(*m_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
#include <QDir>
#include <QThread>

#include "ApplicationWindow.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/MantidVersion.h"

#include "Mantid/MantidApplication.h"
#include "qmainwindow.h"
#include "../inc/MantidQtSliceViewer/SliceViewer.h"
#include "MantidQtSliceViewer/SliceViewer.h"
#include "MantidMDEvents/MDHistoWorkspace.h"
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidAPI/AnalysisDataService.h"
Expand Down

0 comments on commit 3c22432

Please sign in to comment.