[TD]Simplify Section cut surface formatting
This commit is contained in:
@@ -85,12 +85,12 @@ void QGIViewSection::drawSectionFace()
|
||||
|
||||
auto sectionFaces( section->getFaceGeometry() );
|
||||
if (sectionFaces.empty()) {
|
||||
//Base::Console().Log("INFO - QGIViewSection::drawSectionFace - No sectionFaces available. Check Section plane.\n");
|
||||
Base::Console().
|
||||
Log("INFO - QGIViewSection::drawSectionFace - No sectionFaces available. Check Section plane.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<TechDraw::Face *>::iterator fit = sectionFaces.begin();
|
||||
QColor faceColor = (sectionVp->CutSurfaceColor.getValue()).asValue<QColor>();
|
||||
int i = 0;
|
||||
for(; fit != sectionFaces.end(); fit++, i++) {
|
||||
QGIFace* newFace = drawFace(*fit,-1);
|
||||
@@ -102,39 +102,45 @@ void QGIViewSection::drawSectionFace()
|
||||
} else {
|
||||
newFace->setDrawEdges(false);
|
||||
}
|
||||
newFace->setFill(faceColor, Qt::SolidPattern);
|
||||
|
||||
if (sectionVp->HatchCutSurface.getValue()) {
|
||||
if (section->CutSurfaceDisplay.isValue("Hide")) {
|
||||
return;
|
||||
} else if (section->CutSurfaceDisplay.isValue("Color")) {
|
||||
newFace->isHatched(false);
|
||||
newFace->setFillMode(QGIFace::PlainFill);
|
||||
QColor faceColor = (sectionVp->CutSurfaceColor.getValue()).asValue<QColor>();
|
||||
newFace->setFillColor(faceColor);
|
||||
newFace->setFillStyle(Qt::SolidPattern);
|
||||
} else if (section->CutSurfaceDisplay.isValue("SvgHatch")) {
|
||||
newFace->isHatched(true);
|
||||
newFace->setFillMode(QGIFace::FromFile);
|
||||
newFace->setFillMode(QGIFace::SvgFill);
|
||||
newFace->setHatchColor(sectionVp->HatchColor.getValue());
|
||||
newFace->setHatchScale(section->HatchScale.getValue());
|
||||
|
||||
std::string hatchFile = section->FileHatchPattern.getValue();
|
||||
newFace->setHatchFile(hatchFile);
|
||||
std::string patternName = section->NameGeomPattern.getValue();
|
||||
QFileInfo hfi(QString::fromUtf8(hatchFile.data(),hatchFile.size()));
|
||||
if (hfi.isReadable()) {
|
||||
QString ext = hfi.suffix();
|
||||
if ((ext.toUpper() == QString::fromUtf8("PAT")) &&
|
||||
!patternName.empty() ) {
|
||||
newFace->setFillMode(QGIFace::GeomHatchFill);
|
||||
newFace->setLineWeight(sectionVp->WeightPattern.getValue());
|
||||
std::vector<LineSet> lineSets = section->getDrawableLines(i);
|
||||
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);
|
||||
}
|
||||
std::string hatchSpec = section->FileHatchPattern.getValue();
|
||||
newFace->setHatchFile(hatchSpec);
|
||||
} else if (section->CutSurfaceDisplay.isValue("PatHatch")) {
|
||||
newFace->isHatched(true);
|
||||
newFace->setFillMode(QGIFace::GeomHatchFill);
|
||||
newFace->setHatchColor(sectionVp->HatchColor.getValue());
|
||||
newFace->setHatchScale(section->HatchScale.getValue());
|
||||
newFace->setLineWeight(sectionVp->WeightPattern.getValue());
|
||||
std::vector<LineSet> lineSets = section->getDrawableLines(i);
|
||||
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);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Base::Console().Warning("QGIVS::draw - unknown CutSurfaceDisplay: %d\n",
|
||||
section->CutSurfaceDisplay.getValue());
|
||||
}
|
||||
|
||||
newFace->draw();
|
||||
newFace->setPrettyNormal();
|
||||
newFace->setAcceptHoverEvents(false);
|
||||
@@ -150,16 +156,12 @@ void QGIViewSection::updateView(bool update)
|
||||
return;
|
||||
}
|
||||
|
||||
// if(update ||
|
||||
// viewPart->SectionNormal.isTouched() ||
|
||||
// viewPart->SectionOrigin.isTouched()) {
|
||||
//// QGIViewPart::updateView(true);
|
||||
//// drawSectionFace();
|
||||
// } else {
|
||||
//// QGIViewPart::updateView();
|
||||
//// drawSectionFace();
|
||||
// }
|
||||
std::string dbHatch = viewPart->FileHatchPattern.getValue();
|
||||
|
||||
draw();
|
||||
|
||||
QGIView::updateView(update);
|
||||
|
||||
}
|
||||
|
||||
void QGIViewSection::drawSectionLine(TechDraw::DrawViewSection* s, bool b)
|
||||
@@ -168,3 +170,4 @@ void QGIViewSection::drawSectionLine(TechDraw::DrawViewSection* s, bool b)
|
||||
Q_UNUSED(s);
|
||||
//override QGIVP::drawSectionLine
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user