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 #include <GraphicsView_Object.h>
22 #include "DependencyTree.h"
23 #include "DependencyTree_ViewModel.h"
25 #include <QGraphicsItem>
32 #include <QGraphicsPolygonItem>
33 #include <QGraphicsSimpleTextItem>
34 #include <QWidgetAction>
39 #include <QtxActionToolMgr.h>
41 #include "DependencyTree_View.h"
42 #include <DependencyTree_Selector.h>
44 #include <GraphicsView_Viewer.h>
45 #include <GraphicsView_ViewFrame.h>
46 #include <GraphicsView_Scene.h>
48 #include <SUIT_Session.h>
49 #include <SUIT_ViewManager.h>
50 #include <SUIT_SelectionMgr.h>
51 #include <SalomeApp_Application.h>
55 #include <QGraphicsView>
59 DependencyTree::DependencyTree()
61 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
62 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
65 LightApp_SelectionMgr* mySelMgr = app->selectionMgr();
67 SUIT_ViewManager *svm = app->getViewManager(GraphicsView_Viewer::Type(), false );
70 myView = new DependencyTree_View();
71 DependencyTree_ViewModel* ViewModel = new DependencyTree_ViewModel(GraphicsView_Viewer::Type(), myView);
72 SUIT_ViewManager *svm = app->createViewManager( ViewModel );
73 new DependencyTree_Selector( ViewModel,
74 ( SUIT_SelectionMgr*)mySelMgr );
75 SUIT_ViewWindow* svw = svm->getActiveView();
76 GraphicsView_ViewFrame* aViewFrame = 0;
77 if (!svw) svw = svm->createViewWindow();
78 if (svw) aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>(svw);
80 myView->init( aViewFrame );
81 svm->setTitle("DEPENDENCY_TREE");
84 if( DependencyTree_ViewModel* viewModel = dynamic_cast<DependencyTree_ViewModel*>( svm->getViewModel() ) )
85 if( DependencyTree_View* view = dynamic_cast<DependencyTree_View*>( viewModel->getActiveViewPort() ) ) {
86 svm->getActiveView()->setFocus();
94 DependencyTree::~DependencyTree()