PartDesign: transfer Datums to become AttachableObjects
Crude and quick, needs cleanup.
This commit is contained in:
@@ -67,16 +67,12 @@
|
||||
#endif
|
||||
|
||||
using namespace Part;
|
||||
using namespace Attacher;
|
||||
|
||||
PROPERTY_SOURCE_ABSTRACT(Part::Datum, Part::Feature)
|
||||
PROPERTY_SOURCE_ABSTRACT(Part::Datum, Part::AttachableObject)
|
||||
|
||||
Datum::Datum(void)
|
||||
{
|
||||
ADD_PROPERTY_TYPE(References,(0,0),"References",(App::PropertyType)(App::Prop_None),"References defining the datum feature");
|
||||
ADD_PROPERTY(Offset,(0.0));
|
||||
ADD_PROPERTY(Offset2,(0.0));
|
||||
ADD_PROPERTY(Offset3,(0.0));
|
||||
ADD_PROPERTY(Angle,(0.0));
|
||||
touch();
|
||||
}
|
||||
|
||||
@@ -86,20 +82,19 @@ Datum::~Datum()
|
||||
|
||||
void Datum::onChanged (const App::Property* prop)
|
||||
{
|
||||
Part::Feature::onChanged(prop);
|
||||
AttachableObject::onChanged(prop);
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Datum::execute(void)
|
||||
{
|
||||
References.touch();
|
||||
return StdReturn;
|
||||
return AttachableObject::execute();
|
||||
}
|
||||
|
||||
void Datum::onDocumentRestored()
|
||||
{
|
||||
// This seems to be the only way to make the ViewProvider display the datum feature
|
||||
References.touch();
|
||||
Part::Feature::onDocumentRestored();
|
||||
Support.touch();
|
||||
AttachableObject::onDocumentRestored();
|
||||
}
|
||||
|
||||
TopoDS_Shape Datum::getShape() const
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <App/PropertyLinks.h>
|
||||
|
||||
#include "PartFeature.h"
|
||||
#include "AttachableObject.h"
|
||||
|
||||
namespace Part
|
||||
{
|
||||
@@ -35,7 +36,7 @@ namespace Part
|
||||
// This generic class is defined here so that the Sketcher module can access datum features
|
||||
// without creating a dependency on PartDesign
|
||||
|
||||
class PartExport Datum : public Part::Feature
|
||||
class PartExport Datum : public Part::AttachableObject
|
||||
{
|
||||
PROPERTY_HEADER(Part::Datum);
|
||||
|
||||
@@ -44,35 +45,18 @@ public:
|
||||
virtual ~Datum();
|
||||
//short mustExecute();
|
||||
|
||||
/// The references defining the datum object, e.g. three planes for a point, two planes for a line
|
||||
App::PropertyLinkSubList References;
|
||||
/// Offsets and angle for defining planes
|
||||
App::PropertyFloat Offset;
|
||||
App::PropertyFloat Offset2;
|
||||
App::PropertyFloat Offset3;
|
||||
App::PropertyFloat Angle;
|
||||
|
||||
/// recalculate the feature
|
||||
App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
/// returns the type name of the view provider
|
||||
virtual const char* getViewProviderName(void) const = 0;
|
||||
|
||||
virtual const std::set<QString> getHint() const = 0;
|
||||
|
||||
/// Return the number of offset values that make sense for the current reference combination
|
||||
virtual const int offsetsAllowed() const = 0;
|
||||
|
||||
/// Return a shape including Placement representing the datum feature
|
||||
TopoDS_Shape getShape() const;
|
||||
|
||||
protected:
|
||||
void onChanged (const App::Property* prop);
|
||||
void onDocumentRestored();
|
||||
|
||||
protected:
|
||||
std::multiset<QString> refTypes;
|
||||
|
||||
};
|
||||
|
||||
} //namespace Part
|
||||
|
||||
Reference in New Issue
Block a user