connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myRefPointXMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
connect( myPointCEnabler, SIGNAL( toggled( bool ) ), myRefPointYMap[ HYDROGUI_PrsImage::PointC ], SLOT( setEnabled( bool ) ) );
+ connect( myPointCEnabler, SIGNAL( toggled( bool ) ), SIGNAL( setIsByTwoPoints( bool ) ) );
+
aTransformLayout->setColumnStretch( 1, 1 ); // double
aTransformLayout->setColumnStretch( 3, 1 ); // degrees
aTransformLayout->setColumnStretch( 5, 1 ); // minutes
int theValue );
void modeActivated( int );
void refImageActivated( const QString& );
+ void setIsByTwoPoints( bool theIsByTwoPoints );
private:
QGroupBox* myFileNameGroup; //!< The group for the source image file selection
if ( !theIsByTwoPoints )
aPointMap[ HYDROGUI_PrsImage::PointC ].Point = theLocalPointC;
+ thePrs->setIsByTwoPoints( theIsByTwoPoints );
thePrs->setTransformationPointMap( aPointMap );
}
}
HYDROGUI_InputPanel* HYDROGUI_ImportImageOp::createInputPanel() const
{
HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportImageDlg( module(), getName() );
- connect( aPanel, SIGNAL( createPreview( QImage ) ),
- this, SLOT( onCreatePreview( QImage ) ) );
- connect( aPanel, SIGNAL( activatePointSelection( int ) ),
- this, SLOT( onActivatePointSelection( int ) ) );
- connect( aPanel, SIGNAL( pointCoordChanged( bool, int, bool, int ) ),
- this, SLOT( onPointCoordChanged( bool, int, bool, int ) ) );
- connect( aPanel, SIGNAL( modeActivated( int ) ),
- this, SLOT( onModeActivated( int ) ) );
+ connect( aPanel, SIGNAL( createPreview( QImage ) ), SLOT( onCreatePreview( QImage ) ) );
+ connect( aPanel, SIGNAL( activatePointSelection( int ) ), SLOT( onActivatePointSelection( int ) ) );
+ connect( aPanel, SIGNAL( pointCoordChanged( bool, int, bool, int ) ),
+ SLOT( onPointCoordChanged( bool, int, bool, int ) ) );
+ connect( aPanel, SIGNAL( modeActivated( int ) ), SLOT( onModeActivated( int ) ) );
connect( aPanel, SIGNAL( refImageActivated( const QString& ) ),
- this, SLOT( onRefImageActivated( const QString& ) ) );
+ SLOT( onRefImageActivated( const QString& ) ) );
+ connect( aPanel, SIGNAL( setIsByTwoPoints( bool ) ), SLOT( onSetIsByTwoPoints( bool ) ) );
return aPanel;
}
+void HYDROGUI_ImportImageOp::onSetIsByTwoPoints( bool theIsSetByTwoPoints )
+{
+ if ( myPreviewPrs )
+ {
+ myPreviewPrs->setIsByTwoPoints( theIsSetByTwoPoints );
+ }
+ if ( myRefPreviewPrs )
+ {
+ myRefPreviewPrs->setIsByTwoPoints( theIsSetByTwoPoints );
+ }
+}
+
bool HYDROGUI_ImportImageOp::checkPoints( const QPointF& thePointA,
const QPointF& thePointB,
const QPointF& thePointC,
void onPointCoordChanged( bool, int, bool, int );
void onModeActivated( int );
void onRefImageActivated( const QString& );
+ void onSetIsByTwoPoints( bool theIsSetByTwoPoints );
void onLastViewClosed( SUIT_ViewManager* );
}
bool anIsVisible = myIsTransformationPointPreview;
+ bool anIsPointVisible;
for( int aPointType = PointA; aPointType <= PointC; aPointType++ )
{
+ // If image is transformed only by two points then the point C is invisible
+ anIsPointVisible = anIsVisible && (
+ ( !myIsByTwoPoints ) || ( myIsByTwoPoints && ( aPointType != PointC ) ) );
TransformationPoint& aTransformationPoint = myTransformationPointMap[ aPointType ];
double aRadius = 5;
const QPointF& aPoint = aTransformationPoint.Point;
QRectF aRect( aPoint - QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) );
aTransformationPoint.PointItem->setRect( aRect );
- aTransformationPoint.PointItem->setVisible( anIsVisible );
+ aTransformationPoint.PointItem->setVisible( anIsPointVisible );
QPointF aCaptionShift( -aRadius * 2, aRadius * 2 );
aTransformationPoint.CaptionItem->setPos( aPoint + aCaptionShift );
- aTransformationPoint.CaptionItem->setVisible( anIsVisible );
+ aTransformationPoint.CaptionItem->setVisible( anIsPointVisible );
+ }
+}
+
+//================================================================
+// Function : IsByTwoPoints
+// Purpose :
+//================================================================
+bool HYDROGUI_PrsImage::getIsByTwoPoints() const
+{
+ return myIsByTwoPoints;
+}
+
+//================================================================
+// Function : SetIsByTwoPoints
+// Purpose :
+//================================================================
+void HYDROGUI_PrsImage::setIsByTwoPoints( const bool theIsByTwoPoints )
+{
+ myIsByTwoPoints = theIsByTwoPoints;
+ if ( myTransformationPointMap.contains( PointC ) )
+ {
+ TransformationPoint& aTransformationPoint = myTransformationPointMap[ PointC ];
+ aTransformationPoint.PointItem->setVisible( myIsTransformationPointPreview && theIsByTwoPoints );
+ aTransformationPoint.CaptionItem->setVisible( myIsTransformationPointPreview && theIsByTwoPoints );
}
}
void setIsTransformationPointPreview( const bool theState );
bool getIsTransformationPointPreview() const;
+ void setIsByTwoPoints( const bool theIsByTwoPoints );
+ bool getIsByTwoPoints() const;
+
void setTransformationPointType( const int thePointType );
void setTransformationPointMap( const TransformationPointMap& theMap );
HYDROGUI_PrsImageFrame* myPrsImageFrame;
bool myIsTransformationPointPreview;
+ bool myIsByTwoPoints;
int myTransformationPointType;
TransformationPointMap myTransformationPointMap;