user defined dblclick handler

This commit is contained in:
Joachim Schoeberl 2012-08-30 13:40:17 +00:00
parent c2a3f5c149
commit d0b8d63889
10 changed files with 39 additions and 10 deletions

View File

@ -288,6 +288,7 @@ extern "C" {
namespace netgen { namespace netgen {
// #include "../visualization/soldata.hpp" // #include "../visualization/soldata.hpp"
class SolutionData; class SolutionData;
class MouseEventHandler;
} }
enum Ng_SolutionType enum Ng_SolutionType
@ -323,6 +324,8 @@ extern "C" {
DLL_HEADER void Ng_ClearSolutionData(); DLL_HEADER void Ng_ClearSolutionData();
// redraw // redraw
DLL_HEADER void Ng_Redraw(); DLL_HEADER void Ng_Redraw();
///
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
// //
DLL_HEADER void Ng_SetVisualizationParameter (const char * name, DLL_HEADER void Ng_SetVisualizationParameter (const char * name,
const char * value); const char * value);

View File

@ -705,7 +705,11 @@ namespace netgen
int timerloc2 = NgProfiler::CreateTimer ("CalcSurfacesOfNode"); int timerloc2 = NgProfiler::CreateTimer ("CalcSurfacesOfNode");
NgProfiler::RegionTimer regloc(timerloc); 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"); // PrintMessage (2, "Got ", GetNSE(), " surface elements");
NgProfiler::StartTimer (timerloc2); NgProfiler::StartTimer (timerloc2);

View File

@ -157,6 +157,7 @@ namespace netgen
Array<int> par_filledlists; Array<int> par_filledlists;
#endif #endif
MouseEventHandler * user_me_handler;
NgLock *lock; NgLock *lock;
@ -174,6 +175,10 @@ namespace netgen
virtual void DrawScene (); virtual void DrawScene ();
virtual void MouseDblClick (int px, int py); virtual void MouseDblClick (int px, int py);
void SetMouseEventHandler (MouseEventHandler * handler)
{ user_me_handler = handler; }
int SelectedFace () const int SelectedFace () const
{ return selface; } { return selface; }
void SetSelectedFace (int asf); void SetSelectedFace (int asf);

View File

@ -105,6 +105,14 @@ namespace netgen
multidimcomponent = mc; multidimcomponent = mc;
} }
}; };
class DLL_HEADER MouseEventHandler
{
public:
virtual void DblClick (int elnr) { ; }
};
} }
#endif #endif

View File

@ -20,8 +20,8 @@ Visualization
#include "../include/incvis.hpp" #include "../include/incvis.hpp"
#include "vispar.hpp" #include "vispar.hpp"
#include "mvdraw.hpp"
#include "soldata.hpp" #include "soldata.hpp"
#include "mvdraw.hpp"
#include <complex> #include <complex>

View File

@ -61,6 +61,8 @@ namespace netgen
minh = 0.0; minh = 0.0;
maxh = 0.0; maxh = 0.0;
user_me_handler = NULL;
} }
VisualSceneMesh :: ~VisualSceneMesh () VisualSceneMesh :: ~VisualSceneMesh ()
@ -3093,6 +3095,12 @@ namespace netgen
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);
if (user_me_handler)
{
if (selelement != -1)
user_me_handler -> DblClick (selelement-1);
}
selecttimestamp = NextTimeStamp(); selecttimestamp = NextTimeStamp();
@ -3427,7 +3435,6 @@ namespace netgen
cout << "seledge = " << seledge << endl; cout << "seledge = " << seledge << endl;
} }
} }
} }
else else
{ {

View File

@ -139,8 +139,6 @@ public:
Array<SolData*> soldata; Array<SolData*> soldata;
int usetexture; // 0..no, 1..1D texture (standard), 2..2D-texture (complex) int usetexture; // 0..no, 1..1D texture (standard), 2..2D-texture (complex)
@ -192,7 +190,6 @@ public:
void SaveSolutionData (const char * filename); void SaveSolutionData (const char * filename);
static void RealVec3d (const double * values, Vec3d & v, static void RealVec3d (const double * values, Vec3d & v,
bool iscomplex, bool imag); bool iscomplex, bool imag);
static void RealVec3d (const double * values, Vec3d & v, static void RealVec3d (const double * values, Vec3d & v,

View File

@ -1,6 +1,3 @@
proc meshingoptionsdialog { } { proc meshingoptionsdialog { } {
set w .options_dlg set w .options_dlg

View File

@ -2718,6 +2718,12 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata)
#endif #endif
} }
void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler)
{
vsmesh.SetMouseEventHandler (handler);
}
void Ng_ClearSolutionData () void Ng_ClearSolutionData ()
{ {
#ifdef OPENGL #ifdef OPENGL

View File

@ -1180,7 +1180,9 @@ namespace netgen
//Destination for messages, errors, ... //Destination for messages, errors, ...
DLL_HEADER void Ng_PrintDest(const char * s) 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;
} }