FEM: Rename Display Modes

This commit is contained in:
wmayer 2015-11-23 18:17:10 +01:00
parent ad1210f4bb
commit a029d90a98
2 changed files with 35 additions and 31 deletions

View File

@ -70,10 +70,6 @@
using namespace FemGui; using namespace FemGui;
struct FemFace struct FemFace
{ {
const SMDS_MeshNode *Nodes[8]; const SMDS_MeshNode *Nodes[8];
@ -163,6 +159,24 @@ bool FemFace::isSameFace (FemFace &face)
return false; return false;
}; };
// ----------------------------------------------------------------------------
class ViewProviderFemMesh::Private
{
public:
static const char *dm_face_wire;
static const char *dm_face_wire_node;
static const char *dm_face;
static const char *dm_node;
static const char *dm_wire;
};
const char * ViewProviderFemMesh::Private::dm_face_wire = "Faces & Wireframe";
const char * ViewProviderFemMesh::Private::dm_face_wire_node = "Faces, Wireframe & Nodes";
const char * ViewProviderFemMesh::Private::dm_face = "Faces";
const char * ViewProviderFemMesh::Private::dm_node = "Nodes";
const char * ViewProviderFemMesh::Private::dm_wire = "Wireframe";
PROPERTY_SOURCE(FemGui::ViewProviderFemMesh, Gui::ViewProviderGeometryObject) PROPERTY_SOURCE(FemGui::ViewProviderFemMesh, Gui::ViewProviderGeometryObject)
App::PropertyFloatConstraint::Constraints ViewProviderFemMesh::floatRange = {1.0,64.0,1.0}; App::PropertyFloatConstraint::Constraints ViewProviderFemMesh::floatRange = {1.0,64.0,1.0};
@ -249,13 +263,13 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
pcAnoStyle->style = SoDrawStyle::POINTS; pcAnoStyle->style = SoDrawStyle::POINTS;
pcAnoStyle->pointSize = 5; pcAnoStyle->pointSize = 5;
SoMaterial * pcAnoMaterial = new SoMaterial; SoMaterial *pcAnoMaterial = new SoMaterial;
pcAnoMaterial->diffuseColor.setValue(0,1,0); pcAnoMaterial->diffuseColor.setValue(0,1,0);
pcAnoMaterial->emissiveColor.setValue(0,1,0); pcAnoMaterial->emissiveColor.setValue(0,1,0);
pcAnotRoot->addChild(pcAnoMaterial); pcAnotRoot->addChild(pcAnoMaterial);
pcAnotRoot->addChild(pcAnoStyle); pcAnotRoot->addChild(pcAnoStyle);
pcAnotRoot->addChild(pcAnoCoords); pcAnotRoot->addChild(pcAnoCoords);
SoPointSet * pointset = new SoPointSet; SoPointSet *pointset = new SoPointSet;
pcAnotRoot->addChild(pointset); pcAnotRoot->addChild(pointset);
// flat // flat
@ -267,7 +281,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
pcFlatRoot->addChild(pcMatBinding); pcFlatRoot->addChild(pcMatBinding);
pcFlatRoot->addChild(pcFaces); pcFlatRoot->addChild(pcFaces);
pcFlatRoot->addChild(pcAnotRoot); pcFlatRoot->addChild(pcAnotRoot);
addDisplayMaskMode(pcFlatRoot, "Flat"); addDisplayMaskMode(pcFlatRoot, Private::dm_face);
// line // line
SoLightModel* pcLightModel = new SoLightModel(); SoLightModel* pcLightModel = new SoLightModel();
@ -280,7 +294,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
color->rgb.setValue(0.0f,0.0f,0.0f); color->rgb.setValue(0.0f,0.0f,0.0f);
pcWireRoot->addChild(color); pcWireRoot->addChild(color);
pcWireRoot->addChild(pcLines); pcWireRoot->addChild(pcLines);
addDisplayMaskMode(pcWireRoot, "Wireframe"); addDisplayMaskMode(pcWireRoot, Private::dm_wire);
// Points // Points
@ -290,7 +304,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
pcPointsRoot->addChild(pcCoords); pcPointsRoot->addChild(pcCoords);
pointset = new SoPointSet; pointset = new SoPointSet;
pcPointsRoot->addChild(pointset); pcPointsRoot->addChild(pointset);
addDisplayMaskMode(pcPointsRoot, "Nodes"); addDisplayMaskMode(pcPointsRoot, Private::dm_node);
// flat+line (Elements) // flat+line (Elements)
SoPolygonOffset* offset = new SoPolygonOffset(); SoPolygonOffset* offset = new SoPolygonOffset();
@ -310,7 +324,7 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
pcFlatWireRoot->addChild(color); pcFlatWireRoot->addChild(color);
pcFlatWireRoot->addChild(pcLines); pcFlatWireRoot->addChild(pcLines);
addDisplayMaskMode(pcFlatWireRoot, "Elements"); addDisplayMaskMode(pcFlatWireRoot, Private::dm_face_wire);
// flat+line+Nodes (Elements&Nodes) // flat+line+Nodes (Elements&Nodes)
SoGroup* pcElemNodesRoot = new SoSeparator(); SoGroup* pcElemNodesRoot = new SoSeparator();
@ -328,36 +342,23 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
pcElemNodesRoot->addChild(pcPointMaterial); pcElemNodesRoot->addChild(pcPointMaterial);
pcElemNodesRoot->addChild(pointset); pcElemNodesRoot->addChild(pointset);
addDisplayMaskMode(pcElemNodesRoot, "Elements & Nodes"); addDisplayMaskMode(pcElemNodesRoot, Private::dm_face_wire_node);
} }
void ViewProviderFemMesh::setDisplayMode(const char* ModeName) void ViewProviderFemMesh::setDisplayMode(const char* ModeName)
{ {
if (strcmp("Elements",ModeName)==0) setDisplayMaskMode(ModeName);
setDisplayMaskMode("Elements"); ViewProviderGeometryObject::setDisplayMode(ModeName);
else if (strcmp("Elements & Nodes",ModeName)==0)
setDisplayMaskMode("Elements & Nodes");
else if (strcmp("Flat",ModeName)==0)
setDisplayMaskMode("Flat");
else if (strcmp("Wireframe",ModeName)==0)
setDisplayMaskMode("Wireframe");
else if (strcmp("Nodes",ModeName)==0)
setDisplayMaskMode("Nodes");
ViewProviderGeometryObject::setDisplayMode( ModeName );
} }
std::vector<std::string> ViewProviderFemMesh::getDisplayModes(void) const std::vector<std::string> ViewProviderFemMesh::getDisplayModes(void) const
{ {
std::vector<std::string> StrList; std::vector<std::string> StrList;
StrList.push_back("Elements"); StrList.push_back(Private::dm_face_wire);
StrList.push_back("Elements & Nodes"); StrList.push_back(Private::dm_face_wire_node);
StrList.push_back("Flat"); StrList.push_back(Private::dm_face);
StrList.push_back("Wireframe"); StrList.push_back(Private::dm_wire);
StrList.push_back("Nodes"); StrList.push_back(Private::dm_node);
return StrList; return StrList;
} }

View File

@ -158,6 +158,9 @@ protected:
SoIndexedLineSet * pcLines; SoIndexedLineSet * pcLines;
bool onlyEdges; bool onlyEdges;
private:
class Private;
}; };
} //namespace FemGui } //namespace FemGui