1 // Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef DEPENDENCYTREE_VIEW_H
21 #define DEPENDENCYTREE_VIEW_H
24 #include <GEOMUtils.hxx>
25 #include <GeometryGUI.h>
28 #include <GraphicsView_ViewPort.h>
29 #include <GraphicsView_ViewFrame.h>
31 #include <SalomeApp_Application.h>
34 #include <QPushButton>
38 #include "DependencyTree.h"
40 class DependencyTree_Object;
41 class DependencyTree_Arrow;
42 class DependencyTree_View;
44 typedef std::map<std::string,DependencyTree_Object*> EntryObjectMap;
45 typedef std::map<std::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> ArrowsInfo;
47 class DEPENDENCYTREE_EXPORT DependencyTree_View: public GraphicsView_ViewPort
53 DependencyTree_View( QWidget* = 0 );
54 ~DependencyTree_View();
56 void init( GraphicsView_ViewFrame* );
57 void updateModel( bool = true, bool = true );
59 void mouseMoveEvent(QMouseEvent* event);
60 void wheelEvent( QWheelEvent* event );
62 QString getViewName() const;
63 int getStudyId() const;
65 DependencyTree_Object* getObjectByEntry( const std::string& );
69 void onRebuildModel();
74 void onMoveNodes( bool );
75 void onHierarchyType();
76 void onPreferenceChanged( const QString&, const QString& );
77 void onRenameObject( const QString& theEntry );
82 void parseTreeWard( const GEOMUtils::LevelsList& );
83 void parseTreeWardArrow( const GEOMUtils::LevelsList& );
85 void addNode( const std::string& );
86 void addArrow( DependencyTree_Object*, DependencyTree_Object* );
89 void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
90 std::map< int, std::vector< std::string > >&, int, const int );
91 void drawWardArrows( const GEOMUtils::LevelsList& );
94 void clearView( bool );
96 int checkMaxLevelsNumber();
98 void getNewTreeModel( bool = true, bool = true );
100 void setHierarchyType( const int );
101 void setNodesMovable( const bool );
102 void setPrefBackgroundColor( const QColor& );
103 void setNodeColor( const QColor& );
104 void setMainNodeColor( const QColor& );
105 void setUnpublishNodeColor( const QColor& );
106 void setSelectNodeColor( const QColor& );
107 void setArrowColor( const QColor& );
108 void setHighlightArrowColor( const QColor& );
109 void setSelectArrowColor( const QColor& );
111 GEOMUtils::TreeModel myTreeModel;
113 EntryObjectMap myTreeMap;
117 int myMaxDownwardLevelsNumber;
118 int myMaxUpwardLevelsNumber;
120 QCheckBox* myNodesMovable;
121 QSpinBox* myHierarchyDepth;
122 QCheckBox* myDisplayAscendants;
123 QCheckBox* myDisplayDescendants;
124 QPushButton* updateButton;
126 SALOMEDS::Study_var myStudy;
127 LightApp_SelectionMgr* mySelectionMgr;
128 GEOM::string_array_var myMainEntries;