mirror of
https://github.com/leozide/leocad
synced 2025-02-05 08:45:55 +01:00
Scoped enum lcViewpoint.
This commit is contained in:
parent
0e9581efb4
commit
fd8aca92df
6 changed files with 35 additions and 35 deletions
|
@ -1005,13 +1005,13 @@ void lcCamera::SetViewpoint(lcViewpoint Viewpoint)
|
|||
{
|
||||
lcVector3 Positions[] =
|
||||
{
|
||||
lcVector3( 0.0f, -1250.0f, 0.0f), // LC_VIEWPOINT_FRONT
|
||||
lcVector3( 0.0f, 1250.0f, 0.0f), // LC_VIEWPOINT_BACK
|
||||
lcVector3( 0.0f, 0.0f, 1250.0f), // LC_VIEWPOINT_TOP
|
||||
lcVector3( 0.0f, 0.0f, -1250.0f), // LC_VIEWPOINT_BOTTOM
|
||||
lcVector3( 1250.0f, 0.0f, 0.0f), // LC_VIEWPOINT_LEFT
|
||||
lcVector3(-1250.0f, 0.0f, 0.0f), // LC_VIEWPOINT_RIGHT
|
||||
lcVector3( 375.0f, -375.0f, 187.5f) // LC_VIEWPOINT_HOME
|
||||
lcVector3( 0.0f, -1250.0f, 0.0f), // lcViewpoint::Front
|
||||
lcVector3( 0.0f, 1250.0f, 0.0f), // lcViewpoint::Back
|
||||
lcVector3( 0.0f, 0.0f, 1250.0f), // lcViewpoint::Top
|
||||
lcVector3( 0.0f, 0.0f, -1250.0f), // lcViewpoint::Bottom
|
||||
lcVector3( 1250.0f, 0.0f, 0.0f), // lcViewpoint::Left
|
||||
lcVector3(-1250.0f, 0.0f, 0.0f), // lcViewpoint::Right
|
||||
lcVector3( 375.0f, -375.0f, 187.5f) // lcViewpoint::Home
|
||||
};
|
||||
|
||||
lcVector3 Ups[] =
|
||||
|
@ -1025,9 +1025,9 @@ void lcCamera::SetViewpoint(lcViewpoint Viewpoint)
|
|||
lcVector3(0.2357f, -0.2357f, 0.94281f)
|
||||
};
|
||||
|
||||
mPosition = Positions[Viewpoint];
|
||||
mPosition = Positions[static_cast<int>(Viewpoint)];
|
||||
mTargetPosition = lcVector3(0, 0, 0);
|
||||
mUpVector = Ups[Viewpoint];
|
||||
mUpVector = Ups[static_cast<int>(Viewpoint)];
|
||||
|
||||
ChangeKey(mPositionKeys, mPosition, 1, false);
|
||||
ChangeKey(mTargetPositionKeys, mTargetPosition, 1, false);
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
#define LC_CAMERA_SELECTION_MASK (LC_CAMERA_POSITION_SELECTED | LC_CAMERA_TARGET_SELECTED | LC_CAMERA_UPVECTOR_SELECTED)
|
||||
#define LC_CAMERA_FOCUS_MASK (LC_CAMERA_POSITION_FOCUSED | LC_CAMERA_TARGET_FOCUSED | LC_CAMERA_UPVECTOR_FOCUSED)
|
||||
|
||||
enum lcViewpoint
|
||||
enum class lcViewpoint
|
||||
{
|
||||
LC_VIEWPOINT_FRONT,
|
||||
LC_VIEWPOINT_BACK,
|
||||
LC_VIEWPOINT_TOP,
|
||||
LC_VIEWPOINT_BOTTOM,
|
||||
LC_VIEWPOINT_LEFT,
|
||||
LC_VIEWPOINT_RIGHT,
|
||||
LC_VIEWPOINT_HOME
|
||||
Front,
|
||||
Back,
|
||||
Top,
|
||||
Bottom,
|
||||
Left,
|
||||
Right,
|
||||
Home
|
||||
};
|
||||
|
||||
enum lcCameraSection
|
||||
|
|
|
@ -721,19 +721,19 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
|
|||
if (!ViewpointName.isEmpty())
|
||||
{
|
||||
if (ViewpointName == QLatin1String("front"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_FRONT);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Front);
|
||||
else if (ViewpointName == QLatin1String("back"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_BACK);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Back);
|
||||
else if (ViewpointName == QLatin1String("top"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_TOP);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Top);
|
||||
else if (ViewpointName == QLatin1String("bottom"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_BOTTOM);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Bottom);
|
||||
else if (ViewpointName == QLatin1String("left"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_LEFT);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Left);
|
||||
else if (ViewpointName == QLatin1String("right"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_RIGHT);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Right);
|
||||
else if (ViewpointName == QLatin1String("home"))
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_HOME);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Home);
|
||||
else
|
||||
printf("Unknown viewpoint: '%s'\n", ViewpointName.toLatin1().constData());
|
||||
|
||||
|
|
|
@ -1916,7 +1916,7 @@ void lcMainWindow::ResetViews()
|
|||
return;
|
||||
|
||||
TabWidget->ResetLayout();
|
||||
TabWidget->GetActiveView()->SetViewpoint(LC_VIEWPOINT_HOME);
|
||||
TabWidget->GetActiveView()->SetViewpoint(lcViewpoint::Home);
|
||||
}
|
||||
|
||||
void lcMainWindow::ToggleDockWidget(QWidget* DockWidget)
|
||||
|
@ -3106,37 +3106,37 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
|
||||
case LC_VIEW_VIEWPOINT_FRONT:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_FRONT);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Front);
|
||||
break;
|
||||
|
||||
case LC_VIEW_VIEWPOINT_BACK:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_BACK);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Back);
|
||||
break;
|
||||
|
||||
case LC_VIEW_VIEWPOINT_TOP:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_TOP);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Top);
|
||||
break;
|
||||
|
||||
case LC_VIEW_VIEWPOINT_BOTTOM:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_BOTTOM);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Bottom);
|
||||
break;
|
||||
|
||||
case LC_VIEW_VIEWPOINT_LEFT:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_LEFT);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Left);
|
||||
break;
|
||||
|
||||
case LC_VIEW_VIEWPOINT_RIGHT:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_RIGHT);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Right);
|
||||
break;
|
||||
|
||||
case LC_VIEW_VIEWPOINT_HOME:
|
||||
if (ActiveView)
|
||||
ActiveView->SetViewpoint(LC_VIEWPOINT_HOME);
|
||||
ActiveView->SetViewpoint(lcViewpoint::Home);
|
||||
break;
|
||||
|
||||
case LC_VIEW_CAMERA_NONE:
|
||||
|
|
|
@ -192,7 +192,7 @@ void lcPreviewWidget::SetDefaultCamera()
|
|||
{
|
||||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
mCamera->SetViewpoint(LC_VIEWPOINT_HOME);
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
}
|
||||
|
||||
void lcPreviewWidget::SetCamera(lcCamera* Camera) // called by lcModel::DeleteModel()
|
||||
|
|
|
@ -255,7 +255,7 @@ void View::RemoveCamera()
|
|||
if (Camera)
|
||||
mCamera->CopyPosition(Camera);
|
||||
else
|
||||
mCamera->SetViewpoint(LC_VIEWPOINT_HOME);
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
Redraw();
|
||||
|
@ -385,7 +385,7 @@ void View::SetDefaultCamera()
|
|||
if (!mCamera || !mCamera->IsSimple())
|
||||
mCamera = new lcCamera(true);
|
||||
|
||||
mCamera->SetViewpoint(LC_VIEWPOINT_HOME);
|
||||
mCamera->SetViewpoint(lcViewpoint::Home);
|
||||
|
||||
gMainWindow->UpdateCurrentCamera(-1);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue