Skip to content

Commit

Permalink
Refs #4141. Adding parallel projection implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Nov 17, 2011
1 parent 9a090d8 commit 56a4b75
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ public slots:
* @param state flag to determine whether or not to use log color scaling
*/
void onLogScale(int state);
/// Set the view to use a parallel projection.
void onParallelProjection(bool state);
/// Reset center of rotation to center of data volume.
void onResetCenterToData();
/// Reset center of rotation to given point.
Expand Down Expand Up @@ -177,6 +179,8 @@ public slots:

/// Return the active representation determined by ParaView.
pqPipelineRepresentation *getPvActiveRep();
/// Return the active view determined by ParaView
pqRenderView *getPvActiveView();
/// Find the number of true sources in the pipeline.
unsigned int getNumSources();
/// Collect time information for animation controls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,17 @@ void MdViewerWidget::setParaViewComponentsForView()
this->ui.timeControlWidget,
SLOT(updateAnimationControls(double, double, int)));

// Set the connections for the rotation center buttons
// Set the connections for the rotation center button
QObject::connect(this->ui.resetCenterToDataButton,
SIGNAL(clicked()),
this->currentView,
SLOT(onResetCenterToData()));

// Set the connection for the parallel projection button
QObject::connect(this->ui.parallelProjButton,
SIGNAL(toggled(bool)),
this->currentView,
SLOT(onParallelProjection(bool)));
}

void MdViewerWidget::onDataLoaded(pqPipelineSource* source)
Expand Down
24 changes: 24 additions & 0 deletions Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/src/ViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,30 @@ void ViewBase::setAxisScales()
{
}

/**
* This function is used to set the current state of the view between a
* parallel projection and the normal projection.
* @param state whether or not to use parallel projection
*/
void ViewBase::onParallelProjection(bool state)
{
pqRenderView *cview = this->getPvActiveView();
vtkSMProxy *proxy = cview->getProxy();
vtkSMPropertyHelper(proxy, "CameraParallelProjection").Set(state);
proxy->UpdateVTKObjects();
cview->render();
}

/**
* Retrieve the active pqRenderView object according to ParaView's
* ActiveObjects mechanism.
* @return the currently active view
*/
pqRenderView *ViewBase::getPvActiveView()
{
return qobject_cast<pqRenderView*>(pqActiveObjects::instance().activeView());
}

}
}
}

0 comments on commit 56a4b75

Please sign in to comment.