Sketcher visualization enhancement: Do not group sketcher symmetry icons.

Do not add a symmetry constraint icon to a group of icons, so that it lies on the line or point providing the symmetry (symmetry axis/point),
as it is more clear to the user which line this is.
This commit is contained in:
Abdullah Tahiri 2014-08-24 09:12:11 +02:00 committed by wmayer
parent 95c512d9a1
commit fdb7de1dda
2 changed files with 35 additions and 28 deletions

View File

@ -2265,6 +2265,7 @@ void ViewProviderSketch::drawConstraintIcons()
thisIcon.destination = coinIconPtr; thisIcon.destination = coinIconPtr;
thisIcon.infoPtr = infoPtr; thisIcon.infoPtr = infoPtr;
if((*it)->Type==Symmetric) { if((*it)->Type==Symmetric) {
Base::Vector3d startingpoint = getSketchObject()->getPoint((*it)->First,(*it)->FirstPos); Base::Vector3d startingpoint = getSketchObject()->getPoint((*it)->First,(*it)->FirstPos);
@ -2337,39 +2338,46 @@ void ViewProviderSketch::combineConstraintIcons(IconQueue iconQueue)
// A group starts with an item popped off the back of our initial queue // A group starts with an item popped off the back of our initial queue
IconQueue thisGroup; IconQueue thisGroup;
thisGroup.push_back(iconQueue.back()); thisGroup.push_back(iconQueue.back());
ViewProviderSketch::constrIconQueueItem init = iconQueue.back();
iconQueue.pop_back(); iconQueue.pop_back();
// we group only icons not being Symmetry icons, because we want those on the line
if(init.type != QString::fromLatin1("small/Constraint_Symmetric_sm")){
IconQueue::iterator i = iconQueue.begin();
while(i != iconQueue.end()) {
bool addedToGroup = false;
for(IconQueue::iterator j = thisGroup.begin();
j != thisGroup.end(); ++j)
if(i->position.equals(j->position, maxDistSquared) && (*i).type != QString::fromLatin1("small/Constraint_Symmetric_sm")) {
// Found an icon in iconQueue that's close enough to
// a member of thisGroup, so move it into thisGroup
thisGroup.push_back(*i);
i = iconQueue.erase(i);
addedToGroup = true;
break;
}
IconQueue::iterator i = iconQueue.begin(); if(addedToGroup) {
while(i != iconQueue.end()) { if(i == iconQueue.end())
bool addedToGroup = false; // We just got the last icon out of iconQueue
break;
for(IconQueue::iterator j = thisGroup.begin(); else
j != thisGroup.end(); ++j) // Start looking through the iconQueue again, in case
if(i->position.equals(j->position, maxDistSquared)) { // we have an icon that's now close enough to thisGroup
// Found an icon in iconQueue that's close enough to i = iconQueue.begin();
// a member of thisGroup, so move it into thisGroup } else
thisGroup.push_back(*i); ++i;
i = iconQueue.erase(i); }
addedToGroup = true;
break;
}
if(addedToGroup) {
if(i == iconQueue.end())
// We just got the last icon out of iconQueue
break;
else
// Start looking through the iconQueue again, in case
// we have an icon that's now close enough to thisGroup
i = iconQueue.begin();
} else
++i;
} }
if(thisGroup.size() == 1) if(thisGroup.size() == 1) {
drawTypicalConstraintIcon(thisGroup[0]); drawTypicalConstraintIcon(thisGroup[0]);
else }
else {
drawMergedConstraintIcons(thisGroup); drawMergedConstraintIcons(thisGroup);
}
} }
} }

View File

@ -32,7 +32,6 @@
#include <boost/signals.hpp> #include <boost/signals.hpp>
#include <QCoreApplication> #include <QCoreApplication>
class TopoDS_Shape; class TopoDS_Shape;
class TopoDS_Face; class TopoDS_Face;
class SoSeparator; class SoSeparator;