Fix Boundbox problem in FemMesh and make singular Coordinate3 node

This commit is contained in:
jriegel 2013-07-10 01:09:59 +02:00
parent 1ce212160b
commit 4c6e988aad
2 changed files with 15 additions and 19 deletions

View File

@ -806,23 +806,14 @@ Base::Matrix4D FemMesh::getTransform(void) const
Base::BoundBox3d FemMesh::getBoundBox(void) const
{
Base::BoundBox3d box;
try {
// If the shape is empty an exception may be thrown
Bnd_Box bounds;
BRepBndLib::Add(myMesh->GetShapeToMesh(), bounds);
bounds.SetGap(0.0);
Standard_Real xMin, yMin, zMin, xMax, yMax, zMax;
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
box.MinX = xMin;
box.MaxX = xMax;
box.MinY = yMin;
box.MaxY = yMax;
box.MinZ = zMin;
box.MaxZ = zMax;
}
catch (Standard_Failure) {
}
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(getSMesh())->GetMeshDS();
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
for (;aNodeIter->more();) {
const SMDS_MeshNode* aNode = aNodeIter->next();
box.Add(Base::Vector3d(aNode->X(),aNode->Y(),aNode->Z()));
}
return box;
}

View File

@ -231,6 +231,9 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
{
ViewProviderGeometryObject::attach(pcObj);
// Move 'coords' before the switch
pcRoot->insertChild(pcCoords,pcRoot->findChild(reinterpret_cast<const SoNode*>(pcModeSwitch)));
// Annotation sets
SoGroup* pcAnotRoot = new SoAnnotation();
@ -252,7 +255,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
// flat
SoGroup* pcFlatRoot = new SoGroup();
// face nodes
pcFlatRoot->addChild(pcCoords);
//pcFlatRoot->addChild(pcCoords);
pcFlatRoot->addChild(pShapeHints);
pcFlatRoot->addChild(pcShapeMaterial);
pcFlatRoot->addChild(pcMatBinding);
@ -264,7 +267,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
SoLightModel* pcLightModel = new SoLightModel();
pcLightModel->model = SoLightModel::BASE_COLOR;
SoGroup* pcWireRoot = new SoGroup();
pcWireRoot->addChild(pcCoords);
//pcWireRoot->addChild(pcCoords);
pcWireRoot->addChild(pcDrawStyle);
pcWireRoot->addChild(pcLightModel);
SoBaseColor* color = new SoBaseColor();
@ -278,7 +281,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
SoGroup* pcPointsRoot = new SoSeparator();
pcPointsRoot->addChild(pcPointMaterial);
pcPointsRoot->addChild(pcPointStyle);
pcPointsRoot->addChild(pcCoords);
//pcPointsRoot->addChild(pcCoords);
pointset = new SoPointSet;
pcPointsRoot->addChild(pointset);
addDisplayMaskMode(pcPointsRoot, "Nodes");
@ -318,6 +321,8 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
addDisplayMaskMode(pcElemNodesRoot, "Elements & Nodes");
}
void ViewProviderFemMesh::setDisplayMode(const char* ModeName)