Salome HOME
Feature #197: translation or georeferencing of OBSTACLES Box and Cylinder.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PrsImage.h
index 3f78316c95a2883545b2e627648f92682e38eccd..1fafe35416c0a4d346e0a3d0509d68cda199d00a 100644 (file)
@@ -37,25 +37,33 @@ 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                            setIsByTwoPoints( const bool theIsByTwoPoints );
+  bool                            getIsByTwoPoints() const;
+
   void                            setTransformationPointType( const int thePointType );
 
   void                            setTransformationPointMap( const TransformationPointMap& theMap );
@@ -84,7 +92,20 @@ 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*                        getTransformationPointCursor() const { return myTransformationPointCursor; }
@@ -93,9 +114,11 @@ protected:
   QImage                          myImage;
 
   QGraphicsPixmapItem*            myPixmapItem;
+  QGraphicsSimpleTextItem*        myCaptionItem;
   HYDROGUI_PrsImageFrame*         myPrsImageFrame;
 
   bool                            myIsTransformationPointPreview;
+  bool                            myIsByTwoPoints;
   int                             myTransformationPointType;
   TransformationPointMap          myTransformationPointMap;