Commit Graph

63 Commits

Author SHA1 Message Date
PhoneDroid
8abd25c999 [ App ]: Update SPDX License Identifiers 2025-12-25 11:55:37 -06:00
Markus Reitböck
d05e2a0431 App: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:02 +02:00
Benjamin Nauck
65ee1339de App: use contains() instead of count() where possible 2025-05-03 22:19:51 +02:00
Kacper Donat
b300c80b90 Base: Use explicit pointer syntax for freecad_cast (#20694)
* Base: Use explicit pointer syntax for freecad_cast

This aligns our custom cast with other casts

* All: Use explicit pointer syntax for freecad_cast
2025-04-11 14:11:33 +00:00
Kacper Donat
35a9673a75 Base: Rename Base::freecad_dynamic_cast into freecad_cast
This is to make it shorter and easier to use. QT does the same thing
with their qobject_cast.
2025-04-07 10:32:28 -05:00
Chris Hennes
c1ada6bc40 App: Coverity fixes 2025-03-18 15:59:22 +01:00
bofdahof
4a16ea41a7 App: apply std::ranges 2025-03-16 17:14:38 -05:00
Benjamin Nauck
dd6aa9f3c7 Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's
Regex based changes, manually verified
2025-01-27 16:08:18 +01:00
PaddleStroke
3e33cf61e5 Rename 'OriginFeature' to 'DatumElement' 2024-11-26 15:36:48 +01:00
PaddleStroke
3c1358da10 Core: Rename 'OriginFeature' file to 'Datums' 2024-11-26 15:36:48 +01:00
wmayer
4e82a0af48 App: Apply clang format (part 1) 2024-11-21 07:54:24 +01:00
bgbsww
5afdc19874 Toponaming: Cleanup 2024-07-21 17:40:42 -04:00
mosfet80
44449d32d6 App: clean
Clean  GeoFeatureGroupExtension.cpp
2024-04-20 11:29:00 +02:00
André Caldas
560898907b Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
wmayer
89bdd489b0 App: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
luz paz
0e08b51a58 App: fix trailing whitespace 2022-12-02 19:19:17 -06:00
wmayer
07711bb8a8 App: fix endless-loop when recursively determining placement of an object 2022-11-17 15:46:06 +01:00
berniev
65a356835b App: Modernise ctors dtors defs etc 2022-08-01 00:34:46 +02:00
berniev
b40de7a509 remove redundant void 2022-07-31 10:27:44 +02:00
wmayer
749361d2f3 App: modernize C++11
* use nullptr
2022-03-23 17:29:23 +01:00
Uwe
8bedc25344 [App] Feature: remove unused includes 2022-02-27 16:37:29 +01:00
Zheng, Lei
74abb39883 App: fix GeoFeatureGroupExtension::extensionGetSubObject() 2020-09-12 17:30:56 +02:00
Zheng, Lei
643b2d6aa0 App: report error on copying OriginGroup without dependency 2020-08-30 11:58:54 +02:00
luz.paz
4f308dc03c src/App: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/App` files
2019-12-25 11:38:43 +01:00
Zheng, Lei
c5112ecdc5 (GeoFeature)GroupExtension: track children visibility
The future patch will introduce Part::getTopoShape() to construct a
compound shape from a group. It will rely on the children visibility to
determine whether to include the child shape or not. This patch adds
children visibility tracking capability to group, and makes sure that
the group object will be marked for recomputation in case of any change
in group member, and their visibility status.

* Remove Prop_Output from 'Group' property.

* Added hidden property _GroupTouched to help propagate children change.

* Track children visibility change using signal

* GeoFeatureGroupExtension uses new PropertyLinkBase interface for
  scope checking.
2019-08-17 14:52:10 +02:00
Zheng, Lei
ff1d1cd341 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
wmayer
7dc13bd2d6 Replace Base::Exception with appropriate subclass 2018-11-14 23:17:42 +01:00
DeepSOIC
f919eb6a64 fix object.getGlobalPlacement
was confused by expressions in Placement of containers.
Fixes #3217 Sketcher not drawing at mouse position.
2017-12-11 12:48:07 +01:00
Stefan Tröger
e64813827d Expose global placement calculation to python API 2017-09-21 12:58:01 +02:00
Stefan Tröger
957b23e610 Don't check for multiple groups when performing a transaction. fixes #0003150
During undo/redo the order in which objects are removed from a group and added to annother is arbitrary, hence it cannot comply to the single Group rule. Not echking for it in this case is unproblematic, as undo/redo only recrete former states, and those states have been checked in normal operation.
2017-09-21 12:48:39 +02:00
Stefan Tröger
1248ba3bf9 Fix wrong detection of multiple GeoFeatureGroups 2017-09-21 11:14:21 +02:00
wmayer
7ce28bea5c add missing return 2017-09-12 16:42:46 +02:00
wmayer
e260f9dabd improve whitespaces 2017-09-09 18:07:46 +02:00
Stefan Tröger
0053e939e9 Ensure finding the correct parent GeoFeatureGroup 2017-09-09 16:55:55 +02:00
Stefan Tröger
9d4f1b754a Make sure all relevant links are found for object in GeoFeatureGroup. issue0003150 2017-09-09 16:55:55 +02:00
Stefan Tröger
972b89d0a0 Make PartDesign::Boolean work with new Link structure
This is the first feature that used GeoFeatureGroupExtension and required links to the groups inside as well as to things on the same level. Hence a few modifications to link scopes have been nesseccary.
2017-09-09 16:55:55 +02:00
Stefan Tröger
79bb7b7f50 DependencyGraph: show invalid links in red 2017-09-09 16:47:07 +02:00
Stefan Tröger
987a5b36b9 Create special scope properties 2017-09-09 16:47:07 +02:00
Stefan Tröger
3dccf50e83 Introduce Scoped links to prevent cross cs links 2017-09-09 16:47:07 +02:00
Stefan Tröger
c0a270a76e Ensure objects to be in a single GeoFeatureGroup only 2017-09-09 16:47:07 +02:00
Stefan Tröger
f96c69deed Prevent cross GeoFeatureGroup links on recompute 2017-09-09 16:47:07 +02:00
wmayer
989fe4028e various fixes:
+ fix typos
+ fix const correctness
+ whitespace improvements
2017-06-19 17:18:16 +02:00
Stefan Tröger
4ecd831bfd GeoFeatureGroup: Make link collection non-DAG save 2017-06-19 15:37:09 +02:00
Stefan Tröger
da866e5b4d Allow add/remove multiple objects in a group 2017-06-19 15:37:09 +02:00
Stefan Tröger
eb601df236 Fix undo/redo while checking link integrity 2017-06-19 15:37:09 +02:00
Stefan Tröger
0487b66738 Links ensure uncyclic graph and correct groups 2017-06-19 15:37:09 +02:00
Stefan Tröger
f0f7125a11 Group: ensure single group only 2017-06-19 15:37:09 +02:00
Stefan Tröger
26200f95f5 Parent groups are irelevant, not only parent geofeaturegroups 2017-06-19 15:37:09 +02:00
Stefan Tröger
81f91387c8 Fix collecting of cs relevant links 2017-06-19 15:37:09 +02:00
Stefan Tröger
183a4b4ef3 GeoFeatureGroup: Handle drag into document 2017-06-19 15:37:09 +02:00