26 itk::MemberCommand<mitk::Annotation>::Pointer _PropertyListModifiedCommand =
27 itk::MemberCommand<mitk::Annotation>::New();
28 _PropertyListModifiedCommand->SetCallbackFunction(
this, &mitk::Annotation::PropertyListModified);
29 m_PropertyListModifiedObserverTag =
m_PropertyList->AddObserver(itk::ModifiedEvent(), _PropertyListModifiedCommand);
30 this->
SetName(this->GetNameOfClass());
35 void mitk::Annotation::PropertyListModified(
const itk::Object * ,
const itk::EventObject &)
47 if (this->m_ServiceRegistration)
50 std::vector<std::string> propertyKeys;
51 m_ServiceRegistration.
GetReference().GetPropertyKeys(propertyKeys);
52 for (std::string key : propertyKeys)
54 props[key] = m_ServiceRegistration.
GetReference().GetProperty(key);
56 props[propertyKey] = value;
75 if ((overwrite) || (
GetProperty(propertyKey) ==
nullptr))
89 if (property.IsNotNull())
99 if (boolprop.IsNull())
102 boolValue = boolprop->GetValue();
109 if (intprop.IsNull())
112 intValue = intprop->GetValue();
119 if (floatprop.IsNull())
122 floatValue = floatprop->GetValue();
129 if (stringProp.IsNull())
136 string = stringProp->GetValue();
219 return IsOn(propertyKey, defaultIsOn);
225 if (colorprop.IsNull())
228 memcpy(rgb, colorprop->GetColor().GetDataPointer(), 3 *
sizeof(float));
258 if (opacityprop.IsNull())
261 opacity = opacityprop->GetValue();
283 if (m_LastGenerateDataTime < Annotation->GetMTime())
286 if (m_LastGenerateDataTime < Annotation->
GetPropertyList()->GetMTime())
289 if (renderer && m_LastGenerateDataTime < renderer->GetTimeStepUpdateTime())
308 m_ForceInForeground = forceForeground;
313 return m_ForceInForeground;
328 if (m_ServiceRegistration !=
nullptr)
334 m_ServiceRegistration = context->RegisterService(
this, props);
339 if (m_ServiceRegistration !=
nullptr)
341 m_ServiceRegistration = 0;
ServiceReference< I1 > GetReference(InterfaceType< I1 >) const
virtual std::string GetName() const
Extra convenience access method for accessing the name of an object (instance of StringProperty with ...
void SetProperty(const std::string &propertyKey, const BaseProperty::Pointer &property)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
void SetVisibility(bool visible, const std::string &propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
void SetText(std::string text)
mitk::BaseProperty * GetProperty(const std::string &propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
void AddProperty(const std::string &propertyKey, const BaseProperty::Pointer &property, bool overwrite=false)
Add the property (instance of BaseProperty) if it does not exist (or always if overwrite is true) wit...
virtual const char * GetValue() const
Container for position and size on the display.
void SetUSProperty(const std::string &propertyKey, us::Any value)
bool GetFloatProperty(const std::string &propertyKey, float &floatValue) const
Convenience access method for float properties (instances of FloatProperty)
virtual void RegisterAsMicroservice(us::ServiceProperties props)
Registers this object as a Microservice, making it available to every module and/or plugin...
PropertyList::Pointer m_PropertyList
BaseRenderer-independent PropertyList.
bool IsOn(const std::string &propertyKey, bool defaultIsOn=true) const
Convenience access method for boolean properties (instances of BoolProperty). Return value is the val...
itk::Point< double, 2 > Size
static const std::string US_PROPKEY_ID
bool IsVisible(const std::string &propertyKey="visible", bool defaultIsOn=true) const
Convenience access method for visibility properties (instances of BoolProperty). Return value is the ...
Organizes the rendering process.
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Annotation *Annotation)
void AnnotationModified()
Key-value list holding instances of BaseProperty.
static const std::string US_INTERFACE_NAME
These Constants are used in conjunction with Microservices.
bool GetVisibility(bool &visible, const std::string &propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
virtual void UnRegisterMicroservice()
Registers this object as a Microservice, making it available to every module and/or plugin...
void SetColor(const mitk::Color &color, const std::string &propertyKey="color")
Convenience method for setting color properties (instances of ColorProperty)
void SetDoubleProperty(const std::string &propertyKey, double doubleValue)
Convenience method for setting int properties (instances of IntProperty)
The ColorProperty class RGB color property.
static const std::string US_PROPKEY_AnnotationNAME
virtual Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const
Returns position and size of the Annotation on the display.
Abstract base class for properties.
itk::Point< double, 2 > Position
void ConcatenatePropertyList(PropertyList *pList, bool replace=false)
Add values from another PropertyList.
std::string GetMicroserviceID()
Returns the id that this device is registered with. The id will only be valid, if the Annotation has ...
bool GetColor(float rgb[], const std::string &propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
void SetStringProperty(const std::string &propertyKey, const std::string &string)
Convenience method for setting int properties (instances of IntProperty)
void SetOpacity(float opacity, const std::string &propertyKey="opacity")
Convenience method for setting opacity properties (instances of FloatProperty)
void SetFloatProperty(const std::string &propertyKey, float floatValue)
Convenience method for setting int properties (instances of IntProperty)
void ReplaceProperty(const std::string &propertyKey, const BaseProperty::Pointer &property)
Replace the property (instance of BaseProperty) with key propertyKey in the PropertyList of the rende...
Annotation()
explicit constructor which disallows implicit conversions
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
void SetBoolProperty(const std::string &propertyKey, bool boolValue)
Convenience method for setting int properties (instances of IntProperty)
Base class for all Annotation This class is to be implemented in order to create Annotation which are...
static const std::string US_PROPKEY_RENDERER_ID
static const std::string US_PROPKEY_AR_ID
std::string GetText() const
virtual void SetName(const std::string &name)
Extra convenience access method to set the name of an object.
bool GetOpacity(float &opacity, const std::string &propertyKey="opacity") const
Convenience access method for opacity properties (instances of FloatProperty)
static const char * replace[]
This is a dictionary to replace long names of classes, modules, etc. to shorter versions in the conso...
~Annotation() override
virtual destructor in order to derive from this class
void SetProperties(const ServiceProperties &properties)
bool GetBoolProperty(const std::string &propertyKey, bool &boolValue) const
Convenience access method for bool properties (instances of BoolProperty)
bool GetStringProperty(const std::string &propertyKey, std::string &string) const
Convenience access method for string properties (instances of StringProperty)
PropertyList * GetPropertyList() const
void SetFontSize(int fontSize)
void SetIntProperty(const std::string &propertyKey, int intValue)
Convenience method for setting int properties (instances of IntProperty)
virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds &)
Sets position and size of the Annotation on the display.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void SetForceInForeground(bool forceForeground)
bool IsForceInForeground() const
bool GetIntProperty(const std::string &propertyKey, int &intValue) const
Convenience access method for int properties (instances of IntProperty)
static const std::string US_PROPKEY_MODIFIED