Version: 9.12.0
DependencyTree_View.h
Go to the documentation of this file.
1 // Copyright (C) 2014-2023 CEA, EDF, 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 DEPENDENCYTREE_VIEW_H
21 #define DEPENDENCYTREE_VIEW_H
22 
23 // GEOM includes
24 #include <GEOMUtils.hxx>
25 #include <GeometryGUI.h>
26 
27 // GUI includes
28 #include <GraphicsView_ViewPort.h>
29 #include <GraphicsView_ViewFrame.h>
30 
31 #include <SalomeApp_Application.h>
32 
33 // QT includes
34 #include <QPushButton>
35 #include <QSpinBox>
36 #include <QCheckBox>
37 
38 #include "DependencyTree.h"
39 
43 
44 typedef std::map<std::string,DependencyTree_Object*> EntryObjectMap;
45 typedef std::map<std::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> ArrowsInfo;
46 
48 {
49  Q_OBJECT
50 
51 public:
52 
55 
56  void init( GraphicsView_ViewFrame* );
57  void updateModel( bool = true, bool = true );
58 
59  void mouseMoveEvent(QMouseEvent* event);
60  void wheelEvent( QWheelEvent* event );
61 
62  QString getViewName() const;
63 
64  DependencyTree_Object* getObjectByEntry( const std::string& );
65 
66 public slots:
67 
68  void onRebuildModel();
69 
70 protected:
71 
72  void resizeEvent( QResizeEvent *event );
73 
74 private slots:
75 
76  void onUpdateModel();
77  void onMoveNodes( bool );
78  void onHierarchyType();
79  void onPreferenceChanged( const QString&, const QString& );
80  void onRenameObject( const QString& theEntry );
81 
82 private:
83 
84  void parseTree();
85  void parseTreeWard( const GEOMUtils::LevelsList& );
86  void parseTreeWardArrow( const GEOMUtils::LevelsList& );
87 
88  void addNode( const std::string& );
89  void addArrow( DependencyTree_Object*, DependencyTree_Object* );
90 
91  void drawTree();
92  void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
93  std::map< int, std::vector< std::string > >&, int, const int );
94  void drawWardArrows( const GEOMUtils::LevelsList& );
95 
96  void updateView();
97  void clearView( bool );
98 
99  void fitWindow();
100 
101  int checkMaxLevelsNumber();
102 
103  void getNewTreeModel( bool = true, bool = true );
104 
105  void setHierarchyType( const int );
106  void setNodesMovable( const bool );
107  void setPrefBackgroundColor( const QColor& );
108  void setNodeColor( const QColor& );
109  void setMainNodeColor( const QColor& );
110  void setUnpublishNodeColor( const QColor& );
111  void setSelectNodeColor( const QColor& );
112  void setArrowColor( const QColor& );
113  void setHighlightArrowColor( const QColor& );
114  void setSelectArrowColor( const QColor& );
115 
117 
120 
124 
125  QCheckBox* myNodesMovable;
126  QSpinBox* myHierarchyDepth;
129  QPushButton* updateButton;
130 
131  LightApp_SelectionMgr* mySelectionMgr;
132  GEOM::string_array_var myMainEntries;
133 
135 
136 };
137 
138 #endif
#define DEPENDENCYTREE_EXPORT
Definition: DependencyTree.h:30
std::map< std::pair< DependencyTree_Object *, DependencyTree_Object * >, DependencyTree_Arrow * > ArrowsInfo
Definition: DependencyTree_View.h:45
std::map< std::string, DependencyTree_Object * > EntryObjectMap
Definition: DependencyTree_View.h:42
Definition: DependencyTree_Arrow.h:30
Definition: DependencyTree_Object.h:34
Definition: DependencyTree_View.h:48
int myMaxUpwardLevelsNumber
Definition: DependencyTree_View.h:123
bool myIsUpdate
Definition: DependencyTree_View.h:134
LightApp_SelectionMgr * mySelectionMgr
Definition: DependencyTree_View.h:131
GEOMUtils::TreeModel myTreeModel
Definition: DependencyTree_View.h:116
ArrowsInfo myArrows
Definition: DependencyTree_View.h:119
QSpinBox * myHierarchyDepth
Definition: DependencyTree_View.h:126
QCheckBox * myDisplayDescendants
Definition: DependencyTree_View.h:128
int myMaxDownwardLevelsNumber
Definition: DependencyTree_View.h:122
QCheckBox * myDisplayAscendants
Definition: DependencyTree_View.h:127
QCheckBox * myNodesMovable
Definition: DependencyTree_View.h:125
QPushButton * updateButton
Definition: DependencyTree_View.h:129
EntryObjectMap myTreeMap
Definition: DependencyTree_View.h:118
GEOM::string_array_var myMainEntries
Definition: DependencyTree_View.h:132
int myLevelsNumber
Definition: DependencyTree_View.h:121
std::map< std::string, std::pair< LevelsList, LevelsList > > TreeModel
Definition: GEOMUtils.hxx:71
std::vector< LevelInfo > LevelsList
Definition: GEOMUtils.hxx:70