issue #0002183: Mesh View . Use Bounding-Box Not Working For Flat Lines

This commit is contained in:
wmayer 2017-02-09 18:30:48 +01:00
parent 8b8b4237e1
commit 9925e9028e
3 changed files with 32 additions and 14 deletions

View File

@ -249,6 +249,10 @@ ViewProviderMesh::ViewProviderMesh() : pcOpenEdge(0)
if (pcHighlight->selectionMode.getValue() == Gui::SoFCSelection::SEL_OFF)
Selectable.setValue(false);
pcShapeGroup = new SoGroup();
pcShapeGroup->ref();
pcHighlight->addChild(pcShapeGroup);
pOpenColor = new SoBaseColor();
setOpenEdgeColorFrom(ShapeColor.getValue());
pOpenColor->ref();
@ -317,6 +321,7 @@ ViewProviderMesh::ViewProviderMesh() : pcOpenEdge(0)
ViewProviderMesh::~ViewProviderMesh()
{
pcHighlight->unref();
pcShapeGroup->unref();
pOpenColor->unref();
pcLineStyle->unref();
pcPointStyle->unref();
@ -423,7 +428,10 @@ void ViewProviderMesh::attach(App::DocumentObject *pcFeat)
// points
SoGroup* pcPointRoot = new SoGroup();
pcPointRoot->addChild(pcPointStyle);
pcPointRoot->addChild(pcFlatRoot);
pcPointRoot->addChild(pShapeHints);
pcPointRoot->addChild(pcShapeMaterial);
pcPointRoot->addChild(pcMatBinding);
pcPointRoot->addChild(pcHighlight);
addDisplayMaskMode(pcPointRoot, "Point");
// wires
@ -447,12 +455,20 @@ void ViewProviderMesh::attach(App::DocumentObject *pcFeat)
offset->factor = 1.0f;
offset->units = 1.0f;
SoGroup* pcFlatWireRoot = new SoGroup();
SoSeparator* pcWireSep = new SoSeparator();
pcWireSep->addChild(pcWireRoot);
pcWireSep->addChild(pcLineStyle);
pcWireSep->addChild(pcLightModel);
pcWireSep->addChild(binding);
pcWireSep->addChild(pLineColor);
pcWireSep->addChild(pcHighlight);
SoGroup* pcFlatWireRoot = new SoGroup();
pcFlatWireRoot->addChild(pcWireSep);
pcFlatWireRoot->addChild(offset);
pcFlatWireRoot->addChild(pcFlatRoot);
pcFlatWireRoot->addChild(pShapeHints);
pcFlatWireRoot->addChild(pcShapeMaterial);
pcFlatWireRoot->addChild(pcMatBinding);
pcFlatWireRoot->addChild(pcShapeGroup);
addDisplayMaskMode(pcFlatWireRoot, "FlatWireframe");
if (getColorProperty()) {

View File

@ -32,6 +32,7 @@
#include <App/PropertyStandard.h>
class SoGroup;
class SoSeparator;
class SoEventCallback;
class SbViewVolume;
@ -210,6 +211,7 @@ private:
protected:
Gui::SoFCSelection * pcHighlight;
SoGroup * pcShapeGroup;
SoDrawStyle * pcLineStyle;
SoDrawStyle * pcPointStyle;
SoSeparator * pcOpenEdge;

View File

@ -37,7 +37,7 @@
# include <Inventor/nodes/SoShapeHints.h>
# include <Inventor/nodes/SoOrthographicCamera.h>
# include <Inventor/nodes/SoTransform.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/events/SoMouseButtonEvent.h>
# include <QAction>
# include <QMenu>
@ -114,8 +114,8 @@ void ViewProviderMeshFaceSet::attach(App::DocumentObject *pcFeat)
{
ViewProviderMesh::attach(pcFeat);
pcHighlight->addChild(pcMeshCoord);
pcHighlight->addChild(pcMeshFaces);
pcShapeGroup->addChild(pcMeshCoord);
pcShapeGroup->addChild(pcMeshFaces);
// read the threshold from the preferences
Base::Reference<ParameterGrp> hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh");
@ -141,21 +141,21 @@ void ViewProviderMeshFaceSet::updateData(const App::Property* prop)
pcMeshFaces->coordIndex.setNum(0);
}
else {
ViewProviderMeshBuilder builder;
builder.createMesh(prop, pcMeshCoord, pcMeshFaces);
ViewProviderMeshBuilder builder;
builder.createMesh(prop, pcMeshCoord, pcMeshFaces);
}
if (direct != directRendering) {
directRendering = direct;
pcHighlight->removeAllChildren();
pcShapeGroup->removeAllChildren();
if (directRendering) {
pcHighlight->addChild(pcMeshNode);
pcHighlight->addChild(pcMeshShape);
pcShapeGroup->addChild(pcMeshNode);
pcShapeGroup->addChild(pcMeshShape);
}
else {
pcHighlight->addChild(pcMeshCoord);
pcHighlight->addChild(pcMeshFaces);
pcShapeGroup->addChild(pcMeshCoord);
pcShapeGroup->addChild(pcMeshFaces);
}
}