Rename 'OriginFeature' to 'DatumElement'
This commit is contained in:
@@ -2147,7 +2147,7 @@ void Application::initTypes()
|
||||
App::TextDocument ::init();
|
||||
App::Placement ::init();
|
||||
App::PlacementPython ::init();
|
||||
App::OriginFeature ::init();
|
||||
App::DatumElement ::init();
|
||||
App::Plane ::init();
|
||||
App::Line ::init();
|
||||
App::Part ::init();
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
using namespace App;
|
||||
|
||||
PROPERTY_SOURCE(App::OriginFeature, App::GeoFeature)
|
||||
PROPERTY_SOURCE(App::Plane, App::OriginFeature)
|
||||
PROPERTY_SOURCE(App::Line, App::OriginFeature)
|
||||
PROPERTY_SOURCE(App::DatumElement, App::GeoFeature)
|
||||
PROPERTY_SOURCE(App::Plane, App::DatumElement)
|
||||
PROPERTY_SOURCE(App::Line, App::DatumElement)
|
||||
|
||||
OriginFeature::OriginFeature()
|
||||
DatumElement::DatumElement()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Role, (""), 0, App::Prop_ReadOnly, "Role of the feature in the Origin");
|
||||
|
||||
@@ -41,9 +41,9 @@ OriginFeature::OriginFeature()
|
||||
Placement.setStatus(Property::Hidden, true);
|
||||
}
|
||||
|
||||
OriginFeature::~OriginFeature() = default;
|
||||
DatumElement::~DatumElement() = default;
|
||||
|
||||
Origin* OriginFeature::getOrigin()
|
||||
Origin* DatumElement::getOrigin()
|
||||
{
|
||||
App::Document* doc = getDocument();
|
||||
auto origins = doc->getObjectsOfType(App::Origin::getClassTypeId());
|
||||
|
||||
@@ -33,25 +33,25 @@ class Origin;
|
||||
/** Plane Object
|
||||
* Used to define planar support for all kind of operations in the document space
|
||||
*/
|
||||
class AppExport OriginFeature: public App::GeoFeature
|
||||
class AppExport DatumElement: public App::GeoFeature
|
||||
{
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(App::OriginFeature);
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(App::DatumElement);
|
||||
|
||||
public:
|
||||
/// additional information about the feature usage (e.g. "BasePlane-XY" or "Axis-X" in a Origin)
|
||||
PropertyString Role;
|
||||
|
||||
/// Constructor
|
||||
OriginFeature();
|
||||
~OriginFeature() override;
|
||||
DatumElement();
|
||||
~DatumElement() override;
|
||||
|
||||
/// Finds the origin object this plane belongs to
|
||||
App::Origin* getOrigin();
|
||||
};
|
||||
|
||||
class AppExport Plane: public App::OriginFeature
|
||||
class AppExport Plane: public App::DatumElement
|
||||
{
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(App::OriginFeature);
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(App::DatumElement);
|
||||
|
||||
public:
|
||||
const char* getViewProviderName() const override
|
||||
@@ -60,9 +60,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AppExport Line: public App::OriginFeature
|
||||
class AppExport Line: public App::DatumElement
|
||||
{
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(App::OriginFeature);
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(App::DatumElement);
|
||||
|
||||
public:
|
||||
const char* getViewProviderName() const override
|
||||
|
||||
@@ -88,7 +88,7 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject*
|
||||
}
|
||||
|
||||
// we will find origins, but not origin features
|
||||
if (obj->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
if (obj->isDerivedFrom(App::DatumElement::getClassTypeId())) {
|
||||
return OriginGroupExtension::getGroupOfObject(obj);
|
||||
}
|
||||
|
||||
@@ -305,15 +305,11 @@ void GeoFeatureGroupExtension::getCSOutList(const App::DocumentObject* obj,
|
||||
// expressions, also we only want links with scope Local
|
||||
auto result = getScopedObjectsFromLinks(obj, LinkScope::Local);
|
||||
|
||||
// we remove all links to origin features and origins, they belong to a CS too and can't be
|
||||
// moved
|
||||
result.erase(std::remove_if(result.begin(),
|
||||
result.end(),
|
||||
[](App::DocumentObject* obj) -> bool {
|
||||
return (obj->isDerivedFrom(App::OriginFeature::getClassTypeId())
|
||||
|| obj->isDerivedFrom(App::Origin::getClassTypeId()));
|
||||
}),
|
||||
result.end());
|
||||
//we remove all links to origin features and origins, they belong to a CS too and can't be moved
|
||||
result.erase(std::remove_if(result.begin(), result.end(), [](App::DocumentObject* obj)->bool {
|
||||
return (obj->isDerivedFrom(App::DatumElement::getClassTypeId()) ||
|
||||
obj->isDerivedFrom(App::Origin::getClassTypeId()));
|
||||
}), result.end());
|
||||
|
||||
vec.insert(vec.end(), result.begin(), result.end());
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ void Document::exportGraphviz(std::ostream& out) const
|
||||
if (!sgraph) {
|
||||
auto group = GeoFeatureGroupExtension::getGroupOfObject(docObj);
|
||||
if (group) {
|
||||
if (docObj->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
if (docObj->isDerivedFrom(App::DatumElement::getClassTypeId())) {
|
||||
sgraph = GraphList[group->getExtensionByType<OriginGroupExtension>()
|
||||
->Origin.getValue()];
|
||||
}
|
||||
@@ -311,8 +311,8 @@ void Document::exportGraphviz(std::ostream& out) const
|
||||
}
|
||||
}
|
||||
if (!sgraph) {
|
||||
if (docObj->isDerivedFrom(OriginFeature::getClassTypeId())) {
|
||||
sgraph = GraphList[static_cast<OriginFeature*>(docObj)->getOrigin()];
|
||||
if (docObj->isDerivedFrom(DatumElement::getClassTypeId())) {
|
||||
sgraph = GraphList[static_cast<DatumElement*>(docObj)->getOrigin()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <Base/Placement.h>
|
||||
|
||||
#include "Origin.h"
|
||||
#include "OriginFeature.h"
|
||||
#include "Datums.h"
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
@@ -60,15 +60,15 @@ Origin::Origin()
|
||||
|
||||
Origin::~Origin() = default;
|
||||
|
||||
App::OriginFeature* Origin::getOriginFeature(const char* role) const
|
||||
App::DatumElement* Origin::getOriginFeature(const char* role) const
|
||||
{
|
||||
const auto& features = OriginFeatures.getValues();
|
||||
auto featIt = std::find_if(features.begin(), features.end(), [role](App::DocumentObject* obj) {
|
||||
return obj->isDerivedFrom(App::OriginFeature::getClassTypeId())
|
||||
&& strcmp(static_cast<App::OriginFeature*>(obj)->Role.getValue(), role) == 0;
|
||||
return obj->isDerivedFrom(App::DatumElement::getClassTypeId())
|
||||
&& strcmp(static_cast<App::DatumElement*>(obj)->Role.getValue(), role) == 0;
|
||||
});
|
||||
if (featIt != features.end()) {
|
||||
return static_cast<App::OriginFeature*>(*featIt);
|
||||
return static_cast<App::DatumElement*>(*featIt);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -81,7 +81,7 @@ App::OriginFeature* Origin::getOriginFeature(const char* role) const
|
||||
|
||||
App::Line* Origin::getAxis(const char* role) const
|
||||
{
|
||||
App::OriginFeature* feat = getOriginFeature(role);
|
||||
App::DatumElement* feat = getOriginFeature(role);
|
||||
if (feat->isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
return static_cast<App::Line*>(feat);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ App::Line* Origin::getAxis(const char* role) const
|
||||
|
||||
App::Plane* Origin::getPlane(const char* role) const
|
||||
{
|
||||
App::OriginFeature* feat = getOriginFeature(role);
|
||||
App::DatumElement* feat = getOriginFeature(role);
|
||||
if (feat->isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
return static_cast<App::Plane*>(feat);
|
||||
}
|
||||
@@ -171,12 +171,12 @@ void Origin::setupObject()
|
||||
std::string objName = doc->getUniqueObjectName(data.role);
|
||||
App::DocumentObject* featureObj = doc->addObject(data.type.getName(), objName.c_str());
|
||||
|
||||
assert(featureObj && featureObj->isDerivedFrom(App::OriginFeature::getClassTypeId()));
|
||||
assert(featureObj && featureObj->isDerivedFrom(App::DatumElement::getClassTypeId()));
|
||||
|
||||
QByteArray byteArray = data.label.toUtf8();
|
||||
featureObj->Label.setValue(byteArray.constData());
|
||||
|
||||
App::OriginFeature* feature = static_cast<App::OriginFeature*>(featureObj);
|
||||
App::DatumElement* feature = static_cast<App::DatumElement*>(featureObj);
|
||||
feature->Placement.setValue(Base::Placement(Base::Vector3d(), data.rot));
|
||||
feature->Role.setValue(data.role);
|
||||
|
||||
|
||||
@@ -101,13 +101,13 @@ public:
|
||||
}
|
||||
|
||||
/// Returns all controlled objects (both planes and axis) to iterate on them
|
||||
std::vector<App::OriginFeature*> baseObjects() const
|
||||
std::vector<App::DatumElement*> baseObjects() const
|
||||
{
|
||||
return {getX(), getY(), getZ(), getXY(), getXZ(), getYZ()};
|
||||
}
|
||||
|
||||
/// Returns an axis by it's name
|
||||
App::OriginFeature* getOriginFeature(const char* role) const;
|
||||
App::DatumElement* getOriginFeature(const char* role) const;
|
||||
|
||||
/// Returns an axis by it's name
|
||||
App::Line* getAxis(const char* role) const;
|
||||
|
||||
@@ -114,7 +114,7 @@ App::DocumentObject* OriginGroupExtension::getGroupOfObject(const DocumentObject
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isOriginFeature = obj->isDerivedFrom(App::OriginFeature::getClassTypeId());
|
||||
bool isOriginFeature = obj->isDerivedFrom(App::DatumElement::getClassTypeId());
|
||||
|
||||
auto list = obj->getInList();
|
||||
for (auto o : list) {
|
||||
@@ -226,12 +226,12 @@ void OriginGroupExtension::relinkToOrigin(App::DocumentObject* obj)
|
||||
|
||||
auto p = static_cast<App::PropertyLink*>(prop);
|
||||
if (!p->getValue()
|
||||
|| !p->getValue()->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
|| !p->getValue()->isDerivedFrom(App::DatumElement::getClassTypeId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
p->setValue(getOrigin()->getOriginFeature(
|
||||
static_cast<OriginFeature*>(p->getValue())->Role.getValue()));
|
||||
static_cast<DatumElement*>(p->getValue())->Role.getValue()));
|
||||
}
|
||||
else if (prop->isDerivedFrom<App::PropertyLinkList>()) {
|
||||
auto p = static_cast<App::PropertyLinkList*>(prop);
|
||||
@@ -239,12 +239,12 @@ void OriginGroupExtension::relinkToOrigin(App::DocumentObject* obj)
|
||||
std::vector<App::DocumentObject*> result;
|
||||
bool changed = false;
|
||||
for (App::DocumentObject* o : vec) {
|
||||
if (!o || !o->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
if (!o || !o->isDerivedFrom(App::DatumElement::getClassTypeId())) {
|
||||
result.push_back(o);
|
||||
}
|
||||
else {
|
||||
result.push_back(getOrigin()->getOriginFeature(
|
||||
static_cast<OriginFeature*>(o)->Role.getValue()));
|
||||
static_cast<DatumElement*>(o)->Role.getValue()));
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -255,13 +255,13 @@ void OriginGroupExtension::relinkToOrigin(App::DocumentObject* obj)
|
||||
else if (prop->isDerivedFrom<App::PropertyLinkSub>()) {
|
||||
auto p = static_cast<App::PropertyLinkSub*>(prop);
|
||||
if (!p->getValue()
|
||||
|| !p->getValue()->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
|| !p->getValue()->isDerivedFrom(App::DatumElement::getClassTypeId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<std::string> subValues = p->getSubValues();
|
||||
p->setValue(getOrigin()->getOriginFeature(
|
||||
static_cast<OriginFeature*>(p->getValue())->Role.getValue()),
|
||||
static_cast<DatumElement*>(p->getValue())->Role.getValue()),
|
||||
subValues);
|
||||
}
|
||||
else if (prop->isDerivedFrom<App::PropertyLinkSubList>()) {
|
||||
@@ -269,9 +269,9 @@ void OriginGroupExtension::relinkToOrigin(App::DocumentObject* obj)
|
||||
auto vec = p->getSubListValues();
|
||||
bool changed = false;
|
||||
for (auto& v : vec) {
|
||||
if (v.first && v.first->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
if (v.first && v.first->isDerivedFrom(App::DatumElement::getClassTypeId())) {
|
||||
v.first = getOrigin()->getOriginFeature(
|
||||
static_cast<OriginFeature*>(v.first)->Role.getValue());
|
||||
static_cast<DatumElement*>(v.first)->Role.getValue());
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void ViewProviderOriginFeature::setDisplayMode (const char* ModeName)
|
||||
}
|
||||
|
||||
bool ViewProviderOriginFeature::onDelete(const std::vector<std::string> &) {
|
||||
auto feat = static_cast <App::OriginFeature *> ( getObject() );
|
||||
auto feat = static_cast <App::DatumElement*> (getObject());
|
||||
// Forbid deletion if there is an origin this feature belongs to
|
||||
|
||||
if ( feat->getOrigin () ) {
|
||||
|
||||
@@ -65,7 +65,7 @@ const QString makeRefString(const App::DocumentObject* obj, const std::string& s
|
||||
if (!obj)
|
||||
return QObject::tr("No reference selected");
|
||||
|
||||
if (obj->isDerivedFrom<App::OriginFeature>() ||
|
||||
if (obj->isDerivedFrom<App::DatumElement>() ||
|
||||
obj->isDerivedFrom<Part::Datum>())
|
||||
// App::Plane, Line or Datum feature
|
||||
return QString::fromLatin1(obj->getNameInDocument());
|
||||
@@ -374,7 +374,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
std::string subname = msg.pSubName;
|
||||
|
||||
// Remove subname for planes and datum features
|
||||
if (selObj->isDerivedFrom<App::OriginFeature>() ||
|
||||
if (selObj->isDerivedFrom<App::DatumElement>() ||
|
||||
selObj->isDerivedFrom<Part::Datum>())
|
||||
subname = "";
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ PyObject* Feature::getPyObject()
|
||||
|
||||
bool Feature::isDatum(const App::DocumentObject* feature)
|
||||
{
|
||||
return feature->isDerivedFrom<App::OriginFeature>() ||
|
||||
return feature->isDerivedFrom<App::DatumElement>() ||
|
||||
feature->isDerivedFrom<Part::Datum>();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, c
|
||||
}
|
||||
|
||||
// Enable selection from origin of current part/
|
||||
if (pObj->isDerivedFrom<App::OriginFeature>()) {
|
||||
if (pObj->isDerivedFrom<App::DatumElement>()) {
|
||||
return allowOrigin(body, originGroup, pObj);
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ bool getReferencedSelection(const App::DocumentObject* thisObj, const Gui::Selec
|
||||
//of course only if thisObj is in a body, as otherwise the old workflow would not
|
||||
//be supported
|
||||
PartDesign::Body* body = PartDesignGui::getBodyFor(thisObj, false);
|
||||
bool originfeature = selObj->isDerivedFrom(App::OriginFeature::getClassTypeId());
|
||||
bool originfeature = selObj->isDerivedFrom(App::DatumElement::getClassTypeId());
|
||||
if (!originfeature && body) {
|
||||
PartDesign::Body* selBody = PartDesignGui::getBodyFor(selObj, false);
|
||||
if (!selBody || body != selBody) {
|
||||
|
||||
@@ -139,9 +139,9 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
|
||||
}
|
||||
|
||||
// check if we need to set any origin in temporary visibility mode
|
||||
if (*statusIt != invalidShape
|
||||
&& (*objIt)->isDerivedFrom(App::OriginFeature::getClassTypeId())) {
|
||||
App::Origin* origin = static_cast<App::OriginFeature*>(*objIt)->getOrigin();
|
||||
auto* datum = dynamic_cast<App::DatumElement*>(*objIt);
|
||||
if (*statusIt != invalidShape && datum) {
|
||||
App::Origin* origin = dynamic_cast<App::Origin*>(datum->getLCS());
|
||||
if (origin) {
|
||||
if ((*objIt)->isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
originVisStatus[origin].set(planeBit, true);
|
||||
|
||||
@@ -514,7 +514,7 @@ bool isFeatureMovable(App::DocumentObject* const feat)
|
||||
if (feat->hasExtension(Part::AttachExtension::getExtensionClassTypeId())) {
|
||||
auto attachable = feat->getExtensionByType<Part::AttachExtension>();
|
||||
App::DocumentObject* support = attachable->AttachmentSupport.getValue();
|
||||
if (support && !support->isDerivedFrom<App::OriginFeature>()) {
|
||||
if (support && !support->isDerivedFrom<App::DatumElement>()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -545,19 +545,19 @@ std::vector<App::DocumentObject*> collectMovableDependencies(std::vector<App::Do
|
||||
}
|
||||
if (auto prop = dynamic_cast<App::PropertyLinkSub*>(prim->getPropertyByName("ReferenceAxis"))) {
|
||||
App::DocumentObject* axis = prop->getValue();
|
||||
if (axis && !axis->isDerivedFrom<App::OriginFeature>()){
|
||||
if (axis && !axis->isDerivedFrom<App::DatumElement>()){
|
||||
unique_objs.insert(axis);
|
||||
}
|
||||
}
|
||||
if (auto prop = dynamic_cast<App::PropertyLinkSub*>(prim->getPropertyByName("Spine"))) {
|
||||
App::DocumentObject* axis = prop->getValue();
|
||||
if (axis && !axis->isDerivedFrom<App::OriginFeature>()){
|
||||
if (axis && !axis->isDerivedFrom<App::DatumElement>()){
|
||||
unique_objs.insert(axis);
|
||||
}
|
||||
}
|
||||
if (auto prop = dynamic_cast<App::PropertyLinkSub*>(prim->getPropertyByName("AuxillerySpine"))) {
|
||||
App::DocumentObject* axis = prop->getValue();
|
||||
if (axis && !axis->isDerivedFrom<App::OriginFeature>()){
|
||||
if (axis && !axis->isDerivedFrom<App::DatumElement>()){
|
||||
unique_objs.insert(axis);
|
||||
}
|
||||
}
|
||||
@@ -576,9 +576,9 @@ void relinkToOrigin(App::DocumentObject* feat, PartDesign::Body* targetbody)
|
||||
if (feat->hasExtension(Part::AttachExtension::getExtensionClassTypeId())) {
|
||||
auto attachable = feat->getExtensionByType<Part::AttachExtension>();
|
||||
App::DocumentObject* support = attachable->AttachmentSupport.getValue();
|
||||
if (support && support->isDerivedFrom<App::OriginFeature>()) {
|
||||
auto originfeat = static_cast<App::OriginFeature*>(support);
|
||||
App::OriginFeature* targetOriginFeature = targetbody->getOrigin()->getOriginFeature(originfeat->Role.getValue());
|
||||
if (support && support->isDerivedFrom<App::DatumElement>()) {
|
||||
auto originfeat = static_cast<App::DatumElement*>(support);
|
||||
App::DatumElement* targetOriginFeature = targetbody->getOrigin()->getDatumElement(originfeat->Role.getValue());
|
||||
if (targetOriginFeature) {
|
||||
attachable->AttachmentSupport.setValue(static_cast<App::DocumentObject*>(targetOriginFeature), "");
|
||||
}
|
||||
@@ -588,9 +588,9 @@ void relinkToOrigin(App::DocumentObject* feat, PartDesign::Body* targetbody)
|
||||
auto prim = static_cast<PartDesign::ProfileBased*>(feat);
|
||||
if (auto prop = static_cast<App::PropertyLinkSub*>(prim->getPropertyByName("ReferenceAxis"))) {
|
||||
App::DocumentObject* axis = prop->getValue();
|
||||
if (axis && axis->isDerivedFrom<App::OriginFeature>()){
|
||||
auto originfeat = static_cast<App::OriginFeature*>(axis);
|
||||
App::OriginFeature* targetOriginFeature = targetbody->getOrigin()->getOriginFeature(originfeat->Role.getValue());
|
||||
if (axis && axis->isDerivedFrom<App::DatumElement>()){
|
||||
auto originfeat = static_cast<App::DatumElement*>(axis);
|
||||
App::DatumElement* targetOriginFeature = targetbody->getOrigin()->getDatumElement(originfeat->Role.getValue());
|
||||
if (targetOriginFeature) {
|
||||
prop->setValue(static_cast<App::DocumentObject*>(targetOriginFeature), std::vector<std::string>(0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user