15 #include "vtkCallbackCommand.h" 16 #include "vtkCommand.h" 24 const std::string &rendererID)
33 std::vector<us::ServiceReferenceU> serviceReferences =
39 if (serviceReferences.size())
56 AnnotationRendererServices.push_back(std::unique_ptr<AbstractAnnotationRenderer>(annotationRenderer));
63 annotationRenderer->Update();
71 annotationRenderer->CurrentBaseRendererChanged();
73 vtkCallbackCommand *renderCallbackCommand = vtkCallbackCommand::New();
74 renderCallbackCommand->SetCallback(AnnotationUtils::RenderWindowCallback);
75 renderer->
GetRenderWindow()->AddObserver(vtkCommand::ModifiedEvent, renderCallbackCommand);
76 renderCallbackCommand->Delete();
79 void AnnotationUtils::RenderWindowCallback(vtkObject *caller,
unsigned long,
void *,
void *)
81 auto *renderWindow =
dynamic_cast<vtkRenderWindow *
>(caller);
86 if (
nullptr != renderer)
89 annotationRenderer->OnRenderWindowModified();
97 std::vector<us::ServiceReference<mitk::Annotation>> annotations =
100 if (!annotations.empty())
115 std::vector<us::ServiceReferenceU> serviceReferences =
117 std::vector<AbstractAnnotationRenderer *> arList;
const std::string GetRendererID() const
static void UpdateAnnotationRenderer(const std::string &rendererID)
UpdateAnnotationRenderer is a convenience function which calls AbstractAnnotationRenderer::Update for...
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
ServiceRegistrationU RegisterService(const InterfaceMap &service, const ServiceProperties &properties=ServiceProperties())
virtual T GetService(const ServiceReferenceType &reference) const
static const std::string US_PROPKEY_RENDERER_ID
static const std::string US_INTERFACE_NAME
static const std::string US_PROPKEY_ID
Organizes the rendering process.
static mitk::Annotation * GetAnnotation(const std::string &AnnotationID)
GetAnnotation returns a registered Annotation for a specified ID.
static const std::string US_PROPKEY_ID
DataCollection - Class to facilitate loading/accessing structured data.
static void RegisterAnnotationRenderer(AbstractAnnotationRenderer *annotationRenderer)
RegisterAnnotationRenderer registers an AnnotationRenderer as a microservice and saves a reference to...
void * GetService(const ServiceReferenceBase &reference)
static AbstractAnnotationRenderer * GetAnnotationRenderer(const std::string &arTypeID, const std::string &rendererID)
GetAnnotationRenderer returns a registered AnnotationRenderer of a specific type and for a BaseRender...
std::vector< std::unique_ptr< AbstractAnnotationRenderer > > AnnotationRendererServices
static void BaseRendererChanged(BaseRenderer *renderer)
BaseRendererChanged has to be called in the case that the actual BaseRenderer object for a BaseRender...
const std::string GetID() const
Baseclass of Annotation layouters An AbstractAnnotationRenderer can be implemented to control a set o...
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
Base class for all Annotation This class is to be implemented in order to create Annotation which are...
vtkRenderWindow * GetRenderWindow() const
Access the RenderWindow into which this renderer renders.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
const char * GetName() const
get the name of the Renderer