MCPcopy Create free account
hub / github.com/MITK/MITK / GetAnnotationRenderer

Method GetAnnotationRenderer

Modules/Core/src/Rendering/mitkAnnotationUtils.cpp:23–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 AnnotationUtils::AnnotationUtils() {}
22 AnnotationUtils::~AnnotationUtils() {}
23 AbstractAnnotationRenderer *AnnotationUtils::GetAnnotationRenderer(const std::string &arTypeID,
24 const std::string &rendererID)
25 {
26 // get the context
27 us::ModuleContext *context = us::GetModuleContext();
28
29 // specify a filter that defines the requested type
30 std::string filter = "(&(" + AbstractAnnotationRenderer::US_PROPKEY_ID + "=" + arTypeID + ")(" +
31 AbstractAnnotationRenderer::US_PROPKEY_RENDERER_ID + "=" + rendererID + "))";
32 // find the fitting service
33 std::vector<us::ServiceReferenceU> serviceReferences =
34 context->GetServiceReferences(AbstractAnnotationRenderer::US_INTERFACE_NAME, filter);
35
36 // check if a service reference was found. It is also possible that several
37 // services were found. This is not checked here, just the first one is taken.
38 AbstractAnnotationRenderer *ar = nullptr;
39 if (serviceReferences.size())
40 {
41 ar = context->GetService<AbstractAnnotationRenderer>(serviceReferences.front());
42 }
43 // no service reference was found or found service reference has no valid source
44 return ar;
45 }
46
47 void AnnotationUtils::RegisterAnnotationRenderer(AbstractAnnotationRenderer *annotationRenderer)
48 {

Callers

nothing calls this directly

Calls 4

GetModuleContextFunction · 0.85
GetServiceReferencesMethod · 0.80
frontMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected