added addObserver function to layer
This commit is contained in:
parent
7d4fde3485
commit
feec302053
|
|
@ -1,4 +1,6 @@
|
|||
#include "Layer.h"
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
|
|
@ -8,3 +10,8 @@ vtkSmartPointer<vtkRenderer> Layer::getLayer() {
|
|||
|
||||
void Layer::updateData(int t) {
|
||||
}
|
||||
|
||||
|
||||
void Layer::addObserver(const char *event, vtkCommand *observer) {
|
||||
this->getLayer()->GetRenderWindow()->GetInteractor()->AddObserver(event, observer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef LAYER_H
|
||||
#define LAYER_H
|
||||
|
||||
#include <vtkInteractorStyle.h>
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
/** This class represents one abstract layer to be rendered to VTK.
|
||||
|
|
@ -21,6 +22,12 @@ public:
|
|||
* @param t : the timestamp which the data should reflect.
|
||||
*/
|
||||
virtual void updateData(int t);
|
||||
|
||||
/** Adds an observer to the renderWindowinteractor within which this layer is active.
|
||||
* @param event : the specific event type to subscribe to (see the vtkCommand::EventIds enum)
|
||||
* @param observer : the observer to add.
|
||||
*/
|
||||
virtual void addObserver(const char *event, vtkCommand *observer);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue