Skip to content

Commit

Permalink
Merge branch 'master' into flake8_config
Browse files Browse the repository at this point in the history
  • Loading branch information
gwicke committed May 30, 2020
2 parents 64b9186 + 08dca73 commit 834acec
Show file tree
Hide file tree
Showing 44 changed files with 2,055 additions and 1,176 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -48,7 +48,8 @@ jobs:
# - python: 3.7
fast_finish: true # https://blog.travis-ci.com/2013-11-27-fast-finishing-builds
include:
- os: linux
- if: type != pull_request
os: linux
dist: bionic
language: cpp
compiler: clang
Expand Down
1 change: 1 addition & 0 deletions package/fedora/freecad.spec
Expand Up @@ -70,6 +70,7 @@ BuildRequires: netgen-mesher-devel
BuildRequires: netgen-mesher-devel-private
BuildRequires: python3-pivy
BuildRequires: mesa-libEGL-devel
BuildRequires: openmpi-devel
BuildRequires: pcl-devel
BuildRequires: pyside2-tools
BuildRequires: python3
Expand Down
3 changes: 2 additions & 1 deletion src/Gui/AboutApplication.ui
Expand Up @@ -308,6 +308,7 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">People</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Abdullah Tahiriyo</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Adrián Insaurralde</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ajinkya Dahale</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Alexander Golubev (fat-zer)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Alexander Gryson</p>
Expand Down Expand Up @@ -450,7 +451,7 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pinkpony</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Priit Laes</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">pperisin</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Prezmo Firszt</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Przemo Firszt</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qingfeng Xia</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">quick61</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Refael Moya (bitacovir)</p>
Expand Down
8 changes: 1 addition & 7 deletions src/Gui/CommandView.cpp
Expand Up @@ -1908,10 +1908,6 @@ void StdCmdViewCreate::activated(int iMsg)
Q_UNUSED(iMsg);
getActiveGuiDocument()->createView(View3DInventor::getClassTypeId());
getActiveGuiDocument()->getActiveView()->viewAll();

ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
if (hViewGrp->GetBool("ShowAxisCross"))
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)");
}

bool StdCmdViewCreate::isActive(void)
Expand Down Expand Up @@ -2067,6 +2063,7 @@ StdCmdAxisCross::StdCmdAxisCross()
sToolTipText = QT_TR_NOOP("Toggle axis cross");
sStatusTip = QT_TR_NOOP("Toggle axis cross");
sWhatsThis = "Std_AxisCross";
sAccel = "A,C";
}

void StdCmdAxisCross::activated(int iMsg)
Expand All @@ -2078,9 +2075,6 @@ void StdCmdAxisCross::activated(int iMsg)
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)");
else
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(False)");

ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
hViewGrp->SetBool("ShowAxisCross", view->getViewer()->hasAxisCross());
}
}

Expand Down
20 changes: 18 additions & 2 deletions src/Gui/DlgSettings3DView.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>477</width>
<height>407</height>
<width>499</width>
<height>520</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -43,6 +43,22 @@ lower right corner within opened files</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_ShowAxisCross">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Axis cross will be shown by default at file&lt;/p&gt;&lt;p&gt;open or creation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show axis cross by default</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ShowAxisCross</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="CheckBox_ShowFPS">
<property name="toolTip">
Expand Down
2 changes: 2 additions & 0 deletions src/Gui/DlgSettings3DViewImp.cpp
Expand Up @@ -89,6 +89,7 @@ void DlgSettings3DViewImp::saveSettings()
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());

ui->CheckBox_CornerCoordSystem->onSave();
ui->CheckBox_ShowAxisCross->onSave();
ui->CheckBox_WbByTab->onSave();
ui->CheckBox_ShowFPS->onSave();
ui->CheckBox_useVBO->onSave();
Expand All @@ -103,6 +104,7 @@ void DlgSettings3DViewImp::saveSettings()
void DlgSettings3DViewImp::loadSettings()
{
ui->CheckBox_CornerCoordSystem->onRestore();
ui->CheckBox_ShowAxisCross->onRestore();
ui->CheckBox_WbByTab->onRestore();
ui->CheckBox_ShowFPS->onRestore();
ui->CheckBox_useVBO->onRestore();
Expand Down
3 changes: 3 additions & 0 deletions src/Gui/Document.cpp
Expand Up @@ -1648,6 +1648,7 @@ MDIView *Document::createView(const Base::Type& typeId)
const char *ppReturn = 0;
view3D->onMsg(cameraSettings.c_str(),&ppReturn);
}

getMainWindow()->addWindow(view3D);
return view3D;
}
Expand All @@ -1666,6 +1667,8 @@ Gui::MDIView* Document::cloneView(Gui::MDIView* oldview)
std::string overrideMode = firstView->getViewer()->getOverrideMode();
view3D->getViewer()->setOverrideMode(overrideMode);

view3D->getViewer()->setAxisCross(firstView->getViewer()->hasAxisCross());

// attach the viewproviders. we need to make sure that we only attach the toplevel ones
// and not viewproviders which are claimed by other providers. To ensure this we first
// add all providers and then remove the ones already claimed
Expand Down
41 changes: 37 additions & 4 deletions src/Gui/Selection.cpp
Expand Up @@ -44,6 +44,7 @@
#include <Base/Console.h>
#include <Base/Tools.h>
#include <Base/Interpreter.h>
#include <Base/UnitsApi.h>
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
Expand Down Expand Up @@ -843,6 +844,34 @@ int SelectionSingleton::setPreselect(const char* pDocName, const char* pObjectNa
return DocName.empty()?0:1;
}

namespace Gui {
std::array<std::pair<double, std::string>, 3> schemaTranslatePoint(double x, double y, double z, double precision)
{
Base::Quantity mmx(Base::Quantity::MilliMetre);
mmx.setValue(fabs(x) > precision ? x : 0.0);
Base::Quantity mmy(Base::Quantity::MilliMetre);
mmy.setValue(fabs(y) > precision ? y : 0.0);
Base::Quantity mmz(Base::Quantity::MilliMetre);
mmz.setValue(fabs(z) > precision ? z : 0.0);

double xfactor, yfactor, zfactor;
QString xunit, yunit, zunit;

Base::UnitsApi::schemaTranslate(mmx, xfactor, xunit);
Base::UnitsApi::schemaTranslate(mmy, yfactor, yunit);
Base::UnitsApi::schemaTranslate(mmz, zfactor, zunit);

double xuser = fabs(x) > precision ? x / xfactor : 0.0;
double yuser = fabs(y) > precision ? y / yfactor : 0.0;
double zuser = fabs(z) > precision ? z / zfactor : 0.0;

std::array<std::pair<double, std::string>, 3> ret = {std::make_pair(xuser, xunit.toStdString()),
std::make_pair(yuser, yunit.toStdString()),
std::make_pair(zuser, zunit.toStdString())};
return ret;
}
}

void SelectionSingleton::setPreselectCoord( float x, float y, float z)
{
static char buf[513];
Expand All @@ -854,10 +883,14 @@ void SelectionSingleton::setPreselectCoord( float x, float y, float z)
CurrentPreselection.y = y;
CurrentPreselection.z = z;

snprintf(buf,512,"Preselected: %s.%s.%s (%f,%f,%f)",CurrentPreselection.pDocName
,CurrentPreselection.pObjectName
,CurrentPreselection.pSubName
,x,y,z);
auto pts = schemaTranslatePoint(x, y, z, 0.0);
snprintf(buf,512,"Preselected: %s.%s.%s (%f %s,%f %s,%f %s)"
,CurrentPreselection.pDocName
,CurrentPreselection.pObjectName
,CurrentPreselection.pSubName
,pts[0].first, pts[0].second.c_str()
,pts[1].first, pts[1].second.c_str()
,pts[2].first, pts[2].second.c_str());

if (getMainWindow())
getMainWindow()->showMessage(QString::fromLatin1(buf));
Expand Down
21 changes: 14 additions & 7 deletions src/Gui/SoFCSelection.cpp
Expand Up @@ -74,6 +74,10 @@

using namespace Gui;

namespace Gui {
std::array<std::pair<double, std::string>,3 > schemaTranslatePoint(double x, double y, double z, double precision);
}

SoFullPath * Gui::SoFCSelection::currenthighlight = NULL;


Expand Down Expand Up @@ -401,13 +405,16 @@ SoFCSelection::handleEvent(SoHandleEventAction * action)
}

const auto &pt = pp->getPoint();
snprintf(buf,512,"Preselected: %s.%s.%s (%g, %g, %g)",documentName.getValue().getString()
,objectName.getValue().getString()
,subElementName.getValue().getString()
,fabs(pt[0])>1e-7?pt[0]:0.0
,fabs(pt[1])>1e-7?pt[1]:0.0
,fabs(pt[2])>1e-7?pt[2]:0.0);


auto pts = schemaTranslatePoint(pt[0], pt[1], pt[2], 1e-7);
snprintf(buf,512,"Preselected: %s.%s.%s (%f %s, %f %s, %f %s)"
,documentName.getValue().getString()
,objectName.getValue().getString()
,subElementName.getValue().getString()
,pts[0].first, pts[0].second.c_str()
,pts[1].first, pts[1].second.c_str()
,pts[2].first, pts[2].second.c_str());

getMainWindow()->showMessage(QString::fromLatin1(buf));
}
else { // picked point
Expand Down
16 changes: 11 additions & 5 deletions src/Gui/SoFCUnifiedSelection.cpp
Expand Up @@ -100,6 +100,10 @@ FC_LOG_LEVEL_INIT("SoFCUnifiedSelection",false,true,true)

using namespace Gui;

namespace Gui {
std::array<std::pair<double, std::string>,3 > schemaTranslatePoint(double x, double y, double z, double precision);
}

SoFullPath * Gui::SoFCUnifiedSelection::currenthighlight = NULL;

// *************************************************************************
Expand Down Expand Up @@ -479,14 +483,16 @@ bool SoFCUnifiedSelection::setHighlight(SoFullPath *path, const SoDetail *det,
{
const char *docname = vpd->getObject()->getDocument()->getName();
const char *objname = vpd->getObject()->getNameInDocument();

this->preSelection = 1;
static char buf[513];
snprintf(buf,512,"Preselected: %s.%s.%s (%g, %g, %g)"

auto pts = schemaTranslatePoint(x, y, z, 1e-7);
snprintf(buf,512,"Preselected: %s.%s.%s (%f %s, %f %s, %f %s)"
,docname,objname,element
,fabs(x)>1e-7?x:0.0
,fabs(y)>1e-7?y:0.0
,fabs(z)>1e-7?z:0.0);
,pts[0].first,pts[0].second.c_str()
,pts[1].first,pts[1].second.c_str()
,pts[2].first,pts[2].second.c_str());

getMainWindow()->showMessage(QString::fromLatin1(buf));

Expand Down
4 changes: 4 additions & 0 deletions src/Gui/View3DInventor.cpp
Expand Up @@ -161,6 +161,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent,
// apply the user settings
OnChange(*hGrp,"EyeDistance");
OnChange(*hGrp,"CornerCoordSystem");
OnChange(*hGrp,"ShowAxisCross");
OnChange(*hGrp,"UseAutoRotation");
OnChange(*hGrp,"Gradient");
OnChange(*hGrp,"BackgroundColor");
Expand Down Expand Up @@ -366,6 +367,9 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"CornerCoordSystem") == 0) {
_viewer->setFeedbackVisibility(rGrp.GetBool("CornerCoordSystem",true));
}
else if (strcmp(Reason,"ShowAxisCross") == 0) {
_viewer->setAxisCross(rGrp.GetBool("ShowAxisCross",false));
}
else if (strcmp(Reason,"UseAutoRotation") == 0) {
_viewer->setAnimationEnabled(rGrp.GetBool("UseAutoRotation",false));
}
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/Arch/ArchCommands.py
Expand Up @@ -1256,6 +1256,7 @@ def getExtrusionData(shape,sortmethod="area"):
"area" = Of the faces with the smallest area, the one with the lowest z coordinate.
"z" = The face with the lowest z coordinate.
a 3D vector = the face which center is closest to the given 3D point
Parameters
----------
Expand Down Expand Up @@ -1314,9 +1315,11 @@ def getExtrusionData(shape,sortmethod="area"):
if valids:
if sortmethod == "z":
valids.sort(key=lambda v: v[0].CenterOfMass.z)
else:
elif sortmethod == "area":
# sort by smallest area
valids.sort(key=lambda v: v[0].Area)
else:
valids.sort(key=lambda v: (v[0].CenterOfMass.sub(sortmethod)).Length)
return valids[0]
return None

Expand Down

0 comments on commit 834acec

Please sign in to comment.