|
|
|
|
@ -28,7 +28,8 @@ nmVTKViewCommandController::nmVTKViewCommandController(
|
|
|
|
|
m_pContainer(pContainer),
|
|
|
|
|
m_eCapabilities(0),
|
|
|
|
|
m_bViewAvailable(false),
|
|
|
|
|
m_bRotationCenterPickingAvailable(false)
|
|
|
|
|
m_bRotationCenterPickingAvailable(false),
|
|
|
|
|
m_bRotationCenterMarkerAvailable(false)
|
|
|
|
|
{
|
|
|
|
|
for(int nIndex = 0; nIndex < ViewCommandCount; ++nIndex) {
|
|
|
|
|
m_pActions[nIndex] = nullptr;
|
|
|
|
|
@ -63,6 +64,18 @@ nmVTKViewCommandController::nmVTKViewCommandController(
|
|
|
|
|
SLOT(setRotationCenterPickingEnabled(bool)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
QAction* pShowRotationCenterMarkerAction = createAction(
|
|
|
|
|
ViewCommand_ShowRotationCenterMarker,
|
|
|
|
|
tr("Show Rotation Center Marker"), QString(), nullptr);
|
|
|
|
|
if(pShowRotationCenterMarkerAction != nullptr) {
|
|
|
|
|
pShowRotationCenterMarkerAction->setCheckable(true);
|
|
|
|
|
pShowRotationCenterMarkerAction->setChecked(true);
|
|
|
|
|
if(m_pContainer != nullptr) {
|
|
|
|
|
connect(pShowRotationCenterMarkerAction, SIGNAL(toggled(bool)),
|
|
|
|
|
m_pContainer,
|
|
|
|
|
SLOT(setRotationCenterMarkerVisible(bool)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
createAction(ViewCommand_SaveImage, tr("Save as Image"), "SaveImg.png",
|
|
|
|
|
SLOT(saveImage()));
|
|
|
|
|
createAction(ViewCommand_CopyImage, tr("Copy Image"),
|
|
|
|
|
@ -160,7 +173,8 @@ void nmVTKViewCommandController::populateContextMenu(QMenu* pMenu) const
|
|
|
|
|
ViewCommand_Right,
|
|
|
|
|
ViewCommand_Isometric,
|
|
|
|
|
ViewCommand_ResetRotationCenter,
|
|
|
|
|
ViewCommand_SetRotationCenter
|
|
|
|
|
ViewCommand_SetRotationCenter,
|
|
|
|
|
ViewCommand_ShowRotationCenterMarker
|
|
|
|
|
};
|
|
|
|
|
bool bHasViewCommands = false;
|
|
|
|
|
const int nViewCommandCount =
|
|
|
|
|
@ -233,6 +247,26 @@ void nmVTKViewCommandController::setRotationCenterPicking(bool bPicking)
|
|
|
|
|
pAction->blockSignals(bOldBlockState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmVTKViewCommandController::setRotationCenterMarkerAvailable(
|
|
|
|
|
bool bAvailable)
|
|
|
|
|
{
|
|
|
|
|
m_bRotationCenterMarkerAvailable = bAvailable;
|
|
|
|
|
updateActionStates();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmVTKViewCommandController::setRotationCenterMarkerVisible(
|
|
|
|
|
bool bVisible)
|
|
|
|
|
{
|
|
|
|
|
QAction* pAction = getAction(ViewCommand_ShowRotationCenterMarker);
|
|
|
|
|
if(pAction == nullptr || !pAction->isCheckable()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bool bOldBlockState = pAction->blockSignals(true);
|
|
|
|
|
pAction->setChecked(bVisible);
|
|
|
|
|
pAction->blockSignals(bOldBlockState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QAction* nmVTKViewCommandController::createAction(
|
|
|
|
|
ViewCommand eCommand,
|
|
|
|
|
const QString& sText,
|
|
|
|
|
@ -272,6 +306,7 @@ int nmVTKViewCommandController::actionIndex(ViewCommand eCommand) const
|
|
|
|
|
case ViewCommand_Print: return 10;
|
|
|
|
|
case ViewCommand_PrintPreview: return 11;
|
|
|
|
|
case ViewCommand_SetRotationCenter: return 12;
|
|
|
|
|
case ViewCommand_ShowRotationCenterMarker: return 13;
|
|
|
|
|
default: return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -296,7 +331,8 @@ void nmVTKViewCommandController::updateActionStates()
|
|
|
|
|
ViewCommand_CopyImage,
|
|
|
|
|
ViewCommand_Print,
|
|
|
|
|
ViewCommand_PrintPreview,
|
|
|
|
|
ViewCommand_SetRotationCenter
|
|
|
|
|
ViewCommand_SetRotationCenter,
|
|
|
|
|
ViewCommand_ShowRotationCenterMarker
|
|
|
|
|
};
|
|
|
|
|
for(int nIndex = 0; nIndex < ViewCommandCount; ++nIndex) {
|
|
|
|
|
QAction* pAction = m_pActions[nIndex];
|
|
|
|
|
@ -309,6 +345,10 @@ void nmVTKViewCommandController::updateActionStates()
|
|
|
|
|
if(!bEnabled) {
|
|
|
|
|
setRotationCenterPicking(false);
|
|
|
|
|
}
|
|
|
|
|
} else if(eCommands[nIndex] ==
|
|
|
|
|
ViewCommand_ShowRotationCenterMarker) {
|
|
|
|
|
bEnabled = bEnabled &&
|
|
|
|
|
m_bRotationCenterMarkerAvailable;
|
|
|
|
|
}
|
|
|
|
|
pAction->setVisible(bSupported);
|
|
|
|
|
pAction->setEnabled(bEnabled);
|
|
|
|
|
|