本文整理汇总了C++中baserenderer::Pointer::GetDisplayGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetDisplayGeometry方法的具体用法?C++ Pointer::GetDisplayGeometry怎么用?C++ Pointer::GetDisplayGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类baserenderer::Pointer
的用法示例。
在下文中一共展示了Pointer::GetDisplayGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool mitk::DisplayInteractor::Zoom(StateMachineAction*, InteractionEvent* interactionEvent)
{
const BaseRenderer::Pointer sender = interactionEvent->GetSender();
InteractionPositionEvent* positionEvent = dynamic_cast<InteractionPositionEvent*>(interactionEvent);
if (positionEvent == NULL)
{
MITK_WARN<< "DisplayVectorInteractor cannot process the event: " << interactionEvent->GetNameOfClass();
return false;
}
float factor = 1.0;
float distance = 0;
if (m_ZoomDirection == "leftright")
{
distance = m_CurrentDisplayCoordinate[1] - m_LastDisplayCoordinate[1];
}
else
{
distance = m_CurrentDisplayCoordinate[0] - m_LastDisplayCoordinate[0];
}
// set zooming speed
if (distance < 0.0)
{
factor = 1.0 / m_ZoomFactor;
}
else if (distance > 0.0)
{
factor = 1.0 * m_ZoomFactor;
}
sender->GetDisplayGeometry()->ZoomWithFixedWorldCoordinates(factor, m_StartDisplayCoordinate, m_StartCoordinateInMM);
sender->GetRenderingManager()->RequestUpdate(sender->GetRenderWindow());
m_LastDisplayCoordinate = m_CurrentDisplayCoordinate;
m_CurrentDisplayCoordinate = positionEvent->GetPointerPositionOnScreen();
return true;
}
示例2: if
bool mitk::DisplayInteractor::Zoom(StateMachineAction*, InteractionEvent* interactionEvent)
{
const BaseRenderer::Pointer sender = interactionEvent->GetSender();
InteractionPositionEvent* positionEvent = static_cast<InteractionPositionEvent*>(interactionEvent);
float factor = 1.0;
float distance = 0;
if (m_ZoomDirection == "updown")
{
distance = m_CurrentDisplayCoordinate[1] - m_LastDisplayCoordinate[1];
}
else
{
distance = m_CurrentDisplayCoordinate[0] - m_LastDisplayCoordinate[0];
}
if ( m_InvertZoomDirection )
{
distance *= -1.0;
}
// set zooming speed
if (distance < 0.0)
{
factor = 1.0 / m_ZoomFactor;
}
else if (distance > 0.0)
{
factor = 1.0 * m_ZoomFactor;
}
if (factor != 1.0)
{
sender->GetDisplayGeometry()->ZoomWithFixedWorldCoordinates(factor, m_StartDisplayCoordinate, m_StartCoordinateInMM);
sender->GetRenderingManager()->RequestUpdate(sender->GetRenderWindow());
}
m_LastDisplayCoordinate = m_CurrentDisplayCoordinate;
m_CurrentDisplayCoordinate = positionEvent->GetPointerPositionOnScreen();
return true;
}