Commit Graph

1012 Commits

Author SHA1 Message Date
wmayer
e48c52c480 force strict ISO C++ (-Wpedantic)
for Drawing, Image, Inspection, Mesh, MeshPart, Part, Path, Points, Raytracing, ReverseEngineering, Spreadsheet, Start, Surface, Web

TODO: fix several -Woverflow in area
2019-09-18 11:32:42 +02:00
wmayer
d05ae18340 fix -Wreturn-std-move 2019-09-07 15:19:28 +02:00
wmayer
b14cf8a00d extend convertTo function to also support SbRotation/Base::Rotation 2019-09-06 21:29:51 +02:00
wmayer
05649e3848 include missing header 2019-09-01 17:25:42 +02:00
Zheng, Lei
f362229041 Part: avoid touching in ViewProviderAttachExtension mergeOverlayIcons
ViewProviderAttachExtension::extensionMergeOverlayIcons() calls
AttachExtension::positionBySupport() which will always touch the
extended object. This may cause recomputation problems, e.g a datum
that is always touched, because normal recomputation trigger tree
view update by a timer, tree view refreshes the icon, datum gets
touched again.
2019-08-30 14:46:38 +02:00
sdh4
8928f863fe Part.BSplineSurface.buildFromPolesMultsKnots(): Fix 'Truth value of an array ... use a.any() or a.all()' when explicit knots or weights provided
Calls to BSplineSurface.buildFromPolesMultsKnots() with explicit knots or weights fail in recent versions of FreeCAD (tested on 0.18.3 with python3) with the message 'The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()'. 

This trivial change follows the pattern used later in the function of explicit comparisons with Py_None, replacing PyObject_Not() and PyObject_IsTrue()  when they are used to determine whether explicit weights or knots have been provided.
2019-08-27 21:48:52 +02:00
wmayer
a79ce8d823 add missing std:: namespace to build on Debian 10 2019-08-21 23:56:46 +02:00
wmayer
bbea71ce5f add missing std:: namespace to build on Debian 10 2019-08-21 19:22:01 +02:00
wmayer
fb3eb85586 add missing std:: namespace to build on Debian 10 2019-08-21 16:31:00 +02:00
wmayer
6795a28c99 add missing std:: namespace to build on Debian 10 2019-08-21 00:12:50 +02:00
wmayer
b594274407 add missing header and forward declaration 2019-08-17 23:14:45 +02:00
wmayer
7f4378a87e Fix clang compiler warnings:
+ fix -Winconsistent-missing-override
+ fix -Wpessimizing-move (Geometry::clone: moving a temporary object prevents copy elision -> remove std::move call here)
2019-08-17 19:52:32 +02:00
luz.paz
3bb578c825 Fix more typos 2019-08-17 15:32:49 +02:00
luz.paz
63a577fe07 Fix typos in src/Gio 2019-08-17 15:32:49 +02:00
Zheng, Lei
f028ba42ff Part: changes to Part Module
* Added Part::Feature::getTopoShape/getShape() function that can obtain
  shape from any object with proper implementation of getSubObject(). It
  can even construct compound from group object with proper implementation
  of getSubObjects().

* Modified ViewProviderExt to work on any object, because it now obtain
  the shape using Part::Feature::getShape()

* Modified various Part features to obtain base/tool shapes using
  Part::getShape(), which allows them to be any type of object,
  including Link and groups.

* Modified various Part command to relax type requirement on selected
  objects.

* Add support of link and group to dimension, and add dimension refresh
  command

* Support link and group in simple command command, and add a few more
  copy command variations.

* Add special handling of 'Shape' attribute in PropertyContainerPy and
  use Part::Feature::getShape() to return shape for any object without
  Shape property. This allows many python feature work with any object
  without modification.

* GeometrySurface/CurvePy, add convenience attribute 'Rotation'

* TopoShapePy:

    * Extended support of sub shape attribute, e.g. Compound1, Solid2,
      SubShape3 ('SubShape' is used to access child shape of a compound)

    * makeWires(), new API to sort and return wires given a list of edges.

    * transformed/translated/rotated/scaled(), return a new shape with
      some transformation.

    * findPlane(), find the plane of a planar shape

    * isCoplanar(), check if two shape are coplanar
2019-08-17 15:08:35 +02:00
Zheng, Lei
f7edaabe43 Gui: add box geometry element selection command
Implement box element selection that support linked and grouped objects.
Also modified original box selection command to support the same with
the same code.
2019-08-17 15:08:33 +02:00
Zheng, Lei
6731e83bf5 App: add New APIs for future Link function
DocumentObject:

* getSubObject(): the most important API for Link to work with
  hierarchies. The function is a inspired from and replaces the
  getPySubObjects(). It returns a child object following a dot separated
  subname reference, and can optionally return accumulated
  transformation, and/or a python object of the refered
  sub-object/element. The default implementation here is to look for
  link type property, and search for the referenced object. This patch also
  include other specialized implementation of this API, such as
  (GeoFeature)GroupExtension (through extensionGetSubObject()),
  PartDesign::Body, and so on. A link type object is expected to
  call the linked object's getSubObject() for resolving.

* getSubObjectList(): helper function to return a list of object
  referenced in the given subname.

* getSubObjects(): return a list of subname references of all children
  objects. The purpose of this function is similar to
  ViewProvider::claimChildren().  Container type object is expected to
  implement this function.  The reason it returns subname references
  instead of just object is to allow the container to skip hierarchies.
  For example, the Assembly3 container uses this to skip the constraint
  and element group.

* getLinkedObject(), obtain the linked object, and optionally with the
  accumulated transformation. It is expected to return a linked object
  or the object itself if it is not a link. In case there are multiple
  levels of linking involved, this function allows the caller to retrieve
  the linked object recursively.

* hasChildElement(), set/isElementVisible(), controls the children
  visibility for a group type object. Because the child object may be
  claimed by other objects, it is essential to have independent control
  of children visibilities. These APIs are designed to abstract how
  group manages the child visibility. For performance reason, these
  function are meant to control only the immediate child object.

* resolve(), helper function to parse subname reference and resolve the
  final object, and optionally the immediate parent of the final object,
  the final object reference name (for calling `set/isElementVisible()`),
  and the subname reference if there is one.

* touch(), add optional argument 'noRecompute' for better backward
  compatibility with the NoRecompute flag. By default, touch() causes
  recompute unless noRecompute is true

* signalChanged/signalBeforeChange, two new signal for tracking changes
  of a specific object.

* getViewProviderNameOverride(), return a string of the view provider
  type of this object. This allows Python class to override the view
  provider of an object. This feature will be used by ViewProviderLink
  which is designed to work with any object that has LinkBaseExtension.

* canLinkProperties(), will be used by Gui::PropertyView to display
  linked object properties together with the object's own properties.

* redirectSubname(), will be used by Gui::Tree to allow an object to
  redirect selection to some other object when (pre)selected in the tree
  view.

* Visibility, new property serve as the same purpose as view provider
  property of the same name. It is added here so that App namespace
  code can check for visibility without Gui module. This is useful,
  for example, when constructing a compound shape of a container that
  respects the children visibility.

* (has)hasHiddenMarker(), return or check for a special sub-element
  name used as marker for overriding sub-object visibility. Will be
  used by Gui::ViewProvider, it is put here for the same reason as
  adding Visibility property.

* getID(), return object internal identifier. Each object is now
  assigned an integer identifier that is unique within its containing
  document.

Document:

* ShowHidden, new property to tell tree view whether to show hidden
  object items.

* signalTouchedObject, new signal triggered when manually touch an
  object when calling its touch() function

* getObjectByID(), get object by its identifier

* addObject() is modified to allow overriding view provider

* has/getLinksTo(), helper function to obtain links to a given object.

Application:

* checkLinkDepth(), helper function to check recursive depth for link
  traversal. The depth is checked against the total object count of
  all opened documents. The count (_objCount) is internally updated
  whenever object is added or removed.

* has/getLinksTo(), same as Document::has/getLinksTo() but return links
  from all opened documents.

GroupExtension/OriginGroupExtension/DatumFeature/DatumCS/Part::Feature:
implement sepcialized getSubObject/getSubObjects().
2019-08-17 14:52:08 +02:00
luz.paz
0f36eedc0b Fix typos
Found via `codespell -q 3 -I ../fc-word-whitelist.txt -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller`
2019-07-16 11:21:52 -03:00
Abdullah Tahiri
50eff2a5ee MSVC also fails to automatically move if no elision possible 2019-07-14 12:37:37 +02:00
Abdullah Tahiri
b13c564dc2 Enable RVO for any other than old GCCs like 4.8 2019-07-14 12:37:37 +02:00
Abdullah Tahiri
be79d3f6a0 GeometryExtensions: Add override when overriding virtual functions (EMCPP Item 12) 2019-07-14 12:37:37 +02:00
Abdullah Tahiri
f68f64b981 GCC 4.8 fails to covert lvalue during RVO optimization 2019-07-14 12:37:35 +02:00
Abdullah Tahiri
12e9b6c60a old GCC C++11 specialisation in a different namespace and moving template instantiations after all specialisations 2019-07-14 12:37:35 +02:00
Abdullah Tahiri
1d2c45c845 Base: Move std::make_unique to Base 2019-07-14 12:37:35 +02:00
Abdullah Tahiri
006b470a20 Part: geometry extensions minor code clean up 2019-07-14 12:37:35 +02:00
Abdullah Tahiri
4d86374cb0 Part: geometry extensions several memory leak fixes 2019-07-14 12:37:35 +02:00
Abdullah Tahiri
21e1ccbe9b Part: Default geometry extensions for boolean and double 2019-07-14 12:37:35 +02:00
Abdullah Tahiri
331817d1b7 Part: Geometry extension set with unique id (type+name) and list based getExtensions python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
8618dfd3c6 Part Geometry: get an extension from type or name, also from python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
d8e99c1923 Part:: Geometry container extend hasExtension to type and name 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
4d9d3b0c83 Part: Geometry - methods to remove extensions by name and type 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
1700760e0b Part: Default geometry extensions make sure built-in types are initialised 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
d99e667e30 Part: Command to show list of extensions from Python 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
665fcda4dc Part: Fix assignment after reserve of weak_ptr causes segfault 2019-07-14 12:37:33 +02:00
Abdullah Tahiri
aaea1285d4 Part: Extend Geometry Extension to have a name 2019-07-14 12:37:31 +02:00
Abdullah Tahiri
a4cb781d81 Part: correct long parsing in GeometryIntExtensionPyImp 2019-07-14 12:37:31 +02:00
Abdullah Tahiri
274f730826 Part: Geometry extension const correctness 2019-07-14 12:37:31 +02:00
Abdullah Tahiri
062037ffff Part: Move default geometry extension for int to internally use long 2019-07-14 12:37:31 +02:00
Abdullah Tahiri
75fdacb342 Part: Default geometry extension template encapsulate value 2019-07-14 12:37:31 +02:00
Abdullah Tahiri
27620ed717 Part: GeometryDefaultExtensions template
========================================

Generalisation of code for a default geometry extension in the form of a template.

Default geometry extensions provide a standard interface for an extension having a single stored value (e.g. one int or one string).

Python implementation must be provided separatedly.
2019-07-14 12:37:31 +02:00
Abdullah Tahiri
7488faa99f Part: Geometry extensions set interface
=======================================

unique_ptr is a move only type. Therefore it may only take an rvalue.

It does not make sense a pass by value for move only types (Item 41).
2019-07-14 12:37:31 +02:00
Abdullah Tahiri
e4aead2365 Geometry extensions: remove unnecessary smart pointer deletion
==============================================================

When the geometry object is destroyed, std::vector's destructor is called, which in turn calls the destructor of the smart pointers.

If a weak_ptr corresponding to one of those shared_ptr is locked (elsewhere, if FC were multithread),
the underlaying resource will not be freed until said locked weak_ptr goes out of scope. It will then.
2019-07-14 12:37:31 +02:00
Abdullah Tahiri
0c1df38a4b Part: GeometryStringExtension to extend a geometry by a string 2019-07-14 12:37:30 +02:00
Abdullah Tahiri
a846d7627c Part: Expose GeometryIntExtension python type 2019-07-14 12:37:30 +02:00
Abdullah Tahiri
ba3831715c Part: Standard geometry extension adding an integer value 2019-07-14 12:37:30 +02:00
Abdullah Tahiri
d082a42351 Part: Excise GeometryExtension from Geometry 2019-07-14 12:37:30 +02:00
Abdullah Tahiri
6b4148861d Part: Geometry Python interface to get/set an extension 2019-07-14 12:37:29 +02:00
Abdullah Tahiri
a96ca31dda Part:: Bug fix in geometry set extension 2019-07-14 12:37:29 +02:00
Abdullah Tahiri
9ba80f015c Part: Geometry Extension Python object 2019-07-14 12:37:29 +02:00
Abdullah Tahiri
55be6fdb7f Geometry Extension based on smart pointers 2019-07-14 12:37:28 +02:00