1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_PRSIMAGE_H
24 #define HYDROGUI_PRSIMAGE_H
26 #include "HYDROGUI_Prs.h"
28 class HYDROGUI_PrsImageFrame;
31 Class : HYDROGUI_PrsImage
32 Description : Presentation for image object
34 class HYDROGUI_PrsImage : public HYDROGUI_Prs
37 enum TransformationPointType { None = 0, PointA, PointB, PointC };
38 struct TransformationPoint
42 QGraphicsItemGroup* GroupItem;
44 typedef QMap < int, TransformationPoint > TransformationPointMap;
45 typedef QMapIterator< int, TransformationPoint > TransformationPointMapIterator;
48 HYDROGUI_PrsImage( const Handle(HYDROData_Entity)& theObject );
49 virtual ~HYDROGUI_PrsImage();
52 void setImage( const QImage& theImage );
53 QImage getImage() const;
55 void setCaption( const QString& theCaption );
56 QString getCaption() const;
58 void setIsTransformationPointPreview( const bool theState );
59 bool getIsTransformationPointPreview() const;
61 void setIsByTwoPoints( const bool theIsByTwoPoints );
62 bool getIsByTwoPoints() const;
64 void setTransformationPointType( const int thePointType );
66 void setTransformationPointMap( const TransformationPointMap& theMap );
67 const TransformationPointMap& getTransformationPointMap() const { return myTransformationPointMap; }
69 void updateTransformationPoint( const int thePointType,
75 virtual QRectF boundingRect() const;
77 // from GraphicsView_Object
78 virtual void compute();
80 virtual void addTo( GraphicsView_ViewPort* theViewPort );
81 virtual void removeFrom( GraphicsView_ViewPort* theViewPort );
83 virtual bool isMovable() const { return false; }
85 virtual bool checkHighlight( double theX, double theY, QCursor& theCursor ) const;
87 virtual bool select( double theX, double theY, const QRectF& theRect );
88 virtual void unselect();
89 virtual void setSelected( bool theState );
92 void computeTransformationPoints();
94 * Show/hide a transformation point if necessary.
96 void updateTrsfPoint( const int thePointType );
99 QCursor* getTransformationPointCursor() const { return myTransformationPointCursor; }
104 QGraphicsPixmapItem* myPixmapItem;
105 QGraphicsSimpleTextItem* myCaptionItem;
106 HYDROGUI_PrsImageFrame* myPrsImageFrame;
108 bool myIsTransformationPointPreview;
109 bool myIsByTwoPoints;
110 int myTransformationPointType;
111 TransformationPointMap myTransformationPointMap;
114 QCursor* myTransformationPointCursor;