OpenWalnut  1.5.0dev
WMDatasetProfile.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009, 2017 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include <memory>
26 #include <string>
27 #include <vector>
28 
29 #include <osg/LightModel>
30 #include <osgGA/StateSetManipulator>
31 #include <osgGA/TrackballManipulator>
32 #include <osgViewer/ViewerEventHandlers>
33 #include <osgWidget/Util> //NOLINT
34 #include <osgWidget/ViewerEventHandlers> //NOLINT
35 #include <osgWidget/WindowManager> //NOLINT
36 
37 #include "WMDatasetProfile.h"
38 #include "WMDatasetProfile.xpm" // Please put a real icon here.
39 #include "core/kernel/WKernel.h"
40 #include "core/kernel/WSelectionManager.h"
41 
42 // This line is needed by the module loader to actually find your module. Do not remove. Do NOT add a ";" here.
43 W_LOADABLE_MODULE( WMDatasetProfile )
44 
45 WMDatasetProfile::WMDatasetProfile():
46  WModule(),
47  m_dirty( true )
48 {
49 }
50 
51 WMDatasetProfile::~WMDatasetProfile()
52 {
53  // Cleanup!
54 }
55 
56 std::shared_ptr< WModule > WMDatasetProfile::factory() const
57 {
58  // See "src/modules/template/" for an extensively documented example.
59  return std::shared_ptr< WModule >( new WMDatasetProfile() );
60 }
61 
62 const char** WMDatasetProfile::getXPMIcon() const
63 {
64  return WMDatasetProfile_xpm; // Please put a real icon here.
65 }
66 const std::string WMDatasetProfile::getName() const
67 {
68  return "Dataset Profile";
69 }
70 
71 const std::string WMDatasetProfile::getDescription() const
72 {
73  return "Show values along a 3D profile through the dataset as a graph.";
74 }
75 
77 {
78  // the input dataset is just used as source for resolurtion and transformation matrix
79  m_input = std::shared_ptr< WModuleInputData < WDataSetScalar > >(
80  new WModuleInputData< WDataSetScalar >( shared_from_this(), "in", "The input dataset." ) );
82 
84 }
85 
87 {
88  m_propCondition = std::shared_ptr< WCondition >( new WCondition() );
89 
90  m_snapSelectionsList = std::shared_ptr< WItemSelection >( new WItemSelection() );
91  m_snapSelectionsList->addItem( "Free", "No snapping." );
92  m_snapSelectionsList->addItem( "Axial slice", "Snap to axial slice." );
93  m_snapSelectionsList->addItem( "Coronal slice", "Snap to coronal slice." );
94  m_snapSelectionsList->addItem( "Sagittal slice", "Snap to sagittal slice." );
95 
96  m_snapSelection = m_properties->addProperty( "Snap to", "Snap the profile to one of the slices of the Navigation Slices Module.",
97  m_snapSelectionsList->getSelectorFirst(), m_propCondition );
99 
100  m_propAddKnobTrigger = m_properties->addProperty( "Add knob",
101  "Add a segment and a corresponding manipulator knob to profile.",
103  m_propCondition );
104 
105  m_graphColor = m_properties->addProperty( "Graph color",
106  "Color of the curve representing the data profile graph.",
107  WColor( 0.2, 0.2, 0.2, 1.0 ) );
108 
109  m_propLength = m_properties->addProperty( "Length",
110  "Length of profile segments. Needs to activated by Use Length property",
111  60.0 );
112  m_propLength->setMin( 1 );
113  m_propLength->setMax( 500 );
114  m_propUseLength = m_properties->addProperty( "Use length", "Apply the value of the Length property.", false );
115 
116  m_propInterpolate = m_properties->addProperty( "Interpolate",
117  "Use value of voxel closest to sample or interpolate between surrounding values.",
118  true );
119 
120  m_propNumSamples = m_properties->addProperty( "Number of sample points", "Number of samples along the overall profile.", 100 );
121  m_propNumSamples->setMin( 1 );
122  m_propNumSamples->setMax( 500 );
123 
125 }
126 
128 {
129  // Put the code for your requirements here. See "src/modules/template/" for an extensively documented example.
130 }
131 
133 {
134  m_moduleState.setResetable( true, true );
135  m_moduleState.add( m_input->getDataChangedCondition() );
137  m_moduleState.add( m_active->getUpdateCondition() );
138 
139  init();
140 
141  ready();
142 
143  m_dirty = true;
144 
145  // wait for a dataset to be connected, most likely an anatomy dataset
146  while( !m_shutdownFlag() )
147  {
149 
150  if( m_shutdownFlag() )
151  {
152  break;
153  }
154 
155  std::shared_ptr< WDataSetScalar > newDataSet = m_input->getData();
156  bool dataChanged = ( m_dataSet != newDataSet );
157  bool dataValid = ( newDataSet != NULL );
158 
159  if( dataValid )
160  {
161  if( dataChanged )
162  {
163  m_dataSet = newDataSet;
164  m_grid = std::dynamic_pointer_cast< WGridRegular3D >( m_dataSet->getGrid() );
165  }
166  }
167 
168  if( m_snapSelection->changed( true ) )
169  {
170  m_dirty = true;
171  }
172 
173  if( m_propAddKnobTrigger->changed( true ) )
174  {
175  WPosition center = WKernel::getRunningKernel()->getSelectionManager()->getCrosshair()->getPosition();
176  addKnob( center );
177 
179  }
180 
181 
182  if( m_propUseLength->changed() || m_propLength->changed() || m_propInterpolate->changed( true ) || m_propNumSamples->changed( true ) )
183  {
184  m_dirty = true;
185  }
186  }
187 
188  for( size_t i = 0; i < knobs.size(); ++i )
189  {
190  WGraphicsEngine::getGraphicsEngine()->getScene()->remove( &( *knobs[i] ) );
191  knobs[i]->removeROIChangeNotifier( m_changeRoiSignal );
192  }
193 
194  WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_rootNode );
195 }
196 
198 {
199  WPosition center = WKernel::getRunningKernel()->getSelectionManager()->getCrosshair()->getPosition();
200 
201  for( size_t i = 0; i < knobs.size(); ++i )
202  {
203  knobs[i]->setLockX( false );
204  knobs[i]->setLockY( false );
205  knobs[i]->setLockZ( false );
206  }
207  switch( m_snapSelection->get( true ).getItemIndexOfSelected( 0 ) )
208  {
209  case 0:
210  break;
211  case 1:
212  for( size_t i = 0; i < knobs.size(); ++i )
213  {
214  knobs[i]->setZ( center[2] );
215  knobs[i]->setLockZ( true );
216  }
217  break;
218  case 2:
219  for( size_t i = 0; i < knobs.size(); ++i )
220  {
221  knobs[i]->setY( center[1] );
222  knobs[i]->setLockY( true );
223  }
224  break;
225  case 3:
226  for( size_t i = 0; i < knobs.size(); ++i )
227  {
228  knobs[i]->setX( center[0] );
229  knobs[i]->setLockX( true );
230  }
231  break;
232  default:
233  break;
234  }
235 
236  if( m_propUseLength->get( true ) )
237  {
238  for( size_t i = 0; i < knobs.size() - 1; ++i )
239  {
240  WPosition p1 = knobs[i]->getPosition();
241  WPosition p2 = knobs[i+1]->getPosition();
242 
243  float l = sqrt( ( p1[0] - p2[0] ) * ( p1[0] - p2[0] ) +
244  ( p1[1] - p2[1] ) * ( p1[1] - p2[1] ) +
245  ( p1[2] - p2[2] ) * ( p1[2] - p2[2] ) );
246 
247  float mult = m_propLength->get( true ) / l;
248 
249  WPosition vec = p2 - p1;
250 
251  if( ( fabs( l - static_cast<float>( m_propLength->get( true ) ) ) ) > 0.001 )
252  {
253  knobs[i+1]->setPosition( p1 + vec * mult );
254  }
255  }
256  }
257 
258  m_dirty = true;
259  update();
260 }
261 
263 {
264  m_dirty = true;
265 }
266 
267 
269 {
271  WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_rootNode );
272  m_lineGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
273  m_lineGeode->setName( "_line" );
274  m_rootNode->insert( m_lineGeode );
275 
277  = std::shared_ptr< boost::function< void() > >( new boost::function< void() >( boost::bind( &WMDatasetProfile::setDirty, this ) ) );
278 
279  WPosition center = WKernel::getRunningKernel()->getSelectionManager()->getCrosshair()->getPosition();
280 
281  addKnob( WPosition( center[0] + 30, center[1], center[2] ) );
282  addKnob( WPosition( center[0] - 30, center[1], center[2] ) );
283 
284  osg::ref_ptr<osgViewer::View> viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getView();
285 
286  int height = viewer->getCamera()->getViewport()->height();
287  int width = viewer->getCamera()->getViewport()->width();
288 
289  m_oldViewHeight = height;
290  m_oldViewWidth = width;
291 
292  m_graphNode = osg::ref_ptr< WGEManagedGroupNode >( new WGEManagedGroupNode( m_active ) );
293  m_rootNode->insert( m_graphNode );
294 
295  m_wm = new osgWidget::WindowManager( viewer, 0.0f, 0.0f, MASK_2D );
296 
297  m_camera = new WGECamera();
298  m_camera->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::PROTECTED | osg::StateAttribute::OFF );
299 
300  m_camera->setProjectionMatrix( osg::Matrix::ortho2D( 0.0, width, 0.0f, height ) );
301  m_camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
302  m_camera->setViewMatrix( osg::Matrix::identity() );
303  m_camera->setClearMask( GL_DEPTH_BUFFER_BIT );
304  m_camera->setRenderOrder( WGECamera::POST_RENDER );
305 
306  m_graphNode->addChild( m_camera );
307  m_camera->addChild( m_wm );
308 
309  viewer->addEventHandler( new osgWidget::MouseHandler( m_wm ) );
310  viewer->addEventHandler( new osgWidget::KeyboardHandler( m_wm ) );
311  viewer->addEventHandler( new osgWidget::ResizeHandler( m_wm, m_camera ) );
312  viewer->addEventHandler( new osgWidget::CameraSwitchHandler( m_wm, m_camera ) );
313  viewer->addEventHandler( new osgViewer::StatsHandler() );
314  viewer->addEventHandler( new osgViewer::WindowSizeHandler() );
315  viewer->addEventHandler( new osgGA::StateSetManipulator( viewer->getCamera()->getOrCreateStateSet() ) );
316 
317  m_wm->resizeAllWindows();
318 
319  m_rootNode->addUpdateCallback( new WGEFunctorCallback< osg::Node >( boost::bind( &WMDatasetProfile::updateCallback, this ) ) );
320 }
321 
323 {
324  osg::ref_ptr<WROISphere> s = osg::ref_ptr<WROISphere>( new WROISphere( pos, 2.5 ) );
325  WGraphicsEngine::getGraphicsEngine()->getScene()->addChild( &( *s ) );
326  knobs.push_back( s );
327  s->addROIChangeNotifier( m_changeRoiSignal );
328 
329  for( size_t i = 0; i < knobs.size(); ++i )
330  {
331  knobs[i]->setColor( osg::Vec4( 0.0, 1.0, 1.0, 1.0 ) );
332  }
333  knobs[0]->setColor( osg::Vec4( 0.0, 1.0, 0.0, 1.0 ) );
334  knobs[knobs.size()- 1]->setColor( osg::Vec4( 1.0, 0.0, 0.0, 1.0 ) );
335 }
336 
338 {
339  m_lineGeode->removeDrawables( 0, 1 );
340 
341  if( m_active->get() )
342  {
343  osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
344  osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
345  osg::ref_ptr< osg::Geometry > geometry = osg::ref_ptr< osg::Geometry >( new osg::Geometry );
346 
347  for( size_t i = 0; i < knobs.size(); ++i )
348  {
349  vertices->push_back( osg::Vec3( knobs[i]->getPosition() ) );
350  }
351 
352  geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINE_STRIP, 0, vertices->size() ) );
353  geometry->setVertexArray( vertices );
354 
355  colors->push_back( m_graphColor->get() );
356  geometry->setColorArray( colors );
357  geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
358 
359  // disable light for this geode as lines can't be lit properly
360  osg::StateSet* state = m_lineGeode->getOrCreateStateSet();
361  state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
362 
363  m_lineGeode->addDrawable( geometry );
364 
365  osg::ref_ptr<osgViewer::View> viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewer()->getView();
366 
367  int height = viewer->getCamera()->getViewport()->height();
368  int width = viewer->getCamera()->getViewport()->width();
369 
370  if( ( height != m_oldViewHeight ) || width != m_oldViewWidth || m_active->changed( true ) )
371  {
372  m_oldViewHeight = height;
373  m_oldViewWidth = width;
374 
375  m_camera->removeChild( m_graphGridGeode );
377  m_camera->addChild( m_graphGridGeode );
378  }
379 
380  m_camera->removeChild( m_graphGeode );
382  m_camera->addChild( m_graphGeode );
383 
384  for( size_t i = 0; i < knobs.size(); ++i )
385  {
386  knobs[i]->unhide();
387  }
388 
389  m_dirty = false;
390  }
391  else
392  {
393  for( size_t i = 0; i < knobs.size(); ++i )
394  {
395  knobs[i]->hide();
396  }
397  m_camera->removeChild( m_graphGridGeode );
398  m_camera->removeChild( m_graphGeode );
399  }
400 }
401 
402 osg::ref_ptr< osg::Geode > WMDatasetProfile::createGraphGridGeode()
403 {
404  osg::ref_ptr< osg::Geode > newGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
405 
406  osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
407  osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
408  osg::ref_ptr< osg::Geometry > geometry = osg::ref_ptr< osg::Geometry >( new osg::Geometry );
409 
410  int step = ( m_oldViewWidth - 20 ) / 10;
411  int i;
412  for( i = 10; i < m_oldViewWidth; i += step )
413  {
414  vertices->push_back( osg::Vec3( i, m_oldViewHeight / 2, 0 ) );
415  vertices->push_back( osg::Vec3( i, 10, 0 ) );
416  }
417  i -= step;
418  int yStep = ( m_oldViewHeight / 2 - 10 ) / 4;
419 
420  vertices->push_back( osg::Vec3( 10, 10, 0 ) );
421  vertices->push_back( osg::Vec3( i, 10, 0 ) );
422 
423  vertices->push_back( osg::Vec3( 10, yStep, 0 ) );
424  vertices->push_back( osg::Vec3( i, yStep, 0 ) );
425 
426  vertices->push_back( osg::Vec3( 10, yStep * 2, 0 ) );
427  vertices->push_back( osg::Vec3( i, yStep * 2, 0 ) );
428 
429  vertices->push_back( osg::Vec3( 10, yStep * 3, 0 ) );
430  vertices->push_back( osg::Vec3( i, yStep * 3, 0 ) );
431 
432  vertices->push_back( osg::Vec3( 10, m_oldViewHeight / 2, 0 ) );
433  vertices->push_back( osg::Vec3( i, m_oldViewHeight / 2, 0 ) );
434 
435  vertices->push_back( osg::Vec3( 10, 10, 0 ) );
436  vertices->push_back( osg::Vec3( i, 10, 0 ) );
437 
438 
439  geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, vertices->size() ) );
440  geometry->setVertexArray( vertices );
441 
442  WColor color( 0.7, 0.7, 0.7, 1.0 );
443  colors->push_back( color );
444  geometry->setColorArray( colors );
445  geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
446 
447  // disable light for this geode as lines can't be lit properly
448  osg::StateSet* state = m_lineGeode->getOrCreateStateSet();
449  state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
450 
451  newGeode->addDrawable( geometry );
452 
453  return newGeode;
454 }
455 
456 osg::ref_ptr< osg::Geode > WMDatasetProfile::createGraphGeode()
457 {
458  if( !m_dataSet )
459  {
460  return osg::ref_ptr< osg::Geode >();
461  }
462 
463  osg::ref_ptr< osg::Geode > newGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
464 
465  osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
466  osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
467  osg::ref_ptr< osg::Geometry > geometry = osg::ref_ptr< osg::Geometry >( new osg::Geometry );
468 
469  std::vector<float>knobPositions;
470 
471  float max = m_dataSet->getValueSet()->getMaximumValue();
472  float value;
473 
474  float overallLength = 0;
475  std::vector<float> segmentLengths;
476  for( size_t k = 0; k < knobs.size() - 1 ; ++k )
477  {
478  WPosition p = ( knobs[k+1]->getPosition() - knobs[k]->getPosition() );
479  segmentLengths.push_back( length( p ) );
480  overallLength += length( p );
481  }
482 
483  float x = 12;
484  float y;
485  for( size_t k = 0; k < knobs.size() - 1 ; ++k )
486  {
487  float l1 = segmentLengths[k] / overallLength;
488  int steps = m_propNumSamples->get() * l1;
489 
490  knobPositions.push_back( x );
491  WPosition p1 = ( knobs[k+1]->getPosition() - knobs[k]->getPosition() ) / static_cast<float>( steps );
492 
493  for( int i = 0; i < steps; ++i )
494  {
495  if( m_propInterpolate->get() )
496  {
497  bool success;
498  value = m_dataSet->interpolate( knobs[k]->getPosition() + p1 * i, &success );
499  }
500  else
501  {
502  value = m_dataSet->getValueAt( m_grid->getVoxelNum( knobs[k]->getPosition() + p1 * i ) );
503  }
504 
505 
506  x = x + ( m_oldViewWidth / m_propNumSamples->get() );
507  y = 10 + ( value / max * ( m_oldViewHeight - 20 ) / 2 );
508  vertices->push_back( osg::Vec3( x, y, 0 ) );
509  }
510  }
511  knobPositions.push_back( x );
512 
513  for( size_t j = 0; j < knobPositions.size(); ++j )
514  {
515  vertices->push_back( osg::Vec3( knobPositions[j], m_oldViewHeight / 2, 0 ) );
516  vertices->push_back( osg::Vec3( knobPositions[j], 10, 0 ) );
517  }
518 
519  geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINE_STRIP, 0, vertices->size() - knobPositions.size() * 2 ) );
520  geometry->setVertexArray( vertices );
521 
522  geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, vertices->size() - ( knobPositions.size() ) * 2,
523  ( knobPositions.size() + 1 ) * 2 ) );
524 
525  colors->push_back( m_graphColor->get() );
526  geometry->setColorArray( colors );
527  geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
528 
529  // disable light for this geode as lines can't be lit properly
530  osg::StateSet* state = m_lineGeode->getOrCreateStateSet();
531  state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
532 
533  newGeode->addDrawable( geometry );
534 
535  return newGeode;
536 }
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
Class to encapsulate boost::condition_variable_any.
Definition: WCondition.h:42
Class for wrapping around the OSG Camera class.
Definition: WGECamera.h:36
This callback allows you a simple usage of callbacks in your module.
This class adds some convenience methods to WGEGroupNode.
static std::shared_ptr< WGraphicsEngine > getGraphicsEngine()
Returns instance of the graphics engine.
A class containing a list of named items.
std::shared_ptr< WSelectionManager > getSelectionManager()
get for selection manager
Definition: WKernel.cpp:214
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
Definition: WKernel.cpp:117
std::shared_ptr< WGraphicsEngine > getGraphicsEngine() const
Returns pointer to currently running instance of graphics engine.
Definition: WKernel.cpp:122
Someone should add some documentation here.
WPropSelection m_snapSelection
Selection property for clusters.
std::shared_ptr< WGridRegular3D > m_grid
stores a pointer to the grid we use;
osg::ref_ptr< osg::Geode > createGraphGeode()
creates an osg node that contains the graph
int m_oldViewWidth
stores the old viewport resolution to check whether a resize happened
WGECamera * m_camera
stores the camera object
WPropBool m_propUseLength
enforce lengths
bool m_dirty
dirty flag to indicate that redrawing is needed
WPropTrigger m_propAddKnobTrigger
Adds a knob.
virtual const std::string getDescription() const
Gives back a description of this module.
std::vector< osg::ref_ptr< WROISphere > > knobs
stores pointers to the control knobs
osg::ref_ptr< WGEManagedGroupNode > m_rootNode
The root node used for this modules graphics.
osg::ref_ptr< osg::Geode > m_lineGeode
The geometry rendered by this module.
std::shared_ptr< WDataSetScalar > m_dataSet
This is a pointer to the dataset the module is currently working on.
osg::ref_ptr< WGEManagedGroupNode > m_graphNode
Pointer to the graph group node.
std::shared_ptr< WItemSelection > m_snapSelectionsList
A list of cluster selection methods.
osg::ref_ptr< osg::Geode > m_graphGeode
osg node for the graph
virtual const std::string getName() const
Gives back the name of this module.
virtual void moduleMain()
Entry point after loading the module.
osg::ref_ptr< osg::Geode > m_graphGridGeode
osg node for the grid
void addKnob(WPosition pos)
adds a control knob
int m_oldViewHeight
stores the old viewport resolution to check whether a resize happened
virtual void connectors()
Initialize the connectors this module is using.
osg::ref_ptr< osg::Geode > createGraphGridGeode()
creates an osg node that contains the underlying grid
void updateCallback()
update function, called with each update pass of the osg render loop
std::shared_ptr< boost::function< void() > > m_changeRoiSignal
Signal that can be used to update the graph.
WPropInt m_propNumSamples
number of sample points on the graph
void setDirty()
sets the dirty flag, used as callback for control knob changes
void init()
initializes the controls and osg nodes
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input
An input connector that accepts order 1 datasets.
WPropBool m_propInterpolate
interpolate the graph
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
void update()
updates the osg nodes
virtual void properties()
Initialize the properties for this module.
WPropDouble m_propLength
length between knobs
WPropColor m_graphColor
color of the graph
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
osgWidget::WindowManager * m_wm
stores a pointer to the window manager used for osg wdgets and overlay stuff
virtual void requirements()
Initialize requirements for this module.
Class offering an instantiate-able data connection between modules.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
virtual void properties()
Initialize properties in this function.
Definition: WModule.cpp:212
void addConnector(std::shared_ptr< WModuleInputConnector > con)
Adds the specified connector to the list of inputs.
Definition: WModule.cpp:108
std::shared_ptr< WProperties > m_properties
The property object for the module.
Definition: WModule.h:640
void ready()
Call this whenever your module is ready and can react on property changes.
Definition: WModule.cpp:505
WConditionSet m_moduleState
The internal state of the module.
Definition: WModule.h:703
WPropBool m_active
True whenever the module should be active.
Definition: WModule.h:723
virtual void connectors()
Initialize connectors in this function.
Definition: WModule.cpp:208
This only is a 3d double vector.
A sphere representing a region of interest.
Definition: WROISphere.h:44
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
@ PV_TRIGGER_READY
Trigger property: is ready to be triggered (again)
void addTo(WPropSelection prop)
Add the PC_SELECTONLYONE constraint to the property.