Commit Graph

543 Commits

Author SHA1 Message Date
tritao
cdab9c7837 CMake: Cleanup targets with transitive dependencies 2025-03-17 12:12:06 +00:00
Chris Hennes
1a2070c36f Merge pull request #19636 from kadet1090/color-in-base
Base: Move App::Color to Base
2025-03-02 16:36:40 -06:00
Benjamin Bræstrup Sayoc
ee1c73cd04 Build: suppress warnings from 3rd party libraries
Warnings from 3rd parties are not relevant and are only polluting the warning output. Marking these libraries as SYSTEM suppresses warning.

https://gcc.gnu.org/onlinedocs/cpp/Invocation.html#index-I
https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
2025-02-25 14:39:05 +00:00
Chris Hennes
30af56d860 Sketcher Tests: add [[maybe_unused]] 2025-02-25 14:35:12 +00:00
Joao Matos
15076cb504 Core: Move PyCXX library to src/3rdParty. 2025-02-24 16:36:06 +00:00
Kevin Martin
edb8e4c937 Address performance of existing unique-name generation (Part 2) (#18676)
As described in Issue 16849, the existing Tools::getUniqueName method
requires calling code to form a vector of existing names to be avoided.

This leads to poor performance both in the O(n) cost of building such a
vector and also getUniqueName's O(n) algorithm for actually generating
the unique name (where 'n' is the number of pre-existing names).

This has  particularly noticeable cost in documents with large numbers
of DocumentObjects because generating both Names and Labels for each new
object incurs this cost. During an operation such as importing this
results in an O(n^2) time spent generating names.

The other major cost is in the saving of the temporary backup file,
which uses name generation for the "files" embedded in the Zip file.
Documents can easily need several such "files" for each object in the
document.

This update includes the following changes to use the newly-added
UniqueNameManager as a replacement for the old Tools::getUniqueName
method and deletes the latter to remove any temptation to use it as
its usage model breeds inefficiency:

Eliminate Tools::getUniqueName, its local functions, and its unit tests.

Make DocumentObject naming use the new UniqueNameManager class.

Make DocumentObject Label naming use the new UniqueNameManager class.
This needs to monitor DocumentObject Labels for changes since this
property is not read-only. The special handling for the Label
property, which includes optionally forcing uniqueness and updating
links in referencing objects, has been mostly moved from
PropertyString to DocumentObject.

Add Document::containsObject(DocumentObject*) for a definitive
test of an object being in a Document. This is needed because
DocumentObjects can be in a sort of limbo (e.g. when they are in the
Undo/Redo lists) where they have a parent linkage to the Document but
should not participate in Label collision checks.

Rename Document.getStandardObjectName to getStandardObjectLabel
to better represent what it does.

Use new UniqueNameManager for Writer internal filenames within the zip
file.

Eliminate unneeded Reader::FileNames collection. The file names
already exist in the FileList collection elements. The only existing
use for the FileNames collection was to determine if there were any
files at all, and with FileList and FileNames being parallel
vectors, they both had the same length so FileList could be used
for this test..

Use UniqueNameManager for document names and labels. This uses ad hoc
UniqueNameManager objects created on the spot on the assumption that
document creation is relatively rare and there are few documents, so
although the cost is O(n), n itself is small.

Use an ad hoc UniqueNameManager to name new DymanicProperty entries.
This is only done if a property of the proposed name already exists,
since such a check is more-or-less O(log(n)), almost never finds a
collision, and avoids the O(n) building of the UniqueNameManager.
If there is a collision an ad-hoc UniqueNameManager is built
and discarded after use.
The property management classes have a bit of a mess of methods
including several to populate various collection types with all
existing properties. Rather than introducing yet another such
collection-specific method to fill a UniqueNameManager, a
visitProperties method was added which calls a passed function for
each property. The existing code (e.g. getPropertyMap) would be
simpler if they all used this but the cost of calling a lambda
for each property must be considered. It would clarify the semantics
of these methods, which have a bit of variance in which properties
populate the passed collection, e.g. when there are duplicate names..
Ideally the PropertyContainer class would keep a central directory of
all properties ("static", Dynamic, and exposed by ExtensionContainer and
other derivations) and a permanent UniqueNameManager. However the
Property management is a bit of a mess making such a change a project
unto itself.
2025-02-24 10:23:53 -06:00
bofdahof
6f84cd5971 current src path no longer required 2025-02-22 20:48:30 -06:00
Benjamin Bræstrup Sayoc
6f619b5f1c Base: remove unneeded includes 2025-02-18 11:07:57 -06:00
Kacper Donat
13fbab9e42 Base: Move App::Color to Base
Every basic data type is stored in Base module, color is standing out as
one that does not. Moving it to Base opens possibilities to integrate it
better with the rest of FreeCAD.
2025-02-17 21:10:26 +01:00
Benjamin Bræstrup Sayoc
34a77cfbb7 Tests: use QStringLiteral 2 2025-02-17 12:44:27 +01:00
Joao Matos
aace8f7bee CMake: Modernize build files using outdated Python variables. 2025-02-16 10:21:26 -06:00
tritao
80b299bb88 Base: Move zipios library to 3rdParty folder. 2025-02-14 13:08:28 -06:00
Chris Hennes
ec050db9a8 Merge pull request #18791 from CalligaroV/toponaming-ElementMapVersion-code-from-LS3
[Toponaming] Import code releted to _ElementMapVersion from LS3
2025-02-14 10:54:38 -06:00
Chris Hennes
b56cdcde02 Tests: remove superfluous NOLINTs 2025-02-12 14:22:41 -06:00
Chris Hennes
a3004c2c0a Merge pull request #19142 from hyarion/refactor/add-template-addobject
Add new addObject<T>() function
2025-02-11 09:42:47 -06:00
Benjamin Nauck
2107e60304 Mod: Use new GroupExtension::addObject<T>(...) 2025-02-10 18:35:38 +01:00
Benjamin Nauck
265b58c034 Mod: Use new addObject<T>(...) using regex 2025-02-10 18:35:38 +01:00
Benjamin Bræstrup Sayoc
8b57e25cb8 Test: Use QStringLiteral 2025-02-10 18:34:57 +01:00
Benjamin Bræstrup Sayoc
1c0774563d Material: Use QStringLiteral 2025-02-10 18:32:45 +01:00
Chris Hennes
c51ecd73b1 Merge pull request #18916 from AjinkyaDahale/sk-refactor-stage-3
[Sketcher] Round 3 of refactors
2025-02-10 11:01:55 -06:00
tritao
f7a0cece08 Base: Remove Boost-based filesystem and switch to standard <filesystem> 2025-02-10 10:48:54 -06:00
Ajinkya Dahale
fd67538dec [Sketcher][test] Divide SketchObject tests into multiple files
...for managability.
2025-01-30 09:34:03 +01:00
Ajinkya Dahale
bae501e493 [Sketcher][test] Move helper functions away for reusability
...in other tests
2025-01-30 09:34:03 +01:00
Ajinkya Dahale
d06349e3ac [Sketcher][test] Add new test for internal geometry deletion
...when some are "used"
2025-01-16 15:56:21 +05:30
Ajinkya Dahale
10f4fb866e [Sketcher][test] Add tests for B-spline operations 2025-01-16 15:55:14 +05:30
Ajinkya Dahale
6e48d338b7 [Sketcher][test] Tests for expose/delete internal geometry 2025-01-16 15:52:03 +05:30
Ajinkya Dahale
bb11cb52f5 [Sketcher][test] Create test for getConstraintAfterDeletingGeo+
[Sketcher] Add null case to constraint change on deletion checks
2025-01-16 15:52:02 +05:30
Chris Hennes
0517e3dc10 Merge pull request #17564 from kadet1090/new-transform-dialog
Gui: New transform dialog
2025-01-13 11:18:26 -06:00
Kevin Martin
346be29042 Address the poor performance of the existing unique-name generation (part 1) (#18589)
* Change Address the poor performance of the existing unique-name generation

As described in Issue 16849, the existing Tools::getUniqueName method
requires calling code to form a vector of existing names to be avoided.

This leads to poor performance both in the O(n) cost of building such a
vector and also getUniqueName's O(n) algorithm for actually generating
the unique name (where 'n' is the number of pre-existing names).

This has  particularly noticeable cost in documents with large numbers
of DocumentObjects because generating both Names and Labels for each new
object incurs this cost. During an operation such as importing this
results in an O(n^2) time spent generating names.

The other major cost is in the saving of the temporary backup file,
which uses name generation for the "files" embedded in the Zip file.
Documents can easily need several such "files" for each object in the
document.

This is the first part of the correction, adding an efficient class for
managing sets of unique names.

New class UniqueNameManager keeps a list of existing names organized in
a manner that eases unique-name generation. This class essentially acts
as a set of names, with the ability to add and remove names and check if
a name is already there, with the added ability to take a prototype name
and generate a unique form for it which is not already in the set.

a new unit test for UniqueNameManager has been added as well.

There is a small regression, compared to the existing unique-name code,
insofar as passing a prototype name like "xyz1234" to the old code would
yield "xyz1235" whether or not "xyz1234" already existed, while the new
code will return the next name above the currently-highest name on the
"xyz" model, which could be "xyz" or "xyz1" or "xyz0042"..
2025-01-13 10:57:53 -06:00
Kacper Donat
a71a67408b Part: Use TopoShape instead of TopoDS_Shape
This changes Attacher to use more our own TopoShape class which is more
information rich.
2025-01-04 16:32:52 +01:00
Kacper Donat
3774830a46 ServiceProvider: Better naming of methods
This commit renames methods of ServiceProvider to be easier to
understand. It also replaces the misleading singleton with more correct
here global instance of class.
2025-01-04 16:32:47 +01:00
Vincenzo Calligaro
b43394de2d Toponaming: import code related to ElementMapVersion from LS3
*Added test

Signed-off-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>
2025-01-03 14:12:04 +01:00
Mark Ganson TheMarkster
27889739bd [Spreadsheet] fix isValidAlias() (#18567) 2024-12-23 14:18:30 -03:00
Ladislav Michl
3bddb723d5 Base: UnitsSchema: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
0b3adee2ab Base: Quantity: return std::string 2024-12-23 17:48:42 +01:00
Ladislav Michl
379d7ea9d5 Base: Units: return std::string 2024-12-23 17:48:42 +01:00
wwmayer
dd1419cd5f Test: Support of parallel execution of reader tests (#18587)
* Tests: Initialize xerces sub-system in order to parse XML files

* Test: Support of parallel execution of reader tests

Fixes #18549
2024-12-20 10:42:02 -06:00
David Carter
ddf48e0daa Materials: Change display of Quantity values
The default display type of quantity objects is fixed point resulting
in insufficient accuracy when changing unit systems, or when the values
are small. This fix changes the default format from 'Fixed' to the more
apt 'Default' format. This allows the displayed values to scale as
appropriate.

Fixes #18149
2024-12-20 11:31:43 -05:00
Benjamin Nauck
39402e2083 Revert "Address the poor performance of the existing unique-name generation (#17944)"
This reverts commit 83202d8ad6.

# Conflicts:
#	src/Base/Tools.cpp
#	src/Base/Tools.h
2024-12-16 17:31:43 +01:00
Kacper Donat
d835cde3a5 Base: Add Services and ServiceProvider
This is intended to be used for intra-module communication. Modules can
specify service that are then implemented by other modules. This way
we can use features from for example part in Core without relying on the
Part module explicitly.

Base does provide Service definition - which is basically an abstract
class with pure virtual methods. This service then can be implemented
in other modules and accessed in runtime via ServiceProvider class that
stores all implementations.

ServiceProvider does store multiple implementations so in theory it is
possible to use it to provide granular implementations. For example,
part can provide CenterOfMass service that provides center of mass for
part features, mesh can implement another one for meshes and then we can
iterate over all implementations and find one that can provide center of
2024-12-13 12:01:13 -05:00
Kevin Martin
5696c9add3 Address the poor performance of the existing unique-name generation (#17944)
* Address the poor performance of the existing unique-name generation

As described in Issue 16849, the existing Tools::getUniqueName method
requires calling code to form a vector of existing names to be avoided.

This leads to poor performance both in the O(n) cost of building such a
vector and also getUniqueName's O(n) algorithm for actually generating
the unique name (where 'n' is the number of pre-existing names).

This has  particularly noticeable cost in documents with large numbers
of DocumentObjects because generating both Names and Labels for each new
object incurs this cost. During an operation such as importing this
results in an O(n^2) time spent generating names.

The other major cost is in the saving of the temporary backup file,
which uses name generation for the "files" embedded in the Zip file.
Documents can easily need several such "files" for each object in the
document.

This update includes the following changes:

Create UniqueNameManager to keep a list of existing names organized in
a manner that eases unique-name generation. This class essentially acts
as a set of names, with the ability to add and remove names and check if
a name is already there, with the added ability to take a prototype name
and generate a unique form for it which is not already in the set.

Eliminate Tools::getUniqueName

Make DocumentObject naming use the new UniqueNameManager class

Make DocumentObject Label naming use the new UniqueNameManager class.
Labels are not always unique; unique labels are generated if the
settings at the time request it (and other conditions). Because of this
the Label management requires additionally keeping a map of counts
for labels which already exist more than once.
These collections are maintained via notifications of value changes on
the Label properties of the objects in the document.

Add Document::containsObject(DocumentObject*) for a definitive
test of an object being in a Document. This is needed because
DocumentObjects can be in a sort of limbo (e.g. when they are in the
Undo/Redo lists) where they have a parent linkage to the Document but
should not participate in Label collision checks.

Rename Document.getStandardObjectName to getStandardObjectLabel
to better represent what it does.

Use new UniqueNameManager for Writer internal filenames within the zip
file.

Eliminate unneeded Reader::FileNames collection. The file names
already exist in the FileList collection elements. The only existing
use for the FileNames collection was to determine if there were any
files at all, and with FileList and FileNames being parallel
vectors, they both had the same length so FileList could be used
for this test..

Use UniqueNameManager for document names and labels. This uses ad hoc
UniqueNameManager objects created on the spot on the assumption that
document creation is relatively rare and there are few documents, so
although the cost is O(n), n itself is small.

Use an ad hoc UniqueNameManager to name new DymanicProperty entries.
This is only done if a property of the proposed name already exists,
since such a check is more-or-less O(log(n)), almost never finds a
collision, and avoids the O(n) building of the UniqueNameManager.
If there is a collision an ad-hoc UniqueNameManager is built
and discarded after use.
The property management classes have a bit of a mess of methods
including several to populate various collection types with all
existing properties. Rather than introducing yet another such
collection-specific method to fill a UniqueNameManager, a
visitProperties method was added which calls a passed function for
each property. The existing code would be simpler if existing
fill-container methods all used this.
Ideally the PropertyContainer class would keep a central directory of
all properties ("static", Dynamic, and exposed by ExtensionContainer and
other derivations) and a permanent UniqueNameManager. However the
Property management is a bit of a mess making such a change a project
unto itself.

The unit tests for Tools:getUniqueName have been changed to test
UniqueNameManager.makeUniqueName instead.
This revealed a small regression insofar as passing a prototype name
like "xyz1234" to the old code would yield "xyz1235" whether or
not "xyz1234" already existed, while the new code will return the next
name above the currently-highest name on the "xyz" model, which could
be "xyz" or "xyz1".

* Correct wrong case on include path

* Implement suggested code changes
Also change the semantics of visitProperties to not have any short-circuit return

* Remove reference through undefined iterator

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix up some comments for DOxygen

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-13 10:54:46 -06:00
efferre79
70ec5a7583 cmake fixes for external OndselSolver building (#18379)
* Assembly: fix building with external OndselSolver

This commit pairs with f35b075e271e9cb3451f3439f7dc0274841a0838.
It solves two issues:

- remove hardcoded includes of 3rdparty files
- add missing include_directories()

* Assembly: add check for external OndselSolver includes
2024-12-13 10:46:46 -06:00
marioalexis
4c492621fc CMake: Decouple internal SMESH build from Fem build - fixes #18287 2024-12-09 12:09:30 -05:00
Chris Hennes
3134cd5d8c Merge pull request #17315 from mwganson/ssclearall
[Spreadsheet] avoid removing user dynamic properties when clearing ce…
2024-12-06 11:57:45 -05:00
Ajinkya Dahale
4e476b9c78 [Sketcher][test] Add and use helper function to get points of interest 2024-12-04 00:57:41 +05:30
Ajinkya Dahale
30e95ee86a [Sketcher] Refactor SketchObject::trim()
DO NOT MERGE because not complete: not all constraints are not transferred.

Includes:

* Adjust `deriveConstraintsForPieces` for trim
* Make sure new points are constrained on the cutting edges
* Add constraints at trim end(s) dependent on pre-exisiting ones with cutting curve(s). Also change tests to reflect that auto-coincidence can now be applied to non-periodic curves as well.

Known issue(s):
* Some redundant constraints may be added under certain circumstances (e.g. in
presence of perpendicular-via-point)
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
75a347490e [Sketcher] Add tests for split and trim
Includes:
* Tests for splitting and trimming of various types of curves
* Assertions on constraints expected to be added on these curves
2024-12-04 00:57:40 +05:30
Ajinkya Dahale
03b143a0d1 [Sketcher][test] Add unit tests for SketchObject::getPoint() 2024-12-04 00:57:39 +05:30
wmayer
c07df6b392 Test: Add unit test to read in 3MF file 2024-11-28 19:36:58 +01:00
Chris Hennes
e669a58941 Spreadsheet: Add tests for validAddressName and validAliases 2024-11-26 17:51:57 -06:00