Skip to content

Commit

Permalink
Add options for face detection and cut face edge display
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan authored and yorikvanhavre committed Oct 6, 2016
1 parent 62328bb commit ae57984
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 30 deletions.
16 changes: 4 additions & 12 deletions src/Mod/TechDraw/App/DrawViewPart.cpp
Expand Up @@ -817,28 +817,20 @@ void DrawViewPart::getRunControl()
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/RunControl");
m_interAlgo = hGrp->GetInt("InterAlgo", 2l);
m_sectionEdges = hGrp->GetInt("ShowSectionEdges", 1l);
m_handleFaces = hGrp->GetInt("HandleFaces", 1l);
m_sectionEdges = hGrp->GetBool("ShowSectionEdges", 1l);
m_handleFaces = hGrp->GetBool("HandleFaces", 1l);
// Base::Console().Message("TRACE - DVP::getRunControl - interAlgo: %ld sectionFaces: %ld handleFaces: %ld\n",
// m_interAlgo,m_sectionEdges,m_handleFaces);
}

bool DrawViewPart::handleFaces(void)
{
bool result = false;
if (m_handleFaces == 1l) {
result = true;
}
return result;
return m_handleFaces;
}

bool DrawViewPart::showSectionEdges(void)
{
bool result = false;
if (m_sectionEdges == 1l) {
result = true;
}
return result;
return m_sectionEdges;
}

PyObject *DrawViewPart::getPyObject(void)
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/App/DrawViewPart.h
Expand Up @@ -156,8 +156,8 @@ class TechDrawExport DrawViewPart : public DrawView
void getRunControl(void);

long int m_interAlgo;
long int m_sectionEdges;
long int m_handleFaces;
bool m_sectionEdges;
bool m_handleFaces;

private:
static App::PropertyFloatConstraint::Constraints floatRange;
Expand Down
32 changes: 17 additions & 15 deletions src/Mod/TechDraw/Gui/QGIViewPart.cpp
Expand Up @@ -297,23 +297,25 @@ void QGIViewPart::drawViewPart()
removeDecorations();

#if MOD_TECHDRAW_HANDLE_FACES
// Draw Faces
std::vector<TechDraw::DrawHatch*> hatchObjs = viewPart->getHatches();
const std::vector<TechDrawGeometry::Face *> &faceGeoms = viewPart->getFaceGeometry();
std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin();
for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) {
QGIFace* newFace = drawFace(*fit,i);
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
if (fHatch) {
if (!fHatch->HatchPattern.isEmpty()) {
App::Color hColor = fHatch->HatchColor.getValue();
newFace->setHatchColor(hColor.asCSSString());
newFace->setHatch(fHatch->HatchPattern.getValue());
if (viewPart->handleFaces()) {
// Draw Faces
std::vector<TechDraw::DrawHatch*> hatchObjs = viewPart->getHatches();
const std::vector<TechDrawGeometry::Face *> &faceGeoms = viewPart->getFaceGeometry();
std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin();
for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) {
QGIFace* newFace = drawFace(*fit,i);
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
if (fHatch) {
if (!fHatch->HatchPattern.isEmpty()) {
App::Color hColor = fHatch->HatchColor.getValue();
newFace->setHatchColor(hColor.asCSSString());
newFace->setHatch(fHatch->HatchPattern.getValue());
}
}
newFace->setDrawEdges(false);
newFace->setZValue(ZVALUE::FACE);
newFace->setPrettyNormal();
}
newFace->setDrawEdges(false);
newFace->setZValue(ZVALUE::FACE);
newFace->setPrettyNormal();
}
#endif //#if MOD_TECHDRAW_HANDLE_FACES

Expand Down
6 changes: 5 additions & 1 deletion src/Mod/TechDraw/Gui/QGIViewSection.cpp
Expand Up @@ -79,7 +79,11 @@ void QGIViewSection::drawSectionFace()
QGIFace* newFace = drawFace(*fit,-1); //TODO: do we need to know which sectionFace this QGIFace came from?
newFace->setZValue(ZVALUE::SECTIONFACE);
newFace->setFill(faceColor, Qt::SolidPattern);
newFace->setDrawEdges(false);
if (section->showSectionEdges()) {
newFace->setDrawEdges(true);
} else {
newFace->setDrawEdges(false);
}
newFace->setPrettyNormal();
newFace->setAcceptHoverEvents(false);
newFace->setFlag(QGraphicsItem::ItemIsSelectable, false);
Expand Down

0 comments on commit ae57984

Please sign in to comment.