Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GEOMGUI_AnnotationAttrs.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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 
23 // File : GEOMGUI_AnnotationAttrs.h
24 // Author : Anton POLETAEV, Open CASCADE S.A.S.
25 //
26 
27 #ifndef GEOMGUI_ANNOTATIONATTRS_H
28 #define GEOMGUI_ANNOTATIONATTRS_H
29 
30 // SALOME GUI includes
31 #include <GEOMGUI.h>
32 #include <SalomeApp_Study.h>
33 
34 // OCCT includes
35 #include <gp_Ax3.hxx>
36 #include <gp_Pnt.hxx>
37 #include <Standard_Transient.hxx>
38 
39 // Qt, STL includes
40 #include <QString>
41 
42 class GEOM_Annotation;
43 class gp_Ax3;
44 
49 {
50 public:
51 
53 
54 
55  GEOMGUI_EXPORT static Handle(GEOMGUI_AnnotationAttrs) FindAttributes( const _PTR(SObject)& theObject );
56 
58  GEOMGUI_EXPORT static Handle(GEOMGUI_AnnotationAttrs) FindOrCreateAttributes( const _PTR(SObject)& theObject,
59  SalomeApp_Study* theStudy );
60 
62  GEOMGUI_EXPORT static void Remove( const _PTR(SObject)& theObject );
63 
64 // Import / Export
65 public:
66 
68  GEOMGUI_EXPORT QString ExportAsPropertyString() const;
69 
71  GEOMGUI_EXPORT void ImportFromPropertyString( const QString& theString );
72 
73 public:
74 
78  struct Properties
79  {
80  QString Text;
81  bool IsVisible;
83  gp_Pnt Position;
84  gp_Pnt Attach;
85  int ShapeIndex;
86  int ShapeType;
87  };
88 
93  GEOMGUI_EXPORT static void SetupPresentation( const Handle(GEOM_Annotation)& thePresentation,
94  const Properties& theProps,
95  const gp_Ax3& theShapeLCS );
96 
101  GEOMGUI_EXPORT void SetupPresentation( const Handle(GEOM_Annotation)& thePresentation,
102  const int theIndex,
103  const gp_Ax3& theShapeLCS );
104 
105 public:
106 
111  GEOMGUI_EXPORT void SetNbAnnotation( const int theCount ) const;
112 
114  GEOMGUI_EXPORT int GetNbAnnotation() const;
115 
119  GEOMGUI_EXPORT void SetIsVisible( const int theIndex, const bool theIsVisible );
120 
122  GEOMGUI_EXPORT bool GetIsVisible( const int theIndex ) const;
123 
127  GEOMGUI_EXPORT void SetText( const int theIndex, const QString& theText );
128 
130  GEOMGUI_EXPORT QString GetText( const int theIndex ) const;
131 
135  GEOMGUI_EXPORT void SetIsScreenFixed( const int theIndex, const bool theIsScreenFixed );
136 
138  GEOMGUI_EXPORT bool GetIsScreenFixed( const int theIndex ) const;
139 
143  GEOMGUI_EXPORT void SetPosition( const int theIndex, const gp_Pnt& thePosition );
144 
146  GEOMGUI_EXPORT gp_Pnt GetPosition( const int theIndex ) const;
147 
151  GEOMGUI_EXPORT void SetAttach( const int theIndex, const gp_Pnt& theAttach );
152 
154  GEOMGUI_EXPORT gp_Pnt GetAttach( const int theIndex ) const;
155 
159  GEOMGUI_EXPORT void SetShapeSel( const int theIndex, const int theShapeType, const int theSubIdx );
160 
164  GEOMGUI_EXPORT void GetShapeSel( const int theIndex, int& theShapeType, int& theSubIdx ) const;
165 
166 public:
167 
169  GEOMGUI_EXPORT void Append( const Properties& theProps );
170 
175  GEOMGUI_EXPORT void Append( const Properties& theProps, const gp_Ax3& theShapeLCS );
176 
181  GEOMGUI_EXPORT void Remove( const Standard_Integer theIndex );
182 
186  GEOMGUI_EXPORT void SetProperties( const int theIndex, const Properties& theProps );
187 
195  GEOMGUI_EXPORT void SetProperties( const int theIndex, const Properties& theProps, const gp_Ax3& theShapeLCS );
196 
200  GEOMGUI_EXPORT void GetProperties( const int theIndex, Properties& theProps ) const;
201 
202 private:
203 
204  GEOMGUI_AnnotationAttrs( const _PTR(SObject)& theObject, const _PTR(AttributeParameter)& theParameter )
205  : myObj( theObject ),
206  myParameterMap( theParameter ) {}
207 
209 
210  void operator=( const GEOMGUI_AnnotationAttrs& theOther ) {}
211 
212 private:
213 
214  _PTR(SObject) myObj;
215  _PTR(AttributeParameter) myParameterMap;
216 };
217 
219 
220 #endif