From 5a1c43b1315cc34400a46bd04780c59f611ccc7b Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 9 Jan 2019 14:18:26 +0100 Subject: [PATCH] fix incorrect terminology in NaviCube, add support of isometric view --- src/Gui/NaviCube.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index fad94f4e2d..2be17d264c 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -88,6 +88,7 @@ #include #include #include +#include #include #include #include @@ -1294,7 +1295,7 @@ void NaviCube::setNaviCubeLabels(const std::vector& labels) DEF_3DV_CMD(ViewIsometricCmd) ViewIsometricCmd::ViewIsometricCmd() - : Command("ViewIsometric") + : Command("ViewIsometricCmd") { sGroup = QT_TR_NOOP(""); sMenuText = QT_TR_NOOP("Isometric"); @@ -1309,11 +1310,18 @@ ViewIsometricCmd::ViewIsometricCmd() void ViewIsometricCmd::activated(int iMsg) { Q_UNUSED(iMsg); + //from math import sqrt, degrees, asin + //p1=App.Rotation(App.Vector(1,0,0),90) + //p2=App.Rotation(App.Vector(0,0,1),135) + //p3=App.Rotation(App.Vector(-1,1,0),degrees(asin(-sqrt(1.0/3.0)))) + //p4=p3.multiply(p2).multiply(p1) + Command::doCommand(Command::Gui,"Gui.activeDocument().activeView()." + "setCameraOrientation((0.17592, 0.424708, 0.820473, 0.339851))"); } DEF_3DV_CMD(ViewOrthographicCmd) ViewOrthographicCmd::ViewOrthographicCmd() - : Command("ViewDimetric") + : Command("ViewOrthographicCmd") { sGroup = QT_TR_NOOP(""); sMenuText = QT_TR_NOOP("Orthographic"); @@ -1334,7 +1342,7 @@ void ViewOrthographicCmd::activated(int iMsg) DEF_3DV_CMD(ViewPerspectiveCmd) ViewPerspectiveCmd::ViewPerspectiveCmd() - : Command("ViewTrimetric") + : Command("ViewPerspectiveCmd") { sGroup = QT_TR_NOOP(""); sMenuText = QT_TR_NOOP("Perspective"); @@ -1384,13 +1392,15 @@ QMenu* NaviCubeImplementation::createNaviCubeMenu() { init = false; rcCmdMgr.addCommand(new ViewOrthographicCmd); rcCmdMgr.addCommand(new ViewPerspectiveCmd); + rcCmdMgr.addCommand(new ViewIsometricCmd); rcCmdMgr.addCommand(new ViewZoomToFitCmd); } vector commands = NaviCubeImplementation::m_commands; if (commands.empty()) { - commands.push_back("ViewDimetric"); - commands.push_back("ViewTrimetric"); + commands.push_back("ViewOrthographicCmd"); + commands.push_back("ViewPerspectiveCmd"); + commands.push_back("ViewIsometricCmd"); commands.push_back("Separator"); commands.push_back("ViewZoomToFit"); }