start PropertyQuantity and InputField
This commit is contained in:
@@ -94,6 +94,8 @@ FeatureTest::FeatureTest()
|
||||
ADD_PROPERTY_TYPE(TypeAll ,(4711),group,(App::PropertyType) (Prop_Output|Prop_ReadOnly |Prop_Hidden ),
|
||||
"An example property which has the types 'Output', 'ReadOnly' and 'Hidden'");
|
||||
|
||||
ADD_PROPERTY(Quantity,(1.0));
|
||||
|
||||
}
|
||||
|
||||
FeatureTest::~FeatureTest()
|
||||
|
||||
@@ -93,6 +93,8 @@ public:
|
||||
App::PropertyInteger TypeAll;
|
||||
App::PropertyInteger TypeTransient;
|
||||
|
||||
App::PropertyQuantity Quantity;
|
||||
|
||||
/** @name methods overide Feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "PropertyUnits.h"
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/QuantityPy.h>
|
||||
|
||||
#define new DEBUG_CLIENTBLOCK
|
||||
using namespace App;
|
||||
@@ -47,6 +48,29 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
// PropertyFloatUnit
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TYPESYSTEM_SOURCE(App::PropertyQuantity, App::PropertyFloat);
|
||||
|
||||
const char* PropertyQuantity::getEditorName(void) const
|
||||
{
|
||||
|
||||
return "Gui::PropertyEditor::PropertyUnitItem";
|
||||
|
||||
}
|
||||
|
||||
PyObject *PropertyQuantity::getPyObject(void)
|
||||
{
|
||||
return new QuantityPy (new Quantity( _dValue,_Unit));
|
||||
}
|
||||
|
||||
void PropertyQuantity::setPyObject(PyObject *value)
|
||||
{
|
||||
setValue(UnitsApi::toDblWithUserPrefs(Length,value));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <vector>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <Base/Unit.h>
|
||||
#include "PropertyStandard.h"
|
||||
|
||||
namespace Base {
|
||||
@@ -42,6 +43,25 @@ class Writer;
|
||||
namespace App
|
||||
{
|
||||
|
||||
/** Float with Unit property
|
||||
* This is a property for float with a predefined Unit associated .
|
||||
*/
|
||||
class AppExport PropertyQuantity : public PropertyFloat
|
||||
{
|
||||
TYPESYSTEM_HEADER();
|
||||
public:
|
||||
PropertyQuantity(void){}
|
||||
virtual ~PropertyQuantity(){}
|
||||
virtual const char* getEditorName(void) const;
|
||||
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
||||
void setUnit(const Base::Unit &u){_Unit = u;}
|
||||
const Base::Unit &getUnit(void)const{return _Unit;}
|
||||
protected:
|
||||
Base::Unit _Unit;
|
||||
};
|
||||
|
||||
/** Distance property
|
||||
* This is a property for representing distances. It is basically a float
|
||||
|
||||
Reference in New Issue
Block a user