From 35811f7e3cafa6a5fadb165d5377c1082132bc86 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 4 Oct 2016 16:02:30 -0300 Subject: [PATCH] Added new property type App::PropertyVolume --- 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 7b76d3543..4b8f5a5b5 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1097,6 +1097,7 @@ void Application::initTypes(void) App ::PropertyDistance ::init(); App ::PropertyLength ::init(); App ::PropertyArea ::init(); + App ::PropertyVolume ::init(); App ::PropertySpeed ::init(); App ::PropertyAcceleration ::init(); App ::PropertyForce ::init(); diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index 9a399d691..5e5eb8d9f 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -245,6 +245,19 @@ PropertyArea::PropertyArea() setConstraints(&LengthStandard); } +//************************************************************************** +//************************************************************************** +// PropertyVolume +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPESYSTEM_SOURCE(App::PropertyVolume, App::PropertyQuantityConstraint); + +PropertyVolume::PropertyVolume() +{ + setUnit(Base::Unit::Volume); + setConstraints(&LengthStandard); +} + //************************************************************************** //************************************************************************** // PropertyAngle diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index a739f9f48..ba0919640 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -150,6 +150,18 @@ public: virtual ~PropertyArea(){} }; +/** Volume property + * This is a property for representing volumes. It is basically a float + * property which must not be negative. On the Gui it has a quantity like m^3 or mm^3. + */ +class AppExport PropertyVolume : public PropertyQuantityConstraint +{ + TYPESYSTEM_HEADER(); +public: + PropertyVolume(void); + virtual ~PropertyVolume(){} +}; + /** Angle property * This is a property for representing angles. It basicly a float * property. On the Gui it has a quantity like RAD.