show selected point also in solution scene

This commit is contained in:
mhochsteger@cerbsim.com 2022-02-02 14:26:28 +01:00
parent 86fd2983c7
commit deaeeaaac5
4 changed files with 33 additions and 30 deletions

View File

@ -71,6 +71,7 @@ namespace netgen
int VisualScene :: seledge; int VisualScene :: seledge;
int VisualScene :: selecttimestamp; int VisualScene :: selecttimestamp;
optional<Point<3>> VisualScene :: marker = nullopt;
int VisualScene :: viewport[4]; int VisualScene :: viewport[4];
@ -708,6 +709,27 @@ namespace netgen
} }
void VisualScene :: DrawMarker()
{
static constexpr GLubyte cross[] = { 0xc6, 0xee, 0x7c, 0x38, 0x7c, 0xee, 0xc6 };
if(!marker)
return;
glColor3d (0, 0, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glDisable (GL_COLOR_MATERIAL);
glDisable (GL_LIGHTING);
glDisable (GL_CLIP_PLANE0);
auto & p = *marker;
glRasterPos3d (p[0], p[1], p[2]);
glBitmap (7, 7, 3, 3, 0, 0, &cross[0]);
}
void VisualScene :: DrawNetgenLogo () void VisualScene :: DrawNetgenLogo ()
{ {
if (!vispar.drawnetgenlogo) return; if (!vispar.drawnetgenlogo) return;

View File

@ -32,6 +32,7 @@ namespace netgen
static int DLL_HEADER seledge; static int DLL_HEADER seledge;
static int selecttimestamp; static int selecttimestamp;
static optional<Point<3>> marker;
public: public:
static int viewport[4]; static int viewport[4];
@ -70,6 +71,7 @@ namespace netgen
DLL_HEADER void CreateTexture (int ncols, int linear, double alpha, int typ); DLL_HEADER void CreateTexture (int ncols, int linear, double alpha, int typ);
DLL_HEADER void DrawColorBar (double minval, double maxval, int logscale = 0, bool linear = 1); DLL_HEADER void DrawColorBar (double minval, double maxval, int logscale = 0, bool linear = 1);
DLL_HEADER void DrawCoordinateCross (); DLL_HEADER void DrawCoordinateCross ();
DLL_HEADER void DrawMarker();
DLL_HEADER void DrawNetgenLogo (); DLL_HEADER void DrawNetgenLogo ();
DLL_HEADER void SetOpenGlColor(double val, double valmin, double valmax, int logscale = 0); DLL_HEADER void SetOpenGlColor(double val, double valmin, double valmax, int logscale = 0);

View File

@ -256,36 +256,7 @@ namespace netgen
glCallList (edgelist); glCallList (edgelist);
} }
if (selpoint > 0 && selpoint <= mesh->GetNP()) DrawMarker();
{
/*
glPointSize (3.0);
glColor3d (0, 0, 1);
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, matcolblue);
glBegin (GL_POINTS);
const Point3d p = mesh->Point(selpoint);
glVertex3f (p.X(), p.Y(), p.Z());
glEnd();
*/
glColor3d (0, 0, 1);
static GLubyte cross[] =
{
0xc6, 0xee, 0x7c, 0x38, 0x7c, 0xee, 0xc6
};
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glDisable (GL_COLOR_MATERIAL);
glDisable (GL_LIGHTING);
glDisable (GL_CLIP_PLANE0);
const Point3d p = mesh->Point(selpoint);
glRasterPos3d (p.X(), p.Y(), p.Z());
glBitmap (7, 7, 3, 3, 0, 0, &cross[0]);
}
glDisable(GL_CLIP_PLANE0); glDisable(GL_CLIP_PLANE0);
@ -3133,6 +3104,7 @@ namespace netgen
BuildFilledList (true); BuildFilledList (true);
marker = nullopt;
MouseDblClickSelect(px,py,clipplane,backcolor,transformationmat,center,rad, MouseDblClickSelect(px,py,clipplane,backcolor,transformationmat,center,rad,
filledlist,selelement,selface,seledge,selpoint,selpoint2,locpi); filledlist,selelement,selface,seledge,selpoint,selpoint2,locpi);
@ -3168,6 +3140,7 @@ namespace netgen
&result[0], &result[1], &result[2]); &result[0], &result[1], &result[2]);
p = Point<3>{result[0], result[1], result[2]}; p = Point<3>{result[0], result[1], result[2]};
marker = p;
return true; return true;
} }

View File

@ -635,6 +635,8 @@ namespace netgen
for (int i = 0; i < user_vis.Size(); i++) for (int i = 0; i < user_vis.Size(); i++)
user_vis[i] -> Draw(); user_vis[i] -> Draw();
DrawMarker();
glPopMatrix(); glPopMatrix();
glDisable(GL_CLIP_PLANE0); glDisable(GL_CLIP_PLANE0);
@ -4757,6 +4759,7 @@ namespace netgen
{ {
auto mesh = GetMesh(); auto mesh = GetMesh();
auto dim = mesh->GetDimension(); auto dim = mesh->GetDimension();
marker = nullopt;
auto formatComplex = [](double real, double imag) auto formatComplex = [](double real, double imag)
{ {
@ -4832,6 +4835,7 @@ namespace netgen
if(auto el3d = mesh->GetElementOfPoint( p_clipping_plane, lami )) if(auto el3d = mesh->GetElementOfPoint( p_clipping_plane, lami ))
{ {
cout << endl << "Selected point " << p_clipping_plane << " on clipping plane" << endl; cout << endl << "Selected point " << p_clipping_plane << " on clipping plane" << endl;
marker = p_clipping_plane;
bool have_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_volume; bool have_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_volume;
bool have_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_volume; bool have_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_volume;
@ -4872,6 +4876,8 @@ namespace netgen
if(!found_point) if(!found_point)
return; return;
marker = p;
if(selelement==0) if(selelement==0)
return; return;