Commit 16ac7272 authored by Stefan Philips's avatar Stefan Philips

[ADD] Show all three transformation matrixes as information properties

parent e61caac6
...@@ -1194,10 +1194,6 @@ void WGridRegular3DTemplate< T >::initInformationProperties() ...@@ -1194,10 +1194,6 @@ void WGridRegular3DTemplate< T >::initInformationProperties()
WPropDouble zOffset = m_infoProperties->addProperty( "Z offset: ", WPropDouble zOffset = m_infoProperties->addProperty( "Z offset: ",
"The distance between samples in z direction", "The distance between samples in z direction",
static_cast< double >( getOffsetZ() ) ); static_cast< double >( getOffsetZ() ) );
WPropMatrix4X4 transformation = m_infoProperties->addProperty( "Transformation",
"The transformation of this grid.",
static_cast< WMatrix4d >( getTransform() ) );
} }
// +----------------------+ // +----------------------+
......
...@@ -288,7 +288,8 @@ void WMData::moduleMain() ...@@ -288,7 +288,8 @@ void WMData::moduleMain()
// register the dataset properties // register the dataset properties
m_properties->addProperty( m_dataSet->getProperties() ); m_properties->addProperty( m_dataSet->getProperties() );
m_infoProperties->addProperty( m_dataSet->getInformationProperties() ); m_infoProperties->addProperty( m_dataSet->getInformationProperties() );
m_infoProperties->addProperty( getTransformationProperties() );
// I am interested in the active property ( manually subscribe signal ) // I am interested in the active property ( manually subscribe signal )
m_active->getCondition()->subscribeSignal( boost::bind( &WMData::propertyChanged, this, m_active ) ); m_active->getCondition()->subscribeSignal( boost::bind( &WMData::propertyChanged, this, m_active ) );
...@@ -450,3 +451,38 @@ std::string WMData::getDataTypeString( boost::shared_ptr< WDataSetSingle > dss ) ...@@ -450,3 +451,38 @@ std::string WMData::getDataTypeString( boost::shared_ptr< WDataSetSingle > dss )
return result; return result;
} }
namespace
{
// helper which gets a WMatrix< double > and returns a WMatrix4d
WMatrix4d WMatrixDoubleToWMatrix4d( const WMatrix< double >& matrix )
{
WAssert( matrix.getNbRows() == 4, "" );
WAssert( matrix.getNbCols() == 4, "" );
WMatrix4d result;
for( size_t i = 0; i < 4; ++i )
{
for( size_t j = 0; j < 4; ++j )
{
result( i, j ) = matrix( i, j );
}
}
return result;
}
}
boost::shared_ptr< WProperties > WMData::getTransformationProperties() const
{
boost::shared_ptr< WProperties > result( new WProperties( "Transformations", "Availabe transformation matrices for data-set " ) );
WPropGroup transformation = result->addPropertyGroup( "Transformation",
"The transformation of this grid." );
WPropMatrix4X4 noMatrixTransformation = result->addProperty( "No matrix transformation",
"The no matrix transformation for this data set.",
WMatrixDoubleToWMatrix4d( m_transformNoMatrix ) );
WPropMatrix4X4 sformMatrixTransformation = result->addProperty( "sform matrix transformation",
"The sform matrix transformation for this data set.",
WMatrixDoubleToWMatrix4d( m_transformSForm ) );
WPropMatrix4X4 qformMatrixTransformation = result->addProperty( "qform matrix transformation",
"The qform matrix transformation for this data set.",
WMatrixDoubleToWMatrix4d( m_transformQForm ) );
return result;
}
...@@ -177,6 +177,9 @@ protected: ...@@ -177,6 +177,9 @@ protected:
WMatrix< double > m_transformQForm; WMatrix< double > m_transformQForm;
private: private:
//! returns info property group with the three availabe transformation matrixes
boost::shared_ptr< WProperties > getTransformationProperties() const;
//! a condition for the matrix selection //! a condition for the matrix selection
boost::shared_ptr< WCondition > m_propCondition; boost::shared_ptr< WCondition > m_propCondition;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment