From ab803c7b40ab0bf2a70bad946bdf702ac17a56e5 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 29 Aug 2016 19:26:11 -0300 Subject: [PATCH] Added App::PropertyArea (same as PropertyLength but uses Area units) --- src/App/Application.cpp | 1 + src/App/PropertyUnits.cpp | 13 +++++++++++++ src/App/PropertyUnits.h | 12 ++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 297d9c4c0..372f18902 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1096,6 +1096,7 @@ void Application::initTypes(void) App ::PropertyAngle ::init(); App ::PropertyDistance ::init(); App ::PropertyLength ::init(); + App ::PropertyArea ::init(); App ::PropertySpeed ::init(); App ::PropertyAcceleration ::init(); App ::PropertyForce ::init(); diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index 72c9626ab..cb6eeb12f 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -232,6 +232,19 @@ PropertyLength::PropertyLength() setConstraints(&LengthStandard); } +//************************************************************************** +//************************************************************************** +// PropertyArea +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPESYSTEM_SOURCE(App::PropertyArea, App::PropertyQuantityConstraint); + +PropertyArea::PropertyArea() +{ + setUnit(Base::Unit::Area); + setConstraints(&LengthStandard); +} + //************************************************************************** //************************************************************************** // PropertyAngle diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index 771cc175d..a739f9f48 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -138,6 +138,18 @@ public: virtual ~PropertyLength(){} }; +/** Area property + * This is a property for representing areas. It is basically a float + * property which must not be negative. On the Gui it has a quantity like m^2 or mm^2. + */ +class AppExport PropertyArea : public PropertyQuantityConstraint +{ + TYPESYSTEM_HEADER(); +public: + PropertyArea(void); + virtual ~PropertyArea(){} +}; + /** Angle property * This is a property for representing angles. It basicly a float * property. On the Gui it has a quantity like RAD.