Salome HOME
Fit All after was added stream selection and displaying in embedded viewer.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PrsImageFrame.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef HYDROGUI_PRSIMAGEFRAME_H
23 #define HYDROGUI_PRSIMAGEFRAME_H
24
25 #include <GraphicsView_Object.h>
26
27 #include <QGraphicsEllipseItem>
28
29 class HYDROGUI_PrsImage;
30
31 /*
32   Class       : HYDROGUI_PrsImageFrame
33   Description : Presentation for image frame object
34 */
35 class HYDROGUI_PrsImageFrame : public GraphicsView_Object
36 {
37 public:
38   class UnscaledGraphicsEllipseItem;
39
40   enum AnchorType { Undefined = 0, TopLeft, TopRight, BottomLeft, BottomRight };
41
42   typedef QMap        <int, UnscaledGraphicsEllipseItem*> AnchorMap;
43   typedef QMapIterator<int, UnscaledGraphicsEllipseItem*> AnchorMapIterator;
44
45 public:
46   HYDROGUI_PrsImageFrame( HYDROGUI_PrsImage* thePrsImage );
47   virtual ~HYDROGUI_PrsImageFrame();
48
49 public:
50   // from QGraphicsItem
51   virtual QRectF                  boundingRect() const;
52
53   // from GraphicsView_Object
54   virtual void                    compute();
55
56   virtual bool                    hasSpecificZValue() const { return true; }
57
58   virtual bool                    isSelectable() const { return false; }
59   virtual bool                    isMovable() const { return false; }
60
61 public:
62   void                            computeAnchorItems();
63   void                            updateVisibility();
64
65 protected:
66   HYDROGUI_PrsImage*              myPrsImage;
67   AnchorMap                       myAnchorMap;
68 };
69
70 /*
71   Class       : UnscaledGraphicsEllipseItem
72   Description : Class for unscaled ellipse item
73 */
74 class HYDROGUI_PrsImageFrame::UnscaledGraphicsEllipseItem : public QGraphicsEllipseItem
75 {
76 public:
77   UnscaledGraphicsEllipseItem( QGraphicsItem* );
78   virtual ~UnscaledGraphicsEllipseItem();
79
80 public:
81   void           setBasePoint( const QPointF& thePoint ) { myBasePoint = thePoint; }
82   const QPointF& getBasePoint() const { return myBasePoint; }
83
84 public:
85   virtual QRectF boundingRect() const;
86   virtual void   paint( QPainter*, const QStyleOptionGraphicsItem*, QWidget* );
87
88 private:
89   QPointF        myBasePoint;
90 };
91
92 #endif