Version: 9.12.0
GEOMGUI_AnnotationAttrs.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 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 // 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 
208  GEOMGUI_AnnotationAttrs( const GEOMGUI_AnnotationAttrs& ); // private copy constructor, must be never called
209  void operator=( const GEOMGUI_AnnotationAttrs& ); // private assignment operator, must be never called
210 
211 private:
212 
213  _PTR(SObject) myObj;
214  _PTR(AttributeParameter) myParameterMap;
215 };
216 
218 
219 #endif
DEFINE_STANDARD_HANDLE(GEOM_Field, GEOM_BaseObject) DEFINE_STANDARD_HANDLE(GEOM_FieldStep
#define GEOMGUI_EXPORT
Definition: GEOM_GEOMGUI.hxx:36
Attribute-style helper tool to manage shape annotation data of an object.
Definition: GEOMGUI_AnnotationAttrs.h:49
GEOMGUI_EXPORT void SetNbAnnotation(const int theCount) const
Changes count of annotation definitions stored on the object.
Definition: GEOMGUI_AnnotationAttrs.cxx:255
DEFINE_STANDARD_RTTIEXT(GEOMGUI_AnnotationAttrs, Standard_Transient) GEOMGUI_EXPORT static Handle(GEOMGUI_AnnotationAttrs) FindAttributes(const _PTR(SObject) &theObject)
Find annotation data defined for an object.
GEOMGUI_EXPORT void Append(const Properties &theProps)
Appends new annotation definition with the given properties.
Definition: GEOMGUI_AnnotationAttrs.cxx:437
GEOMGUI_EXPORT bool GetIsScreenFixed(const int theIndex) const
Returns screen fixed flag of the annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:347
GEOMGUI_EXPORT gp_Pnt GetPosition(const int theIndex) const
Returns position of the annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:371
GEOMGUI_EXPORT void SetIsVisible(const int theIndex, const bool theIsVisible)
Sets application visibility state of an annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:302
GEOMGUI_EXPORT QString GetText(const int theIndex) const
Returns annotation label's text.
Definition: GEOMGUI_AnnotationAttrs.cxx:329
static GEOMGUI_EXPORT Handle(GEOMGUI_AnnotationAttrs) FindOrCreateAttributes(const _PTR(SObject) &theObject
Find or create annotation data fields for an object.
GEOMGUI_EXPORT void GetShapeSel(const int theIndex, int &theShapeType, int &theSubIdx) const
Returns shape selection arguments.
Definition: GEOMGUI_AnnotationAttrs.cxx:424
GEOMGUI_EXPORT void SetIsScreenFixed(const int theIndex, const bool theIsScreenFixed)
Sets screen fixed flag of the annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:338
GEOMGUI_EXPORT int GetNbAnnotation() const
Returns number of annotation definitions stored on the object.
Definition: GEOMGUI_AnnotationAttrs.cxx:293
GEOMGUI_EXPORT void SetText(const int theIndex, const QString &theText)
Sets annotation label's text.
Definition: GEOMGUI_AnnotationAttrs.cxx:320
GEOMGUI_EXPORT gp_Pnt GetAttach(const int theIndex) const
Returns attach point of the annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:398
static GEOMGUI_EXPORT SalomeApp_Study * theStudy
Definition: GEOMGUI_AnnotationAttrs.h:59
GEOMGUI_EXPORT void SetShapeSel(const int theIndex, const int theShapeType, const int theSubIdx)
Sets shape selection arguments.
Definition: GEOMGUI_AnnotationAttrs.cxx:410
GEOMGUI_AnnotationAttrs(const _PTR(SObject)&theObject, const _PTR(AttributeParameter)&theParameter)
Definition: GEOMGUI_AnnotationAttrs.h:204
GEOMGUI_EXPORT void SetPosition(const int theIndex, const gp_Pnt &thePosition)
Sets position of the annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:356
static GEOMGUI_EXPORT void SetupPresentation(const Handle(GEOM_Annotation)&thePresentation, const Properties &theProps, const gp_Ax3 &theShapeLCS)
Setup parameters of the annotation presentation with the properties given.
Definition: GEOMGUI_AnnotationAttrs.cxx:523
void operator=(const GEOMGUI_AnnotationAttrs &)
_PTR(AttributeParameter) myParameterMap
GEOMGUI_EXPORT QString ExportAsPropertyString() const
Exports annotation records as a property string.
Definition: GEOMGUI_AnnotationAttrs.cxx:176
GEOMGUI_EXPORT bool GetIsVisible(const int theIndex) const
Returns application visibility state of an annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:311
GEOMGUI_AnnotationAttrs(const GEOMGUI_AnnotationAttrs &)
GEOMGUI_EXPORT void GetProperties(const int theIndex, Properties &theProps) const
Returns complete properties of an annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:508
static GEOMGUI_EXPORT void Remove(const _PTR(SObject)&theObject)
Remove annotation data fields for an object.
Definition: GEOMGUI_AnnotationAttrs.cxx:140
GEOMGUI_EXPORT void SetProperties(const int theIndex, const Properties &theProps)
Sets complete properties of an annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:480
GEOMGUI_EXPORT void SetAttach(const int theIndex, const gp_Pnt &theAttach)
Sets attach point of the annotation definition.
Definition: GEOMGUI_AnnotationAttrs.cxx:383
GEOMGUI_EXPORT void ImportFromPropertyString(const QString &theString)
Imports annotation records from a property string.
Definition: GEOMGUI_AnnotationAttrs.cxx:201
Interactive object, representating annotation entity.
Definition: GEOM_Annotation.hxx:63
Definition: GEOMGUI_AnnotationAttrs.h:79
gp_Pnt Attach
Attachment point of the annotation.
Definition: GEOMGUI_AnnotationAttrs.h:84
gp_Pnt Position
Position of the annotation.
Definition: GEOMGUI_AnnotationAttrs.h:83
QString Text
Displayed annotation text.
Definition: GEOMGUI_AnnotationAttrs.h:80
int ShapeType
Type of the annotated subshape.
Definition: GEOMGUI_AnnotationAttrs.h:86
bool IsVisible
Application visibility flag of annotation.
Definition: GEOMGUI_AnnotationAttrs.h:81
int ShapeIndex
Index of the annotated subshape.
Definition: GEOMGUI_AnnotationAttrs.h:85
bool IsScreenFixed
Fixed screen mode flag.
Definition: GEOMGUI_AnnotationAttrs.h:82