X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_PrsImage.h;h=1fafe35416c0a4d346e0a3d0509d68cda199d00a;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=8f385185a869ad4441e566082b71415a87e5613e;hpb=d74afc6389ed4e656c9451ac01b4065470746fd8;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_PrsImage.h b/src/HYDROGUI/HYDROGUI_PrsImage.h index 8f385185..1fafe354 100644 --- a/src/HYDROGUI/HYDROGUI_PrsImage.h +++ b/src/HYDROGUI/HYDROGUI_PrsImage.h @@ -37,28 +37,42 @@ public: enum TransformationPointType { None = 0, PointA, PointB, PointC }; struct TransformationPoint { - QPoint Point; - QString Caption; - QGraphicsEllipseItem* PointItem; - QGraphicsSimpleTextItem* CaptionItem; + TransformationPoint() : Point( 0, 0 ), Caption( "" ), GroupItem( 0 ) {} + + QPoint Point; + QString Caption; + QGraphicsItemGroup* GroupItem; }; typedef QMap < int, TransformationPoint > TransformationPointMap; typedef QMapIterator< int, TransformationPoint > TransformationPointMapIterator; public: - HYDROGUI_PrsImage( const Handle(HYDROData_Object)& theObject ); + HYDROGUI_PrsImage( const Handle(HYDROData_Entity)& theObject ); virtual ~HYDROGUI_PrsImage(); public: - void setImage( const QImage& theImage ); + void setImage( const QImage& theImage, + const bool theCompute = false ); QImage getImage() const; + void setCaption( const QString& theCaption ); + QString getCaption() const; + void setIsTransformationPointPreview( const bool theState ); bool getIsTransformationPointPreview() const; - void setTransformationPointMode( const int theMode ); + void setIsByTwoPoints( const bool theIsByTwoPoints ); + bool getIsByTwoPoints() const; + + void setTransformationPointType( const int thePointType ); + + void setTransformationPointMap( const TransformationPointMap& theMap ); const TransformationPointMap& getTransformationPointMap() const { return myTransformationPointMap; } + void updateTransformationPoint( const int thePointType, + const bool theIsY, + const int theValue ); + public: // from QGraphicsItem virtual QRectF boundingRect() const; @@ -78,24 +92,37 @@ public: virtual void setSelected( bool theState ); protected: - void computeTransformationPoints(); + void computeTransformationPoints( const bool theObligatoryInit = false ); + + QGraphicsItemGroup* createPointItem( const QString& theCaption, + const QColor& theColor ); + + /** + * Create presentations for transformation points A, B and C or update the presentation + * parameters if it is already created + */ + void initTrsfPoints( const int thePointType ); + /** + * Show/hide a transformation point if necessary. + */ + void updateTrsfPoint( const int thePointType ); protected: - QCursor* getHighlightCursor() const { return myHighlightCursor; } QCursor* getTransformationPointCursor() const { return myTransformationPointCursor; } protected: QImage myImage; QGraphicsPixmapItem* myPixmapItem; + QGraphicsSimpleTextItem* myCaptionItem; HYDROGUI_PrsImageFrame* myPrsImageFrame; bool myIsTransformationPointPreview; - int myTransformationPointMode; + bool myIsByTwoPoints; + int myTransformationPointType; TransformationPointMap myTransformationPointMap; private: - QCursor* myHighlightCursor; QCursor* myTransformationPointCursor; };