diff --git a/src/Base/Persistence.h b/src/Base/Persistence.h index e845d554ed..7bbda4d31a 100644 --- a/src/Base/Persistence.h +++ b/src/Base/Persistence.h @@ -43,7 +43,7 @@ class BaseExport Persistence : public BaseClass TYPESYSTEM_HEADER(); -public: +public: /** This method is used to get the size of objects * It is not meant to have the exact size, it is more or less an estimation * which runs fast! Is it two bytes or a GB? @@ -62,12 +62,12 @@ public: * The writer.ind() expression writes the indentation, just for pretty printing of the XML. * As you see, the writing of the XML document is not done with a DOM implementation because * of performance reasons. Therefore the programmer has to take care that a valid XML document - * is written. This means closing tags and writing UTF-8. + * is written. This means closing tags and writing UTF-8. * @see Base::Writer */ virtual void Save (Writer &/*writer*/) const = 0; /** This method is used to restore properties from an XML document. - * It uses the XMLReader class, which bases on SAX, to read the in Save() + * It uses the XMLReader class, which bases on SAX, to read the in Save() * written information. Again the Vector as an example: * \code * void PropertyVector::Restore(Base::XMLReader &reader) @@ -83,13 +83,13 @@ public: */ virtual void Restore(XMLReader &/*reader*/) = 0; /** This method is used to save large amounts of data to a binary file. - * Sometimes it makes no sense to write property data as XML. In case the - * amount of data is too big or the data type has a more effective way to + * Sometimes it makes no sense to write property data as XML. In case the + * amount of data is too big or the data type has a more effective way to * save itself. In this cases it is possible to write the data in a separate file - * inside the document archive. In case you want do so you have to re-implement + * inside the document archive. In case you want do so you have to re-implement * SaveDocFile(). First, you have to inform the framework in Save() that you want do so. * Here an example from the Mesh module which can save a (pontetionaly big) triangle mesh: - * \code + * \code * void PropertyMeshKernel::Save (Base::Writer &writer) const * { * if (writer.isForceXML()) @@ -124,7 +124,7 @@ public: * { * reader.readElement("Mesh"); * std::string file (reader.getAttribute("file") ); - * + * * if(file == "") * { * // read XML diff --git a/src/Mod/Draft/DraftGeomUtils.py b/src/Mod/Draft/DraftGeomUtils.py index 64c75caaa4..94fa596ce6 100755 --- a/src/Mod/Draft/DraftGeomUtils.py +++ b/src/Mod/Draft/DraftGeomUtils.py @@ -28,7 +28,7 @@ __url__ = ["http://www.freecadweb.org"] ## \defgroup DRAFTGEOMUTILS DraftGeomUtils # \ingroup DRAFT # \brief Shape manipulation utilities for the Draft workbench -# +# # Shapes manipulation utilities ## \addtogroup DRAFTGEOMUTILS @@ -415,7 +415,7 @@ def findIntersection(edge1,edge2,infinite1=False,infinite2=False,ex1=False,ex2=F rad1 , rad2 = edge1.Curve.Radius, edge2.Curve.Radius axis1, axis2 = edge1.Curve.Axis , edge2.Curve.Axis c2c = cent2.sub(cent1) - + if cent1.sub(cent2).Length == 0: # circles are concentric return [] @@ -641,7 +641,7 @@ def findClosest(basepoint,pointslist): an index from the list is returned. ''' npoint = None - if not pointslist: + if not pointslist: return None smallest = 1000000 for n in range(len(pointslist)): @@ -899,7 +899,7 @@ def flattenWire(wire): def findWires(edgeslist): return [ Part.Wire(e) for e in Part.sortEdges(edgeslist)] - + def findWiresOld2(edgeslist): '''finds connected wires in the given list of edges''' diff --git a/src/Mod/Raytracing/App/resources/FCAnimation.inc b/src/Mod/Raytracing/App/resources/FCAnimation.inc index a9b66ea4ed..e8ed308180 100644 --- a/src/Mod/Raytracing/App/resources/FCAnimation.inc +++ b/src/Mod/Raytracing/App/resources/FCAnimation.inc @@ -38,17 +38,17 @@ // Time per scene in seconds #declare TimePerScene = final_clock/(nCamPos-1); #debug concat("Time per Scene: ",str(TimePerScene,5,3),"\n") - + #macro debugprint() #debug concat("Szene ",str(sz,3,0),"\n") #debug concat("T=",str(T,5,2)," T0=",str(T0,5,2)," T1=",str(T1,5,2)," T2=",str(T2,5,2)," T1Sin=",str(T1Sin,5,2),"\n") #end - + // Current time is always zero based #declare T = clock; // Compute Scene number: One scene less than camera positions - #declare sz = floor(T / TimePerScene) ; + #declare sz = floor(T / TimePerScene) ; // check for end of scene definition #if ((clock / TimePerScene) >= (nCamPos-1)) #warning "Clock value is beyond last camera position. I will try to extrapolate the last motion vector." @@ -61,22 +61,22 @@ #declare sz1 = sz; #declare sz2 = sz+1; #end - + // Time Variables #declare T0 = T-TimePerScene*sz ; // Relative scene time #declare T1 = T0/TimePerScene ; // Normalised scene time #declare T2 = 1-T1 ; // Reversed normalised scene time #declare T1Sin = pow(sin(radians(T1*90)),2); // Sin-square time for smooth movements debugprint() - + // Interpolate camera position between scenes #declare CamPosT = CamPos[sz] + (CamPos[sz2]-CamPos[sz1])*T1 ; - #declare CamDirT = CamDir[sz] + (CamDir[sz2]-CamDir[sz1])*T1 ; - #declare LookAtT = LookAt[sz] + (LookAt[sz2]-LookAt[sz1])*T1 ; - #declare UpT = Up[sz] + (Up[sz2] -Up[sz1] )*T1 ; + #declare CamDirT = CamDir[sz] + (CamDir[sz2]-CamDir[sz1])*T1 ; + #declare LookAtT = LookAt[sz] + (LookAt[sz2]-LookAt[sz1])*T1 ; + #declare UpT = Up[sz] + (Up[sz2] -Up[sz1] )*T1 ; #declare CamZoomT = CamZoom[sz] + (CamZoom[sz2]-CamZoom[sz1])*T1Sin ; - - + + // Cameradefinition #declare MovieCamera = camera { @@ -100,5 +100,5 @@ look_at LookAt[0] up Up[0] } - -#end \ No newline at end of file + +#end diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 58f08a5625..f71ab6a0ad 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -149,7 +149,7 @@ MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget* m_view->scene(), SIGNAL(selectionChanged()), this , SLOT (sceneSelectionChanged()) ); - + //get informed by App side about deleted DocumentObjects App::Document* appDoc = m_vpPage->getDocument()->getDocument(); auto bnd = boost::bind(&MDIViewPage::onDeleteObject, this, _1); @@ -405,15 +405,15 @@ void MDIViewPage::updateDrawing(void) if (obj == nullptr) { m_view->removeQView(qv); } else { - DrawPage* pp = qv->getViewObject()->findParentPage(); + DrawPage* pp = qv->getViewObject()->findParentPage(); if (thisPage != pp) { m_view->removeQView(qv); } } } - + // Update all the QGIVxxxx - // WF: why do we do this? views should be keeping themselves up to date. + // WF: why do we do this? views should be keeping themselves up to date. // const std::vector &upviews = m_view->getViews(); // for(std::vector::const_iterator it = upviews.begin(); it != upviews.end(); ++it) { // Base::Console().Message("TRACE - MDIVP::updateDrawing - updating a QGIVxxxx\n"); @@ -841,7 +841,7 @@ void MDIViewPage::saveSVG(std::string file) /////////////// Selection Routines /////////////////// // wf: this is never executed??? // needs a signal from Scene? hoverEvent? Scene does not emit signal for "preselect" -// there is no "preSelect" signal from Gui either. +// there is no "preSelect" signal from Gui either. void MDIViewPage::preSelectionChanged(const QPoint &pos) { QObject *obj = QObject::sender(); @@ -1127,7 +1127,7 @@ bool MDIViewPage::compareSelections(std::vector& treeSel,Q int treeCount = 0; int sceneCount = 0; - int subCount = 0; + int subCount = 0; int ppCount = 0; std::vector treeNames; std::vector sceneNames; @@ -1142,7 +1142,7 @@ bool MDIViewPage::compareSelections(std::vector& treeSel,Q } std::sort(treeNames.begin(),treeNames.end()); treeCount = treeNames.size(); - + for (auto& sn:sceneSel){ QGIView *itemView = dynamic_cast(sn); if(itemView == 0) { @@ -1150,20 +1150,20 @@ bool MDIViewPage::compareSelections(std::vector& treeSel,Q if (pp != nullptr) { ppCount++; } - } else { + } else { std::string s = itemView->getViewNameAsString(); sceneNames.push_back(s); } } std::sort(sceneNames.begin(),sceneNames.end()); sceneCount = sceneNames.size(); - - //different # of DrawView* vs QGIV* + + //different # of DrawView* vs QGIV* if (sceneCount != treeCount) { return false; } - -// even of counts match, have to check that names in scene == names in tree + +// even of counts match, have to check that names in scene == names in tree auto treePtr = treeNames.begin(); for (auto& s: sceneNames){ if (s == (*treePtr)) { @@ -1173,11 +1173,11 @@ bool MDIViewPage::compareSelections(std::vector& treeSel,Q return false; } } - + //Objects all match, check subs if (treeCount != ppCount) { return false; - } + } return result; } diff --git a/src/Mod/Test/Document.py b/src/Mod/Test/Document.py index 292f8144f1..474d52d355 100644 --- a/src/Mod/Test/Document.py +++ b/src/Mod/Test/Document.py @@ -189,12 +189,12 @@ class DocumentBasicCases(unittest.TestCase): else: self.failUnless(False) del L2 - + def testExtensions(self): #we try to create a normal python object and add an extension to it obj = self.Doc.addObject("App::DocumentObject", "Extension_1") grp = self.Doc.addObject("App::DocumentObject", "Extension_2") - #we should have all methods we need to handle extensions + #we should have all methods we need to handle extensions try: self.failUnless(not grp.hasExtension("App::GroupExtensionPython")) grp.addExtension("App::GroupExtensionPython", self) @@ -205,36 +205,36 @@ class DocumentBasicCases(unittest.TestCase): self.failUnless(grp.Group[0] == obj) except: self.failUnless(False) - + #test if the method override works class SpecialGroup(): def allowObject(self, obj): return False; - + callback = SpecialGroup() - grp2 = self.Doc.addObject("App::DocumentObject", "Extension_3") + grp2 = self.Doc.addObject("App::DocumentObject", "Extension_3") grp2.addExtension("App::GroupExtensionPython", callback) - + try: self.failUnless(grp2.hasExtension("App::GroupExtension")) grp2.addObject(obj) self.failUnless(len(grp2.Group) == 0) except: self.failUnless(True) - + self.Doc.removeObject(grp.Name) self.Doc.removeObject(grp2.Name) self.Doc.removeObject(obj.Name) del obj del grp del grp2 - + def testExtensionBug0002785(self): - + class MyExtension(): def __init__(self, obj): obj.addExtension("App::GroupExtensionPython", self) - + obj = self.Doc.addObject("App::DocumentObject", "myObj") MyExtension(obj) self.failUnless(obj.hasExtension("App::GroupExtension")) @@ -248,7 +248,7 @@ class DocumentBasicCases(unittest.TestCase): grp.addExtension("App::GroupExtensionPython", None) grp.Group = [obj] self.assertTrue(obj in grp.Group) - + def testExtensionBugViewProvider(self): class Layer(): @@ -259,7 +259,7 @@ class DocumentBasicCases(unittest.TestCase): def __init__(self, obj): obj.addExtension("Gui::ViewProviderGroupExtensionPython", self) obj.Proxy = self - + obj = self.Doc.addObject("App::FeaturePython","Layer") Layer(obj) self.failUnless(obj.hasExtension("App::GroupExtension")) @@ -268,10 +268,10 @@ class DocumentBasicCases(unittest.TestCase): LayerViewProvider(obj.ViewObject) self.failUnless(obj.ViewObject.hasExtension("Gui::ViewProviderGroupExtension")) self.failUnless(obj.ViewObject.hasExtension("Gui::ViewProviderGroupExtensionPython")) - + self.Doc.removeObject(obj.Name) del obj - + def testPropertyLink_Issue2902Part1(self): o1 = self.Doc.addObject("App::FeatureTest","test1") o2 = self.Doc.addObject("App::FeatureTest","test2") @@ -339,19 +339,19 @@ class SaveRestoreSpecialGroup(): def __init__(self, obj): obj.addExtension("App::GroupExtensionPython", self) obj.Proxy = self - + def allowObject(self, obj): return False; -# class must be defined in global scope to allow it to be reloaded on document open +# class must be defined in global scope to allow it to be reloaded on document open class SaveRestoreSpecialGroupViewProvider(): def __init__(self, obj): obj.addExtension("Gui::ViewProviderGroupExtensionPython", self) obj.Proxy = self - + def testFunction(self): pass - + class DocumentSaveRestoreCases(unittest.TestCase): def setUp(self): self.Doc = FreeCAD.newDocument("SaveRestoreTests") @@ -410,7 +410,7 @@ class DocumentSaveRestoreCases(unittest.TestCase): except: # Okay, no document open self.failUnless(True) - + def testExtensionSaveRestore(self): # saving and restoring SaveName = self.TempPath + os.sep + "SaveRestoreExtensions.FCStd" @@ -418,18 +418,18 @@ class DocumentSaveRestoreCases(unittest.TestCase): #we try to create a normal python object and add an extension to it obj = Doc.addObject("App::DocumentObject", "Obj") grp1 = Doc.addObject("App::DocumentObject", "Extension_1") - grp2 = Doc.addObject("App::FeaturePython", "Extension_2") - + grp2 = Doc.addObject("App::FeaturePython", "Extension_2") + grp1.addExtension("App::GroupExtensionPython", None) SaveRestoreSpecialGroup(grp2) if FreeCAD.GuiUp: SaveRestoreSpecialGroupViewProvider(grp2.ViewObject) grp2.Group = [obj] - + Doc.saveAs(SaveName) FreeCAD.closeDocument("SaveRestoreExtensions") Doc = FreeCAD.open(SaveName) - + self.failUnless(Doc.Extension_1.hasExtension("App::GroupExtension")) self.failUnless(Doc.Extension_2.hasExtension("App::GroupExtension")) self.failUnless(Doc.Extension_1.ExtensionProxy is None) @@ -463,7 +463,7 @@ class DocumentRecomputeCases(unittest.TestCase): self.L2.Link = self.L3 def testRecompute(self): - + # sequence to test recompute behaviour # L1---\ L7 # / \ \ | @@ -496,7 +496,7 @@ class DocumentRecomputeCases(unittest.TestCase): seqDic[obj] = i print(obj) i += 1 - + self.failUnless(seqDic[L2] > seqDic[L1]) self.failUnless(seqDic[L3] > seqDic[L1]) self.failUnless(seqDic[L5] > seqDic[L2]) @@ -526,7 +526,7 @@ class DocumentRecomputeCases(unittest.TestCase): L1.touch() self.failUnless(self.Doc.recompute()==1) self.failUnless((7, 5, 4, 1, 2, 1)==(L1.ExecCount,L2.ExecCount,L3.ExecCount,L4.ExecCount,L5.ExecCount,L6.ExecCount)) - + self.Doc.removeObject(L1.Name) self.Doc.removeObject(L2.Name) self.Doc.removeObject(L3.Name) @@ -766,9 +766,9 @@ class UndoRedoCases(unittest.TestCase): self.assertEqual(self.Doc.RedoCount,0) def testUndoInList(self): - + self.Doc.UndoMode = 1 - + self.Doc.openTransaction("Box") self.Box = self.Doc.addObject('Part::Box') self.Doc.commitTransaction() @@ -776,26 +776,26 @@ class UndoRedoCases(unittest.TestCase): self.Doc.openTransaction("Cylinder") self.Cylinder = self.Doc.addObject('Part::Cylinder') self.Doc.commitTransaction() - + self.Doc.openTransaction("Fuse") self.Fuse1 = self.Doc.addObject('Part::MultiFuse', 'Fuse') self.Fuse1.Shapes = [self.Box, self.Cylinder] self.Doc.commitTransaction() - + self.Doc.undo() self.failUnless(len(self.Box.InList) == 0) - self.failUnless(len(self.Cylinder.InList) == 0) - + self.failUnless(len(self.Cylinder.InList) == 0) + self.Doc.redo() self.failUnless(len(self.Box.InList) == 1) self.failUnless(self.Box.InList[0] == self.Doc.Fuse) - self.failUnless(len(self.Cylinder.InList) == 1) + self.failUnless(len(self.Cylinder.InList) == 1) self.failUnless(self.Cylinder.InList[0] == self.Doc.Fuse) - + def testUndoIssue0003150Part1(self): - + self.Doc.UndoMode = 1 - + self.Doc.openTransaction("Box") self.Box = self.Doc.addObject('Part::Box') self.Doc.commitTransaction() @@ -839,7 +839,7 @@ class UndoRedoCases(unittest.TestCase): FreeCAD.closeDocument("UndoTest") class DocumentGroupCases(unittest.TestCase): - + def setUp(self): self.Doc = FreeCAD.newDocument("GroupTests") @@ -918,9 +918,9 @@ class DocumentGroupCases(unittest.TestCase): self.Doc.removeObject("Group") self.Doc.removeObject("Label_2") self.Doc.removeObject("Label_3") - + def testGroupAndGeoFeatureGroup(self): - + # an object can only be in one group at once, that must be enforced obj1 = self.Doc.addObject("App::FeatureTest","obj1") grp1 = self.Doc.addObject("App::DocumentObjectGroup","Group1") @@ -932,19 +932,19 @@ class DocumentGroupCases(unittest.TestCase): grp2.addObject(obj1) self.failUnless(grp1.hasObject(obj1)==False) self.failUnless(grp2.hasObject(obj1)) - + # an object is allowed to be in a group and a geofeaturegroup prt1 = self.Doc.addObject("App::Part","Part1") prt2 = self.Doc.addObject("App::Part","Part2") - + prt1.addObject(grp2) self.failUnless(grp2.getParentGeoFeatureGroup()==prt1) self.failUnless(grp2.getParentGroup()==None) self.failUnless(grp2.hasObject(obj1)) self.failUnless(prt1.hasObject(grp2)) self.failUnless(prt1.hasObject(obj1)) - - #it is not allowed to be in 2 geofeaturegroups + + #it is not allowed to be in 2 geofeaturegroups prt2.addObject(grp2) self.failUnless(grp2.hasObject(obj1)) self.failUnless(prt1.hasObject(grp2)==False) @@ -960,7 +960,7 @@ class DocumentGroupCases(unittest.TestCase): self.failUnless(prt1.Group == grp) else: self.fail("No exception thrown when object is in multiple Groups") - + #it is not allowed to be in 2 Groups prt2.addObject(grp1) grp = grp1.Group @@ -971,7 +971,7 @@ class DocumentGroupCases(unittest.TestCase): pass else: self.fail("No exception thrown when object is in multiple Groups") - + #cross linking between GeoFeatureGroups is not allowed self.Doc.recompute() box = self.Doc.addObject("Part::Box","Box") @@ -998,7 +998,7 @@ class DocumentGroupCases(unittest.TestCase): prt2.addObject(box) #this time addObject should move all dependencies to the new part self.Doc.recompute() self.failUnless(fus.State[0] == 'Up-to-date') - + #grouping must be resilient against cyclic links and not crash: #issue 0002567 prt1.addObject(prt2) grp = prt2.Group @@ -1012,9 +1012,9 @@ class DocumentGroupCases(unittest.TestCase): pass else: self.fail("Exception is expected") - + self.Doc.recompute() - + def testIssue0003150Part2(self): self.box = self.Doc.addObject("Part::Box") self.cyl = self.Doc.addObject("Part::Cylinder") @@ -1031,7 +1031,7 @@ class DocumentGroupCases(unittest.TestCase): self.failUnless(len(self.prt.Group)==5) self.failUnless(self.fus2.getParentGeoFeatureGroup() == self.prt) self.failUnless(self.prt.hasObject(self.sph)) - + self.prt.removeObject(self.fus1) self.failUnless(len(self.prt.Group)==0) @@ -1286,7 +1286,7 @@ class DocumentExpressionCases(unittest.TestCase): if (math.fabs(v2-v1) > 1E-12) : self.assertEqual(v1,v2) - + def testExpression(self): # set the object twice to test that the backlinks are removed when overwriting the expression self.Obj2.setExpression('Placement.Rotation.Angle', u'%s.Placement.Rotation.Angle' % self.Obj1.Name) @@ -1294,7 +1294,7 @@ class DocumentExpressionCases(unittest.TestCase): self.Obj1.Placement = FreeCAD.Placement(FreeCAD.Vector(0,0,0),FreeCAD.Rotation(FreeCAD.Vector(0,0,1),10)) self.Doc.recompute() self.assertAlmostEqual(self.Obj1.Placement.Rotation.Angle, self.Obj2.Placement.Rotation.Angle) - + # clear the expression self.Obj2.setExpression('Placement.Rotation.Angle', None) self.assertAlmostEqual(self.Obj1.Placement.Rotation.Angle, self.Obj2.Placement.Rotation.Angle)