Ladislav Michl
e7cd72b2e0
Base: refactor unit formatting defaults
...
Defaults for both precision (number of digits after decimal point)
and denominator (number of fractions) are defined on various places
making difficult to find which default is used for various tasks.
Store these values at one central place: UnitsApi. Unless overriden
by user, default values are defined by unitSchemasDataPack.
2025-09-05 17:31:54 +02:00
Ladislav Michl
a067083a0b
Base: UnitsApi: remove nowhere called init()
2025-09-05 17:31:54 +02:00
Ladislav Michl
8eea79fe05
Base: make UnitsApi::toNumber method of Quantity
...
This static method takes Quantity as a parameter, so make it
method of Quantity directly.
2025-09-05 17:31:54 +02:00
Ladislav Michl
e3852f7732
Base: make UnitsApi::toString method of Quantity
...
This static method takes Quantity as a parameter, so make it
method of Quantity directly.
2025-09-05 17:31:54 +02:00
bofdahof
1155f0d752
Base: simplify UnitsSchemas management
...
Fixes: Maintaining schemas is difficult and error-prone
- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
Benjamin Bræstrup Sayoc
dda05369c4
Base: remove unneeded includes
2025-02-18 11:07:57 -06:00
Ladislav Michl
4d6ed9d531
Base: UnitsSchema: return std::string
2024-12-23 17:48:42 +01:00
Ladislav Michl
2ea8a633ac
Base: Quantity: return std::string
2024-12-23 17:48:42 +01:00
Ladislav Michl
c11b37e312
Base: Units: remove unused defines
2024-12-23 17:48:42 +01:00
Ladislav Michl
0907c7bfda
Base: Units: return std::string
2024-12-23 17:48:42 +01:00
Max Wilfinger
7d21d9edb8
Fix source string typos mentioned on Crowdin ( #15261 )
2024-07-08 17:18:31 -05:00
Ladislav Michl
95b37fa806
Base: Do not use else before return
2024-01-21 16:14:12 +01:00
hasecilu
af6477205b
[Base/Units] Change strings' description
...
Affect strings presented to the user on the combobox to select unit system.
- The symbol to represent angles on "degree" unit is '°'
- Change imperial velocity to "ft/s" to enforce the use of 's' symnbol as second
2023-12-19 16:35:22 -06:00
wmayer
f539138dd9
fix readability-*:
...
* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
2023-11-16 01:22:08 +01:00
pre-commit-ci[bot]
6a66034ce2
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2023-11-16 00:24:09 +01:00
wandererfan
7194c29a81
[Units]Add Meters-only schema ( #7395 )
...
- use correct unit for velocity
- typo in include guard
2023-11-16 00:24:09 +01:00
wmayer
e85c383bff
Base: apply clang format
2023-11-13 12:01:26 -05:00
wmayer
010dca8303
Base: C++ core guidelines: init variables
2023-08-24 18:48:52 +02:00
Chris Hennes
001c79f459
Gui: Translate unit system UI
2023-05-15 20:16:46 -05:00
wmayer
0c2fdd64f4
Base: [skip ci] fix readability-identifier-length
2022-11-19 16:54:08 +01:00
wandererfan
7745a5aca0
[Units]Allow querying schema for unit of measure
2022-11-19 16:49:46 +01:00
wandererfan
16ff6dfbbb
[Base]identify schemas which use multiple units
...
- allow querying a schema to determine if it uses multiple
units for length (ex ft/in) or angles (ex DMS).
2022-08-31 16:31:27 -04:00
wmayer
6c1e940b69
Base: use forward declaration instead of including Python.h
2022-03-03 19:18:07 +01:00
Uwe
9ec0bcdcf2
[Base] Units and Uui: remove unused includes
2022-02-24 11:08:56 +01:00
wmayer
243f81fd94
Base: harmonize UnitsApi::toString/UnitsApi::toNumber with UnitsSchema::toLocale
2022-02-06 12:47:13 +01:00
wmayer
5f8bb65757
Base: [skip ci] fix inconsistency in overloaded UnitsApi::toNumber()
2022-02-06 08:49:50 +01:00
wmayer
cbc60a3f44
Base: clean-up code in UnitsApi
2022-01-25 00:26:47 +01:00
Syres916
e215c22519
[Base] Remove one unnecessary precision level
2021-08-12 11:13:29 +01:00
Syres916
463ff88a57
[Base] Increase precision
2021-08-12 10:55:50 +01:00
luz paz
142c2c2c4d
Base: remove Py2 code
2021-04-26 09:23:58 +02:00
wmayer
e084df62b9
Base: add convenience functions to create a QString from quantity
2021-04-20 14:56:29 +02:00
wmayer
cd9319f125
Base: add convenience functions to create a QString from quantity or double
2021-04-20 14:07:20 +02:00
Benjamin Nauck
f6c9cc90ee
[Base] Remove includes to StdStlTools.h as that's not needed anymore
...
std::make_unique was introduced in c++14, so no need to use the back
ported version
2021-03-06 21:20:32 +01:00
luz paz
d5f6c096b8
Base: Fix header uniformity, whitespace, and doxygen
...
[skip ci]
2020-11-22 18:12:16 +01:00
Bernd Hahnebach
7852957623
Base: add new unit schema for mm and N for use in FEM
2020-08-07 19:19:44 +02:00
luz.paz
6f11ed298a
src/Base: [skip ci] fix header uniformity
...
This PR fixes header uniformity across all `src/Base` files
2019-12-25 11:38:58 +01:00
donovaly
ce56205ed0
more fixes for the UnitsCalculator
...
- we must read out the unit system description UTF8 to get the characters ² and ³
- update unit system description according to today's unit "cft" addition
- don't hardcode the unit system descriptions in the .ui file
- add acceleration to imperial schema
2019-12-24 13:31:13 +01:00
wmayer
04b54cd6a5
Base: [skip ci] replace raw pointers of UnitsSchema with unique_ptr
2019-12-21 10:45:22 +01:00
wmayer
4bcb43ebd2
Base: [skip ci] make UnitSystem an enum class
2019-12-21 10:10:19 +01:00
wandererfan
00e6e376c9
Add ImperialCivil Units Schema
...
- units for civil engineering - ft, ft2, ft3, mph,
and angles as degrees/minutes/seconds
2018-12-06 08:57:17 -03:00
luz.paz
505488c4f9
Misc. typos
...
Found via `codespell`
2018-04-25 09:41:33 -03:00
Unknown
a8ecffb652
Misc. typo fixes
...
Various workbenches
2017-12-23 14:30:30 +01:00
wmayer
49d75f88be
fix warning
2017-08-13 16:58:06 +02:00
wmayer
892e78d445
extend Python api of units:
...
+ get list of all available schemas
+ get currently set schema
+ translate a quantity to a given schema
2017-08-13 16:55:00 +02:00
Itai Nahshon
a91c5bbae7
Add UnitsSchemaMmMin - izes are only in mm, speed in mm/munute.
2017-07-18 17:41:36 +02:00
Yorik van Havre
0e9e49cbcc
py3: Base: files R-Z ported to python3
...
issue 0000995
2017-05-21 12:35:41 +02:00
wmayer
1673ab801e
use specialized exception classes
2017-04-28 18:49:11 +02:00
wmayer
f408f3180b
fix -Wextra in FreeCADBase
2016-09-21 15:02:02 +02:00
wmayer
f39b89a54d
add class QuantityFormat to control user string of Quantity
...
do some code refactoration to reduce duplicate code
2016-08-06 19:06:29 +02:00
Yorik van Havre
ad92a2df25
Added new units schema: US building (feet + inches + fraction)
2016-05-26 20:37:53 -03:00