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

View File

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

View File

@ -114,8 +114,8 @@ void ViewProviderMeshFaceSet::attach(App::DocumentObject *pcFeat)
{ {
ViewProviderMesh::attach(pcFeat); ViewProviderMesh::attach(pcFeat);
pcHighlight->addChild(pcMeshCoord); pcShapeGroup->addChild(pcMeshCoord);
pcHighlight->addChild(pcMeshFaces); pcShapeGroup->addChild(pcMeshFaces);
// read the threshold from the preferences // read the threshold from the preferences
Base::Reference<ParameterGrp> hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh"); Base::Reference<ParameterGrp> hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh");
@ -147,15 +147,15 @@ void ViewProviderMeshFaceSet::updateData(const App::Property* prop)
if (direct != directRendering) { if (direct != directRendering) {
directRendering = direct; directRendering = direct;
pcHighlight->removeAllChildren(); pcShapeGroup->removeAllChildren();
if (directRendering) { if (directRendering) {
pcHighlight->addChild(pcMeshNode); pcShapeGroup->addChild(pcMeshNode);
pcHighlight->addChild(pcMeshShape); pcShapeGroup->addChild(pcMeshShape);
} }
else { else {
pcHighlight->addChild(pcMeshCoord); pcShapeGroup->addChild(pcMeshCoord);
pcHighlight->addChild(pcMeshFaces); pcShapeGroup->addChild(pcMeshFaces);
} }
} }