Allow interchangable use of link properties and their derivatives
This commit is contained in:
@@ -2801,7 +2801,7 @@ DocumentObject* Document::moveObject(DocumentObject* obj, bool recursive)
|
||||
std::map<std::string,App::Property*> props;
|
||||
obj->getPropertyMap(props);
|
||||
for (std::map<std::string,App::Property*>::iterator it = props.begin(); it != props.end(); ++it) {
|
||||
if (it->second->getTypeId() == PropertyLink::getClassTypeId()) {
|
||||
if (it->second->getTypeId().isDerivedFrom(PropertyLink::getClassTypeId())) {
|
||||
DocumentObject* link = static_cast<PropertyLink*>(it->second)->getValue();
|
||||
if (recursive) {
|
||||
moveObject(link, recursive);
|
||||
@@ -2811,7 +2811,7 @@ DocumentObject* Document::moveObject(DocumentObject* obj, bool recursive)
|
||||
static_cast<PropertyLink*>(it->second)->setValue(0);
|
||||
}
|
||||
}
|
||||
else if (it->second->getTypeId() == PropertyLinkList::getClassTypeId()) {
|
||||
else if (it->second->getTypeId().isDerivedFrom(PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<DocumentObject*> links = static_cast<PropertyLinkList*>(it->second)->getValues();
|
||||
if (recursive) {
|
||||
for (std::vector<DocumentObject*>::iterator jt = links.begin(); jt != links.end(); ++jt)
|
||||
|
||||
@@ -184,7 +184,7 @@ void ViewProviderInspection::attach(App::DocumentObject *pcFeat)
|
||||
void ViewProviderInspection::updateData(const App::Property* prop)
|
||||
{
|
||||
// set to the expected size
|
||||
if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId())) {
|
||||
App::GeoFeature* object = static_cast<const App::PropertyLink*>(prop)->getValue<App::GeoFeature*>();
|
||||
if (object) {
|
||||
float accuracy=0;
|
||||
|
||||
@@ -288,7 +288,7 @@ void ViewProviderMeshCurvature::attach(App::DocumentObject *pcFeat)
|
||||
void ViewProviderMeshCurvature::updateData(const App::Property* prop)
|
||||
{
|
||||
// set to the expected size
|
||||
if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId())) {
|
||||
Mesh::Feature* object = static_cast<const App::PropertyLink*>(prop)->getValue<Mesh::Feature*>();
|
||||
this->pcLinkRoot->removeAllChildren();
|
||||
if (object) {
|
||||
|
||||
@@ -130,7 +130,7 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId())) {
|
||||
App::DocumentObject *pBase = static_cast<const App::PropertyLink*>(prop)->getValue();
|
||||
if (pBase)
|
||||
Gui::Application::Instance->hideViewProvider(pBase);
|
||||
@@ -216,7 +216,7 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop)
|
||||
|
||||
this->DiffuseColor.setValues(colBool);
|
||||
}
|
||||
else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
@@ -344,7 +344,7 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop)
|
||||
|
||||
this->DiffuseColor.setValues(colBool);
|
||||
}
|
||||
else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
|
||||
@@ -106,7 +106,7 @@ void ViewProviderCompound::updateData(const App::Property* prop)
|
||||
|
||||
this->DiffuseColor.setValues(compCol);
|
||||
}
|
||||
else if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
const std::vector<App::DocumentObject *>& pBases = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject *>::const_iterator it = pBases.begin(); it != pBases.end(); ++it) {
|
||||
if (*it) Gui::Application::Instance->hideViewProvider(*it);
|
||||
|
||||
@@ -310,10 +310,10 @@ App::DocumentObject* TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::st
|
||||
|
||||
//independent copies don't have links and are not attached
|
||||
if(independent && (
|
||||
prop->getTypeId() == App::PropertyLink::getClassTypeId() ||
|
||||
prop->getTypeId() == App::PropertyLinkList::getClassTypeId() ||
|
||||
prop->getTypeId() == App::PropertyLinkSub::getClassTypeId() ||
|
||||
prop->getTypeId() == App::PropertyLinkSubList::getClassTypeId()||
|
||||
prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId()) ||
|
||||
prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId()) ||
|
||||
prop->getTypeId().isDerivedFrom(App::PropertyLinkSub::getClassTypeId()) ||
|
||||
prop->getTypeId().isDerivedFrom(App::PropertyLinkSubList::getClassTypeId())||
|
||||
( prop->getGroup() && strcmp(prop->getGroup(),"Attachment")==0) )) {
|
||||
|
||||
++it;
|
||||
|
||||
@@ -92,7 +92,7 @@ void ViewProviderArea::dropObject(App::DocumentObject* obj)
|
||||
void ViewProviderArea::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
@@ -170,7 +170,7 @@ void ViewProviderAreaView::dropObject(App::DocumentObject* obj)
|
||||
void ViewProviderAreaView::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPlaneParametric::updateData(prop);
|
||||
if (prop->getTypeId() == App::PropertyLink::getClassTypeId())
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId()))
|
||||
Gui::Application::Instance->hideViewProvider(
|
||||
static_cast<const App::PropertyLink*>(prop)->getValue());
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void ViewProviderPathShape::dropObject(App::DocumentObject* obj)
|
||||
void ViewProviderPathShape::updateData(const App::Property* prop)
|
||||
{
|
||||
PathGui::ViewProviderPath::updateData(prop);
|
||||
if (prop->getTypeId() == App::PropertyLinkList::getClassTypeId()) {
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pShapes.begin(); it != pShapes.end(); ++it) {
|
||||
if (*it)
|
||||
|
||||
Reference in New Issue
Block a user