added addObserver function to layer

This commit is contained in:
djaidjai committed 2024-05-05 08:29:55 +02:00
1 parent 7d4fde3485
commit feec302053
2 files changed
+14

No files matched your search

+7
View File
@@ -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);
}
+7
View File
@@ -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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.