Skip to content
Snippets Groups Projects
Commit 4ac3cc6b authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

make Show/Hide work with GModel entities
parent f9841901
No related branches found
No related tags found
No related merge requests found
...@@ -1236,10 +1236,16 @@ void VisibilityShape(int Type, int Num, int Mode) ...@@ -1236,10 +1236,16 @@ void VisibilityShape(int Type, int Num, int Mode)
switch (Type) { switch (Type) {
case MSH_POINT: case MSH_POINT:
case MSH_POINT_FROM_GMODEL:
if((v = FindPoint(Num))) if((v = FindPoint(Num)))
v->Visible = Mode; v->Visible = Mode;
else{
GVertex *gv = GModel::current()->getVertexByTag(Num);
if(gv)
gv->setVisibility(Mode);
else else
Msg::Warning("Unknown point %d (use '*' to hide/show all points)", Num); Msg::Warning("Unknown point %d (use '*' to hide/show all points)", Num);
}
break; break;
case MSH_SEGM_LINE: case MSH_SEGM_LINE:
case MSH_SEGM_SPLN: case MSH_SEGM_SPLN:
...@@ -1251,26 +1257,44 @@ void VisibilityShape(int Type, int Num, int Mode) ...@@ -1251,26 +1257,44 @@ void VisibilityShape(int Type, int Num, int Mode)
case MSH_SEGM_ELLI_INV: case MSH_SEGM_ELLI_INV:
case MSH_SEGM_NURBS: case MSH_SEGM_NURBS:
case MSH_SEGM_DISCRETE: case MSH_SEGM_DISCRETE:
case MSH_SEGM_FROM_GMODEL:
if((c = FindCurve(Num))) if((c = FindCurve(Num)))
c->Visible = Mode; c->Visible = Mode;
else{
GEdge *ge = GModel::current()->getEdgeByTag(Num);
if(ge)
ge->setVisibility(Mode);
else else
Msg::Warning("Unknown line %d (use '*' to hide/show all lines)", Num); Msg::Warning("Unknown line %d (use '*' to hide/show all lines)", Num);
}
break; break;
case MSH_SURF_TRIC: case MSH_SURF_TRIC:
case MSH_SURF_REGL: case MSH_SURF_REGL:
case MSH_SURF_PLAN: case MSH_SURF_PLAN:
case MSH_SURF_DISCRETE: case MSH_SURF_DISCRETE:
case MSH_SURF_FROM_GMODEL:
if((s = FindSurface(Num))) if((s = FindSurface(Num)))
s->Visible = Mode; s->Visible = Mode;
else{
GFace *gf = GModel::current()->getFaceByTag(Num);
if(gf)
gf->setVisibility(Mode);
else else
Msg::Warning("Unknown surface %d (use '*' to hide/show all surfaces)", Num); Msg::Warning("Unknown surface %d (use '*' to hide/show all surfaces)", Num);
}
break; break;
case MSH_VOLUME: case MSH_VOLUME:
case MSH_VOLUME_DISCRETE: case MSH_VOLUME_DISCRETE:
case MSH_VOLUME_FROM_GMODEL:
if((V = FindVolume(Num))) if((V = FindVolume(Num)))
V->Visible = Mode; V->Visible = Mode;
else{
GRegion *gr = GModel::current()->getRegionByTag(Num);
if(gr)
gr->setVisibility(Mode);
else else
Msg::Warning("Unknown volume %d (use '*' to hide/show all volumes)", Num); Msg::Warning("Unknown volume %d (use '*' to hide/show all volumes)", Num);
}
break; break;
default: default:
break; break;
...@@ -1289,10 +1313,30 @@ void VisibilityShape(char *str, int Type, int Mode) ...@@ -1289,10 +1313,30 @@ void VisibilityShape(char *str, int Type, int Mode)
if(!strcmp(str, "all") || !strcmp(str, "*")) { if(!strcmp(str, "all") || !strcmp(str, "*")) {
switch (Type) { switch (Type) {
case 0: Tree_Action(GModel::current()->getGEOInternals()->Points, vis_nod); break; case 0:
case 1: Tree_Action(GModel::current()->getGEOInternals()->Curves, vis_cur); break; Tree_Action(GModel::current()->getGEOInternals()->Points, vis_nod);
case 2: Tree_Action(GModel::current()->getGEOInternals()->Surfaces, vis_sur); break; for(GModel::viter it = GModel::current()->firstVertex();
case 3: Tree_Action(GModel::current()->getGEOInternals()->Volumes, vis_vol); break; it != GModel::current()->lastVertex(); it++)
(*it)->setVisibility(Mode);
break;
case 1:
Tree_Action(GModel::current()->getGEOInternals()->Curves, vis_cur);
for(GModel::eiter it = GModel::current()->firstEdge();
it != GModel::current()->lastEdge(); it++)
(*it)->setVisibility(Mode);
break;
case 2:
Tree_Action(GModel::current()->getGEOInternals()->Surfaces, vis_sur);
for(GModel::fiter it = GModel::current()->firstFace();
it != GModel::current()->lastFace(); it++)
(*it)->setVisibility(Mode);
break;
case 3:
Tree_Action(GModel::current()->getGEOInternals()->Volumes, vis_vol);
for(GModel::riter it = GModel::current()->firstRegion();
it != GModel::current()->lastRegion(); it++)
(*it)->setVisibility(Mode);
break;
} }
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment