Commit a3c49230 authored by Edward Vigmond's avatar Edward Vigmond
Browse files

Data display on objects can now be determined independently for each object

parent ea72e097
......@@ -6,6 +6,7 @@ FLTK_INC := $(shell fltk-config --use-gl --cxxflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-images --use-gl --ldflags)
COMMON_INC := -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX -fopenmp
HDF5=1
ifdef HDF5
LIB_CH5 := (HDF5_ROOT)/lib/libch5.a
LIB_HDF5 := -lch5 -lhdf5 -lhdf5_hl
......
......@@ -21,6 +21,7 @@
unsigned int TBmeshWin::MAX_MESSAGES_READ = 100;
const int NUM_CP = 6;
const GLenum CLIP_PLANE[] =
{
......@@ -186,7 +187,7 @@ void TBmeshWin::highlight( Object_t obj, int a )
TBmeshWin ::TBmeshWin(int x, int y, int w, int h, const char *l )
: Fl_Gl_Tb_Window(x, y, w, h, l), vecdata( NULL ), hilighton(false),
autocol(false), have_data(NoData), datadst(Surface), vert_asc_obj(SurfEle),
autocol(false), have_data(NoData), datadst(ObjFlg[Surface]), vert_asc_obj(SurfEle),
fill_assc_obj(false), fill_hitet(false), revDrawOrder(false), tm(0),
frame_skip(0), frame_delay(0.01), lightson(true), auxGrid(NULL),
cs( new Colourscale( 64 ) ), renderMode(GL_RENDER),
......@@ -322,7 +323,7 @@ void TBmeshWin :: draw()
glLineWidth(0.5);
glColor3fv( tet_color );
const bool datcolor = (datadst == VolEle) && have_data!=NoData;
const bool datcolor = datadst&VolEle_flg && have_data!=NoData;
for ( int r=0; r<model->_numReg; r++ ) {
......@@ -505,7 +506,7 @@ void TBmeshWin::draw_iso_surfaces()
}
// draw surfaces
// draw filled surface elements
void TBmeshWin::draw_surfaces(Surfaces* sf)
{
int stride = 1;
......@@ -518,7 +519,7 @@ void TBmeshWin::draw_surfaces(Surfaces* sf)
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
//glEnable(GL_BLEND);
bool showData=true;
if ( (datadst!=Surface && datadst!=All) || have_data==NoData )
if ( !(datadst&Surface_flg) || have_data==NoData )
showData = false;
if ( dataopac->dop[Surface].on() ||
......@@ -535,7 +536,7 @@ void TBmeshWin::draw_surfaces(Surfaces* sf)
}
// draw triangular elements
// draw surface element outlines
void TBmeshWin::draw_elements(Surfaces* sf)
{
glPushAttrib(GL_POLYGON_BIT);
......@@ -543,7 +544,7 @@ void TBmeshWin::draw_elements(Surfaces* sf)
glLineWidth(2.);
bool datacol=true;
if ( (datadst!=SurfEle && datadst!=All) || have_data==NoData )
if ( !(datadst&SurfEdge_flg) || have_data==NoData )
datacol = false;
if ( renderMode == GL_RENDER )
......@@ -563,7 +564,7 @@ void TBmeshWin::draw_cables(RRegion* sf)
model->_cable->threeD( sf->threeD(Cable) );
if ( dataopac->dop[Cable].on() ) translucency(true);
model->_cable->draw( 0, model->_cable->num()-1, sf->get_color(Cable),
cs, (datadst==Cable||datadst==All)?data:NULL,
cs, datadst&Cable_flg?data:NULL,
model->stride(Cable), dataopac->dop+Cable );
if ( dataopac->dop[Cable].on() ) translucency(false);
glPopAttrib();
......@@ -581,7 +582,7 @@ void TBmeshWin::draw_cnnx(RRegion* sf)
model->_cnnx->threeD( sf->threeD(Cnnx) );
glColor4fv( sf->get_color( Cnnx ) );
model->_cnnx->draw( 0, model->_cnnx->num()-1, sf->get_color(Cnnx),
cs, (datadst==All|datadst==Cnnx)?data:NULL,
cs, datadst&Cnnx_flg?data:NULL,
model->stride(Cnnx), dataopac->dop+Cnnx );
glPopAttrib();
} else
......@@ -601,7 +602,7 @@ void TBmeshWin::draw_vertices(RRegion* reg)
model->pt.threeD( reg->threeD(Vertex) );
if ( dataopac->dop[Vertex].on() ) translucency(true);
model->pt.draw( 0, model->pt.num()-1, reg->get_color(Vertex),
cs, (datadst==All||datadst==Vertex)?data:NULL,
cs, datadst&Vertex_flg?data:NULL,
model->stride(Vertex), dataopac->dop+Vertex );
if ( dataopac->dop[Vertex].on() ) translucency(false);
glPopAttrib();
......@@ -1724,7 +1725,7 @@ TBmeshWin::draw_cut_planes( RRegion *reg )
glEnable( GL_POLYGON_SMOOTH );
bool showData=true;
if ( (datadst!=Surface && datadst!=All) || have_data==NoData )
if ( !(datadst&Surface_flg) || have_data==NoData )
showData = false;
if ( dataopac->dop[Surface].on() ) translucency(true);
......
......@@ -26,6 +26,16 @@
#include <hdf5.h>
#endif
// for displaying data
const unsigned int Vertex_flg=1;
const unsigned int Cable_flg=2;
const unsigned int Cnnx_flg=4;
const unsigned int SurfEdge_flg=8;
const unsigned int Surface_flg=16;
const unsigned int VolEle_flg=32;
const unsigned int ObjFlg[] = { Vertex_flg, Cable_flg, Cnnx_flg, SurfEdge_flg, Surface_flg, VolEle_flg };
class Sequence;
class HiLiteInfoWin;
class Controls;
......@@ -66,8 +76,9 @@ class TBmeshWin:public Fl_Gl_Tb_Window
inline bool visibility( int s ){return model->visibility(s);}
void opacity( int s, float opac );
inline GLfloat opacity( int s ){return model->opacity(s);}
inline Object_t datify(){ return datadst; }
inline void datify( Object_t obj ){ datadst=obj; redraw(); }
inline unsigned int datify(){ return datadst; }
inline void datify( Object_t obj ){ if(obj==All)datadst=(1<<maxobject)-1;else datadst |= ObjFlg[obj]; redraw(); }
inline void undatify( Object_t obj ){if(obj==All)datadst=0;else datadst&=~ObjFlg[obj];redraw();}
Colourscale *cs;
int add_surface( const char * ); // add a surface
void get_data( const char *, Myslider* mslider=NULL ); // get data file
......@@ -141,7 +152,7 @@ class TBmeshWin:public Fl_Gl_Tb_Window
int hilight[maxobject]; // which object to highlight
bool hilighton; // whether to highlight
Display_t disp; // type of display
Object_t datadst; // which object gets data coloured
unsigned int datadst; // which object gets data coloured
GLfloat tet_color[4], hitet_color[4], hiele_color[4],
hicable_color[4], hicnnx_color[4], hipt_color[4], bc[4],
hiptobj_color[4];
......
......@@ -61,7 +61,7 @@ void Tetrahedral::draw( int p0, int p1, GLfloat *colour, Colourscale* cs,
continue;
const GLfloat* a = _pt->pt(an=_node[p]);
const GLfloat* b = _pt->pt(dn=_node[p+1]);
const GLfloat* b = _pt->pt(bn=_node[p+1]);
const GLfloat* c = _pt->pt(cn=_node[p+2]);
const GLfloat* d = _pt->pt(dn=_node[p+3]);
......
......@@ -4,7 +4,7 @@
typedef enum objects{
Vertex, Cable, Cnnx, SurfEle, Surface, VolEle, RegionDef, Nothing, All } Object_t;
static const char *objnames[] = { "Vertex", "Cable", "Cnnx", "Surface",
static const char *objnames[] = { "Vertex", "Cable", "Cnnx", "SurfaceEdge", "Surface",
"Volume", "RegionDef", "Nothing", "All" };
static const int maxobject=6;
......
......@@ -29,7 +29,7 @@ decl {\#define TEST_VAR(A,B,C) if(!strcmp(\#A,B)){A->value(C);A->do_callback();c
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;}} {private local
decl {\#define TEST_MENUVAR(A,B,C,D) if(!strcmp(\#A,B)){if(C)A->set();else A->clear();if(A->callback())A->do_callback(D);continue;}} {private local
}
decl {\#define IGNORE_VAR(A,B) if(!strcmp(\#A,B)){continue;}} {private local
......@@ -70,15 +70,15 @@ class Controls {open
} {
Fl_Window window {
label {Meshalyzer Controls} open
xywh {1539 100 350 650} type Double box UP_BOX
xywh {972 341 350 650} type Double box UP_BOX
code0 {\#include <FL/Fl_Color_Chooser.H>}
code1 {\#include "VecData.h"} visible
} {
Fl_Menu_Bar mainbar {open
xywh {0 -1 350 30} labelcolor 1
xywh {0 0 350 30} labelcolor 1
} {
Submenu {} {
label File open
label File
xywh {0 0 100 20}
} {
MenuItem {} {
......@@ -442,12 +442,14 @@ mwtb->redraw();}
}
MenuItem revdraworder {
label {Reverse draw order}
callback {mwtb->revdraworder( (bool)(o->mvalue()->value()) );}
user_data revdraworder
callback {mwtb->revdraworder(((Fl_Menu_Item*)v)->checked());}
xywh {0 0 100 20} type Toggle
}
MenuItem norot {
label {No rotation}
callback {mwtb->norot((bool)(o->mvalue()->value()));}
user_data norot
callback {mwtb->norot(((Fl_Menu_Item*)v)->checked());}
xywh {0 0 30 20} type Toggle
}
MenuItem {} {
......@@ -500,6 +502,7 @@ s->window->show();}
}
MenuItem transBgd {
label {Transparent Bgd}
user_data transBgd
callback {mwtb->transBgd( transBgd->value() );}
xywh {0 0 30 20} type Toggle value 1
}
......@@ -569,50 +572,73 @@ mainbar->redraw();}
xywh {0 0 30 20}
}
}
Fl_Choice datachc {
label {Data on}
tooltip {use data to color which elements} xywh {75 50 110 25} down_box BORDER_BOX
code0 {o->value(4);}
Fl_Menu_Button datadest {
label {Data on:} open selected
xywh {10 45 170 30} color 26
} {
MenuItem {} {
MenuItem vertdisp {
label Vertices
callback {mwtb->datify(Vertex);}
xywh {5 5 100 20}
user_data vertdisp
callback {if(((Fl_Menu_Item*)v)->checked()) mwtb->datify(Vertex);
else mwtb->undatify(Vertex);}
xywh {0 0 30 20} type Toggle
}
MenuItem {} {
MenuItem cabledisp {
label Cables
callback {mwtb->datify(Cable);}
xywh {5 5 100 20}
user_data cabledisp
callback {if(((Fl_Menu_Item*)v)->checked()) mwtb->datify(Cable);
else mwtb->undatify(Cable);}
xywh {0 0 30 20} type Toggle
}
MenuItem {} {
label Connections
callback {mwtb->datify(Cnnx);}
xywh {15 15 100 20}
MenuItem cnnxdisp {
label Cnnx
user_data cnnxdisp
callback {if(((Fl_Menu_Item*)v)->checked()) mwtb->datify(Cnnx);
else mwtb->undatify(Cnnx);}
xywh {0 0 30 20} type Toggle
}
MenuItem {} {
label {Surface Edges}
callback {mwtb->datify(SurfEle);}
xywh {5 5 100 20}
MenuItem surfedgedisp {
label {Surface edges}
user_data surfedgedisp
callback {if(((Fl_Menu_Item*)v)->checked() ) mwtb->datify(SurfEle);
else mwtb->undatify(SurfEle);}
xywh {0 0 30 20} type Toggle
}
MenuItem {} {
label Surfaces
callback {mwtb->datify(Surface);}
xywh {5 5 100 20}
MenuItem surfdisp {
label {Surface Elements}
user_data surfdisp
callback {if(((Fl_Menu_Item*)v)->checked() ) mwtb->datify(Surface);
else mwtb->undatify(Surface);}
xywh {0 0 30 20} type Toggle value 1
}
MenuItem {} {
label Tetrahedra
callback {mwtb->datify(VolEle);}
xywh {0 0 100 20}
MenuItem voldisp {
label {Volume Elements}
user_data voldisp
callback {if(((Fl_Menu_Item*)v)->checked() ) mwtb->datify(VolEle);
else mwtb->undatify(VolEle);}
xywh {0 0 30 20} type Toggle
}
MenuItem {} {
label Nothing
callback {mwtb->datify(Nothing);}
xywh {0 0 100 20}
label ALL
callback {mwtb->datify(All);
vertdisp->check();
cabledisp->check();
cnnxdisp->check();
surfedgedisp->check();
surfdisp->check();
voldisp->check();}
xywh {0 0 30 20}
}
MenuItem {} {
label All
callback {mwtb->datify(All);}
xywh {0 0 100 20}
label NONE
callback {mwtb->undatify(All);
vertdisp->uncheck();
cabledisp->uncheck();
cnnxdisp->uncheck();
surfedgedisp->uncheck();
surfdisp->uncheck();
voldisp->uncheck();}
xywh {0 0 30 20}
}
}
Fl_Light_Button draw_axes {
......@@ -635,7 +661,7 @@ mainbar->redraw();}
xywh {195 55 90 25} type Radio down_box DIAMOND_DOWN_BOX value 1
}
Fl_Check_Button {} {
label {Tetrahedral Mesh}
label {Volume Mesh}
callback {mwtb->dispmode(asTetMesh);}
xywh {195 80 140 25} type Radio down_box DIAMOND_DOWN_BOX
}
......@@ -917,7 +943,7 @@ mwtb->redraw();}
}
Fl_Group surfgrp {
label Surface
xywh {15 310 315 175} color 93 labelfont 1 labelsize 12 labelcolor 90
xywh {15 310 315 175} color 93 labelfont 1 labelsize 12 labelcolor 90 hide
} {
Fl_Light_Button surfvisbut {
label visible
......@@ -994,7 +1020,7 @@ elehi->value( mwtb->model->globalElemnum(hsurf,lnum) );
elehi->do_callback();
refresh_surflist();
if( !mwtb->model->number(SurfEle) )
elehi->deactivate();} selected
elehi->deactivate();}
xywh {0 0 30 20}
}
}
......@@ -1135,7 +1161,7 @@ mwtb->redraw();}
}
Fl_Group auxgridgrp {
label {Aux Grid} open
xywh {15 305 320 180} box UP_BOX color 60 labelfont 1 labelsize 12 labelcolor 60 align 4 hide deactivate
xywh {15 305 320 180} box UP_BOX color 60 labelfont 1 labelsize 12 labelcolor 60 align 4 deactivate
} {
Fl_Light_Button auxgriddispbut {
label On
......@@ -1677,7 +1703,12 @@ mwtb->dataopac->save(mshzf);
SAVE_WIDGET(mshzf,read_recalibrate);
SAVE_WIDGET(mshzf,revdraworder);
SAVE_WIDGET(mshzf,datachc);
SAVE_WIDGET(mshzf,vertdisp);
SAVE_WIDGET(mshzf,cabledisp);
SAVE_WIDGET(mshzf,cnnxdisp);
SAVE_WIDGET(mshzf,surfedgedisp);
SAVE_WIDGET(mshzf,surfdisp);
SAVE_WIDGET(mshzf,voldisp);
SAVE_WIDGET(mshzf,draw_axes);
//region group
SAVE_WIDGET(mshzf,vertbut);
......@@ -1970,9 +2001,14 @@ while( mshzf.getline( buf, BUFLEN ) ) {
mwtb->stride( Cnnx, cxs );
continue;
}
TEST_MENUVAR( read_recalibrate, var, val )
TEST_MENUVAR( revdraworder, var, val )
TEST_CHOICE( datachc, var, int(val) )
TEST_MENUVAR( read_recalibrate, var, val, mainbar )
TEST_MENUVAR( revdraworder, var, val, mainbar )
TEST_MENUVAR( vertdisp, var, val, datadest )
TEST_MENUVAR( cabledisp, var, val, datadest )
TEST_MENUVAR( cnnxdisp, var, val, datadest )
TEST_MENUVAR( surfedgedisp, var, val, datadest )
TEST_MENUVAR( surfdisp, var, val, datadest )
TEST_MENUVAR( voldisp, var, val, datadest )
TEST_VAR( draw_axes, var, int(val) )
TEST_VAR( vertbut, var, int(val) )
TEST_VAR( cabbut, var, int(val) )
......
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