Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1280
bug-19360-line-width.txt
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
maleike
Oct 7 2015, 5:00 PM
2015-10-07 17:00:18 (UTC+2)
Size
2 KB
Referenced Files
None
Subscribers
None
bug-19360-line-width.txt
View Options
diff --git a/Modules/Core/include/mitkSurfaceVtkMapper2D.h b/Modules/Core/include/mitkSurfaceVtkMapper2D.h
index b97d040..e378cf8 100644
--- a/Modules/Core/include/mitkSurfaceVtkMapper2D.h
+++ b/Modules/Core/include/mitkSurfaceVtkMapper2D.h
@@ -194,6 +194,19 @@ protected:
virtual void ResetMapper( BaseRenderer* renderer ) override;
/**
+ * @brief Updates legacy properties to current behavior/interpretation.
+ * @param renderer The respective renderer of the mitkRenderWindow.
+ *
+ * Whenever a mapper decides to change its property types or its
+ * interpretation of certain values, it should add something to this
+ * method and call it before methods like ApplyProperties();
+ *
+ * This is particularly helpful when dealing with data from
+ * archive/scene files that were created before changes.
+ */
+ virtual void FixupLegacyProperties(DataNode* node, const BaseRenderer* renderer);
+
+ /**
* @brief ApplyAllProperties Pass all the properties to VTK.
* @param renderer The respective renderer of the mitkRenderWindow.
*/
diff --git a/Modules/Core/src/Rendering/mitkSurfaceVtkMapper2D.cpp b/Modules/Core/src/Rendering/mitkSurfaceVtkMapper2D.cpp
index 0cbf30d..16d3cd4 100644
--- a/Modules/Core/src/Rendering/mitkSurfaceVtkMapper2D.cpp
+++ b/Modules/Core/src/Rendering/mitkSurfaceVtkMapper2D.cpp
@@ -258,15 +258,31 @@ void mitk::SurfaceVtkMapper2D::GenerateDataForRenderer( mitk::BaseRenderer *rend
}
}
+void mitk::SurfaceVtkMapper2D::FixupLegacyProperties(DataNode* node, const BaseRenderer* renderer)
+{
+ // Before bug 18528, "line width" was an IntProperty, now it is a FloatProperty
+ float lineWidth = 1.0f;
+ if ( !node->GetFloatProperty("line width", lineWidth, renderer) )
+ {
+ int legacyLineWidth = lineWidth;
+ if ( node->GetIntProperty("line width", legacyLineWidth, renderer) )
+ {
+ node->ReplaceProperty("line width", FloatProperty::New(static_cast<float>(legacyLineWidth)));
+ }
+ }
+}
+
void mitk::SurfaceVtkMapper2D::ApplyAllProperties(mitk::BaseRenderer* renderer)
{
- const DataNode * node = GetDataNode();
+ DataNode * node = GetDataNode();
if(node == NULL)
{
return;
}
+ FixupLegacyProperties(node, renderer);
+
float lineWidth = 1.0f;
node->GetFloatProperty("line width", lineWidth, renderer);
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1239
Default Alt Text
bug-19360-line-width.txt (2 KB)
Attached To
Mode
T19360: Compatibility with old scene files broken (Surface line width redefined from int to float)
Attached
Detach File
Event Timeline
maleike
added a comment.
Oct 7 2015, 5:00 PM
2015-10-07 17:00:18 (UTC+2)
Comment Actions
Final patch
Log In to Comment