Merge branch 'gui_draw_sel_nrs' into 'master'

gui draw segment and surfacelement numbers

See merge request ngsolve/netgen!597
This commit is contained in:
Schöberl, Joachim 2023-08-29 17:09:52 +02:00
commit 9712f7c959
6 changed files with 61 additions and 4 deletions

View File

@ -58,6 +58,8 @@ public:
int drawedgenumbers; int drawedgenumbers;
int drawfacenumbers; int drawfacenumbers;
int drawelementnumbers; int drawelementnumbers;
int drawsurfaceelementnumbers;
int drawsegmentnumbers;
int drawdomainsurf; int drawdomainsurf;
int drawtets; int drawtets;
int drawtetsdomain; int drawtetsdomain;

View File

@ -209,6 +209,8 @@ namespace netgen
if (vispar.drawpointnumbers || if (vispar.drawpointnumbers ||
vispar.drawedgenumbers || vispar.drawedgenumbers ||
vispar.drawfacenumbers || vispar.drawfacenumbers ||
vispar.drawsegmentnumbers ||
vispar.drawsurfaceelementnumbers ||
vispar.drawelementnumbers) vispar.drawelementnumbers)
glCallList (pointnumberlist); glCallList (pointnumberlist);
@ -366,6 +368,8 @@ namespace netgen
if (vispar.drawpointnumbers || if (vispar.drawpointnumbers ||
vispar.drawedgenumbers || vispar.drawedgenumbers ||
vispar.drawfacenumbers || vispar.drawfacenumbers ||
vispar.drawsegmentnumbers ||
vispar.drawsurfaceelementnumbers ||
vispar.drawelementnumbers) vispar.drawelementnumbers)
{ {
// glEnable (GL_COLOR_MATERIAL); // glEnable (GL_COLOR_MATERIAL);
@ -427,8 +431,18 @@ namespace netgen
} }
if (vispar.drawsegmentnumbers)
{
for (auto si : Range(mesh->LineSegments())) {
const auto& seg = (*mesh)[si];
Point<3> c = Center((*mesh)[seg[0]], (*mesh)[seg[1]]);
glRasterPos3d (c[0], c[1], c[2]);
snprintf (buf, size(buf), "%d", int(si));
MyOpenGLText (buf);
}
}
if (vispar.drawfacenumbers) if (vispar.drawfacenumbers)
{ {
const MeshTopology & top = mesh->GetTopology(); const MeshTopology & top = mesh->GetTopology();
NgArray<int> v; NgArray<int> v;
@ -458,9 +472,28 @@ namespace netgen
} }
} }
if (vispar.drawsurfaceelementnumbers)
{
for (auto sei : Range(mesh->SurfaceElements()))
{
const auto & sel = (*mesh)[sei];
Point<3> c;
if(sel.GetNV() == 3)
c = Center((*mesh)[sel[0]],
(*mesh)[sel[1]],
(*mesh)[sel[2]]);
else
c = Center((*mesh)[sel[0]],
(*mesh)[sel[1]],
(*mesh)[sel[2]],
(*mesh)[sel[3]]);
glRasterPos3d (c[0], c[1], c[2]);
snprintf (buf, size(buf), "%d", int(sei));
MyOpenGLText (buf);
}
}
if (vispar.drawelementnumbers)
if (vispar.drawelementnumbers)
{ {
NgArray<int> v; NgArray<int> v;
for (int i = 1; i <= mesh->GetNE(); i++) for (int i = 1; i <= mesh->GetNE(); i++)

View File

@ -1214,6 +1214,12 @@ proc viewingoptionsdialog { } {
ttk::checkbutton $f.showelementnumbers -text "Show Element-numbers" \ ttk::checkbutton $f.showelementnumbers -text "Show Element-numbers" \
-variable viewoptions.drawelementnumbers \ -variable viewoptions.drawelementnumbers \
-command { Ng_SetVisParameters; redraw } -command { Ng_SetVisParameters; redraw }
ttk::checkbutton $f.showsegmentnumbers -text "Show Segment-numbers" \
-variable viewoptions.drawsegmentnumbers \
-command { Ng_SetVisParameters; redraw }
ttk::checkbutton $f.showsurfaceelementnumbers -text "Show Surfaceelement-numbers" \
-variable viewoptions.drawsurfaceelementnumbers \
-command { Ng_SetVisParameters; redraw }
# label $f.showdomainlab -text "Domain Surface" # label $f.showdomainlab -text "Domain Surface"
# scale $f.showdomain -orient horizontal -length 100 -from 0 -to 50 \ # scale $f.showdomain -orient horizontal -length 100 -from 0 -to 50 \
@ -1281,7 +1287,8 @@ proc viewingoptionsdialog { } {
grid $f.showfilledtrigs $f.showoutline -sticky nw grid $f.showfilledtrigs $f.showoutline -sticky nw
grid $f.showedges $f.showbadels -sticky nw grid $f.showedges $f.showbadels -sticky nw
grid $f.showpointnumbers $f.showedgenumbers -sticky nw grid $f.showpointnumbers $f.showedgenumbers -sticky nw
grid $f.showfacenumbers $f.showelementnumbers -sticky nw grid $f.showfacenumbers $f.showelementnumbers -sticky nw
grid $f.showsurfaceelementnumbers $f.showsegmentnumbers -sticky nw
grid $f.showmetispartition $f.showidentified -sticky nw grid $f.showmetispartition $f.showidentified -sticky nw
grid $f.showcolor $f.showpyramids -sticky nw grid $f.showcolor $f.showpyramids -sticky nw
grid $f.showprisms $f.showhexes -sticky nw grid $f.showprisms $f.showhexes -sticky nw

View File

@ -2644,6 +2644,10 @@ void PlayAnimFile(const char* name, int speed, int maxcnt)
atoi (Tcl_GetVar (interp, "::viewoptions.drawfacenumbers", TCL_GLOBAL_ONLY)); atoi (Tcl_GetVar (interp, "::viewoptions.drawfacenumbers", TCL_GLOBAL_ONLY));
vispar.drawelementnumbers = vispar.drawelementnumbers =
atoi (Tcl_GetVar (interp, "::viewoptions.drawelementnumbers", TCL_GLOBAL_ONLY)); atoi (Tcl_GetVar (interp, "::viewoptions.drawelementnumbers", TCL_GLOBAL_ONLY));
vispar.drawsurfaceelementnumbers =
atoi (Tcl_GetVar (interp, "::viewoptions.drawsurfaceelementnumbers", TCL_GLOBAL_ONLY));
vispar.drawsegmentnumbers =
atoi (Tcl_GetVar (interp, "::viewoptions.drawsegmentnumbers", TCL_GLOBAL_ONLY));
vispar.drawdomainsurf = vispar.drawdomainsurf =
atoi (Tcl_GetVar (interp, "::viewoptions.drawdomainsurf", TCL_GLOBAL_ONLY)); atoi (Tcl_GetVar (interp, "::viewoptions.drawdomainsurf", TCL_GLOBAL_ONLY));

View File

@ -145,6 +145,8 @@ DLL_HEADER const char * ngscript[] = {""
,"set viewoptions.drawedgenumbers 0\n" ,"set viewoptions.drawedgenumbers 0\n"
,"set viewoptions.drawfacenumbers 0\n" ,"set viewoptions.drawfacenumbers 0\n"
,"set viewoptions.drawelementnumbers 0\n" ,"set viewoptions.drawelementnumbers 0\n"
,"set viewoptions.drawsegmentnumbers 0\n"
,"set viewoptions.drawsurfaceelementnumbers 0\n"
,"set viewoptions.drawdomainsurf 0\n" ,"set viewoptions.drawdomainsurf 0\n"
,"set viewoptions.drawededges 1\n" ,"set viewoptions.drawededges 1\n"
,"set viewoptions.drawedpoints 1\n" ,"set viewoptions.drawedpoints 1\n"
@ -2183,6 +2185,12 @@ DLL_HEADER const char * ngscript[] = {""
,"ttk::checkbutton $f.showelementnumbers -text \"Show Element-numbers\" \\\n" ,"ttk::checkbutton $f.showelementnumbers -text \"Show Element-numbers\" \\\n"
,"-variable viewoptions.drawelementnumbers \\\n" ,"-variable viewoptions.drawelementnumbers \\\n"
,"-command { Ng_SetVisParameters; redraw }\n" ,"-command { Ng_SetVisParameters; redraw }\n"
,"ttk::checkbutton $f.showsegmentnumbers -text \"Show Segment-numbers\" \\\n"
,"-variable viewoptions.drawsegmentnumbers \\\n"
,"-command { Ng_SetVisParameters; redraw }\n"
,"ttk::checkbutton $f.showsurfaceelementnumbers -text \"Show Surfaceelement-numbers\" \\\n"
,"-variable viewoptions.drawsurfaceelementnumbers \\\n"
,"-command { Ng_SetVisParameters; redraw }\n"
,"ttk::frame $f.frametets\n" ,"ttk::frame $f.frametets\n"
,"ttk::checkbutton $f.frametets.showtets -text \"\" \\\n" ,"ttk::checkbutton $f.frametets.showtets -text \"\" \\\n"
,"-variable viewoptions.drawtets \\\n" ,"-variable viewoptions.drawtets \\\n"
@ -2212,6 +2220,7 @@ DLL_HEADER const char * ngscript[] = {""
,"grid $f.showedges $f.showbadels -sticky nw\n" ,"grid $f.showedges $f.showbadels -sticky nw\n"
,"grid $f.showpointnumbers $f.showedgenumbers -sticky nw\n" ,"grid $f.showpointnumbers $f.showedgenumbers -sticky nw\n"
,"grid $f.showfacenumbers $f.showelementnumbers -sticky nw\n" ,"grid $f.showfacenumbers $f.showelementnumbers -sticky nw\n"
,"grid $f.showsurfaceelementnumbers $f.showsegmentnumbers -sticky nw\n"
,"grid $f.showmetispartition $f.showidentified -sticky nw\n" ,"grid $f.showmetispartition $f.showidentified -sticky nw\n"
,"grid $f.showcolor $f.showpyramids -sticky nw\n" ,"grid $f.showcolor $f.showpyramids -sticky nw\n"
,"grid $f.showprisms $f.showhexes -sticky nw\n" ,"grid $f.showprisms $f.showhexes -sticky nw\n"

View File

@ -112,6 +112,8 @@ set viewoptions.drawpointnumbers 0
set viewoptions.drawedgenumbers 0 set viewoptions.drawedgenumbers 0
set viewoptions.drawfacenumbers 0 set viewoptions.drawfacenumbers 0
set viewoptions.drawelementnumbers 0 set viewoptions.drawelementnumbers 0
set viewoptions.drawsegmentnumbers 0
set viewoptions.drawsurfaceelementnumbers 0
set viewoptions.drawdomainsurf 0 set viewoptions.drawdomainsurf 0
set viewoptions.drawededges 1 set viewoptions.drawededges 1