Commit 2102b9b2 authored by Otmane Lahlou's avatar Otmane Lahlou

ENH: add the origin information in the manipulators

parent ef0243e8
......@@ -143,6 +143,9 @@ public:
/** */
inline SpacingType GetSpacing();
/** */
inline PointType GetOrigin();
/**
* Get a smart-pointer to the current LOD image-base.
*/
......@@ -338,6 +341,15 @@ AbstractImageModel
return ToImageBase()->GetSpacing();
}
/*****************************************************************************/
inline
PointType
AbstractImageModel
::GetOrigin()
{
return ToImageBase()->GetOrigin();
}
} // end namespace 'mvd'
#endif // __mvdAbstractImageModel_h
......@@ -90,4 +90,11 @@ AbstractViewManipulator
m_Spacing = spacing;
}
/*******************************************************************************/
void
AbstractViewManipulator
::SetOrigin(const PointType& origin)
{
m_Origin = origin;
}
} // end namespace 'mvd'
......@@ -119,6 +119,12 @@ public:
/** */
inline SpacingType GetSpacing() const;
/** */
void SetOrigin(const PointType& spacing);
/** */
inline PointType GetOrigin() const;
/** */
inline PointType ScreenIndexToPhysicalPoint(const IndexType & index);
......@@ -131,7 +137,8 @@ public slots:
/** */
virtual
void OnModelImageRegionChanged( const ImageRegionType& largestRegion,
const SpacingType & spacing) =0;
const SpacingType & spacing,
const PointType& ) = 0;
/** */
void OnViewportOriginChanged(const IndexType& origin);
......@@ -228,6 +235,9 @@ protected:
/** */
SpacingType m_NativeSpacing;
/** */
PointType m_Origin;
/*-[ PRIVATE SECTION ]-----------------------------------------------------*/
......@@ -294,6 +304,15 @@ AbstractViewManipulator
return m_Spacing;
}
/*****************************************************************************/
inline
PointType
AbstractViewManipulator
::GetOrigin() const
{
return m_Origin;
}
/*****************************************************************************/
inline
PointType
......
......@@ -143,10 +143,14 @@ GLImageWidget
// Connect this model region changed.
QObject::connect(
this,
SIGNAL( ModelImageRegionChanged( const ImageRegionType& , const SpacingType&) ),
SIGNAL( ModelImageRegionChanged( const ImageRegionType& ,
const SpacingType&,
const PointType&) ),
// to:
m_ImageViewManipulator,
SLOT( OnModelImageRegionChanged( const ImageRegionType&, const SpacingType& ) )
SLOT( OnModelImageRegionChanged( const ImageRegionType&,
const SpacingType&,
const PointType&) )
);
// Connect the renderer origin (of extent) changed to the manipulator
......
......@@ -126,7 +126,7 @@ public slots:
signals:
void movingMouse();
void releasingMouse();
void ModelImageRegionChanged(const ImageRegionType &, const SpacingType&);
void ModelImageRegionChanged(const ImageRegionType &, const SpacingType&, const PointType&);
void CentralWidgetUpdated();
//
......@@ -205,7 +205,8 @@ GLImageWidget
{
emit ModelImageRegionChanged(
model->GetNativeLargestRegion(),
model->GetNativeSpacing()
model->GetNativeSpacing(),
model->GetOrigin() // origin is the same for ql and central image
);
}
}
......
......@@ -395,11 +395,16 @@ ImageViewManipulator
/*****************************************************************************/
void ImageViewManipulator
::OnModelImageRegionChanged(const ImageRegionType & largestRegion, const SpacingType& spacing)
::OnModelImageRegionChanged(const ImageRegionType & largestRegion,
const SpacingType& spacing,
const PointType& origin)
{
// update the spacing
SetSpacing(spacing);
// update the origin
SetOrigin(origin);
// store the native spacing too (for physical coordinate
// computations)
m_NativeSpacing = spacing;
......
......@@ -123,7 +123,9 @@ public:
// Public SLOTS.
public slots:
void OnModelImageRegionChanged(const ImageRegionType & largestRegion,
const SpacingType& spacing);
const SpacingType& spacing,
const PointType& origin );
void OnViewportRegionChanged(double Xpc, double Ypc);
void OnPhysicalCursorPositionChanged(double Xpc, double Ypc);
......
......@@ -346,11 +346,15 @@ QuicklookViewManipulator
void
QuicklookViewManipulator
::OnModelImageRegionChanged(const ImageRegionType & largestRegion,
const SpacingType & spacing)
const SpacingType & spacing,
const PointType& origin )
{
// update spacing
SetSpacing(spacing);
// update origin
SetOrigin(origin);
// set back the zoom to 1
m_IsotropicZoom = 1.;
......
......@@ -124,7 +124,8 @@ public:
// Public SLOTS.
public slots:
void OnModelImageRegionChanged(const ImageRegionType & largestRegion,
const SpacingType & spacing);
const SpacingType & spacing,
const PointType& origin);
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
......
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