X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_PrsImage.h;h=f926178fdfcb8b57959d04365b1d17eab7855838;hb=d6e19029f8b41f295db878e9aecf451c2edda4af;hp=651c787cf08df9a6e85e2434fa97b215068b17e6;hpb=2c7a183c127b169bf0d08c30d493d66f2bd8465f;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_PrsImage.h b/src/HYDROGUI/HYDROGUI_PrsImage.h index 651c787c..f926178f 100644 --- a/src/HYDROGUI/HYDROGUI_PrsImage.h +++ b/src/HYDROGUI/HYDROGUI_PrsImage.h @@ -1,12 +1,8 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -37,30 +33,48 @@ 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 ); + + /** + * Set shape of the transformation point cursor. + * @param theCursorShape a cursor shape to be set + */ + void setTransformationPointCursorShape(Qt::CursorShape theCursorShape); + public: // from QGraphicsItem virtual QRectF boundingRect() const; @@ -80,24 +94,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; };