diff --git a/Core/Code/Rendering/Overlays/mitkBaseLayouter.h b/Core/Code/Rendering/Overlays/mitkBaseLayouter.h index 4bc1c92e95..2ba7291ad0 100644 --- a/Core/Code/Rendering/Overlays/mitkBaseLayouter.h +++ b/Core/Code/Rendering/Overlays/mitkBaseLayouter.h @@ -1,87 +1,96 @@ /*=================================================================== * The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef BASELAYOUTER_H #define BASELAYOUTER_H #include #include #include #include "mitkBaseRenderer.h" #include "mitkOverlay.h" namespace mitk { /** @brief Baseclass of Overlay layouters */ /** *A BaseLayouter can be implemented to control a set of Overlays by means of position and size. *BaseLayouter::PrepareLayout() should be implemented with a routine to set the position of the internal m_ManagedOverlays List. *A layouter is always connected to one BaseRenderer, so there is one instance of the layouter for each BaseRenderer. *One type of layouter should always have a unique identifier. *@ingroup Overlays */ class MITK_CORE_EXPORT BaseLayouter : public itk::Object { public: mitkClassMacro(BaseLayouter, itk::Object); void SetBaseRenderer(BaseRenderer* renderer); BaseRenderer *GetBaseRenderer(); /** \brief Adds an Overlay to the internal list of managed Overlays.*/ /** By calling this, the previous Layouter of the passed Overlays is called to remove this overlay from its internal list.*/ void AddOverlay(Overlay *Overlay); /** \brief Removes the passed Overlay from the m_ManagedOverlays List */ void RemoveOverlay(Overlay *Overlay); - /** \brief explicit constructor which disallows implicit conversions */ + /** \brief Returns a unique identifier for one specific kind of layouter.*/ std::string GetIdentifier(); + + /** \brief Sets the positions of each managed overlay according to the layouter role*/ + /** This has to be implemented in order to provide a layouting procedure for the list of managed Overlays. + * The method has to provide a layouting for each identifier.*/ virtual void PrepareLayout() = 0; protected: /** \brief explicit constructor which disallows implicit conversions */ explicit BaseLayouter(); /** \brief virtual destructor in order to derive from this class */ virtual ~BaseLayouter(); + /** \brief returns a list of the overlays that is managed by this Layouter. */ std::list GetManagedOverlays(); + + /** \brief A unique identifier for one specific kind of layouter.*/ + /** If the implementation of the layouter can manage the overlay positions in different ways, each instance has to have +its own unique identifier.*/ std::string m_Identifier; private: /** \brief The baserenderer on which this layouter is active. */ mitk::BaseRenderer* m_BaseRenderer; /** \brief List of the overlays managed by this layouter. */ std::list m_ManagedOverlays; /** \brief copy constructor */ BaseLayouter( const BaseLayouter &); /** \brief assignment operator */ BaseLayouter &operator=(const BaseLayouter &); }; } // namespace mitk #endif // BASELAYOUTER_H diff --git a/Core/Code/Rendering/Overlays/mitkOverlay.cpp b/Core/Code/Rendering/Overlays/mitkOverlay.cpp index a81bd389fd..8ed71cd726 100644 --- a/Core/Code/Rendering/Overlays/mitkOverlay.cpp +++ b/Core/Code/Rendering/Overlays/mitkOverlay.cpp @@ -1,291 +1,268 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkOverlay.h" mitk::Overlay::Overlay() : m_LayoutedBy(NULL) { m_PropertyList = mitk::PropertyList::New(); } mitk::Overlay::~Overlay() { } void mitk::Overlay::SetProperty(const char *propertyKey, BaseProperty* propertyValue, const mitk::BaseRenderer* renderer) { GetPropertyList(renderer)->SetProperty(propertyKey, propertyValue); this->Modified(); } void mitk::Overlay::ReplaceProperty(const char *propertyKey, BaseProperty* propertyValue, const mitk::BaseRenderer* renderer) { GetPropertyList(renderer)->ReplaceProperty(propertyKey, propertyValue); } void mitk::Overlay::AddProperty(const char *propertyKey, BaseProperty* propertyValue, const mitk::BaseRenderer* renderer, bool overwrite) { if((overwrite) || (GetProperty(propertyKey, renderer) == NULL)) { SetProperty(propertyKey, propertyValue, renderer); } } void mitk::Overlay::ConcatenatePropertyList(PropertyList *pList, bool replace) { m_PropertyList->ConcatenatePropertyList(pList, replace); } mitk::BaseProperty* mitk::Overlay::GetProperty(const char *propertyKey, const mitk::BaseRenderer* renderer) const { if(propertyKey==NULL) return NULL; //renderer specified? if (renderer) { std::map::const_iterator it; //check for the renderer specific property it=m_MapOfPropertyLists.find(renderer); if(it!=m_MapOfPropertyLists.end()) //found { mitk::BaseProperty::Pointer property; property=it->second->GetProperty(propertyKey); if(property.IsNotNull())//found an enabled property in the render specific list return property; else //found a renderer specific list, but not the desired property return m_PropertyList->GetProperty(propertyKey); //return renderer unspecific property } else //didn't find the property list of the given renderer { //return the renderer unspecific property if there is one return m_PropertyList->GetProperty(propertyKey); } } else //no specific renderer given; use the renderer independent one { mitk::BaseProperty::Pointer property; property=m_PropertyList->GetProperty(propertyKey); if(property.IsNotNull()) return property; } //only to satisfy compiler! return NULL; } bool mitk::Overlay::GetBoolProperty(const char* propertyKey, bool& boolValue, mitk::BaseRenderer* renderer) const { mitk::BoolProperty::Pointer boolprop = dynamic_cast(GetProperty(propertyKey, renderer)); if(boolprop.IsNull()) return false; boolValue = boolprop->GetValue(); return true; } bool mitk::Overlay::GetIntProperty(const char* propertyKey, int &intValue, mitk::BaseRenderer* renderer) const { mitk::IntProperty::Pointer intprop = dynamic_cast(GetProperty(propertyKey, renderer)); if(intprop.IsNull()) return false; intValue = intprop->GetValue(); return true; } bool mitk::Overlay::GetFloatProperty(const char* propertyKey, float &floatValue, mitk::BaseRenderer* renderer) const { mitk::FloatProperty::Pointer floatprop = dynamic_cast(GetProperty(propertyKey, renderer)); if(floatprop.IsNull()) return false; floatValue = floatprop->GetValue(); return true; } bool mitk::Overlay::GetStringProperty(const char* propertyKey, std::string& string, mitk::BaseRenderer* renderer) const { mitk::StringProperty::Pointer stringProp = dynamic_cast(GetProperty(propertyKey, renderer)); if(stringProp.IsNull()) { return false; } else { //memcpy((void*)string, stringProp->GetValue(), strlen(stringProp->GetValue()) + 1 ); // looks dangerous string = stringProp->GetValue(); return true; } } void mitk::Overlay::SetIntProperty(const char* propertyKey, int intValue, mitk::BaseRenderer* renderer) { GetPropertyList(renderer)->SetProperty(propertyKey, mitk::IntProperty::New(intValue)); } void mitk::Overlay::SetBoolProperty( const char* propertyKey, bool boolValue, mitk::BaseRenderer* renderer/*=NULL*/ ) { GetPropertyList(renderer)->SetProperty(propertyKey, mitk::BoolProperty::New(boolValue)); } void mitk::Overlay::SetFloatProperty( const char* propertyKey, float floatValue, mitk::BaseRenderer* renderer/*=NULL*/ ) { GetPropertyList(renderer)->SetProperty(propertyKey, mitk::FloatProperty::New(floatValue)); } void mitk::Overlay::SetStringProperty( const char* propertyKey, const char* stringValue, mitk::BaseRenderer* renderer/*=NULL*/ ) { GetPropertyList(renderer)->SetProperty(propertyKey, mitk::StringProperty::New(stringValue)); } void mitk::Overlay::SetText(std::string text) { - SetStringProperty("text", text.c_str()); + SetStringProperty("Overlay.Text", text.c_str()); } std::string mitk::Overlay::GetText() { std::string text; - GetPropertyList()->GetStringProperty("text", text); + GetPropertyList()->GetStringProperty("Overlay.Text", text); return text; } void mitk::Overlay::SetFontSize(int fontSize) { - SetIntProperty("fontSize",fontSize); + SetIntProperty("Overlay.FontSize",fontSize); } int mitk::Overlay::GetFontSize() { int fontSize; - GetPropertyList()->GetIntProperty("fontSize", fontSize); + GetPropertyList()->GetIntProperty("Overlay.FontSize", fontSize); return fontSize; } bool mitk::Overlay::GetColor(float rgb[], mitk::BaseRenderer* renderer, const char* propertyKey) const { mitk::ColorProperty::Pointer colorprop = dynamic_cast(GetProperty(propertyKey, renderer)); if(colorprop.IsNull()) return false; memcpy(rgb, colorprop->GetColor().GetDataPointer(), 3*sizeof(float)); return true; } void mitk::Overlay::SetColor(const mitk::Color &color, mitk::BaseRenderer* renderer, const char* propertyKey) { mitk::ColorProperty::Pointer prop; prop = mitk::ColorProperty::New(color); GetPropertyList(renderer)->SetProperty(propertyKey, prop); } void mitk::Overlay::SetColor(float red, float green, float blue, mitk::BaseRenderer* renderer, const char* propertyKey) { float color[3]; color[0]=red; color[1]=green; color[2]=blue; SetColor(color, renderer, propertyKey); } void mitk::Overlay::SetColor(const float rgb[], mitk::BaseRenderer* renderer, const char* propertyKey) { mitk::ColorProperty::Pointer prop; prop = mitk::ColorProperty::New(rgb); GetPropertyList(renderer)->SetProperty(propertyKey, prop); } bool mitk::Overlay::GetOpacity(float &opacity, mitk::BaseRenderer* renderer, const char* propertyKey) const { mitk::FloatProperty::Pointer opacityprop = dynamic_cast(GetProperty(propertyKey, renderer)); if(opacityprop.IsNull()) return false; opacity=opacityprop->GetValue(); return true; } void mitk::Overlay::SetOpacity(float opacity, mitk::BaseRenderer* renderer, const char* propertyKey) { mitk::FloatProperty::Pointer prop; prop = mitk::FloatProperty::New(opacity); GetPropertyList(renderer)->SetProperty(propertyKey, prop); } -//void mitk::Overlay::SetLayout(mitk::BaseLayouter::Pointer layout, mitk::BaseRenderer* renderer) -//{ -// if(renderer==NULL || layout.IsNull()) -// return; - -// mitk::BaseLayouter::Pointer & OldLayout = m_MapOfLayouters[renderer]; - -// if(OldLayout.IsNotNull()) -// OldLayout->RemoveOverlay(this); - -// m_MapOfLayouters[renderer] = layout; -//} - -//mitk::BaseLayouter::Pointer mitk::Overlay::GetLayout(mitk::BaseRenderer *renderer) -//{ -// if(renderer==NULL) -// return NULL; - -// mitk::BaseLayouter::Pointer & layout = m_MapOfLayouters[renderer]; - -// return layout; -//} - void mitk::Overlay::SetVisibility(bool visible, mitk::BaseRenderer *renderer, const char *propertyKey) { mitk::BoolProperty::Pointer prop; prop = mitk::BoolProperty::New(visible); GetPropertyList(renderer)->SetProperty(propertyKey, prop); } mitk::PropertyList* mitk::Overlay::GetPropertyList(const mitk::BaseRenderer* renderer) const { if(renderer==NULL) return m_PropertyList; mitk::PropertyList::Pointer & propertyList = m_MapOfPropertyLists[renderer]; if(propertyList.IsNull()) propertyList = mitk::PropertyList::New(); assert(m_MapOfPropertyLists[renderer].IsNotNull()); return propertyList; } bool mitk::Overlay::BaseLocalStorage::IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Overlay *overlay) { if( m_LastGenerateDataTime < overlay -> GetMTime () ) return true; if( renderer && m_LastGenerateDataTime < renderer -> GetTimeStepUpdateTime ( ) ) return true; return false; } diff --git a/Core/Code/Rendering/Overlays/mitkOverlay.h b/Core/Code/Rendering/Overlays/mitkOverlay.h index ee295ce651..e40cbc5308 100644 --- a/Core/Code/Rendering/Overlays/mitkOverlay.h +++ b/Core/Code/Rendering/Overlays/mitkOverlay.h @@ -1,425 +1,431 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef OVERLAY_H #define OVERLAY_H #include #include #include #include "mitkBaseRenderer.h" namespace mitk { class BaseLayouter; /** \brief Base class for all overlays */ /** This class is to be implemented in order to create overlays which are managed by the OverlayManager and can be placed by a BaseLayouter. This class contains an internal Propertylist, and another PropertyList for each BaseRenderer. A property that is specified for a specific renderer always overrides the general internal property of the same name. AddOverlay, RemoveOverlay and UpdateOverlay methods have to be implemented.*/ class MITK_CORE_EXPORT Overlay : public itk::Object { friend class BaseLayouter; public: + /** \brief Container for position and size on the display.*/ struct Bounds { itk::Point Position; itk::Point Size; }; + typedef std::map MapOfPropertyLists; /** \brief Base class for mapper specific rendering ressources. */ class MITK_CORE_EXPORT BaseLocalStorage { public: bool IsGenerateDataRequired(mitk::BaseRenderer *renderer,mitk::Overlay *overlay); inline void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); } PropertyList::Pointer GetPropertyList(); inline itk::TimeStamp & GetLastGenerateDataTime() { return m_LastGenerateDataTime; } protected: /** \brief timestamp of last update of stored data */ itk::TimeStamp m_LastGenerateDataTime; }; //##Documentation //## @brief Set the property (instance of BaseProperty) with key @a propertyKey in the PropertyList //## of the @a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-value. //## //## @warning Change in semantics since Aug 25th 2006. Check your usage of this method if you do //## more with properties than just call SetProperty( "key", new SomeProperty("value") ). //## //## @sa GetProperty //## @sa m_PropertyList //## @sa m_MapOfPropertyLists void SetProperty(const char *propertyKey, BaseProperty* property, const mitk::BaseRenderer* renderer = NULL); //##Documentation //## @brief Replace the property (instance of BaseProperty) with key @a propertyKey in the PropertyList //## of the @a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-reference. //## //## If @a renderer is @a NULL the property is set in the BaseRenderer-independent //## PropertyList of this Overlay. //## @sa GetProperty //## @sa m_PropertyList //## @sa m_MapOfPropertyLists void ReplaceProperty(const char *propertyKey, BaseProperty* property, const mitk::BaseRenderer* renderer = NULL); //##Documentation //## @brief Add the property (instance of BaseProperty) if it does //## not exist (or always if \a overwrite is \a true) //## with key @a propertyKey in the PropertyList //## of the @a renderer (if NULL, use BaseRenderer-independent //## PropertyList). This is set-by-value. //## //## For \a overwrite == \a false the property is \em not changed //## if it already exists. For \a overwrite == \a true the method //## is identical to SetProperty. //## //## @sa SetProperty //## @sa GetProperty //## @sa m_PropertyList //## @sa m_MapOfPropertyLists void AddProperty(const char *propertyKey, BaseProperty* property, const mitk::BaseRenderer* renderer = NULL, bool overwrite = false); //##Documentation //## @brief Get the PropertyList of the @a renderer. If @a renderer is @a //## NULL, the BaseRenderer-independent PropertyList of this Overlay //## is returned. //## @sa GetProperty //## @sa m_PropertyList //## @sa m_MapOfPropertyLists mitk::PropertyList* GetPropertyList(const mitk::BaseRenderer* renderer = NULL) const; //##Documentation //## @brief Add values from another PropertyList. //## //## Overwrites values in m_PropertyList only when possible (i.e. when types are compatible). //## If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty, //## set the @param replace. //## //## @param replace true: if @param pList contains a property "visible" of type ColorProperty and our m_PropertyList also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects behind the pointer. //## //## @sa SetProperty //## @sa ReplaceProperty //## @sa m_PropertyList void ConcatenatePropertyList(PropertyList* pList, bool replace = false); //##Documentation //## @brief Get the property (instance of BaseProperty) with key @a propertyKey from the PropertyList //## of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. //## //## If @a renderer is @a NULL or the @a propertyKey cannot be found //## in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent //## PropertyList of this Overlay is queried. //## @sa GetPropertyList //## @sa m_PropertyList //## @sa m_MapOfPropertyLists mitk::BaseProperty* GetProperty(const char *propertyKey, const mitk::BaseRenderer* renderer = NULL) const; //##Documentation //## @brief Get the property of type T with key @a propertyKey from the PropertyList //## of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. //## //## If @a renderer is @a NULL or the @a propertyKey cannot be found //## in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent //## PropertyList of this Overlay is queried. //## @sa GetPropertyList //## @sa m_PropertyList //## @sa m_MapOfPropertyLists template bool GetProperty(itk::SmartPointer &property, const char *propertyKey, const mitk::BaseRenderer* renderer = NULL) const { property = dynamic_cast(GetProperty(propertyKey, renderer)); return property.IsNotNull(); } //##Documentation //## @brief Get the property of type T with key @a propertyKey from the PropertyList //## of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. //## //## If @a renderer is @a NULL or the @a propertyKey cannot be found //## in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent //## PropertyList of this Overlay is queried. //## @sa GetPropertyList //## @sa m_PropertyList //## @sa m_MapOfPropertyLists template bool GetProperty(T* &property, const char *propertyKey, const mitk::BaseRenderer* renderer = NULL) const { property = dynamic_cast(GetProperty(propertyKey, renderer)); return property!=NULL; } //##Documentation //## @brief Convenience access method for GenericProperty properties //## (T being the type of the second parameter) //## @return @a true property was found template bool GetPropertyValue(const char* propertyKey, T & value, mitk::BaseRenderer* renderer=NULL) const { GenericProperty* gp= dynamic_cast*>(GetProperty(propertyKey, renderer)); if ( gp != NULL ) { value = gp->GetValue(); return true; } return false; } //##Documentation //## @brief Convenience access method for bool properties (instances of //## BoolProperty) //## @return @a true property was found bool GetBoolProperty(const char* propertyKey, bool &boolValue, mitk::BaseRenderer* renderer = NULL) const; //##Documentation //## @brief Convenience access method for int properties (instances of //## IntProperty) //## @return @a true property was found bool GetIntProperty(const char* propertyKey, int &intValue, mitk::BaseRenderer* renderer=NULL) const; //##Documentation //## @brief Convenience access method for float properties (instances of //## FloatProperty) //## @return @a true property was found bool GetFloatProperty(const char* propertyKey, float &floatValue, mitk::BaseRenderer* renderer = NULL) const; //##Documentation //## @brief Convenience access method for string properties (instances of //## StringProperty) //## @return @a true property was found bool GetStringProperty(const char* propertyKey, std::string& string, mitk::BaseRenderer* renderer = NULL) const; //##Documentation //## @brief Convenience method for setting int properties (instances of //## IntProperty) void SetIntProperty(const char* propertyKey, int intValue, mitk::BaseRenderer* renderer=NULL); //##Documentation //## @brief Convenience method for setting int properties (instances of //## IntProperty) void SetBoolProperty(const char* propertyKey, bool boolValue, mitk::BaseRenderer* renderer=NULL); //##Documentation //## @brief Convenience method for setting int properties (instances of //## IntProperty) void SetFloatProperty(const char* propertyKey, float floatValue, mitk::BaseRenderer* renderer=NULL); //##Documentation //## @brief Convenience method for setting int properties (instances of //## IntProperty) void SetStringProperty(const char* propertyKey, const char* string, mitk::BaseRenderer* renderer=NULL); //##Documentation //## @brief Convenience access method for boolean properties (instances //## of BoolProperty). Return value is the value of the property. If the property is //## not found, the value of @a defaultIsOn is returned. //## //## Thus, the return value has a different meaning than in the //## GetBoolProperty method! //## @sa GetBoolProperty bool IsOn(const char* propertyKey, mitk::BaseRenderer* renderer, bool defaultIsOn = true) const { if(propertyKey==NULL) return defaultIsOn; GetBoolProperty(propertyKey, defaultIsOn, renderer); return defaultIsOn; } //##Documentation //## @brief Convenience access method for accessing the name of an object (instance of //## StringProperty with property-key "name") //## @return @a true property was found bool GetName(std::string& nodeName, mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "name") const { return GetStringProperty(propertyKey, nodeName, renderer); } //##Documentation //## @brief Extra convenience access method for accessing the name of an object (instance of //## StringProperty with property-key "name"). //## //## This method does not take the renderer specific //## propertylists into account, because the name of an object should never be renderer specific. //## @returns a std::string with the name of the object (content of "name" Property). //## If there is no "name" Property, an empty string will be returned. virtual std::string GetName() const { mitk::StringProperty* sp = dynamic_cast(this->GetProperty("name")); if (sp == NULL) return ""; return sp->GetValue(); } //##Documentation //## @brief Extra convenience access method to set the name of an object. //## //## The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name". virtual void SetName( const char* name) { if (name == NULL) return; this->SetProperty("name", StringProperty::New(name)); } //##Documentation //## @brief Extra convenience access method to set the name of an object. //## //## The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name". virtual void SetName( const std::string name) { this->SetName(name.c_str()); } //##Documentation //## @brief Convenience access method for color properties (instances of //## ColorProperty) //## @return @a true property was found bool GetColor(float rgb[], mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color") const; //##Documentation //## @brief Convenience method for setting color properties (instances of //## ColorProperty) void SetColor(const mitk::Color &color, mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color"); //##Documentation //## @brief Convenience method for setting color properties (instances of //## ColorProperty) void SetColor(float red, float green, float blue, mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color"); //##Documentation //## @brief Convenience method for setting color properties (instances of //## ColorProperty) void SetColor(const float rgb[], mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color"); //##Documentation //## @brief Convenience access method for opacity properties (instances of //## FloatProperty) //## @return @a true property was found bool GetOpacity(float &opacity, mitk::BaseRenderer* renderer, const char* propertyKey = "opacity") const; //##Documentation //## @brief Convenience method for setting opacity properties (instances of //## FloatProperty) void SetOpacity(float opacity, mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "opacity"); void SetText(std::string text); std::string GetText(); void SetFontSize(int fontSize); int GetFontSize(); //##Documentation //## @brief Convenience access method for visibility properties (instances //## of BoolProperty with property-key "visible") //## @return @a true property was found //## @sa IsVisible bool GetVisibility(bool &visible, mitk::BaseRenderer* renderer, const char* propertyKey = "visible") const { return GetBoolProperty(propertyKey, visible, renderer); } //##Documentation //## @brief Convenience access method for visibility properties (instances //## of BoolProperty). Return value is the visibility. Default is //## visible==true, i.e., true is returned even if the property (@a //## propertyKey) is not found. //## //## Thus, the return value has a different meaning than in the //## GetVisibility method! //## @sa GetVisibility //## @sa IsOn bool IsVisible(mitk::BaseRenderer* renderer, const char* propertyKey = "visible", bool defaultIsOn = true) const { return IsOn(propertyKey, renderer, defaultIsOn); } //##Documentation //## @brief Convenience method for setting visibility properties (instances //## of BoolProperty) //## @param visible If set to true, the data will be rendered. If false, the render will skip this data. //## @param renderer Specify a renderer if the visibility shall be specific to a renderer //## @param propertykey Can be used to specify a user defined name of the visibility propery. void SetVisibility(bool visible, mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "visible"); /** \brief Adds the overlay to the specified renderer. Update Overlay should be called soon in order to apply all properties*/ virtual void AddOverlay(BaseRenderer *renderer) = 0; /** \brief Removes the overlay from the specified renderer. It is not visible anymore then.*/ virtual void RemoveOverlay(BaseRenderer *renderer) = 0; /** \brief Applies all properties and should be called before the rendering procedure.*/ virtual void UpdateOverlay(BaseRenderer *renderer) = 0; + /** \brief Returns position and size of the overlay on the display.*/ virtual Bounds GetBoundsOnDisplay(BaseRenderer *renderer) = 0; + + /** \brief Sets position and size of the overlay on the display.*/ virtual void SetBoundsOnDisplay(BaseRenderer *renderer, Bounds) = 0; mitkClassMacro(Overlay, itk::Object); protected: /** \brief explicit constructor which disallows implicit conversions */ explicit Overlay(); /** \brief virtual destructor in order to derive from this class */ virtual ~Overlay(); //##Documentation //## @brief BaseRenderer-independent PropertyList //## //## Properties herein can be overwritten specifically for each BaseRenderer //## by the BaseRenderer-specific properties defined in m_MapOfPropertyLists. PropertyList::Pointer m_PropertyList; //##Documentation //## @brief Map associating each BaseRenderer with its own PropertyList mutable MapOfPropertyLists m_MapOfPropertyLists; //##Documentation //## @brief Timestamp of the last change of m_Data itk::TimeStamp m_DataReferenceChangedTime; unsigned long m_PropertyListModifiedObserverTag; private: /** \brief copy constructor */ Overlay( const Overlay &); /** \brief assignment operator */ Overlay &operator=(const Overlay &); + /** \brief Reference to the layouter in which this overlay is managed. */ BaseLayouter* m_LayoutedBy; }; } // namespace mitk #endif // OVERLAY_H diff --git a/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.cpp b/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.cpp index 4b9331953a..9044263e84 100644 --- a/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.cpp +++ b/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.cpp @@ -1,134 +1,135 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkOverlay2DLayouter.h" const char* mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT = "STANDARD_2D_TOPLEFT"; const char* mitk::Overlay2DLayouter::STANDARD_2D_TOP = "STANDARD_2D_TOP"; const char* mitk::Overlay2DLayouter::STANDARD_2D_TOPRIGHT = "STANDARD_2D_TOPRIGHT"; const char* mitk::Overlay2DLayouter::STANDARD_2D_BOTTOMLEFT = "STANDARD_2D_BOTTOMLEFT"; const char* mitk::Overlay2DLayouter::STANDARD_2D_BOTTOM = "STANDARD_2D_BOTTOM"; const char* mitk::Overlay2DLayouter::STANDARD_2D_BOTTOMRIGHT = "STANDARD_2D_BOTTOMRIGHT"; mitk::Overlay2DLayouter::Overlay2DLayouter() { m_Margin = 5; } mitk::Overlay2DLayouter::~Overlay2DLayouter() { } void mitk::Overlay2DLayouter::PrepareLayout() { std::list managedOverlays = GetManagedOverlays(); std::list::iterator it; mitk::Overlay::Bounds bounds; double posX,posY; int* size = GetBaseRenderer()->GetVtkRenderer()->GetSize(); + //The alignment enum defines the type of this layouter switch (m_Alignment) { case TopLeft: posX = m_Margin; posY = size[1]-m_Margin; for ( it=managedOverlays.begin() ; it != managedOverlays.end(); it++ ) { mitk::Overlay* overlay = *it; bounds = overlay->GetBoundsOnDisplay(this->GetBaseRenderer()); posY -= bounds.Size[1]; bounds.Position[0] = posX; bounds.Position[1] = posY; overlay->SetBoundsOnDisplay(this->GetBaseRenderer(), bounds); posY -= m_Margin; } break; default: break; case Top: posX = 0; posY = size[1]-m_Margin; for ( it=managedOverlays.begin() ; it != managedOverlays.end(); it++ ) { mitk::Overlay* overlay = *it; bounds = overlay->GetBoundsOnDisplay(this->GetBaseRenderer()); posX = size[0]/2 - bounds.Size[0]/2; posY -= bounds.Size[1]; bounds.Position[0] = posX; bounds.Position[1] = posY; overlay->SetBoundsOnDisplay(this->GetBaseRenderer(), bounds); posY -= m_Margin; } break; case TopRight: posX = 0; posY = size[1]-m_Margin; for ( it=managedOverlays.begin() ; it != managedOverlays.end(); it++ ) { mitk::Overlay* overlay = *it; bounds = overlay->GetBoundsOnDisplay(this->GetBaseRenderer()); posX = size[0] - (bounds.Size[0]+m_Margin); posY -= bounds.Size[1]; bounds.Position[0] = posX; bounds.Position[1] = posY; overlay->SetBoundsOnDisplay(this->GetBaseRenderer(), bounds); posY -= m_Margin; } break; case BottomLeft: posX = m_Margin; posY = m_Margin; for ( it=managedOverlays.begin() ; it != managedOverlays.end(); it++ ) { mitk::Overlay* overlay = *it; bounds = overlay->GetBoundsOnDisplay(this->GetBaseRenderer()); bounds.Position[0] = posX; bounds.Position[1] = posY; overlay->SetBoundsOnDisplay(this->GetBaseRenderer(), bounds); posY += bounds.Size[1]; posY += m_Margin; } break; case Bottom: posX = 0; posY = m_Margin; for ( it=managedOverlays.begin() ; it != managedOverlays.end(); it++ ) { mitk::Overlay* overlay = *it; bounds = overlay->GetBoundsOnDisplay(this->GetBaseRenderer()); posX = size[0]/2 - bounds.Size[0]/2; bounds.Position[0] = posX; bounds.Position[1] = posY; overlay->SetBoundsOnDisplay(this->GetBaseRenderer(), bounds); posY += bounds.Size[1]; posY += m_Margin; } break; case BottomRight: posX = 0; posY = m_Margin; for ( it=managedOverlays.begin() ; it != managedOverlays.end(); it++ ) { mitk::Overlay* overlay = *it; bounds = overlay->GetBoundsOnDisplay(this->GetBaseRenderer()); posX = size[0] - (bounds.Size[0]+m_Margin); bounds.Position[0] = posX; bounds.Position[1] = posY; overlay->SetBoundsOnDisplay(this->GetBaseRenderer(), bounds); posY += bounds.Size[1]; posY += m_Margin; } break; } } diff --git a/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.h b/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.h index e1eda786fc..5facbe5acc 100644 --- a/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.h +++ b/Core/Code/Rendering/Overlays/mitkOverlay2DLayouter.h @@ -1,131 +1,135 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKOVERLAY2DLAYOUTER_H #define MITKOVERLAY2DLAYOUTER_H #include #include #include namespace mitk { /** @brief A simple implementation of a layouter for 2D Overlays * * @ingroup Overlays */ class MITK_CORE_EXPORT Overlay2DLayouter : public mitk::BaseLayouter { public: enum Alignment{TopLeft, Top, TopRight, BottomLeft, Bottom, BottomRight}; mitkClassMacro(Overlay2DLayouter, mitk::BaseLayouter); itkNewMacro(Overlay2DLayouter); static const char* STANDARD_2D_TOPLEFT; static const char* STANDARD_2D_TOP; static const char* STANDARD_2D_TOPRIGHT; static const char* STANDARD_2D_BOTTOMLEFT; static const char* STANDARD_2D_BOTTOM; static const char* STANDARD_2D_BOTTOMRIGHT; + /** \brief Factory method for the different kinds of Layouters */ + /** Create a Layouter that, depending on the identifier sorts the Overlays in one corner of the Renderwindow*/ static Overlay2DLayouter::Pointer CreateLayouter(Alignment alignment, BaseRenderer* renderer) { if(renderer == NULL) return NULL; std::string identifier; switch (alignment) { case TopLeft: identifier = STANDARD_2D_TOPLEFT; break; case Top: identifier = STANDARD_2D_TOP; break; case TopRight: identifier = STANDARD_2D_TOPRIGHT; break; case BottomLeft: identifier = STANDARD_2D_BOTTOMLEFT; break; case Bottom: identifier = STANDARD_2D_BOTTOM; break; case BottomRight: identifier = STANDARD_2D_BOTTOMRIGHT; break; default: return NULL; } mitk::Overlay2DLayouter::Pointer layouter = mitk::Overlay2DLayouter::New(); layouter->m_Alignment = alignment; layouter->m_Identifier = identifier; layouter->SetBaseRenderer(renderer); return layouter; } + /** \brief Factory method for the different kinds of Layouters */ + /** Create a Layouter that, depending on the identifier sorts the Overlays in one corner of the Renderwindow*/ static Overlay2DLayouter::Pointer CreateLayouter(std::string identifier, BaseRenderer* renderer) { if(renderer == NULL) return NULL; Alignment alignment; if(identifier.compare(0,11,"STANDARD_2D") != 0) return NULL; if(identifier.compare(STANDARD_2D_TOPLEFT) == 0) alignment = TopLeft; else if(identifier.compare(STANDARD_2D_TOP) == 0) alignment = Top; else if(identifier.compare(STANDARD_2D_TOPRIGHT) == 0) alignment = TopRight; else if(identifier.compare(STANDARD_2D_BOTTOMLEFT) == 0) alignment = BottomLeft; else if(identifier.compare(STANDARD_2D_BOTTOM) == 0) alignment = Bottom; else if(identifier.compare(STANDARD_2D_BOTTOMRIGHT) == 0) alignment = BottomRight; else return NULL; mitk::Overlay2DLayouter::Pointer layouter = mitk::Overlay2DLayouter::New(); layouter->m_Alignment = alignment; layouter->m_Identifier = identifier; layouter->SetBaseRenderer(renderer); return layouter; } void PrepareLayout(); protected: /** \brief explicit constructor which disallows implicit conversions */ explicit Overlay2DLayouter(); /** \brief virtual destructor in order to derive from this class */ virtual ~Overlay2DLayouter(); Alignment m_Alignment; double m_Margin; private: /** \brief copy constructor */ Overlay2DLayouter( const Overlay2DLayouter &); /** \brief assignment operator */ Overlay2DLayouter &operator=(const Overlay2DLayouter &); }; } // namespace mitk #endif // MITKOVERLAY2DLAYOUTER_H diff --git a/Core/Code/Rendering/Overlays/mitkOverlayManager.cpp b/Core/Code/Rendering/Overlays/mitkOverlayManager.cpp index 5a3cd71e6f..4b6cc587ce 100644 --- a/Core/Code/Rendering/Overlays/mitkOverlayManager.cpp +++ b/Core/Code/Rendering/Overlays/mitkOverlayManager.cpp @@ -1,185 +1,184 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkOverlayManager.h" #include "usGetModuleContext.h" const std::string mitk::OverlayManager::PROP_ID = "org.mitk.services.OverlayManager.ID"; mitk::OverlayManager::OverlayManager() { m_id = this->RegisterMicroservice(); } mitk::OverlayManager::~OverlayManager() { m_BaseRendererList.clear(); m_OverlayList.clear(); LayouterRendererMap::iterator it; for ( it=m_LayouterMap.begin() ; it != m_LayouterMap.end(); it++ ) { (it->second).clear(); } m_LayouterMap.clear(); } void mitk::OverlayManager::AddBaseRenderer(mitk::BaseRenderer* renderer) { size_t nRenderers = m_BaseRendererList.size(); m_BaseRendererList.remove(renderer); m_BaseRendererList.push_back(renderer); if(nRenderers < m_BaseRendererList.size()) { std::list::iterator it; for ( it=m_OverlayList.begin() ; it != m_OverlayList.end(); it++ ) { (*it)->AddOverlay(renderer); } } } void mitk::OverlayManager::AddOverlay(Overlay *overlay) { m_OverlayList.push_back(overlay); BaseRendererList::iterator it; for ( it=m_BaseRendererList.begin() ; it != m_BaseRendererList.end(); it++ ) { overlay->AddOverlay(*it); } } void mitk::OverlayManager::RemoveOverlay(Overlay *overlay) { m_OverlayList.remove(overlay); BaseRendererList::iterator it; for ( it=m_BaseRendererList.begin() ; it != m_BaseRendererList.end(); it++ ) { overlay->RemoveOverlay(*it); } } void mitk::OverlayManager::RemoveAllOverlays() { std::list::iterator it; for ( it=m_OverlayList.begin() ; it != m_OverlayList.end(); it++ ) { RemoveOverlay(*it); } m_OverlayList.clear(); } void mitk::OverlayManager::UpdateOverlays(mitk::BaseRenderer* baseRenderer) { std::list::iterator it; for ( it=m_OverlayList.begin() ; it != m_OverlayList.end(); it++ ) { (*it)->UpdateOverlay(baseRenderer); } UpdateLayouts(baseRenderer); } std::string mitk::OverlayManager::RegisterMicroservice() { mitk::ServiceProperties properties; static int ID = 0; std::string id_str = static_cast( &(std::ostringstream() << ID) )->str(); properties[mitk::OverlayManager::PROP_ID] = id_str; mitk::ModuleContext* moduleContext = mitk::GetModuleContext(); m_Registration = moduleContext->RegisterService(this,properties); ID++; return id_str; } void mitk::OverlayManager::UnregisterMicroservice() { if(m_Registration) { m_Registration.Unregister(); } } void mitk::OverlayManager::SetLayouter(Overlay *overlay, const char *identifier, mitk::BaseRenderer *renderer) { if(renderer) { BaseLayouter::Pointer layouter = GetLayouter(renderer,identifier); if(layouter.IsNull()) { MITK_WARN << "Layouter " << identifier << " cannot be found or created!"; return; } else { layouter->AddOverlay(overlay); } } } void mitk::OverlayManager::UpdateLayouts(mitk::BaseRenderer *renderer) { LayouterMap layouters = m_LayouterMap[renderer]; LayouterMap::iterator it; for ( it=layouters.begin() ; it != layouters.end(); it++ ) { (it->second)->PrepareLayout(); } } mitk::OverlayManager::Pointer mitk::OverlayManager::GetServiceInstance(std::string ID) { -// std::string id_str = static_cast( &(std::ostringstream() << ID) )->str(); mitk::ModuleContext* moduleContext = mitk::GetModuleContext(); std::string filter = "("+PROP_ID + "="+ID+")"; std::list serref = moduleContext->GetServiceReferences("org.mitk.services.OverlayManager",filter); if(serref.size()==0) { return NULL; } else { mitk::OverlayManager::Pointer om = moduleContext->GetService(serref.front()); return om; } } std::string mitk::OverlayManager::GetID() { return m_id; } mitk::BaseLayouter::Pointer mitk::OverlayManager::GetLayouter(mitk::BaseRenderer *renderer, const std::string identifier) { BaseLayouter::Pointer layouter = m_LayouterMap[renderer][identifier]; return layouter; } void mitk::OverlayManager::AddLayouter(BaseLayouter *layouter) { if(layouter) { BaseLayouter::Pointer oldLayouter = m_LayouterMap[layouter->GetBaseRenderer()][layouter->GetIdentifier()]; if(oldLayouter.IsNotNull() && oldLayouter.GetPointer() != layouter) { MITK_WARN << "Layouter " << layouter->GetIdentifier() << " does already exist!"; } else if(oldLayouter.IsNull()) { m_LayouterMap[layouter->GetBaseRenderer()][layouter->GetIdentifier()] = layouter; } } } diff --git a/Core/Code/Rendering/Overlays/mitkTextOverlay2D.cpp b/Core/Code/Rendering/Overlays/mitkTextOverlay2D.cpp index c1c4043cf0..60bbfa85ab 100644 --- a/Core/Code/Rendering/Overlays/mitkTextOverlay2D.cpp +++ b/Core/Code/Rendering/Overlays/mitkTextOverlay2D.cpp @@ -1,102 +1,105 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkTextOverlay2D.h" #include #include "vtkUnicodeString.h" #include #include "vtkQtStringToImage.h" #include mitk::TextOverlay2D::TextOverlay2D() { mitk::Point2D position; position[0] = position[1] = 0; SetPosition2D(position); SetOffsetVector(position); } mitk::TextOverlay2D::~TextOverlay2D() { } mitk::Overlay::Bounds mitk::TextOverlay2D::GetBoundsOnDisplay(mitk::BaseRenderer *renderer) { LocalStorage* ls = this->m_LSH.GetLocalStorage(renderer); mitk::Overlay::Bounds bounds; bounds.Position = ls->m_textActor->GetPosition(); bounds.Size[0] = ls->m_textImage->GetDimensions()[0]; bounds.Size[1] = ls->m_textImage->GetDimensions()[1]; return bounds; } void mitk::TextOverlay2D::SetBoundsOnDisplay(mitk::BaseRenderer *renderer, mitk::Overlay::Bounds bounds) { vtkSmartPointer actor = GetVtkActor2D(renderer); actor->SetDisplayPosition(bounds.Position[0],bounds.Position[1]); actor->SetWidth(bounds.Size[0]); actor->SetHeight(bounds.Size[1]); } mitk::TextOverlay2D::LocalStorage::~LocalStorage() { } mitk::TextOverlay2D::LocalStorage::LocalStorage() { m_textActor = vtkSmartPointer::New(); m_textImage = vtkSmartPointer::New(); m_imageMapper = vtkSmartPointer::New(); m_imageMapper->SetInputConnection(m_textImage->GetProducerPort()); m_textActor->SetMapper(m_imageMapper); } void mitk::TextOverlay2D::UpdateVtkOverlay2D(mitk::BaseRenderer *renderer) { LocalStorage* ls = this->m_LSH.GetLocalStorage(renderer); if(ls->IsGenerateDataRequired(renderer,this)) { vtkSmartPointer freetype = vtkSmartPointer::New(); vtkSmartPointer prop = vtkSmartPointer::New(); float color[3] = {1,1,1}; float opacity = 1.0; GetColor(color,renderer); GetOpacity(opacity,renderer); prop->SetColor( color[0], color[1], color[2]); prop->SetFontSize(GetFontSize()); prop->SetOpacity(opacity); freetype->RenderString(prop,vtkUnicodeString::from_utf8(GetText().c_str()),ls->m_textImage); ls->m_textImage->Modified(); + + //Levelwindow has to be set to full range, that the colors are displayed properly. ls->m_imageMapper->SetColorWindow(255); ls->m_imageMapper->SetColorLevel(127.5); + ls->m_imageMapper->Update(); ls->m_textActor->SetPosition(GetPosition2D(renderer)[0]+GetOffsetVector(renderer)[0], GetPosition2D(renderer)[1]+GetOffsetVector(renderer)[1]); ls->UpdateGenerateDataTime(); } } vtkActor2D* mitk::TextOverlay2D::GetVtkActor2D(BaseRenderer *renderer) { LocalStorage* ls = this->m_LSH.GetLocalStorage(renderer); return ls->m_textActor; } diff --git a/Core/Code/Rendering/Overlays/mitkVtkOverlay2D.cpp b/Core/Code/Rendering/Overlays/mitkVtkOverlay2D.cpp index 352bb8806d..941efa1fde 100644 --- a/Core/Code/Rendering/Overlays/mitkVtkOverlay2D.cpp +++ b/Core/Code/Rendering/Overlays/mitkVtkOverlay2D.cpp @@ -1,90 +1,90 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkVtkOverlay2D.h" #include mitk::VtkOverlay2D::VtkOverlay2D() { } mitk::VtkOverlay2D::~VtkOverlay2D() { } mitk::Overlay::Bounds mitk::VtkOverlay2D::GetBoundsOnDisplay(mitk::BaseRenderer *renderer) { mitk::Overlay::Bounds bounds; vtkSmartPointer actor = GetVtkActor2D(renderer); bounds.Position = actor->GetPosition(); bounds.Size = actor->GetPosition2(); return bounds; } void mitk::VtkOverlay2D::SetBoundsOnDisplay(mitk::BaseRenderer *renderer, mitk::Overlay::Bounds bounds) { vtkSmartPointer actor = GetVtkActor2D(renderer); actor->SetDisplayPosition(bounds.Position[0],bounds.Position[1]); actor->SetWidth(bounds.Size[0]); actor->SetHeight(bounds.Size[1]); } void mitk::VtkOverlay2D::UpdateVtkOverlay(mitk::BaseRenderer *renderer) { vtkActor2D* prop = GetVtkActor2D(renderer); float color[3] = {1,1,1}; float opacity = 1.0; GetColor(color,renderer); GetOpacity(opacity,renderer); prop->GetProperty()->SetColor(color[0], color[1], color[2]); prop->GetProperty()->SetOpacity(opacity); UpdateVtkOverlay2D(renderer); } void mitk::VtkOverlay2D::SetPosition2D(Point2D position2D, mitk::BaseRenderer *renderer) { mitk::Point2dProperty::Pointer position2dProperty = mitk::Point2dProperty::New(position2D); - SetProperty("Position2D", position2dProperty,renderer); + SetProperty("VtkOverlay2D.Position2D", position2dProperty,renderer); } mitk::Point2D mitk::VtkOverlay2D::GetPosition2D(mitk::BaseRenderer *renderer) { mitk::Point2D position2D; - GetPropertyValue("Position2D", position2D, renderer); + GetPropertyValue("VtkOverlay2D.Position2D", position2D, renderer); return position2D; } void mitk::VtkOverlay2D::SetOffsetVector(Point2D OffsetVector, mitk::BaseRenderer *renderer) { mitk::Point2dProperty::Pointer OffsetVectorProperty = mitk::Point2dProperty::New(OffsetVector); - SetProperty("OffsetVector", OffsetVectorProperty,renderer); + SetProperty("VtkOverlay2D.OffsetVector", OffsetVectorProperty,renderer); } mitk::Point2D mitk::VtkOverlay2D::GetOffsetVector(mitk::BaseRenderer *renderer) { mitk::Point2D OffsetVector; - GetPropertyValue("OffsetVector", OffsetVector, renderer); + GetPropertyValue("VtkOverlay2D.OffsetVector", OffsetVector, renderer); return OffsetVector; } vtkProp* mitk::VtkOverlay2D::GetVtkProp(mitk::BaseRenderer *renderer) { return GetVtkActor2D(renderer); } diff --git a/Core/Code/Rendering/Overlays/mitkVtkOverlay3D.cpp b/Core/Code/Rendering/Overlays/mitkVtkOverlay3D.cpp index c55e117e7d..446f0dcb32 100644 --- a/Core/Code/Rendering/Overlays/mitkVtkOverlay3D.cpp +++ b/Core/Code/Rendering/Overlays/mitkVtkOverlay3D.cpp @@ -1,67 +1,67 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkVtkOverlay3D.h" mitk::VtkOverlay3D::VtkOverlay3D() { mitk::Point3D offsetVector; offsetVector[0]=offsetVector[1]=offsetVector[2]=0; SetOffsetVector(offsetVector); } mitk::VtkOverlay3D::~VtkOverlay3D() { } mitk::Overlay::Bounds mitk::VtkOverlay3D::GetBoundsOnDisplay(mitk::BaseRenderer*) { mitk::Overlay::Bounds bounds; bounds.Position[0] = bounds.Position[1] = bounds.Size[0] = bounds.Size[1] = 0; return bounds; } void mitk::VtkOverlay3D::SetBoundsOnDisplay(mitk::BaseRenderer*, mitk::Overlay::Bounds) { } void mitk::VtkOverlay3D::SetPosition3D(Point3D position3D, mitk::BaseRenderer *renderer) { mitk::Point3dProperty::Pointer position3dProperty = mitk::Point3dProperty::New(position3D); - SetProperty("Position3D", position3dProperty,renderer); + SetProperty("VtkOverlay3D.Position3D", position3dProperty,renderer); } mitk::Point3D mitk::VtkOverlay3D::GetPosition3D(mitk::BaseRenderer *renderer) { mitk::Point3D position3D; - GetPropertyValue("Position3D", position3D, renderer); + GetPropertyValue("VtkOverlay3D.Position3D", position3D, renderer); return position3D; } void mitk::VtkOverlay3D::SetOffsetVector(Point3D OffsetVector, mitk::BaseRenderer *renderer) { mitk::Point3dProperty::Pointer OffsetVectorProperty = mitk::Point3dProperty::New(OffsetVector); - SetProperty("OffsetVector", OffsetVectorProperty,renderer); + SetProperty("VtkOverlay3D.OffsetVector", OffsetVectorProperty,renderer); } mitk::Point3D mitk::VtkOverlay3D::GetOffsetVector(mitk::BaseRenderer *renderer) { mitk::Point3D OffsetVector; - GetPropertyValue("OffsetVector", OffsetVector, renderer); + GetPropertyValue("VtkOverlay3D.OffsetVector", OffsetVector, renderer); return OffsetVector; }