Commit 5cb6d721 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Cleaned up DataContainerInspectorWidget and DataContainerInspectorCanvas to finish issue 546.

closes #546
closes #37
parent 18e07a01
......@@ -60,10 +60,8 @@ namespace campvis {
, _quad(nullptr)
, _numTiles(0, 0)
, _quadSize(0, 0)
, _currentSlice(-1)
, _localDataContainer("Local DataContainer for DataContainerInspectorCanvas")
, p_viewportSize("ViewportSize", "Viewport Size", tgt::ivec2(200), tgt::ivec2(0, 0), tgt::ivec2(10000))
, p_camera("Camera", "Camera", tgt::Camera())
, _geometryRenderer(&p_viewportSize)
, _trackballEH(nullptr)
{
......@@ -246,9 +244,6 @@ namespace campvis {
_paintShader->setUniform("_2dTextureParams._numChannels", static_cast<int>(texture->getNumChannels()));
}
else {
// clamp current slice to texture size, since this can't be done in event handler:
_currentSlice = tgt::clamp(_currentSlice, -1, texture->getDimensions().z);
unit3d.activate();
texture->bind();
_paintShader->setUniform("_is3d", true);
......@@ -287,7 +282,7 @@ namespace campvis {
{
if (e->modifiers() & tgt::Event::CTRL) {
int texIndx = (e->y() / _quadSize.y) * _numTiles.x + (e->x() / _quadSize.x);
if (texIndx < 0 || texIndx >= _textures.size())
if (texIndx < 0 || texIndx >= static_cast<int>(_textures.size()))
return;
const ImageData* id = static_cast<const ImageData*>(_textures[texIndx].getData());
......@@ -439,6 +434,7 @@ namespace campvis {
void DataContainerInspectorCanvas::onPropertyChanged(const AbstractProperty* prop) {
// ignore properties of the geometry renderer
if (prop != &p_geometryRendererProperties)
invalidate();
}
......
......@@ -88,6 +88,10 @@ namespace campvis {
*/
void deinit();
/**
* Set the DataHandles to show in the canvas to those in \a handles.
* \param handles vector of name-DataHandle pairs to show in the canvas.
*/
void setDataHandles(const std::vector< std::pair<QString, QtDataHandle> >& handles);
/**
......@@ -112,15 +116,15 @@ namespace campvis {
virtual void onEvent(tgt::Event* e);
IntProperty p_currentSlice;
TransferFunctionProperty p_transferFunction; ///< Transfer function
IntProperty p_currentSlice; ///< Currently selected slice to show
TransferFunctionProperty p_transferFunction; ///< Transfer function
BoolProperty p_renderRChannel; /// Flag whether to render Red channel
BoolProperty p_renderGChannel; /// Flag whether to render Green channel
BoolProperty p_renderBChannel; /// Flag whether to render Blue channel
BoolProperty p_renderAChannel; /// Flag whether to render Alpha channel
BoolProperty p_renderRChannel; ///< Flag whether to render Red channel
BoolProperty p_renderGChannel; ///< Flag whether to render Green channel
BoolProperty p_renderBChannel; ///< Flag whether to render Blue channel
BoolProperty p_renderAChannel; ///< Flag whether to render Alpha channel
MetaProperty p_geometryRendererProperties;
MetaProperty p_geometryRendererProperties; ///< MetaProperty for the GeometryRenderer
signals:
void s_colorChanged(const tgt::vec4&);
......@@ -147,6 +151,7 @@ namespace campvis {
* \param dh DataHandle to the newly added data.
*/
void onDataContainerDataAdded(const std::string& name, const DataHandle& dh);
/**
* Slot getting called when one of the observed properties changed and notifies its observers.
* \param prop Property that emitted the signal
......@@ -160,6 +165,9 @@ namespace campvis {
*/
void updateTextures();
/**
* Resets the trackball and reinitializes the camera to the currently loaded geometries if necessary.
*/
void resetTrackball();
/**
......@@ -189,7 +197,8 @@ namespace campvis {
*/
void createQuad();
std::map<QString, QtDataHandle> _handles;
std::map<QString, QtDataHandle> _handles; ///< Map of DataHandles to show
/// Vector of textures to render. Each DataHandle contains an ImageData that has an OpenGL representation.
/// This ensures thread safety.
......@@ -210,11 +219,8 @@ namespace campvis {
tgt::ivec2 _numTiles; ///< number of tiles on texture overview
tgt::ivec2 _quadSize; ///< size in pixels for each tile in overview
int _currentSlice; ///< current slice if rendering a 3D image fullscreen, render MIP if negative
DataContainer _localDataContainer; ///< Local DataContainer the GeometryRenderer works on
IVec2Property p_viewportSize;
CameraProperty p_camera;
GeometryRenderer _geometryRenderer; ///< GeometryRenderer used to render geometries
TrackballNavigationEventListener* _trackballEH;
};
......
......@@ -180,8 +180,6 @@ namespace campvis {
QWidget* _colorValWidget; ///< Widget that shows the color value in color
QPalette _colorValWidgetPalette; ///< Palette which will be used to colorize the color widget
// Added by Hossain Mahmud <mahmud@in.tum.de>
// Date: January 02, 2014
QPushButton* _btnLoadFile;
QPushButton* _btnSaveToFile;
DataContainerFileLoaderWidget* _propEditorWid;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment