*/
class HYDROData_Image : public HYDROData_Entity
{
+
+public:
+
+ enum TransformationMode
+ {
+ ManualLambert = 0,
+ ManualCartesian,
+ ReferenceImage
+ };
+
protected:
/**
* Enumeration of tags corresponding to the persistent object parameters.
enum DataTag
{
DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
- DataTag_Operator, ///< name of the operator that must be executed for image update
- DataTag_TrsfMode, ///< transformation mode (0 - Lambert93, 1 - Cartesian)
- DataTag_TrsfPoints, ///< image transformation points (3 input + 3 output lambert + 3 output cartesian)
- DataTag_FilePath ///< image imported file path
+ DataTag_Operator, ///< name of the operator that must be executed for image update
+ DataTag_TrsfMode, ///< transformation mode (0 - Lambert93, 1 - Cartesian, 2 - on other Image)
+ DataTag_TrsfPoints, ///< image transformation points
+ DataTag_TrsfImage, ///< reference transformation image
+ DataTag_FilePath ///< image imported file path
};
public:
HYDRODATA_EXPORT QTransform Trsf() const;
/**
- * Stores the image transformation points (3 input + 3 output)
- * \param thePointA input point A
- * \param thePointB input point B
- * \param thePointC input point C
- * \param theLambertPointA output point A in Lambert93 coordinates
- * \param theLambertPointB output point B in Lambert93 coordinates
- * \param theLambertPointC output point C in Lambert93 coordinates
- * \param theCartesianPointA output point A in Cartesian coordinates
- * \param theCartesianPointB output point B in Cartesian coordinates
- * \param theCartesianPointC output point C in Cartesian coordinates
+ * Updates the matrix of transformation in accordance with reference points.
+ * \param theTrsf new transformation
+ */
+ HYDRODATA_EXPORT void UpdateTrsf();
+
+
+ /**
+ * Returns true if transformation is done by two points only
+ */
+ HYDRODATA_EXPORT bool IsByTwoPoints() const;
+
+
+ /**
+ * Stores the transformation points in local cs of image
+ * \param thePointA point A
+ * \param thePointB point B
+ * \param thePointC point C
+ */
+ HYDRODATA_EXPORT void SetLocalPoints( const QPoint& thePointA,
+ const QPoint& thePointB,
+ const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ) );
+
+ /**
+ * Returns the transformation points in local cs of image
+ * \param thePointA point A
+ * \param thePointB point B
+ * \param thePointC point C
+ * \return true if all parameters has been set before
+ */
+ HYDRODATA_EXPORT bool GetLocalPoints( QPoint& thePointA,
+ QPoint& thePointB,
+ QPoint& thePointC ) const;
+
+ /**
+ * Returns true if local points has been set before
+ */
+ HYDRODATA_EXPORT bool HasLocalPoints() const;
+
+
+ /**
+ * Stores the transformation points in global cs
+ * \param theMode transformation mode
+ * \param thePointA point A
+ * \param thePointB point B
+ * \param thePointC point C
+ */
+ HYDRODATA_EXPORT void SetGlobalPoints( const TransformationMode& theMode,
+ const QPointF& thePointA,
+ const QPointF& thePointB,
+ const QPointF& thePointC = QPoint( INT_MIN, INT_MIN ) );
+
+ /**
+ * Returns the transformation points in global cs
+ * \param theMode transformation mode
+ * \param thePointA point A
+ * \param thePointB point B
+ * \param thePointC point C
+ * \return true if all parameters has been set before
+ */
+ HYDRODATA_EXPORT bool GetGlobalPoints( TransformationMode& theMode,
+ QPointF& thePointA,
+ QPointF& thePointB,
+ QPointF& thePointC ) const;
+
+ /**
+ * Returns true if global points has been set before
*/
- HYDRODATA_EXPORT void SetTrsfPoints(const QPoint& thePointA,
- const QPoint& thePointB,
- const QPoint& thePointC,
- const QPointF& theLambertPointA,
- const QPointF& theLambertPointB,
- const QPointF& theLambertPointC,
- const QPointF& theCartesianPointA,
- const QPointF& theCartesianPointB,
- const QPointF& theCartesianPointC);
+ HYDRODATA_EXPORT bool HasGlobalPoints() const;
+
/**
- * Returns the image transformation points (3 input + 3 output)
- * \param thePointA input point A
- * \param thePointB input point B
- * \param thePointC input point C
- * \param theLambertPointA output point A in Lambert93 coordinates
- * \param theLambertPointB output point B in Lambert93 coordinates
- * \param theLambertPointC output point C in Lambert93 coordinates
- * \param theCartesianPointA output point A in Cartesian coordinates
- * \param theCartesianPointB output point B in Cartesian coordinates
- * \param theCartesianPointC output point C in Cartesian coordinates
+ * Stores the transformation points in reference image local cs
+ * \param theRefImage reference image
+ * \param thePointA point A
+ * \param thePointB point B
+ * \param thePointC point C
*/
- HYDRODATA_EXPORT void TrsfPoints(QPoint& thePointA,
- QPoint& thePointB,
- QPoint& thePointC,
- QPointF& theLambertPointA,
- QPointF& theLambertPointB,
- QPointF& theLambertPointC,
- QPointF& theCartesianPointA,
- QPointF& theCartesianPointB,
- QPointF& theCartesianPointC) const;
+ HYDRODATA_EXPORT void SetReferencePoints( const Handle(HYDROData_Image)& theRefImage,
+ const QPointF& thePointA,
+ const QPointF& thePointB,
+ const QPointF& thePointC = QPoint( INT_MIN, INT_MIN ) );
/**
- * Returns true if the image has stored transformation points
+ * Returns the transformation points in reference image local cs
+ * \param theRefImage reference image
+ * \param thePointA point A
+ * \param thePointB point B
+ * \param thePointC point C
+ * \return true if all parameters has been set correctly
*/
- HYDRODATA_EXPORT bool HasTrsfPoints() const;
+ HYDRODATA_EXPORT bool GetReferencePoints( Handle(HYDROData_Image)& theRefImage,
+ QPointF& thePointA,
+ QPointF& thePointB,
+ QPointF& thePointC ) const;
/**
- * Stores the transformation mode (0 - Lambert93, 1 - Cartesian)
+ * Returns true if reference points has been set before
*/
- HYDRODATA_EXPORT void SetTrsfMode(const int theMode);
+ HYDRODATA_EXPORT bool HasReferencePoints() const;
+
/**
- * Returns the transformation mode (0 - Lambert93, 1 - Cartesian)
+ * Stores the reference image for transformation
+ * \param theRefImage reference image
*/
- HYDRODATA_EXPORT int TrsfMode() const;
+ HYDRODATA_EXPORT void SetTrsfReferenceImage( const Handle(HYDROData_Image)& theRefImage );
+
+ /**
+ * Returns the reference image for transformation
+ */
+ HYDRODATA_EXPORT Handle(HYDROData_Image) GetTrsfReferenceImage() const;
+
+
+ /**
+ * Stores the transformation mode
+ */
+ HYDRODATA_EXPORT void SetTrsfMode( const TransformationMode& theMode );
+
+ /**
+ * Returns the transformation mode
+ */
+ HYDRODATA_EXPORT TransformationMode GetTrsfMode() const;
+
/**
* Returns the number of referenced objects
*/
HYDRODATA_EXPORT bool IsSelfSplitted() const;
+private:
+
+ QPointF generateThirdPoint( const QPointF& thePointA,
+ const QPointF& thePointB,
+ const bool& theIsLocal ) const;
+
protected:
friend class HYDROData_Iterator;