mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
Merge branch 'show_selected_point_in_solution_scene' into 'master'
Show selected point in solution scene See merge request jschoeberl/netgen!471
This commit is contained in:
commit
11f7d64c41
@ -71,6 +71,7 @@ namespace netgen
|
||||
int VisualScene :: seledge;
|
||||
|
||||
int VisualScene :: selecttimestamp;
|
||||
optional<Point<3>> VisualScene :: marker = nullopt;
|
||||
|
||||
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 ()
|
||||
{
|
||||
if (!vispar.drawnetgenlogo) return;
|
||||
|
@ -32,6 +32,7 @@ namespace netgen
|
||||
static int DLL_HEADER seledge;
|
||||
|
||||
static int selecttimestamp;
|
||||
static optional<Point<3>> marker;
|
||||
|
||||
public:
|
||||
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 DrawColorBar (double minval, double maxval, int logscale = 0, bool linear = 1);
|
||||
DLL_HEADER void DrawCoordinateCross ();
|
||||
DLL_HEADER void DrawMarker();
|
||||
DLL_HEADER void DrawNetgenLogo ();
|
||||
DLL_HEADER void SetOpenGlColor(double val, double valmin, double valmax, int logscale = 0);
|
||||
|
||||
|
@ -256,36 +256,7 @@ namespace netgen
|
||||
glCallList (edgelist);
|
||||
}
|
||||
|
||||
if (selpoint > 0 && selpoint <= mesh->GetNP())
|
||||
{
|
||||
/*
|
||||
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]);
|
||||
}
|
||||
|
||||
DrawMarker();
|
||||
|
||||
glDisable(GL_CLIP_PLANE0);
|
||||
|
||||
@ -3133,6 +3104,7 @@ namespace netgen
|
||||
|
||||
BuildFilledList (true);
|
||||
|
||||
marker = nullopt;
|
||||
MouseDblClickSelect(px,py,clipplane,backcolor,transformationmat,center,rad,
|
||||
filledlist,selelement,selface,seledge,selpoint,selpoint2,locpi);
|
||||
|
||||
@ -3168,6 +3140,7 @@ namespace netgen
|
||||
&result[0], &result[1], &result[2]);
|
||||
|
||||
p = Point<3>{result[0], result[1], result[2]};
|
||||
marker = p;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -635,6 +635,8 @@ namespace netgen
|
||||
for (int i = 0; i < user_vis.Size(); i++)
|
||||
user_vis[i] -> Draw();
|
||||
|
||||
DrawMarker();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_CLIP_PLANE0);
|
||||
@ -4757,6 +4759,7 @@ namespace netgen
|
||||
{
|
||||
auto mesh = GetMesh();
|
||||
auto dim = mesh->GetDimension();
|
||||
marker = nullopt;
|
||||
|
||||
auto formatComplex = [](double real, double imag)
|
||||
{
|
||||
@ -4832,6 +4835,7 @@ namespace netgen
|
||||
if(auto el3d = mesh->GetElementOfPoint( p_clipping_plane, lami ))
|
||||
{
|
||||
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_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_volume;
|
||||
@ -4872,7 +4876,9 @@ namespace netgen
|
||||
if(!found_point)
|
||||
return;
|
||||
|
||||
if(selelement==0)
|
||||
marker = p;
|
||||
|
||||
if(selelement<=0)
|
||||
return;
|
||||
|
||||
double lami[3] = {0.0, 0.0, 0.0};
|
||||
|
Loading…
Reference in New Issue
Block a user