| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2010 Jürgen Riegel <[email protected]> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#include <limits> |
| 24 |
|
| 25 |
#include <Base/QuantityPy.h> |
| 26 |
#include <Base/UnitPy.h> |
| 27 |
|
| 28 |
#include "PropertyUnits.h" |
| 29 |
#include "Expression.h" |
| 30 |
|
| 31 |
|
| 32 |
using namespace App; |
| 33 |
using namespace Base; |
| 34 |
using namespace std; |
| 35 |
|
| 36 |
|
| 37 |
const PropertyQuantityConstraint::Constraints LengthStandard = { |
| 38 |
0.0, std::numeric_limits<double>::max(), 1.0}; |
| 39 |
const PropertyQuantityConstraint::Constraints AngleStandard = {-360, 360, 1.0}; |
| 40 |
|
| 41 |
//************************************************************************** |
| 42 |
// PropertyQuantity |
| 43 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 44 |
|
| 45 |
TYPESYSTEM_SOURCE(App::PropertyQuantity, App::PropertyFloat) |
| 46 |
|
| 47 |
Base::Quantity PropertyQuantity::getQuantityValue() const |
| 48 |
{ |
| 49 |
Quantity quantity(_dValue, _Unit); |
| 50 |
quantity.setFormat(_Format); |
| 51 |
return quantity; |
| 52 |
} |
| 53 |
|
| 54 |
const char* PropertyQuantity::getEditorName() const |
| 55 |
{ |
| 56 |
return "Gui::PropertyEditor::PropertyUnitItem"; |
| 57 |
} |
| 58 |
|
| 59 |
PyObject* PropertyQuantity::getPyObject() |
| 60 |
{ |
| 61 |
return new QuantityPy(new Quantity(_dValue, _Unit)); |
| 62 |
} |
| 63 |
|
| 64 |
Base::Quantity PropertyQuantity::createQuantityFromPy(PyObject* value) |
| 65 |
{ |
| 66 |
Base::Quantity quant; |
| 67 |
|
| 68 |
if (PyUnicode_Check(value)) { |
| 69 |
quant = Quantity::parse(PyUnicode_AsUTF8(value)); |
| 70 |
} |
| 71 |
else if (PyFloat_Check(value)) { |
| 72 |
quant = Quantity(PyFloat_AsDouble(value), _Unit); |
| 73 |
} |
| 74 |
else if (PyLong_Check(value)) { |
| 75 |
quant = Quantity(double(PyLong_AsLong(value)), _Unit); |
| 76 |
} |
| 77 |
else if (PyObject_TypeCheck(value, &(QuantityPy::Type))) { |
| 78 |
Base::QuantityPy* pcObject = static_cast<Base::QuantityPy*>(value); |
| 79 |
quant = *(pcObject->getQuantityPtr()); |
| 80 |
} |
| 81 |
else { |
| 82 |
std::string error = std::string("wrong type as quantity: "); |
| 83 |
error += value->ob_type->tp_name; |
| 84 |
throw Base::TypeError(error); |
| 85 |
} |
| 86 |
|
| 87 |
return quant; |
| 88 |
} |
| 89 |
|
| 90 |
void PropertyQuantity::setPyObject(PyObject* value) |
| 91 |
{ |
| 92 |
// Set the unit if Unit object supplied, else check the unit |
| 93 |
// and set the value |
| 94 |
|
| 95 |
if (PyObject_TypeCheck(value, &(UnitPy::Type))) { |
| 96 |
Base::UnitPy* pcObject = static_cast<Base::UnitPy*>(value); |
| 97 |
Base::Unit unit = *(pcObject->getUnitPtr()); |
| 98 |
aboutToSetValue(); |
| 99 |
_Unit = unit; |
| 100 |
hasSetValue(); |
| 101 |
} |
| 102 |
else { |
| 103 |
Base::Quantity quant = createQuantityFromPy(value); |
| 104 |
|
| 105 |
if (quant.isDimensionless()) { |
| 106 |
PropertyFloat::setValue(quant.getValue()); |
| 107 |
return; |
| 108 |
} |
| 109 |
|
| 110 |
if (_Unit != quant.getUnit()) { |
| 111 |
throw Base::UnitsMismatchError("Not matching Unit!"); |
| 112 |
} |
| 113 |
|
| 114 |
PropertyFloat::setValue(quant.getValue()); |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
void PropertyQuantity::setPathValue(const ObjectIdentifier& /*path*/, const boost::any& value) |
| 119 |
{ |
| 120 |
auto q = App::anyToQuantity(value); |
| 121 |
aboutToSetValue(); |
| 122 |
if (!q.isDimensionless()) { |
| 123 |
_Unit = q.getUnit(); |
| 124 |
} |
| 125 |
_dValue = q.getValue(); |
| 126 |
setValue(q.getValue()); |
| 127 |
} |
| 128 |
|
| 129 |
const boost::any PropertyQuantity::getPathValue(const ObjectIdentifier& /*path*/) const |
| 130 |
{ |
| 131 |
Quantity quantity(_dValue, _Unit); |
| 132 |
quantity.setFormat(_Format); |
| 133 |
return quantity; |
| 134 |
} |
| 135 |
|
| 136 |
//************************************************************************** |
| 137 |
// PropertyQuantityConstraint |
| 138 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 139 |
|
| 140 |
TYPESYSTEM_SOURCE(App::PropertyQuantityConstraint, App::PropertyQuantity) |
| 141 |
|
| 142 |
|
| 143 |
void PropertyQuantityConstraint::setConstraints(const Constraints* sConstrain) |
| 144 |
{ |
| 145 |
_ConstStruct = sConstrain; |
| 146 |
} |
| 147 |
|
| 148 |
const char* PropertyQuantityConstraint::getEditorName() const |
| 149 |
{ |
| 150 |
return "Gui::PropertyEditor::PropertyUnitConstraintItem"; |
| 151 |
} |
| 152 |
|
| 153 |
const PropertyQuantityConstraint::Constraints* PropertyQuantityConstraint::getConstraints() const |
| 154 |
{ |
| 155 |
return _ConstStruct; |
| 156 |
} |
| 157 |
|
| 158 |
double PropertyQuantityConstraint::getMinimum() const |
| 159 |
{ |
| 160 |
if (_ConstStruct) { |
| 161 |
return _ConstStruct->LowerBound; |
| 162 |
} |
| 163 |
return std::numeric_limits<double>::min(); |
| 164 |
} |
| 165 |
|
| 166 |
double PropertyQuantityConstraint::getMaximum() const |
| 167 |
{ |
| 168 |
if (_ConstStruct) { |
| 169 |
return _ConstStruct->UpperBound; |
| 170 |
} |
| 171 |
return std::numeric_limits<double>::max(); |
| 172 |
} |
| 173 |
|
| 174 |
double PropertyQuantityConstraint::getStepSize() const |
| 175 |
{ |
| 176 |
if (_ConstStruct) { |
| 177 |
return _ConstStruct->StepSize; |
| 178 |
} |
| 179 |
return 1.0; |
| 180 |
} |
| 181 |
|
| 182 |
void PropertyQuantityConstraint::setPyObject(PyObject* value) |
| 183 |
{ |
| 184 |
Base::Quantity quant = createQuantityFromPy(value); |
| 185 |
|
| 186 |
double temp = quant.getValue(); |
| 187 |
if (_ConstStruct) { |
| 188 |
if (temp > _ConstStruct->UpperBound) { |
| 189 |
temp = _ConstStruct->UpperBound; |
| 190 |
} |
| 191 |
else if (temp < _ConstStruct->LowerBound) { |
| 192 |
temp = _ConstStruct->LowerBound; |
| 193 |
} |
| 194 |
} |
| 195 |
quant.setValue(temp); |
| 196 |
|
| 197 |
if (quant.isDimensionless()) { |
| 198 |
PropertyFloat::setValue(quant.getValue()); // clazy:exclude=skipped-base-method |
| 199 |
return; |
| 200 |
} |
| 201 |
|
| 202 |
if (_Unit != quant.getUnit()) { |
| 203 |
throw Base::UnitsMismatchError("Not matching Unit!"); |
| 204 |
} |
| 205 |
|
| 206 |
PropertyFloat::setValue(quant.getValue()); // clazy:exclude=skipped-base-method |
| 207 |
} |
| 208 |
|
| 209 |
// ------------------------------------------------------ |
| 210 |
// now all properties |
| 211 |
// ------------------------------------------------------ |
| 212 |
|
| 213 |
//************************************************************************** |
| 214 |
// PropertyAcceleration |
| 215 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 216 |
|
| 217 |
TYPESYSTEM_SOURCE(App::PropertyAcceleration, App::PropertyQuantity) |
| 218 |
|
| 219 |
PropertyAcceleration::PropertyAcceleration() |
| 220 |
{ |
| 221 |
setUnit(Base::Unit::Acceleration); |
| 222 |
} |
| 223 |
|
| 224 |
//************************************************************************** |
| 225 |
// PropertyAmountOfSubstance |
| 226 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 227 |
|
| 228 |
TYPESYSTEM_SOURCE(App::PropertyAmountOfSubstance, App::PropertyQuantity) |
| 229 |
|
| 230 |
PropertyAmountOfSubstance::PropertyAmountOfSubstance() |
| 231 |
{ |
| 232 |
setUnit(Base::Unit::AmountOfSubstance); |
| 233 |
} |
| 234 |
|
| 235 |
//************************************************************************** |
| 236 |
// PropertyAngle |
| 237 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 238 |
|
| 239 |
TYPESYSTEM_SOURCE(App::PropertyAngle, App::PropertyQuantityConstraint) |
| 240 |
|
| 241 |
PropertyAngle::PropertyAngle() |
| 242 |
{ |
| 243 |
setUnit(Base::Unit::Angle); |
| 244 |
setConstraints(&AngleStandard); |
| 245 |
} |
| 246 |
|
| 247 |
//************************************************************************** |
| 248 |
// PropertyArea |
| 249 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 250 |
|
| 251 |
TYPESYSTEM_SOURCE(App::PropertyArea, App::PropertyQuantityConstraint) |
| 252 |
|
| 253 |
PropertyArea::PropertyArea() |
| 254 |
{ |
| 255 |
setUnit(Base::Unit::Area); |
| 256 |
setConstraints(&LengthStandard); |
| 257 |
} |
| 258 |
|
| 259 |
//************************************************************************** |
| 260 |
// PropertyCompressiveStrength |
| 261 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 262 |
|
| 263 |
TYPESYSTEM_SOURCE(App::PropertyCompressiveStrength, App::PropertyQuantity) |
| 264 |
|
| 265 |
PropertyCompressiveStrength::PropertyCompressiveStrength() |
| 266 |
{ |
| 267 |
setUnit(Base::Unit::CompressiveStrength); |
| 268 |
} |
| 269 |
|
| 270 |
//************************************************************************** |
| 271 |
// PropertyCurrentDensity |
| 272 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 273 |
|
| 274 |
TYPESYSTEM_SOURCE(App::PropertyCurrentDensity, App::PropertyQuantity) |
| 275 |
|
| 276 |
PropertyCurrentDensity::PropertyCurrentDensity() |
| 277 |
{ |
| 278 |
setUnit(Base::Unit::CurrentDensity); |
| 279 |
} |
| 280 |
|
| 281 |
//************************************************************************** |
| 282 |
// PropertyDensity |
| 283 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 284 |
|
| 285 |
TYPESYSTEM_SOURCE(App::PropertyDensity, App::PropertyQuantity) |
| 286 |
|
| 287 |
PropertyDensity::PropertyDensity() |
| 288 |
{ |
| 289 |
setUnit(Base::Unit::Density); |
| 290 |
} |
| 291 |
|
| 292 |
//************************************************************************** |
| 293 |
// PropertyDissipationRate |
| 294 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 295 |
|
| 296 |
TYPESYSTEM_SOURCE(App::PropertyDissipationRate, App::PropertyQuantity) |
| 297 |
|
| 298 |
PropertyDissipationRate::PropertyDissipationRate() |
| 299 |
{ |
| 300 |
setUnit(Base::Unit::DissipationRate); |
| 301 |
} |
| 302 |
|
| 303 |
//************************************************************************** |
| 304 |
// PropertyDistance |
| 305 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 306 |
|
| 307 |
TYPESYSTEM_SOURCE(App::PropertyDistance, App::PropertyQuantity) |
| 308 |
|
| 309 |
PropertyDistance::PropertyDistance() |
| 310 |
{ |
| 311 |
setUnit(Base::Unit::Length); |
| 312 |
} |
| 313 |
|
| 314 |
//************************************************************************** |
| 315 |
// PropertyDynamicViscosity |
| 316 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 317 |
|
| 318 |
TYPESYSTEM_SOURCE(App::PropertyDynamicViscosity, App::PropertyQuantity) |
| 319 |
|
| 320 |
PropertyDynamicViscosity::PropertyDynamicViscosity() |
| 321 |
{ |
| 322 |
setUnit(Base::Unit::DynamicViscosity); |
| 323 |
} |
| 324 |
|
| 325 |
//************************************************************************** |
| 326 |
// PropertyElectricalCapacitance |
| 327 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 328 |
|
| 329 |
TYPESYSTEM_SOURCE(App::PropertyElectricalCapacitance, App::PropertyQuantity) |
| 330 |
|
| 331 |
PropertyElectricalCapacitance::PropertyElectricalCapacitance() |
| 332 |
{ |
| 333 |
setUnit(Base::Unit::ElectricalCapacitance); |
| 334 |
} |
| 335 |
|
| 336 |
//************************************************************************** |
| 337 |
// PropertyElectricalInductance |
| 338 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 339 |
|
| 340 |
TYPESYSTEM_SOURCE(App::PropertyElectricalInductance, App::PropertyQuantity) |
| 341 |
|
| 342 |
PropertyElectricalInductance::PropertyElectricalInductance() |
| 343 |
{ |
| 344 |
setUnit(Base::Unit::ElectricalInductance); |
| 345 |
} |
| 346 |
|
| 347 |
//************************************************************************** |
| 348 |
// PropertyElectricalConductance |
| 349 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 350 |
|
| 351 |
TYPESYSTEM_SOURCE(App::PropertyElectricalConductance, App::PropertyQuantity) |
| 352 |
|
| 353 |
PropertyElectricalConductance::PropertyElectricalConductance() |
| 354 |
{ |
| 355 |
setUnit(Base::Unit::ElectricalConductance); |
| 356 |
} |
| 357 |
|
| 358 |
//************************************************************************** |
| 359 |
// PropertyElectricalConductivity |
| 360 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 361 |
|
| 362 |
TYPESYSTEM_SOURCE(App::PropertyElectricalConductivity, App::PropertyQuantity) |
| 363 |
|
| 364 |
PropertyElectricalConductivity::PropertyElectricalConductivity() |
| 365 |
{ |
| 366 |
setUnit(Base::Unit::ElectricalConductivity); |
| 367 |
} |
| 368 |
|
| 369 |
//************************************************************************** |
| 370 |
// PropertyElectricalResistance |
| 371 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 372 |
|
| 373 |
TYPESYSTEM_SOURCE(App::PropertyElectricalResistance, App::PropertyQuantity) |
| 374 |
|
| 375 |
PropertyElectricalResistance::PropertyElectricalResistance() |
| 376 |
{ |
| 377 |
setUnit(Base::Unit::ElectricalResistance); |
| 378 |
} |
| 379 |
|
| 380 |
//************************************************************************** |
| 381 |
// PropertyElectricCharge |
| 382 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 383 |
|
| 384 |
TYPESYSTEM_SOURCE(App::PropertyElectricCharge, App::PropertyQuantity) |
| 385 |
|
| 386 |
PropertyElectricCharge::PropertyElectricCharge() |
| 387 |
{ |
| 388 |
setUnit(Base::Unit::ElectricCharge); |
| 389 |
} |
| 390 |
|
| 391 |
//************************************************************************** |
| 392 |
// PropertySurfaceChargeDensity |
| 393 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 394 |
|
| 395 |
TYPESYSTEM_SOURCE(App::PropertySurfaceChargeDensity, App::PropertyQuantity) |
| 396 |
|
| 397 |
PropertySurfaceChargeDensity::PropertySurfaceChargeDensity() |
| 398 |
{ |
| 399 |
setUnit(Base::Unit::SurfaceChargeDensity); |
| 400 |
} |
| 401 |
|
| 402 |
//************************************************************************** |
| 403 |
// PropertyVolumeChargeDensity |
| 404 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 405 |
|
| 406 |
TYPESYSTEM_SOURCE(App::PropertyVolumeChargeDensity, App::PropertyQuantity) |
| 407 |
|
| 408 |
PropertyVolumeChargeDensity::PropertyVolumeChargeDensity() |
| 409 |
{ |
| 410 |
setUnit(Base::Unit::VolumeChargeDensity); |
| 411 |
} |
| 412 |
|
| 413 |
//************************************************************************** |
| 414 |
// PropertyElectricCurrent |
| 415 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 416 |
|
| 417 |
TYPESYSTEM_SOURCE(App::PropertyElectricCurrent, App::PropertyQuantity) |
| 418 |
|
| 419 |
PropertyElectricCurrent::PropertyElectricCurrent() |
| 420 |
{ |
| 421 |
setUnit(Base::Unit::ElectricCurrent); |
| 422 |
} |
| 423 |
|
| 424 |
//************************************************************************** |
| 425 |
// PropertyElectricPotential |
| 426 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 427 |
|
| 428 |
TYPESYSTEM_SOURCE(App::PropertyElectricPotential, App::PropertyQuantity) |
| 429 |
|
| 430 |
PropertyElectricPotential::PropertyElectricPotential() |
| 431 |
{ |
| 432 |
setUnit(Base::Unit::ElectricPotential); |
| 433 |
} |
| 434 |
|
| 435 |
//************************************************************************** |
| 436 |
// PropertyFrequency |
| 437 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 438 |
|
| 439 |
TYPESYSTEM_SOURCE(App::PropertyFrequency, App::PropertyQuantity) |
| 440 |
|
| 441 |
PropertyFrequency::PropertyFrequency() |
| 442 |
{ |
| 443 |
setUnit(Base::Unit::Frequency); |
| 444 |
} |
| 445 |
|
| 446 |
//************************************************************************** |
| 447 |
// PropertyForce |
| 448 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 449 |
|
| 450 |
TYPESYSTEM_SOURCE(App::PropertyForce, App::PropertyQuantity) |
| 451 |
|
| 452 |
PropertyForce::PropertyForce() |
| 453 |
{ |
| 454 |
setUnit(Base::Unit::Force); |
| 455 |
} |
| 456 |
|
| 457 |
//************************************************************************** |
| 458 |
// PropertyHeatFlux |
| 459 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 460 |
|
| 461 |
TYPESYSTEM_SOURCE(App::PropertyHeatFlux, App::PropertyQuantity) |
| 462 |
|
| 463 |
PropertyHeatFlux::PropertyHeatFlux() |
| 464 |
{ |
| 465 |
setUnit(Base::Unit::HeatFlux); |
| 466 |
} |
| 467 |
|
| 468 |
//************************************************************************** |
| 469 |
// PropertyInverseArea |
| 470 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 471 |
|
| 472 |
TYPESYSTEM_SOURCE(App::PropertyInverseArea, App::PropertyQuantity) |
| 473 |
|
| 474 |
PropertyInverseArea::PropertyInverseArea() |
| 475 |
{ |
| 476 |
setUnit(Base::Unit::InverseArea); |
| 477 |
} |
| 478 |
|
| 479 |
//************************************************************************** |
| 480 |
// PropertyInverseLength |
| 481 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 482 |
|
| 483 |
TYPESYSTEM_SOURCE(App::PropertyInverseLength, App::PropertyQuantity) |
| 484 |
|
| 485 |
PropertyInverseLength::PropertyInverseLength() |
| 486 |
{ |
| 487 |
setUnit(Base::Unit::InverseLength); |
| 488 |
} |
| 489 |
|
| 490 |
//************************************************************************** |
| 491 |
// PropertyInverseVolume |
| 492 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 493 |
|
| 494 |
TYPESYSTEM_SOURCE(App::PropertyInverseVolume, App::PropertyQuantity) |
| 495 |
|
| 496 |
PropertyInverseVolume::PropertyInverseVolume() |
| 497 |
{ |
| 498 |
setUnit(Base::Unit::InverseVolume); |
| 499 |
} |
| 500 |
|
| 501 |
//************************************************************************** |
| 502 |
// PropertyKinematicViscosity |
| 503 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 504 |
|
| 505 |
TYPESYSTEM_SOURCE(App::PropertyKinematicViscosity, App::PropertyQuantity) |
| 506 |
|
| 507 |
PropertyKinematicViscosity::PropertyKinematicViscosity() |
| 508 |
{ |
| 509 |
setUnit(Base::Unit::KinematicViscosity); |
| 510 |
} |
| 511 |
|
| 512 |
//************************************************************************** |
| 513 |
// PropertyLength |
| 514 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 515 |
|
| 516 |
TYPESYSTEM_SOURCE(App::PropertyLength, App::PropertyQuantityConstraint) |
| 517 |
|
| 518 |
PropertyLength::PropertyLength() |
| 519 |
{ |
| 520 |
setUnit(Base::Unit::Length); |
| 521 |
enableNegative(false); |
| 522 |
} |
| 523 |
|
| 524 |
void PropertyLength::enableNegative(bool on) |
| 525 |
{ |
| 526 |
setConstraints(on ? nullptr : &LengthStandard); |
| 527 |
} |
| 528 |
|
| 529 |
//************************************************************************** |
| 530 |
// PropertyLuminousIntensity |
| 531 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 532 |
|
| 533 |
TYPESYSTEM_SOURCE(App::PropertyLuminousIntensity, App::PropertyQuantity) |
| 534 |
|
| 535 |
PropertyLuminousIntensity::PropertyLuminousIntensity() |
| 536 |
{ |
| 537 |
setUnit(Base::Unit::LuminousIntensity); |
| 538 |
} |
| 539 |
|
| 540 |
//************************************************************************** |
| 541 |
// PropertyMagneticFieldStrength |
| 542 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 543 |
|
| 544 |
TYPESYSTEM_SOURCE(App::PropertyMagneticFieldStrength, App::PropertyQuantity) |
| 545 |
|
| 546 |
PropertyMagneticFieldStrength::PropertyMagneticFieldStrength() |
| 547 |
{ |
| 548 |
setUnit(Base::Unit::MagneticFieldStrength); |
| 549 |
} |
| 550 |
|
| 551 |
//************************************************************************** |
| 552 |
// PropertyMagneticFlux |
| 553 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 554 |
|
| 555 |
TYPESYSTEM_SOURCE(App::PropertyMagneticFlux, App::PropertyQuantity) |
| 556 |
|
| 557 |
PropertyMagneticFlux::PropertyMagneticFlux() |
| 558 |
{ |
| 559 |
setUnit(Base::Unit::MagneticFlux); |
| 560 |
} |
| 561 |
|
| 562 |
//************************************************************************** |
| 563 |
// PropertyMagneticFluxDensity |
| 564 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 565 |
|
| 566 |
TYPESYSTEM_SOURCE(App::PropertyMagneticFluxDensity, App::PropertyQuantity) |
| 567 |
|
| 568 |
PropertyMagneticFluxDensity::PropertyMagneticFluxDensity() |
| 569 |
{ |
| 570 |
setUnit(Base::Unit::MagneticFluxDensity); |
| 571 |
} |
| 572 |
|
| 573 |
//************************************************************************** |
| 574 |
// PropertyMagnetization |
| 575 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 576 |
|
| 577 |
TYPESYSTEM_SOURCE(App::PropertyMagnetization, App::PropertyQuantity) |
| 578 |
|
| 579 |
PropertyMagnetization::PropertyMagnetization() |
| 580 |
{ |
| 581 |
setUnit(Base::Unit::Magnetization); |
| 582 |
} |
| 583 |
|
| 584 |
//************************************************************************** |
| 585 |
// PropertyElectromagneticPotential |
| 586 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 587 |
|
| 588 |
TYPESYSTEM_SOURCE(App::PropertyElectromagneticPotential, App::PropertyQuantity) |
| 589 |
|
| 590 |
PropertyElectromagneticPotential::PropertyElectromagneticPotential() |
| 591 |
{ |
| 592 |
setUnit(Base::Unit::ElectromagneticPotential); |
| 593 |
} |
| 594 |
|
| 595 |
//************************************************************************** |
| 596 |
// PropertyMass |
| 597 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 598 |
|
| 599 |
TYPESYSTEM_SOURCE(App::PropertyMass, App::PropertyQuantity) |
| 600 |
|
| 601 |
PropertyMass::PropertyMass() |
| 602 |
{ |
| 603 |
setUnit(Base::Unit::Mass); |
| 604 |
} |
| 605 |
|
| 606 |
//************************************************************************** |
| 607 |
// PropertyMoment |
| 608 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 609 |
|
| 610 |
TYPESYSTEM_SOURCE(App::PropertyMoment, App::PropertyQuantity) |
| 611 |
|
| 612 |
PropertyMoment::PropertyMoment() |
| 613 |
{ |
| 614 |
setUnit(Base::Unit::Moment); |
| 615 |
} |
| 616 |
|
| 617 |
//************************************************************************** |
| 618 |
// PropertyPressure |
| 619 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 620 |
|
| 621 |
TYPESYSTEM_SOURCE(App::PropertyPressure, App::PropertyQuantity) |
| 622 |
|
| 623 |
PropertyPressure::PropertyPressure() |
| 624 |
{ |
| 625 |
setUnit(Base::Unit::Pressure); |
| 626 |
} |
| 627 |
|
| 628 |
//************************************************************************** |
| 629 |
// PropertyPower |
| 630 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 631 |
|
| 632 |
TYPESYSTEM_SOURCE(App::PropertyPower, App::PropertyQuantity) |
| 633 |
|
| 634 |
PropertyPower::PropertyPower() |
| 635 |
{ |
| 636 |
setUnit(Base::Unit::Power); |
| 637 |
} |
| 638 |
|
| 639 |
//************************************************************************** |
| 640 |
// PropertySpecificEnergy |
| 641 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 642 |
|
| 643 |
TYPESYSTEM_SOURCE(App::PropertySpecificEnergy, App::PropertyQuantity) |
| 644 |
|
| 645 |
PropertySpecificEnergy::PropertySpecificEnergy() |
| 646 |
{ |
| 647 |
setUnit(Base::Unit::SpecificEnergy); |
| 648 |
} |
| 649 |
|
| 650 |
//************************************************************************** |
| 651 |
// PropertySpecificHeat |
| 652 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 653 |
|
| 654 |
TYPESYSTEM_SOURCE(App::PropertySpecificHeat, App::PropertyQuantity) |
| 655 |
|
| 656 |
PropertySpecificHeat::PropertySpecificHeat() |
| 657 |
{ |
| 658 |
setUnit(Base::Unit::SpecificHeat); |
| 659 |
} |
| 660 |
|
| 661 |
//************************************************************************** |
| 662 |
// PropertySpeed |
| 663 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 664 |
|
| 665 |
TYPESYSTEM_SOURCE(App::PropertySpeed, App::PropertyQuantity) |
| 666 |
|
| 667 |
PropertySpeed::PropertySpeed() |
| 668 |
{ |
| 669 |
setUnit(Base::Unit::Velocity); |
| 670 |
} |
| 671 |
|
| 672 |
//************************************************************************** |
| 673 |
// PropertyStiffness |
| 674 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 675 |
|
| 676 |
TYPESYSTEM_SOURCE(App::PropertyStiffness, App::PropertyQuantity) |
| 677 |
|
| 678 |
PropertyStiffness::PropertyStiffness() |
| 679 |
{ |
| 680 |
setUnit(Base::Unit::Stiffness); |
| 681 |
} |
| 682 |
|
| 683 |
//************************************************************************** |
| 684 |
// PropertyStiffnessDensity |
| 685 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 686 |
|
| 687 |
TYPESYSTEM_SOURCE(App::PropertyStiffnessDensity, App::PropertyQuantity) |
| 688 |
|
| 689 |
PropertyStiffnessDensity::PropertyStiffnessDensity() |
| 690 |
{ |
| 691 |
setUnit(Base::Unit::StiffnessDensity); |
| 692 |
} |
| 693 |
|
| 694 |
//************************************************************************** |
| 695 |
// PropertyTemperature |
| 696 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 697 |
|
| 698 |
TYPESYSTEM_SOURCE(App::PropertyTemperature, App::PropertyQuantity) |
| 699 |
|
| 700 |
PropertyTemperature::PropertyTemperature() |
| 701 |
{ |
| 702 |
setUnit(Base::Unit::Temperature); |
| 703 |
} |
| 704 |
|
| 705 |
//************************************************************************** |
| 706 |
// PropertyThermalConductivity |
| 707 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 708 |
|
| 709 |
TYPESYSTEM_SOURCE(App::PropertyThermalConductivity, App::PropertyQuantity) |
| 710 |
|
| 711 |
PropertyThermalConductivity::PropertyThermalConductivity() |
| 712 |
{ |
| 713 |
setUnit(Base::Unit::ThermalConductivity); |
| 714 |
} |
| 715 |
|
| 716 |
//************************************************************************** |
| 717 |
// PropertyThermalExpansionCoefficient |
| 718 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 719 |
|
| 720 |
TYPESYSTEM_SOURCE(App::PropertyThermalExpansionCoefficient, App::PropertyQuantity) |
| 721 |
|
| 722 |
PropertyThermalExpansionCoefficient::PropertyThermalExpansionCoefficient() |
| 723 |
{ |
| 724 |
setUnit(Base::Unit::ThermalExpansionCoefficient); |
| 725 |
} |
| 726 |
|
| 727 |
|
| 728 |
//************************************************************************** |
| 729 |
// PropertyThermalTransferCoefficient |
| 730 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 731 |
|
| 732 |
TYPESYSTEM_SOURCE(App::PropertyThermalTransferCoefficient, App::PropertyQuantity) |
| 733 |
|
| 734 |
PropertyThermalTransferCoefficient::PropertyThermalTransferCoefficient() |
| 735 |
{ |
| 736 |
setUnit(Base::Unit::ThermalTransferCoefficient); |
| 737 |
} |
| 738 |
|
| 739 |
//************************************************************************** |
| 740 |
// PropertyTime |
| 741 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 742 |
|
| 743 |
TYPESYSTEM_SOURCE(App::PropertyTime, App::PropertyQuantity) |
| 744 |
|
| 745 |
PropertyTime::PropertyTime() |
| 746 |
{ |
| 747 |
setUnit(Base::Unit::TimeSpan); |
| 748 |
} |
| 749 |
|
| 750 |
//************************************************************************** |
| 751 |
// PropertyShearModulus |
| 752 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 753 |
|
| 754 |
TYPESYSTEM_SOURCE(App::PropertyShearModulus, App::PropertyQuantity) |
| 755 |
|
| 756 |
PropertyShearModulus::PropertyShearModulus() |
| 757 |
{ |
| 758 |
setUnit(Base::Unit::ShearModulus); |
| 759 |
} |
| 760 |
|
| 761 |
//************************************************************************** |
| 762 |
// PropertyStress |
| 763 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 764 |
|
| 765 |
TYPESYSTEM_SOURCE(App::PropertyStress, App::PropertyQuantity) |
| 766 |
|
| 767 |
PropertyStress::PropertyStress() |
| 768 |
{ |
| 769 |
setUnit(Base::Unit::Stress); |
| 770 |
} |
| 771 |
|
| 772 |
//************************************************************************** |
| 773 |
// PropertyUltimateTensileStrength |
| 774 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 775 |
|
| 776 |
TYPESYSTEM_SOURCE(App::PropertyUltimateTensileStrength, App::PropertyQuantity) |
| 777 |
|
| 778 |
PropertyUltimateTensileStrength::PropertyUltimateTensileStrength() |
| 779 |
{ |
| 780 |
setUnit(Base::Unit::UltimateTensileStrength); |
| 781 |
} |
| 782 |
|
| 783 |
//************************************************************************** |
| 784 |
// PropertyVacuumPermittivity |
| 785 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 786 |
|
| 787 |
TYPESYSTEM_SOURCE(App::PropertyVacuumPermittivity, App::PropertyQuantity) |
| 788 |
|
| 789 |
PropertyVacuumPermittivity::PropertyVacuumPermittivity() |
| 790 |
{ |
| 791 |
setUnit(Base::Unit::VacuumPermittivity); |
| 792 |
} |
| 793 |
|
| 794 |
//************************************************************************** |
| 795 |
// PropertyVelocity |
| 796 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 797 |
|
| 798 |
TYPESYSTEM_SOURCE(App::PropertyVelocity, App::PropertyQuantity) |
| 799 |
|
| 800 |
PropertyVelocity::PropertyVelocity() |
| 801 |
{ |
| 802 |
setUnit(Base::Unit::Velocity); |
| 803 |
} |
| 804 |
|
| 805 |
//************************************************************************** |
| 806 |
// PropertyVolume |
| 807 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 808 |
|
| 809 |
TYPESYSTEM_SOURCE(App::PropertyVolume, App::PropertyQuantityConstraint) |
| 810 |
|
| 811 |
PropertyVolume::PropertyVolume() |
| 812 |
{ |
| 813 |
setUnit(Base::Unit::Volume); |
| 814 |
setConstraints(&LengthStandard); |
| 815 |
} |
| 816 |
|
| 817 |
//************************************************************************** |
| 818 |
// PropertyVolumeFlowRate |
| 819 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 820 |
|
| 821 |
TYPESYSTEM_SOURCE(App::PropertyVolumeFlowRate, App::PropertyQuantity) |
| 822 |
|
| 823 |
PropertyVolumeFlowRate::PropertyVolumeFlowRate() |
| 824 |
{ |
| 825 |
setUnit(Base::Unit::VolumeFlowRate); |
| 826 |
} |
| 827 |
|
| 828 |
//************************************************************************** |
| 829 |
// PropertyVolumetricThermalExpansionCoefficient |
| 830 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 831 |
|
| 832 |
TYPESYSTEM_SOURCE(App::PropertyVolumetricThermalExpansionCoefficient, App::PropertyQuantity) |
| 833 |
|
| 834 |
PropertyVolumetricThermalExpansionCoefficient::PropertyVolumetricThermalExpansionCoefficient() |
| 835 |
{ |
| 836 |
setUnit(Base::Unit::VolumetricThermalExpansionCoefficient); |
| 837 |
} |
| 838 |
|
| 839 |
//************************************************************************** |
| 840 |
// PropertyWork |
| 841 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 842 |
|
| 843 |
TYPESYSTEM_SOURCE(App::PropertyWork, App::PropertyQuantity) |
| 844 |
|
| 845 |
PropertyWork::PropertyWork() |
| 846 |
{ |
| 847 |
setUnit(Base::Unit::Work); |
| 848 |
} |
| 849 |
|
| 850 |
//************************************************************************** |
| 851 |
// PropertyYieldStrength |
| 852 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 853 |
|
| 854 |
TYPESYSTEM_SOURCE(App::PropertyYieldStrength, App::PropertyQuantity) |
| 855 |
|
| 856 |
PropertyYieldStrength::PropertyYieldStrength() |
| 857 |
{ |
| 858 |
setUnit(Base::Unit::YieldStrength); |
| 859 |
} |
| 860 |
|
| 861 |
//************************************************************************** |
| 862 |
// PropertyYoungsModulus |
| 863 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 864 |
|
| 865 |
TYPESYSTEM_SOURCE(App::PropertyYoungsModulus, App::PropertyQuantity) |
| 866 |
|
| 867 |
PropertyYoungsModulus::PropertyYoungsModulus() |
| 868 |
{ |
| 869 |
setUnit(Base::Unit::YoungsModulus); |
| 870 |
} |
| 871 |
|