[TD]Improve section face display
This commit is contained in:
@@ -718,17 +718,27 @@ QGIFace* QGIViewPart::drawFace(TechDraw::Face* f, int idx)
|
||||
for(std::vector<TechDraw::Wire *>::iterator wire = fWires.begin(); wire != fWires.end(); ++wire) {
|
||||
QPainterPath wirePath;
|
||||
std::vector<TechDraw::BaseGeom*> geoms = (*wire)->geoms;
|
||||
for(std::vector<TechDraw::BaseGeom *>::iterator edge = (*wire)->geoms.begin(); edge != (*wire)->geoms.end(); ++edge) {
|
||||
//Save the start Position
|
||||
TechDraw::BaseGeom* firstGeom = geoms.front();
|
||||
//QPointF startPoint(firstGeom->getStartPoint().x, firstGeom->getStartPoint().y);
|
||||
//wirePath.moveTo(startPoint);
|
||||
QPainterPath firstSeg = drawPainterPath(firstGeom);
|
||||
wirePath.connectPath(firstSeg);
|
||||
for(std::vector<TechDraw::BaseGeom *>::iterator edge = ((*wire)->geoms.begin()) + 1; edge != (*wire)->geoms.end(); ++edge) {
|
||||
QPainterPath edgePath = drawPainterPath(*edge);
|
||||
// If the current end point matches the shape end point the new edge path needs reversing
|
||||
// wf: this check isn't good enough.
|
||||
//if ((*edge)->reversed) {
|
||||
// path = ???
|
||||
// QPointF shapePos = (wirePath.currentPosition()- edgePath.currentPosition());
|
||||
// if(sqrt(shapePos.x() * shapePos.x() + shapePos.y()*shapePos.y()) < 0.05) { //magic tolerance
|
||||
// edgePath = edgePath.toReversed();
|
||||
// }
|
||||
//handle section faces differently
|
||||
if (idx == -1) {
|
||||
QPointF wEnd = wirePath.currentPosition();
|
||||
auto element = edgePath.elementAt(0);
|
||||
QPointF eStart(element.x, element.y);
|
||||
QPointF eEnd = edgePath.currentPosition();
|
||||
QPointF sVec = wEnd - eStart;
|
||||
QPointF eVec = wEnd - eEnd;
|
||||
double sDist2 = sVec.x() * sVec.x() + sVec.y() * sVec.y();
|
||||
double eDist2 = eVec.x() * eVec.x() + eVec.y() * eVec.y();
|
||||
if (sDist2 > eDist2) {
|
||||
edgePath = edgePath.toReversed();
|
||||
}
|
||||
}
|
||||
wirePath.connectPath(edgePath);
|
||||
}
|
||||
// dumpPath("wirePath:",wirePath);
|
||||
|
||||
@@ -82,9 +82,7 @@ void QGIViewSection::drawSectionFace()
|
||||
|
||||
float lineWidth = sectionVp->LineWidth.getValue();
|
||||
|
||||
std::vector<TopoDS_Wire> sectionWires = section->getSectionFaceWires();
|
||||
|
||||
auto sectionFaces( section->getFaceGeometry() );
|
||||
auto sectionFaces( section->getTDFaceGeometry() );
|
||||
if (sectionFaces.empty()) {
|
||||
Base::Console().
|
||||
Log("INFO - QGIViewSection::drawSectionFace - No sectionFaces available. Check Section plane.\n");
|
||||
@@ -134,11 +132,6 @@ void QGIViewSection::drawSectionFace()
|
||||
if (!lineSets.empty()) {
|
||||
newFace->clearLineSets();
|
||||
for (auto& ls: lineSets) {
|
||||
QPainterPath bigPath;
|
||||
for (auto& g: ls.getGeoms()) {
|
||||
QPainterPath smallPath = drawPainterPath(g);
|
||||
bigPath.addPath(smallPath);
|
||||
}
|
||||
newFace->addLineSet(ls);
|
||||
}
|
||||
}
|
||||
@@ -161,13 +154,8 @@ void QGIViewSection::updateView(bool update)
|
||||
if( viewPart == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string dbHatch = viewPart->FileHatchPattern.getValue();
|
||||
|
||||
draw();
|
||||
|
||||
QGIView::updateView(update);
|
||||
|
||||
}
|
||||
|
||||
void QGIViewSection::drawSectionLine(TechDraw::DrawViewSection* s, bool b)
|
||||
|
||||
Reference in New Issue
Block a user