[TechDraw] Reimplement Leader Line parent linking
This commit is contained in:
@@ -130,7 +130,6 @@ void QGSPage::addChildrenToPage()
|
||||
//therefore we need to make sure parentage of the graphics representation is set properly. bit of a kludge.
|
||||
setDimensionGroups();
|
||||
setBalloonGroups();
|
||||
setLeaderGroups();
|
||||
|
||||
App::DocumentObject* obj = m_vpPage->getDrawPage()->Template.getValue();
|
||||
auto pageTemplate(dynamic_cast<TechDraw::DrawTemplate*>(obj));
|
||||
@@ -606,29 +605,11 @@ void QGSPage::addDimToParent(QGIViewDimension* dim, QGIView* parent)
|
||||
|
||||
QGIView* QGSPage::addViewLeader(TechDraw::DrawLeaderLine* leaderFeat)
|
||||
{
|
||||
// Base::Console().Message("QGSP::addViewLeader(%s)\n", leader->getNameInDocument());
|
||||
QGILeaderLine* leaderGroup = new QGILeaderLine();
|
||||
addItem(leaderGroup);
|
||||
QGILeaderLine *leaderView = new QGILeaderLine;
|
||||
leaderView->setViewFeature(leaderFeat);
|
||||
|
||||
leaderGroup->setLeaderFeature(leaderFeat);
|
||||
|
||||
QGIView* parent = nullptr;
|
||||
parent = findParent(leaderGroup);
|
||||
|
||||
if (parent) {
|
||||
addLeaderToParent(leaderGroup, parent);
|
||||
}
|
||||
|
||||
leaderGroup->updateView(true);
|
||||
|
||||
return leaderGroup;
|
||||
}
|
||||
|
||||
void QGSPage::addLeaderToParent(QGILeaderLine* lead, QGIView* parent)
|
||||
{
|
||||
// Base::Console().Message("QGSP::addLeaderToParent()\n");
|
||||
parent->addToGroup(lead);
|
||||
lead->setZValue(ZVALUE::DIMENSION);
|
||||
addQView(leaderView);
|
||||
return leaderView;
|
||||
}
|
||||
|
||||
QGIView* QGSPage::addRichAnno(TechDraw::DrawRichAnno* richFeat)
|
||||
@@ -698,25 +679,6 @@ void QGSPage::setBalloonGroups(void)
|
||||
}
|
||||
}
|
||||
|
||||
void QGSPage::setLeaderGroups(void)
|
||||
{
|
||||
// Base::Console().Message("QGSP::setLeaderGroups()\n");
|
||||
const std::vector<QGIView*>& allItems = getViews();
|
||||
int leadItemType = QGraphicsItem::UserType + 232;
|
||||
|
||||
//make sure that qgileader belongs to correct parent.
|
||||
//quite possibly redundant
|
||||
for (auto& item : allItems) {
|
||||
if (item->type() == leadItemType && !item->group()) {
|
||||
QGIView* parent = findParent(item);
|
||||
if (parent) {
|
||||
QGILeaderLine* lead = dynamic_cast<QGILeaderLine*>(item);
|
||||
addLeaderToParent(lead, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! find the graphic for a DocumentObject
|
||||
QGIView* QGSPage::findQViewForDocObj(App::DocumentObject* obj) const
|
||||
{
|
||||
@@ -799,23 +761,6 @@ QGIView* QGSPage::findParent(QGIView* view) const
|
||||
}
|
||||
}
|
||||
|
||||
//If type is LeaderLine we check LeaderParent
|
||||
TechDraw::DrawLeaderLine* lead = nullptr;
|
||||
lead = dynamic_cast<TechDraw::DrawLeaderLine*>(myFeat);
|
||||
|
||||
if (lead) {
|
||||
App::DocumentObject* obj = lead->LeaderParent.getValue();
|
||||
if (obj) {
|
||||
std::string parentName = obj->getNameInDocument();
|
||||
for (std::vector<QGIView*>::const_iterator it = qviews.begin(); it != qviews.end();
|
||||
++it) {
|
||||
if (strcmp((*it)->getViewName(), parentName.c_str()) == 0) {
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if part of view collection
|
||||
for (std::vector<QGIView*>::const_iterator it = qviews.begin(); it != qviews.end(); ++it) {
|
||||
QGIViewCollection* grp = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user