Commit 4c2241da authored by Edward Vigmond's avatar Edward Vigmond
Browse files

Adding temporal linking widget.

Now use SIGUSR1 and SIGUSR2 for communication.
parent 7c13aede
HOSTMACHINE := $(shell uname)
FLTK_INC := $(shell fltk-config --use-gl --cxxflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-gl --ldflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-images --use-gl --ldflags)
COMMON_LIBS = -lpng -lpthread -lm -lz
COMMON_INC = -I. -O3 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX
COMMON_INC = -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX
ifeq ($(HOSTMACHINE),Darwin)
LIBS = -L/sw/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS)
......
#include "trimesh.h"
#include <signal.h>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Progress.H>
#include <fstream>
......@@ -63,7 +64,9 @@ void animate_cb( void *v )
if ( mw->tm<0 || mw->tm>ctrl->tmslider->maximum() ) {
mw->tm -= mw->frame_skip;
mw->frame_skip = 0;
}
} else
mw->signal_links( 1 );
ctrl->tmslider->value(mw->tm);
ctrl->tmslider->redraw();
if ( mw->timeplotter->window->shown() ) mw->timeplotter->highlight( mw->tm );
......@@ -72,16 +75,6 @@ void animate_cb( void *v )
}
// determine whether or not to draw object type
bool
do_draw( int t_state, dataOpac *dopac )
{
if ( ( (t_state==1) || (!dopac->on() && t_state==2) ) || !t_state )
return true;
else
return false;
}
// determine the action if the play button is pressed on the control widget
void
......@@ -148,6 +141,8 @@ TBmeshWin ::TBmeshWin(int x, int y, int w, int h, const char *l )
= tet_color[3] = hipt_color[3] = hiptobj_color[3] = 1.;
bgd( 1. );
for ( int i=0; i<NUM_CP; i++ ) _cutsurface[i]=NULL;
tmLink = new TimeLink( timeLinks );
}
......@@ -589,6 +584,7 @@ int TBmeshWin::handle( int event )
contwin->frameskip->value()*
((Fl::event_state()&FL_SHIFT)?shift_time_scale:1));
if ( newtm <= contwin->tmslider->maximum() ) {
signal_links( 1 );
contwin->tmslider->value(newtm);
contwin->tmslider->redraw();
set_time( newtm );
......@@ -600,6 +596,7 @@ int TBmeshWin::handle( int event )
contwin->frameskip->value()*
((Fl::event_state()&FL_SHIFT)?shift_time_scale:1));
if ( newtm >= 0 ) {
signal_links( -1 );
contwin->tmslider->value(newtm);
contwin->tmslider->redraw();
set_time( newtm );
......@@ -1636,3 +1633,19 @@ TBmeshWin::draw_iso_lines()
glPopAttrib( );
}
/** signal the time linked meshalyzer instances
*
* \param dir direction
*/
void
TBmeshWin::signal_links( int dir )
{
set<int> :: iterator it;
for( it=timeLinks.begin(); it!=timeLinks.end(); it++ )
if( kill( *it, dir>0?SIGUSR1:SIGUSR2 ) )
timeLinks.erase( *it );
}
......@@ -4,6 +4,7 @@
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include "Colourscale.h"
#include <zlib.h>
#include "trimesh.h"
......@@ -20,6 +21,7 @@
#include "isosurf.h"
#include "IsoSurface.h"
#include "IsoLines.h"
#include "TimeLink.h"
class Sequence;
class HiLiteInfoWin;
......@@ -68,10 +70,7 @@ class TBmeshWin:public Fl_Gl_Tb_Window
else return 0;}
inline void assc_obj( Object_t o, bool fo=false ) { vert_asc_obj=o;
fill_assc_obj=fo; redraw(); }
inline int reg_first( int s, Object_t t )
{
return model->reg_first( s,t );
}
inline int reg_first( int s, Object_t t ) { return model->reg_first( s,t ); }
void hiliteinfo();
void select_hi( int );
void controlwin( Controls *c ){ contwin = c; }
......@@ -116,6 +115,8 @@ class TBmeshWin:public Fl_Gl_Tb_Window
IsosurfControl *isosurfwin;
int readAuxGrid( char* agfile );
AuxGrid *auxGrid;
TimeLink *tmLink;
void signal_links( int );
private:
int hilight[maxobject]; // which object to highlight
bool hilighton; // whether to highlight
......@@ -131,7 +132,7 @@ class TBmeshWin:public Fl_Gl_Tb_Window
Object_t vert_asc_obj; // object to draw with vertex
double solid_angle3Dpt( int v, int a, int b, int c );
bool fill_hitet; // true to fill hilighted tetrahedron
bool revDrawOrder; // draw surfaces in reverse order
bool revDrawOrder; // draw surfaces in reverse orderc++ convert int to string
float frame_delay; // delay between frames
int frame_skip; // direction and #frames to skip
int tm;
......@@ -166,6 +167,7 @@ class TBmeshWin:public Fl_Gl_Tb_Window
CutSurfaces **_cutsurface; // clipped surfaces
IsoSurface *iso0, *iso1;
IsoLine *isoline;
set<int> timeLinks; // other meshalyzer processes linked to this one
};
#include "DataOpacity.h"
......
......@@ -5,6 +5,34 @@
#include <libgen.h>
#include <getopt.h>
#include <FL/Fl_Text_Display.H>
#include <signal.h>
static Meshwin win;
static Controls control;
/** animate in response to a signal received: SIGUSR1 for forward, SIGUSR2 for backward
*
* \param sig the signal
*/
void animate_signal( int sig )
{
if( sig!=SIGUSR1 && sig != SIGUSR2 )
return;
int fs = control.frameskip->value();
fs *= sig==SIGUSR1 ? 1 : -1;
int newtm = control.tmslider->value() + fs;
if( newtm<0 )
newtm += control.tmslider->maximum();
if( newtm> control.tmslider->maximum() )
newtm -= control.tmslider->maximum();
win.trackballwin->set_time( newtm );
control.tmslider->value(newtm);
}
/** read in the version and license information
*
......@@ -97,8 +125,6 @@ main( int argc, char *argv[] )
{
Fl::gl_visual(FL_RGB|FL_DOUBLE|FL_DEPTH|FL_ALPHA);
Meshwin win;
Controls control;
bool iconcontrols = false;
bool no_elems = false;
......@@ -191,6 +217,9 @@ main( int argc, char *argv[] )
control.window->iconize();
win.winny->position(1,1);
signal( 10, animate_signal );
signal( 12, animate_signal );
return Fl::run();
}
......@@ -872,4 +872,24 @@ Depressing the ``p'' key will enter vertex picking mode. It is a short cut for t
``Pick Vertex'' button.
To reread the current data file, press ``r''.
\section{Temporal Linking}
\meshal responds to the following UNIX signals:
\begin{longtable}{|l|l|}\hline
Signal & Action \\ \hline
SIGUSR1 & advance forward by the frame increment \\
SIGUSR2 & go backwards by the frame increment \\ \hline
\end{longtable}
This can be used to have several instances of meshalyzer advance in time at once.
To do this, in one instance of meshalyzer which will henceforth be the master,
select ``Temporal link'' under the ``File''menu.
A window will pop open. In the top panel will be a list of process IDs for meshalyzer run by
the user. Select the processes you would like linked and click on ``link selected''.
Any of these can be unlinked by selecting them in the bottom list and hitting ``Unlink
selected''.
Now, when the time is changed in the master window by using the arrow keys or animation button,
the time in the other windows will also be changed.
\end{document}
......@@ -2,36 +2,44 @@
version 1.0300
header_name {.h}
code_name {.cc}
decl {\#include "Surfaces.h"} {public
decl {\#include "Surfaces.h"} {public local
}
decl {\#include <GL/gl.h>} {public
decl {\#include <GL/gl.h>} {public local
}
decl {\#include <vector>} {}
decl {\#include <vector>} {private local
}
decl {class TBmeshWin;} {public
decl {class TBmeshWin;} {public local
}
decl {class IsoSurface;} {public
decl {class IsoSurface;} {public local
}
decl {\#define SAVE_WIDGET(f,a) f<<\#a<<" = "<<double(a->value())<<endl;} {}
decl {\#define SAVE_WIDGET(f,a) f<<\#a<<" = "<<double(a->value())<<endl;} {private local
}
decl {\#define TEST_VAR(A,B,C) if(!strcmp(\#A,B)){A->value(C);A->do_callback();continue;}} {}
decl {\#define TEST_VAR(A,B,C) if(!strcmp(\#A,B)){A->value(C);A->do_callback();continue;}} {private local
}
decl {\#define TEST_CHOICE(A,B,C) if(!strcmp(\#A,B)){A->value(C);A->mvalue()->do_callback(A);continue;}} {}
decl {\#define TEST_CHOICE(A,B,C) if(!strcmp(\#A,B)){A->value(C);A->mvalue()->do_callback(A);continue;}} {private local
}
decl {\#define TEST_MENUVAR(A,B,C) if(!strcmp(\#A,B)){if(C)A->set();else A->clear();continue;}} {}
decl {\#define TEST_MENUVAR(A,B,C) if(!strcmp(\#A,B)){if(C)A->set();else A->clear();continue;}} {private local
}
decl {\#define IGNORE_VAR(A,B) if(!strcmp(\#A,B)){continue;}} {}
decl {\#define IGNORE_VAR(A,B) if(!strcmp(\#A,B)){continue;}} {private local
}
decl {\#include "Model.h"} {public
decl {\#include "Model.h"} {public local
}
decl {\#include <set>} {}
decl {\#include <set>} {private local
}
decl {\#include "colourchoice.h"} {}
decl {\#include "colourchoice.h"} {private local
}
class Meshwin {} {
Function {Meshwin()} {open
......@@ -59,15 +67,15 @@ class Controls {open
} {
Fl_Window window {
label {Meshalyzer Controls} open
xywh {924 50 350 650} type Double box UP_BOX
xywh {1045 25 350 650} type Double box UP_BOX
code0 {\#include <FL/Fl_Color_Chooser.H>}
code1 {\#include "VecData.h"} visible
} {
Fl_Menu_Bar mainbar {
Fl_Menu_Bar mainbar {open
xywh {0 -1 350 30} labelcolor 1
} {
Submenu {} {
label File
label File open
xywh {0 0 100 20}
} {
MenuItem {} {
......@@ -185,6 +193,12 @@ if( fn != NULL ){
callback {restore_state();}
xywh {10 10 100 20} divider
}
MenuItem {} {
label {Temporal link}
callback {mwtb->tmLink->list_mesh_pids();
mwtb->tmLink->window->show();} selected
xywh {0 0 30 20} divider
}
MenuItem {} {
label Quit
callback {exit(0);}
......@@ -661,7 +675,7 @@ op->win->show();}
xywh {260 165 70 25} labelsize 12
}
}
Fl_Tabs tabwidget {open
Fl_Tabs tabwidget {
xywh {10 270 330 220} align 0
} {
Fl_Group hilightgrp {
......@@ -1340,7 +1354,7 @@ mwtb->redraw();}
}
}
}
Fl_Group colorscalegrp {selected
Fl_Group colorscalegrp {
xywh {10 490 330 60} box ENGRAVED_BOX
} {
Fl_Button {} {
......@@ -1453,8 +1467,9 @@ mwtb->redraw();}
} {
code {mwtb = w;} {}
}
decl {TBmeshWin *mwtb;} {}
decl {Fl_Window* proginfo;} {public
decl {TBmeshWin *mwtb;} {private local
}
decl {Fl_Window* proginfo;} {public local
}
Function {pickcolor(Object_t obj, const char* wintitle )} {open
} {
......@@ -2039,8 +2054,12 @@ class ObjProps {} {
sizeinp->value( mwtb->size( obj, i ) );
}} {}
}
decl {TBmeshWin *mwtb;} {}
decl {Object_t obj;} {}
decl {int numreg;} {}
decl {bool *sel;} {}
decl {TBmeshWin *mwtb;} {private local
}
decl {Object_t obj;} {private local
}
decl {int numreg;} {private local
}
decl {bool *sel;} {private local
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment