Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GEOMGUI_AnnotationMgr.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef GEOMGUI_ANNOTATIONMGR_H
21 #define GEOMGUI_ANNOTATIONMGR_H
22 
23 #include "GEOM_GEOMGUI.hxx"
24 
25 #include <SALOMEconfig.h>
26 #include CORBA_SERVER_HEADER(GEOM_Gen)
27 
28 #include <QObject>
30 
31 #include <SALOME_Prs.h>
32 #include <SALOME_InteractiveObject.hxx>
33 
34 #include <SOCC_ViewModel.h>
35 
36 class SalomeApp_Application;
37 class GEOM_Annotation;
38 class GEOM_Displayer;
39 
47 {
48  Q_OBJECT;
49 
50 public:
51  GEOMGUI_AnnotationMgr( SalomeApp_Application* theApplication );
53 
54  static QString GetEntrySeparator();
55 
56  SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
57  GEOM::GEOM_Object_ptr theObject,
58  SOCC_Viewer* theView = 0,
59  const QString& theEntry = QString() );
60 
61  bool IsDisplayed( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 ) const;
62  void Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0,
63  const bool isStoreViewState = true, const bool isUpdateViewer = true );
64  void Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0,
65  const bool isUpdateViewer = true );
66  void EraseRemovedAnnotation( const QString& theEntry, const int theIndex );
67  void Redisplay( const QString& theEntry, const int theIndex,
68  const GEOMGUI_AnnotationAttrs::Properties& theProperties);
69  void Redisplay( const QString& theEntry, const int theIndex,
70  const GEOMGUI_AnnotationAttrs::Properties& theProperties, SOCC_Viewer* theView );
71 
72  void DisplayVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0,
73  const bool isUpdateViewer = true );
74  void EraseVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0,
75  const bool isUpdateViewer = true );
76  void UpdateVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
77 
78  void DisplayAllAnnotations( SOCC_Viewer* theView = 0 );
79  void EraseAllAnnotations( SOCC_Viewer* theView = 0 );
80 
81  void SetPreviewStyle( const QString& theEntry, const int theIndex, const bool theIsPreview );
82 
83  void RemoveView( SOCC_Viewer* theView );
84 
85  int FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
86  SOCC_Viewer* theView = 0 );
87 
88  Handle(SALOME_InteractiveObject) FindInteractiveObject( const QString& theEntry, const int theIndex,
89  SOCC_Viewer* theView = 0 ) const;
90 
91  QString getDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView ) const;
92 
93  void setDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView, const QString theIndicesInfo );
94 
95  QString makeAnnotationEntry( const QString& theEntry, const int theIndex );
96 
97  void storeFixedPosition( const QString& theEntry, SOCC_Viewer* theView );
98 
99  bool getIndexFromEntry( const QString& theEntry, QString& theObjEntry, int& theIndex );
100 
101  bool isAnnotationEntry( const QString& theEntry ) { return theEntry.indexOf( GetEntrySeparator() ) != -1; }
102 
103 protected:
104 
105  SalomeApp_Application* getApplication() const { return myApplication; }
106 
107  GEOM_Displayer* getDisplayer() const;
108 
109  SOCC_Viewer* viewOrActiveView( SOCC_Viewer* theView ) const;
110 
111  void getObject( const QString& theEntry, const int theIndex,
112  GEOM::GEOM_Object_ptr& anObject,
114 
115  void storeVisibleState( const QString& theEntry, SOCC_Viewer* theView );
116 
117  std::string getEntry( const GEOM::GEOM_Object_ptr theObject );
118 
119  std::string getName( const GEOM::GEOM_Object_ptr theObject );
120 
121  void setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
122  SOCC_Viewer* theView = 0,
123  const QString& theEntry = QString() );
124 
125  Handle(GEOM_Annotation) getAISPresentation ( const QString& theEntry,
126  const int theIndex,
127  SOCC_Viewer* theView );
128 
129 private:
130  SalomeApp_Application* myApplication;
131 
132  typedef QMap<int, SALOME_Prs*> AnnotationToPrs;
133  typedef QMap<QString, AnnotationToPrs> EntryToAnnotations;
134  QMap<SOCC_Viewer*, EntryToAnnotations> myVisualized;
135 };
136 #endif