Implement the three major unit system schemas

This commit is contained in:
jriegel
2013-12-05 18:16:31 +01:00
parent 2df4f4ff7f
commit 69a4bbc46a
14 changed files with 220 additions and 51 deletions

View File

@@ -79,13 +79,16 @@ UnitsApi::~UnitsApi()
void UnitsApi::setSchema(UnitSystem s)
{
delete UserPrefSystem;
if(UserPrefSystem){
UserPrefSystem->resetSchemaUnits(); // for schemas changed the Quantity constants
delete UserPrefSystem;
}
switch (s) {
case SI1 : UserPrefSystem = new UnitsSchemaInternal(); break;
case SI2 : UserPrefSystem = new UnitsSchemaMKS(); break;
case Imperial1: UserPrefSystem = new UnitsSchemaImperial1(); break;
}
//UserPrefSystem->setSchemaUnits();
UserPrefSystem->setSchemaUnits(); // if necesarry a unit schema can change the constants in Quantity (e.g. mi=1.8km rather then 1.6km).
}