2014-05-21 19:42:20 +06:00
|
|
|
// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef DEPENDENCYTREE_VIEW_H
|
|
|
|
#define DEPENDENCYTREE_VIEW_H
|
|
|
|
|
|
|
|
#include <GraphicsView_ViewPort.h>
|
|
|
|
#include <GraphicsView_ViewFrame.h>
|
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
#include <GEOMUtils.hxx>
|
|
|
|
|
2014-05-21 19:42:20 +06:00
|
|
|
#include <QWidgetAction>
|
2014-05-23 14:09:19 +06:00
|
|
|
#include <QPushButton>
|
2014-05-21 19:42:20 +06:00
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
class DependencyTree_Object;
|
2014-05-23 14:09:19 +06:00
|
|
|
class DependencyTree_Arrow;
|
2014-05-21 19:42:20 +06:00
|
|
|
class DependencyTree_View;
|
|
|
|
|
|
|
|
class DependencyTree_ComputeDlg_QThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-05-23 14:09:19 +06:00
|
|
|
|
|
|
|
DependencyTree_ComputeDlg_QThread( DependencyTree_View* );
|
|
|
|
bool result();
|
|
|
|
void cancel();
|
2014-05-21 19:42:20 +06:00
|
|
|
|
|
|
|
DependencyTree_View* getView() { return myView; };
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void run();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DependencyTree_View* myView;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DependencyTree_View: public GraphicsView_ViewPort
|
|
|
|
{
|
2014-05-23 14:09:19 +06:00
|
|
|
Q_OBJECT
|
2014-05-21 19:42:20 +06:00
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
public:
|
2014-05-21 19:42:20 +06:00
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
DependencyTree_View( QWidget* = 0 );
|
2014-05-21 19:42:20 +06:00
|
|
|
~DependencyTree_View();
|
|
|
|
|
|
|
|
void setHierarchyType( const int );
|
|
|
|
void setNodesMovable( const bool );
|
|
|
|
void setPrefBackgroundColor( const QColor& );
|
|
|
|
void setNodeColor( const QColor& );
|
|
|
|
void setMainNodeColor( const QColor& );
|
|
|
|
void setSelectNodeColor( const QColor& );
|
|
|
|
void setArrowColor( const QColor& );
|
|
|
|
void setHighlightArrowColor( const QColor& );
|
|
|
|
void setSelectArrowColor( const QColor& );
|
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
// typedef QList<QString> NodeLinks;
|
|
|
|
// typedef QMap<QString, NodeLinks> LevelInfo;
|
|
|
|
// typedef QList<LevelInfo> LevelsList;
|
|
|
|
// typedef QMap<QString,QPair<LevelsList,LevelsList> > TreeModel;
|
2014-05-21 19:42:20 +06:00
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
GEOMUtils::TreeModel myTreeModel;
|
|
|
|
std::map<std::string,DependencyTree_Object*> myTreeMap;
|
|
|
|
std::map<std::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> Arrows;
|
2014-05-21 19:42:20 +06:00
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
std::map<std::string,int> myLevelMap;
|
2014-05-21 19:42:20 +06:00
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
std::map< int, std::vector<std::string> > myLevelsObject;
|
2014-05-21 19:42:20 +06:00
|
|
|
int myCurrentLevel;
|
|
|
|
|
|
|
|
void init( GraphicsView_ViewFrame* );
|
|
|
|
|
|
|
|
void onRedrawTree();
|
|
|
|
|
|
|
|
void setIsCompute( bool theIsCompute );
|
|
|
|
bool getIsCompute() { return myIsCompute; };
|
|
|
|
private slots:
|
|
|
|
void onUpdateTree();
|
|
|
|
void updateView();
|
|
|
|
void onMoveNodes( bool );
|
|
|
|
void onHierarchyType();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void timerEvent(QTimerEvent *timer);
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onCancel();
|
|
|
|
|
|
|
|
private:
|
2014-05-23 14:09:19 +06:00
|
|
|
// void parseData( QString& data );
|
|
|
|
|
|
|
|
void parseTree();
|
|
|
|
void parseTreeWard(const GEOMUtils::LevelsList);
|
|
|
|
void parseTreeWardArrow(const GEOMUtils::LevelsList);
|
|
|
|
|
|
|
|
void addNode( const std::string& entry );
|
2014-05-21 19:42:20 +06:00
|
|
|
void addArrow( DependencyTree_Object *startItem, DependencyTree_Object *endItem );
|
|
|
|
void findArrow( DependencyTree_Object *startItem, DependencyTree_Object *endItem );
|
2014-05-23 14:09:19 +06:00
|
|
|
// GEOMUtils::LevelsList parseWard( const QString& data, int& cursor );
|
2014-05-21 19:42:20 +06:00
|
|
|
void drawTree();
|
2014-05-23 14:09:19 +06:00
|
|
|
void drawWard( GEOMUtils::LevelsList ward, const int levelStep );
|
2014-05-21 19:42:20 +06:00
|
|
|
void drawArrows();
|
2014-05-23 14:09:19 +06:00
|
|
|
void drawWardArrows( GEOMUtils::LevelsList );
|
2014-05-21 19:42:20 +06:00
|
|
|
|
|
|
|
int checkMaxLevelsNumber();
|
|
|
|
int myLevelsNumber;
|
|
|
|
int myMaxDownwardLevelsNumber;
|
|
|
|
int myMaxUpwardLevelsNumber;
|
|
|
|
|
|
|
|
QCheckBox* myNodesMovable;
|
|
|
|
QSpinBox* myHierarchyDepth;
|
|
|
|
QCheckBox* myDisplayAscendants;
|
|
|
|
QCheckBox* myDisplayDescendants;
|
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
std::string myData;
|
2014-05-21 19:42:20 +06:00
|
|
|
|
|
|
|
bool myIsUpdate;
|
|
|
|
|
|
|
|
GraphicsView_ViewFrame* myViewFrame;
|
|
|
|
|
|
|
|
bool myIsCompute;
|
|
|
|
DependencyTree_ComputeDlg_QThread* qthread;
|
|
|
|
QPushButton * cancelButton;
|
|
|
|
QProgressBar* progressBar;
|
|
|
|
QWidgetAction* cancelAction;
|
|
|
|
QWidgetAction* progressAction;
|
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
//SALOMEDS::Study_var myStudy;
|
2014-05-21 19:42:20 +06:00
|
|
|
|
2014-05-23 14:09:19 +06:00
|
|
|
};
|
2014-05-21 19:42:20 +06:00
|
|
|
|
|
|
|
#endif
|