Salome HOME
Updated copyright comment
[modules/geom.git] / src / MeasureGUI / MeasureGUI_AnnotationDlg.h
1 // Copyright (C) 2007-2024  CEA, EDF, 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
23 //  GEOM GEOMGUI : GUI for Geometry component
24 //  File   : MeasureGUI_AnnotationDlg.h
25
26 #ifndef MeasureGUI_AnnotationDlg_H
27 #define MeasureGUI_AnnotationDlg_H
28
29 #include <GEOMBase_Skeleton.h>
30
31 #include <GEOM_Annotation.hxx>
32 #include <GEOM_Constants.h>
33 #include <GEOMGUI_AnnotationAttrs.h>
34
35 #include <TopAbs_ShapeEnum.hxx>
36 //#include <TColStd_DataMapOfIntegerInteger.hxx>
37 //#include <TColStd_IndexedMapOfInteger.hxx>
38 //#include <TopTools_IndexedMapOfShape.hxx>
39
40 //#include <QMap>
41 //#include <QSet>
42 //#include <QVector>
43 //#include <QTableWidget>
44
45 class QGroupBox;
46 class QLineEdit;
47 class QPushButton;
48 class QComboBox;
49 class QCheckBox;
50 class SalomeApp_IntSpinBox;
51 class MeasureGUI_AnnotationInteractor;
52
53 //=================================================================================
54 // class    : MeasureGUI_AnnotationDlg
55 // purpose  :
56 //=================================================================================
57 class MeasureGUI_AnnotationDlg : public GEOMBase_Skeleton
58 {
59   Q_OBJECT
60
61 public:
62   MeasureGUI_AnnotationDlg ( GeometryGUI* theGeometryGUI,
63                              const bool theIsCreate,
64                              QWidget* parent=0,
65                              bool modal=false, Qt::WindowFlags fl=0 );
66   ~MeasureGUI_AnnotationDlg();
67
68 protected:
69   // redefined from GEOMBase_Helper
70   virtual                             GEOM::GEOM_IOperations_ptr createOperation();
71   virtual bool                        isValid ( QString& );
72   virtual bool                        execute ();
73
74   SALOME_Prs*                         buildPrs();
75   void                                updateSubShapeEnableState();
76   void                                redisplayPreview();
77
78   void                                closeEvent( QCloseEvent* theEv );
79
80 private slots:
81   void                                ClickOnOk();
82   bool                                ClickOnApply();
83   void                                SelectionIntoArgument();
84   void                                SetEditCurrentArgument();
85
86   void                                onTextChange();
87   void                                onTypeChange();
88   void                                onSubShapeTypeChange();
89
90   void                                onDragged( Handle_GEOM_Annotation theAnnotation );
91
92 private:
93   void                                Init();
94
95   void                                activateSelectionArgument( QPushButton* theSelectionButton );
96   void                                activateSelection();
97   TopAbs_ShapeEnum                    getShapeType() const;
98
99   bool                                getPickedPoint( gp_Pnt& thePnt, const TopoDS_Shape& theShape );
100   gp_Pnt                              getAttachPoint( const TopoDS_Shape& theShape, bool& theIsOk );
101   gp_Pnt                              getDefaultPosition( const gp_Pnt& theAttach );
102
103 private:
104   TopAbs_ShapeEnum                    mySelectionMode;
105   QString                             myEditAnnotationEntry;
106   int                                 myEditAnnotationIndex;
107   GEOMGUI_AnnotationAttrs::Properties myAnnotationProperties;
108   bool                                myIsPositionDefined;
109   /// an index of edited annotation in the list shape annotations, -1 in create operation
110   bool                                myIsCreation;
111   GEOM::GeomObjPtr                    myShape;
112
113   QLineEdit*                          myTextEdit;
114
115   QPushButton*                        myShapeSelBtn;
116   // update shape name by shape selection if it has not been manually modified yet
117   bool                                myShapeNameModified;
118   QLineEdit*                          myShapeName;
119   QCheckBox*                          myIsScreenFixed;
120
121   QComboBox*                          mySubShapeTypeCombo;
122
123   QPushButton*                        mySubShapeSelBtn;
124   QLineEdit*                          mySubShapeName;
125
126   MeasureGUI_AnnotationInteractor*    myInteractor;
127 };
128
129 #endif