Commit 80554f9c authored by vigmond's avatar vigmond

corrected highlighting with element data

parent da28aecf
......@@ -1285,8 +1285,10 @@ Model::~Model()
*
* \param hinfo window in which to output text
* \param hilight list of highlighted objects
* @param data data values
* @param eledata data on elements, points o.w.
*/
void Model::hilight_info( HiLiteInfoWin* hinfo, int* hilight, DATA_TYPE* data )
void Model::hilight_info( HiLiteInfoWin* hinfo, int* hilight, DATA_TYPE* data, bool eledata )
{
hinfo->clear();
char* txt = new char[256];
......@@ -1297,7 +1299,7 @@ void Model::hilight_info( HiLiteInfoWin* hinfo, int* hilight, DATA_TYPE* data )
sprintf(txt, "@b@C%6dVertex: %d of %d", FL_DARK_GREEN, hilight[Vertex],
pt.num() );
hinfo->add( txt );
if ( data != NULL ) {
if ( data && !eledata ) {
sprintf( txt, "value: %f", data[hilight[Vertex]] );
hinfo->add( txt );
}
......@@ -1364,13 +1366,14 @@ void Model::hilight_info( HiLiteInfoWin* hinfo, int* hilight, DATA_TYPE* data )
hinfo->add( "" );
// data extrema
if( data ) {
const char *src = eledata ? "element" : "vertex";
hinfo->add( "Data Extrema" );
DATA_TYPE *mind = min_element( data, data+pt.num() );
sprintf( txt, "Minimum: %g @", *mind );
sprintf( txt, "Minimum: %g @ %s", *mind, src );
hinfo->add( txt );
hinfo->add( format_hilite( mind-data, mind-data==hilight[Vertex]) );
DATA_TYPE *maxd = max_element( data, data+pt.num() );
sprintf( txt, "Maximum: %g @", *maxd );
sprintf( txt, "Maximum: %g @ %s", *maxd, src );
hinfo->add( txt );
hinfo->add( format_hilite( maxd-data, maxd-data==hilight[Vertex]) );
hinfo->add( "" );
......@@ -1396,6 +1399,10 @@ void Model::hilight_info( HiLiteInfoWin* hinfo, int* hilight, DATA_TYPE* data )
int hivol=hilight[VolEle];
sprintf( txt, "@b@C%6dVolume Element: %d of %lu", FL_RED, hivol, _vol.size() );
hinfo->add( txt );
if ( eledata ) {
sprintf( txt, "value: %f", data[hilight[VolEle]] );
hinfo->add( txt );
}
hinfo->add( "nodes:\t" );
const int* tet=_vol[hivol]->obj();
for ( int i=0; i<_vol[hivol]->ptsPerObj(); i++ ) {
......@@ -1415,6 +1422,10 @@ void Model::hilight_info( HiLiteInfoWin* hinfo, int* hilight, DATA_TYPE* data )
FL_BLUE, hilight[SurfEle], number(SurfEle),
lele, surface(elesurf)->num(), surface(elesurf)->label().c_str());
hinfo->add( txt );
if ( eledata && !_vol.size() ) {
sprintf( txt, "value: %f", data[hilight[SurfEle]] );
hinfo->add( txt );
}
hinfo->add( "nodes:\t" );
for ( int i=0; i<surface(elesurf)->ele(lele)->ptsPerObj(); i++ ) {
int node=surface(elesurf)->ele(lele)->obj()[i];
......
......@@ -66,7 +66,7 @@ class Model
void visibility( int, bool a );
void opacity( int s, float opac );
void randomize_color( Object_t obj );
void hilight_info( HiLiteInfoWin*, int*, DATA_TYPE *d=NULL );
void hilight_info( HiLiteInfoWin*, int*, DATA_TYPE *d=NULL, bool eb=false );
void stride( Object_t o, int s ){_outstride[o]=s;}
int stride( Object_t o ) const {return _outstride[o]; }
const GLfloat* pt_offset() const {return pt.offset();}
......
......@@ -145,8 +145,10 @@ void TBmeshWin::highlight( Object_t obj, int a )
if ( obj == Vertex ) {
if( timeplotter->window->shown() ) timeplot();
if( timeplotter->graph->crvi_vis() )static_curve_info_cb(timeplotter->graph);
if( have_data != NoData) contwin->vertvalout->value( data[a] );
}
if( have_data == NoData ) return;
Object_t o=!dataBuffer->ele_based()?Vertex:(model->numVol()?VolEle:SurfEle);
if( obj==o ) contwin->vertvalout->value( data[a] );
}
......@@ -260,7 +262,8 @@ void TBmeshWin :: draw()
if ( have_data != NoData ) {
if ( (data = dataBuffer->slice(tm)) == NULL )
data = dataBuffer->slice(dataBuffer->max_tm());
contwin->dispVertVal(data[hilight[Vertex]]);
Object_t o = !dataBuffer->ele_based() ? Vertex : (model->numVol() ? VolEle : SurfEle);
contwin->dispVertVal(data[hilight[o]]);
}
if ( autocol == true ) {
......@@ -1306,7 +1309,7 @@ void TBmeshWin :: randomize_color( Object_t obj )
void TBmeshWin :: hiliteinfo()
{
model->hilight_info( hinfo, hilight, data );
model->hilight_info( hinfo, hilight, data, data&&dataBuffer->ele_based() );
}
......
# data file for the Fltk User Interface Designer (fluid)
version 1.0400
version 1.0305
header_name {.h}
code_name {.cc}
decl {\#include "Surfaces.h"} {public local
......@@ -919,7 +919,7 @@ reglist->do_callback();}
xywh {10 270 330 260} align 0
} {
Fl_Group hilightgrp {
label Highlight selected
label Highlight open
xywh {10 305 330 225} color 11 labelfont 1 labelsize 12 labelcolor 121 align 4
} {
Fl_Value_Input tethi {
......@@ -1003,8 +1003,8 @@ reglist->do_callback();}
tooltip {display info on highlighted objects} xywh {150 490 65 30} box ROUND_UP_BOX color 133 labelsize 18
}
Fl_Value_Output vertvalout {
label {:value}
tooltip {data value of highlighted vertex} xywh {190 420 85 25} color 174 align 8
label {:value} selected
tooltip {data value of highlighted vertex/element} xywh {190 420 85 25} color 174 align 8
}
Fl_Choice hitettype {
tooltip {display style} xywh {15 355 85 25} down_box BORDER_BOX textsize 10
......
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