mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
user defined dblclick handler
This commit is contained in:
parent
c2a3f5c149
commit
d0b8d63889
@ -288,6 +288,7 @@ extern "C" {
|
||||
namespace netgen {
|
||||
// #include "../visualization/soldata.hpp"
|
||||
class SolutionData;
|
||||
class MouseEventHandler;
|
||||
}
|
||||
|
||||
enum Ng_SolutionType
|
||||
@ -323,6 +324,8 @@ extern "C" {
|
||||
DLL_HEADER void Ng_ClearSolutionData();
|
||||
// redraw
|
||||
DLL_HEADER void Ng_Redraw();
|
||||
///
|
||||
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
|
||||
//
|
||||
DLL_HEADER void Ng_SetVisualizationParameter (const char * name,
|
||||
const char * value);
|
||||
|
@ -705,7 +705,11 @@ namespace netgen
|
||||
int timerloc2 = NgProfiler::CreateTimer ("CalcSurfacesOfNode");
|
||||
|
||||
NgProfiler::RegionTimer regloc(timerloc);
|
||||
PrintMessage (2, "Got ", GetNE(), " elements and ", GetNSE(), " surface elements");
|
||||
stringstream str;
|
||||
str << "Got " << GetNE() << " elements and "
|
||||
<< GetNSE() << " surface elements";
|
||||
cout << str.str() << endl;
|
||||
// PrintMessage (2, "Got ", GetNE(), " elements and ", GetNSE(), " surface elements");
|
||||
// PrintMessage (2, "Got ", GetNSE(), " surface elements");
|
||||
|
||||
NgProfiler::StartTimer (timerloc2);
|
||||
|
@ -157,6 +157,7 @@ namespace netgen
|
||||
Array<int> par_filledlists;
|
||||
#endif
|
||||
|
||||
MouseEventHandler * user_me_handler;
|
||||
|
||||
NgLock *lock;
|
||||
|
||||
@ -174,6 +175,10 @@ namespace netgen
|
||||
virtual void DrawScene ();
|
||||
virtual void MouseDblClick (int px, int py);
|
||||
|
||||
void SetMouseEventHandler (MouseEventHandler * handler)
|
||||
{ user_me_handler = handler; }
|
||||
|
||||
|
||||
int SelectedFace () const
|
||||
{ return selface; }
|
||||
void SetSelectedFace (int asf);
|
||||
|
@ -105,6 +105,14 @@ namespace netgen
|
||||
multidimcomponent = mc;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DLL_HEADER MouseEventHandler
|
||||
{
|
||||
public:
|
||||
virtual void DblClick (int elnr) { ; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -20,8 +20,8 @@ Visualization
|
||||
#include "../include/incvis.hpp"
|
||||
|
||||
#include "vispar.hpp"
|
||||
#include "mvdraw.hpp"
|
||||
#include "soldata.hpp"
|
||||
#include "mvdraw.hpp"
|
||||
|
||||
#include <complex>
|
||||
|
||||
|
@ -61,6 +61,8 @@ namespace netgen
|
||||
|
||||
minh = 0.0;
|
||||
maxh = 0.0;
|
||||
user_me_handler = NULL;
|
||||
|
||||
}
|
||||
|
||||
VisualSceneMesh :: ~VisualSceneMesh ()
|
||||
@ -3093,6 +3095,12 @@ namespace netgen
|
||||
MouseDblClickSelect(px,py,clipplane,backcolor,transformationmat,center,rad,
|
||||
filledlist,selelement,selface,seledge,selpoint,selpoint2,locpi);
|
||||
|
||||
|
||||
if (user_me_handler)
|
||||
{
|
||||
if (selelement != -1)
|
||||
user_me_handler -> DblClick (selelement-1);
|
||||
}
|
||||
|
||||
selecttimestamp = NextTimeStamp();
|
||||
|
||||
@ -3427,7 +3435,6 @@ namespace netgen
|
||||
cout << "seledge = " << seledge << endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -139,8 +139,6 @@ public:
|
||||
|
||||
|
||||
Array<SolData*> soldata;
|
||||
|
||||
|
||||
|
||||
|
||||
int usetexture; // 0..no, 1..1D texture (standard), 2..2D-texture (complex)
|
||||
@ -192,7 +190,6 @@ public:
|
||||
|
||||
void SaveSolutionData (const char * filename);
|
||||
|
||||
|
||||
static void RealVec3d (const double * values, Vec3d & v,
|
||||
bool iscomplex, bool imag);
|
||||
static void RealVec3d (const double * values, Vec3d & v,
|
||||
|
@ -1,6 +1,3 @@
|
||||
|
||||
|
||||
|
||||
proc meshingoptionsdialog { } {
|
||||
|
||||
set w .options_dlg
|
||||
|
@ -2718,6 +2718,12 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler)
|
||||
{
|
||||
vsmesh.SetMouseEventHandler (handler);
|
||||
}
|
||||
|
||||
|
||||
void Ng_ClearSolutionData ()
|
||||
{
|
||||
#ifdef OPENGL
|
||||
|
@ -1180,7 +1180,9 @@ namespace netgen
|
||||
//Destination for messages, errors, ...
|
||||
DLL_HEADER void Ng_PrintDest(const char * s)
|
||||
{
|
||||
(*mycout) << s << flush;
|
||||
int id = 0;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &id);
|
||||
if (id == 0) (*mycout) << s << flush;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user