mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 12:40:33 +05:00
- clean programming code
This commit is contained in:
parent
589fb20740
commit
182e941e7e
@ -17,6 +17,7 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// internal includes
|
||||||
#include "DependencyTree_Arrow.h"
|
#include "DependencyTree_Arrow.h"
|
||||||
#include "DependencyTree_Object.h"
|
#include "DependencyTree_Object.h"
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ QRectF DependencyTree_Arrow::boundingRect() const
|
|||||||
qreal extra;
|
qreal extra;
|
||||||
QRectF boundingRect;
|
QRectF boundingRect;
|
||||||
if( myStartItem == myEndItem ) {
|
if( myStartItem == myEndItem ) {
|
||||||
extra = arrowSize / 2.0;
|
extra = arrowSize / 2.0 + 2.0;
|
||||||
boundingRect = mySelfDependencyArrow;
|
boundingRect = mySelfDependencyArrow;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// internal includes
|
||||||
#include "DependencyTree_Object.h"
|
#include "DependencyTree_Object.h"
|
||||||
|
|
||||||
// GEOM includes
|
// GEOM includes
|
||||||
@ -169,7 +170,6 @@ void DependencyTree_Object::updateName()
|
|||||||
|
|
||||||
QString name = myGeomObject->GetName();
|
QString name = myGeomObject->GetName();
|
||||||
QString studyEntry = myGeomObject->GetStudyEntry();
|
QString studyEntry = myGeomObject->GetStudyEntry();
|
||||||
std::cout<<"\n\n name = " << name.toStdString() << " studyEntry = " << studyEntry.toStdString() << std::endl;
|
|
||||||
|
|
||||||
if( studyEntry.isEmpty() ) {
|
if( studyEntry.isEmpty() ) {
|
||||||
if( name.isEmpty() )
|
if( name.isEmpty() )
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// internal includes
|
||||||
#include "DependencyTree_Selector.h"
|
#include "DependencyTree_Selector.h"
|
||||||
#include "DependencyTree_View.h"
|
#include "DependencyTree_View.h"
|
||||||
#include "DependencyTree_ViewModel.h"
|
#include "DependencyTree_ViewModel.h"
|
||||||
@ -28,8 +29,6 @@
|
|||||||
//GEOM includes
|
//GEOM includes
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
DependencyTree_Selector::DependencyTree_Selector( DependencyTree_ViewModel* theModel, SUIT_SelectionMgr* theSelMgr )
|
DependencyTree_Selector::DependencyTree_Selector( DependencyTree_ViewModel* theModel, SUIT_SelectionMgr* theSelMgr )
|
||||||
:LightApp_GVSelector( (GraphicsView_Viewer*)theModel, theSelMgr )
|
:LightApp_GVSelector( (GraphicsView_Viewer*)theModel, theSelMgr )
|
||||||
{
|
{
|
||||||
@ -50,8 +49,11 @@ void DependencyTree_Selector::getSelection( SUIT_DataOwnerPtrList& theList ) con
|
|||||||
if( DependencyTree_Object* treeObject = dynamic_cast<DependencyTree_Object*>( myView->selectedObject() ) ) {
|
if( DependencyTree_Object* treeObject = dynamic_cast<DependencyTree_Object*>( myView->selectedObject() ) ) {
|
||||||
const char* entry;
|
const char* entry;
|
||||||
const char* name;
|
const char* name;
|
||||||
if( !treeObject->getGeomObject()->_is_nil() ) {
|
GEOM::GEOM_BaseObject_var anObj = GeometryGUI::GetGeomGen()->GetObject( myView->getStudyId(),
|
||||||
QString studyEntry = treeObject->getGeomObject()->GetStudyEntry();
|
treeObject->getEntry().c_str() );
|
||||||
|
if( anObj->_is_nil() )
|
||||||
|
continue;
|
||||||
|
QString studyEntry = anObj->GetStudyEntry();
|
||||||
if( studyEntry.isEmpty() ) {
|
if( studyEntry.isEmpty() ) {
|
||||||
entry = treeObject->getEntry().c_str();
|
entry = treeObject->getEntry().c_str();
|
||||||
name = "TEMP_IO_UNPUBLISHED";
|
name = "TEMP_IO_UNPUBLISHED";
|
||||||
@ -66,7 +68,6 @@ void DependencyTree_Selector::getSelection( SUIT_DataOwnerPtrList& theList ) con
|
|||||||
theList.append( new LightApp_DataOwner( tmpIO ) );
|
theList.append( new LightApp_DataOwner( tmpIO ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : setSelection()
|
// function : setSelection()
|
||||||
@ -93,7 +94,7 @@ void DependencyTree_Selector::setSelection( const SUIT_DataOwnerPtrList& theList
|
|||||||
return;
|
return;
|
||||||
entry = geomObject->GetEntry();
|
entry = geomObject->GetEntry();
|
||||||
}
|
}
|
||||||
DependencyTree_Object* object = myView->getObjectByEntry( QString( entry ) );
|
DependencyTree_Object* object = myView->getObjectByEntry( entry );
|
||||||
if( object ) {
|
if( object ) {
|
||||||
myView->setSelected( object );
|
myView->setSelected( object );
|
||||||
object->select( object->pos().x(), object->pos().y(), object->getRect() );
|
object->select( object->pos().x(), object->pos().y(), object->getRect() );
|
||||||
|
@ -29,14 +29,17 @@ class DependencyTree_Selector: public LightApp_GVSelector
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DependencyTree_Selector( DependencyTree_ViewModel*, SUIT_SelectionMgr* );
|
DependencyTree_Selector( DependencyTree_ViewModel*, SUIT_SelectionMgr* );
|
||||||
~DependencyTree_Selector();
|
~DependencyTree_Selector();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
|
virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
|
||||||
virtual void setSelection( const SUIT_DataOwnerPtrList& );
|
virtual void setSelection( const SUIT_DataOwnerPtrList& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DependencyTree_View* myView;
|
DependencyTree_View* myView;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -34,23 +34,15 @@
|
|||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QProgressBar>
|
#include <QWidgetAction>
|
||||||
|
|
||||||
#define UPDATE_EVENT ( QEvent::User + 1 )
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
DependencyTree_View::DependencyTree_View( QWidget* theParent )
|
DependencyTree_View::DependencyTree_View( QWidget* theParent )
|
||||||
:GraphicsView_ViewPort( theParent ),
|
:GraphicsView_ViewPort( theParent ),
|
||||||
|
myLevelsNumber(0),
|
||||||
myMaxDownwardLevelsNumber(0),
|
myMaxDownwardLevelsNumber(0),
|
||||||
myMaxUpwardLevelsNumber(0),
|
myMaxUpwardLevelsNumber(0),
|
||||||
myLevelsNumber(0),
|
myIsUpdate( true )
|
||||||
myIsCompute(false),
|
|
||||||
myIsUpdate( true ),
|
|
||||||
myTotalCost(0),
|
|
||||||
myComputedCost(0)
|
|
||||||
{
|
{
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
if ( !app ) return;
|
if ( !app ) return;
|
||||||
@ -68,25 +60,26 @@ myComputedCost(0)
|
|||||||
|
|
||||||
DependencyTree_View::~DependencyTree_View()
|
DependencyTree_View::~DependencyTree_View()
|
||||||
{
|
{
|
||||||
|
clearView( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : init()
|
||||||
|
// purpose : this method is obligatory for initialize view frame actions
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::init( GraphicsView_ViewFrame* theViewFrame )
|
void DependencyTree_View::init( GraphicsView_ViewFrame* theViewFrame )
|
||||||
{
|
{
|
||||||
qthread = new DependencyTree_QThread( this );
|
|
||||||
|
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
|
||||||
|
|
||||||
myNodesMovable = new QCheckBox( tr( "MOVE_NODES" ) );
|
myNodesMovable = new QCheckBox( tr( "MOVE_NODES" ) );
|
||||||
QWidgetAction* nodesMovableAction = new QWidgetAction( theViewFrame );
|
QWidgetAction* nodesMovableAction = new QWidgetAction( theViewFrame );
|
||||||
nodesMovableAction->setDefaultWidget( myNodesMovable );
|
nodesMovableAction->setDefaultWidget( myNodesMovable );
|
||||||
|
|
||||||
myDisplayAscendants = new QCheckBox( tr( "DISPLAY_ASCENDANTS" ) );
|
myDisplayAscendants = new QCheckBox( tr( "DISPLAY_ASCENDANTS" ) );
|
||||||
QWidgetAction* ShowParentsAction = new QWidgetAction( theViewFrame );
|
QWidgetAction* displayAscendantsAction = new QWidgetAction( theViewFrame );
|
||||||
ShowParentsAction->setDefaultWidget( myDisplayAscendants );
|
displayAscendantsAction->setDefaultWidget( myDisplayAscendants );
|
||||||
|
|
||||||
myDisplayDescendants = new QCheckBox(tr("DISPLAY_DESCENDANTS"));
|
myDisplayDescendants = new QCheckBox(tr("DISPLAY_DESCENDANTS"));
|
||||||
QWidgetAction* ShowChildrenAction = new QWidgetAction(theViewFrame);
|
QWidgetAction* displayDescendantsAction = new QWidgetAction( theViewFrame );
|
||||||
ShowChildrenAction->setDefaultWidget( myDisplayDescendants );
|
displayDescendantsAction->setDefaultWidget( myDisplayDescendants );
|
||||||
|
|
||||||
QLabel* hierarchyDepthLabel = new QLabel( tr( "HIERARCHY_DEPTH" ) );
|
QLabel* hierarchyDepthLabel = new QLabel( tr( "HIERARCHY_DEPTH" ) );
|
||||||
QWidgetAction* hierarchyDepthLabelAction = new QWidgetAction( theViewFrame );
|
QWidgetAction* hierarchyDepthLabelAction = new QWidgetAction( theViewFrame );
|
||||||
@ -105,184 +98,103 @@ void DependencyTree_View::init( GraphicsView_ViewFrame* theViewFrame )
|
|||||||
QWidgetAction* updateAction = new QWidgetAction( theViewFrame );
|
QWidgetAction* updateAction = new QWidgetAction( theViewFrame );
|
||||||
updateAction->setDefaultWidget( updateButton );
|
updateAction->setDefaultWidget( updateButton );
|
||||||
|
|
||||||
QPushButton* cancelButton = new QPushButton( tr( "CANCEL" ) );
|
|
||||||
cancelButton->setCheckable( true );
|
|
||||||
cancelAction = new QWidgetAction( theViewFrame );
|
|
||||||
cancelAction->setDefaultWidget( cancelButton );
|
|
||||||
cancelAction->setVisible( false );
|
|
||||||
|
|
||||||
QProgressBar* progressBar = new QProgressBar( this );
|
|
||||||
progressBar->setMinimum( 0 );
|
|
||||||
progressBar->setMaximum( 100 );
|
|
||||||
progressBar->setFixedWidth( 100 );
|
|
||||||
progressAction = new QWidgetAction( theViewFrame );
|
|
||||||
progressAction->setDefaultWidget( progressBar );
|
|
||||||
progressAction->setVisible( false );
|
|
||||||
|
|
||||||
QAction* separator1 = theViewFrame->toolMgr()->separator( false );
|
QAction* separator1 = theViewFrame->toolMgr()->separator( false );
|
||||||
QAction* separator2 = theViewFrame->toolMgr()->separator( false );
|
QAction* separator2 = theViewFrame->toolMgr()->separator( false );
|
||||||
|
|
||||||
theViewFrame->toolMgr()->append( separator1, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( separator1, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( hierarchyDepthLabelAction, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( hierarchyDepthLabelAction, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( hierarchyDepthAction, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( hierarchyDepthAction, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( ShowParentsAction, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( displayAscendantsAction, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( ShowChildrenAction, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( displayDescendantsAction, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( nodesMovableAction, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( nodesMovableAction, theViewFrame->getToolBarId() );
|
||||||
|
|
||||||
theViewFrame->toolMgr()->append( separator2, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( separator2, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( updateAction, theViewFrame->getToolBarId() );
|
theViewFrame->toolMgr()->append( updateAction, theViewFrame->getToolBarId() );
|
||||||
theViewFrame->toolMgr()->append( progressAction, theViewFrame->getToolBarId() );
|
|
||||||
theViewFrame->toolMgr()->append( cancelAction, theViewFrame->getToolBarId() );
|
|
||||||
|
|
||||||
connect( myNodesMovable, SIGNAL( toggled( bool ) ), this, SLOT( onMoveNodes( bool ) ) );
|
connect( myNodesMovable, SIGNAL( toggled( bool ) ), this, SLOT( onMoveNodes( bool ) ) );
|
||||||
connect( myHierarchyDepth, SIGNAL( valueChanged ( int ) ), this, SLOT( onHierarchyType() ) );
|
connect( myHierarchyDepth, SIGNAL( valueChanged ( int ) ), this, SLOT( onHierarchyType() ) );
|
||||||
connect( myDisplayAscendants , SIGNAL( toggled( bool ) ), this, SLOT( onHierarchyType() ) );
|
connect( myDisplayAscendants , SIGNAL( toggled( bool ) ), this, SLOT( onHierarchyType() ) );
|
||||||
connect( myDisplayDescendants, SIGNAL( toggled( bool ) ), this, SLOT( onHierarchyType() ) );
|
connect( myDisplayDescendants, SIGNAL( toggled( bool ) ), this, SLOT( onHierarchyType() ) );
|
||||||
connect( updateButton, SIGNAL( clicked() ), this, SLOT( onUpdateModel() ) );
|
connect( updateButton, SIGNAL( clicked() ), this, SLOT( onUpdateModel() ) );
|
||||||
connect( cancelButton, SIGNAL( clicked() ), this, SLOT( onCancel() ) );
|
|
||||||
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
|
|
||||||
setPrefBackgroundColor( resMgr->colorValue( "Geometry", "dependency_tree_background_color", QColor( 255, 255, 255 ) ) );
|
setPrefBackgroundColor( resMgr->colorValue( "Geometry", "dependency_tree_background_color", QColor( 255, 255, 255 ) ) );
|
||||||
setNodesMovable( resMgr->booleanValue( "Geometry", "dependency_tree_move_nodes", true ) );
|
setNodesMovable( resMgr->booleanValue( "Geometry", "dependency_tree_move_nodes", true ) );
|
||||||
setHierarchyType( resMgr->integerValue( "Geometry", "dependency_tree_hierarchy_type", 0 ) );
|
setHierarchyType( resMgr->integerValue( "Geometry", "dependency_tree_hierarchy_type", 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateModel()
|
||||||
|
// purpose : run all stage of dependency tree creation
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::updateModel( bool theUseSelectedObject, bool theUseOB )
|
void DependencyTree_View::updateModel( bool theUseSelectedObject, bool theUseOB )
|
||||||
{
|
{
|
||||||
getNewTreeModel( theUseSelectedObject, theUseOB );
|
getNewTreeModel( theUseSelectedObject, theUseOB );
|
||||||
onHierarchyType();
|
onHierarchyType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : mouseMoveEvent()
|
||||||
|
// purpose : make some actions when mouse was moved
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::mouseMoveEvent( QMouseEvent *event )
|
||||||
|
{
|
||||||
|
QGraphicsView::mouseMoveEvent( event );
|
||||||
|
ArrowsInfo::const_iterator i;
|
||||||
|
for( i = myArrows.begin(); i != myArrows.end(); i++ ) {
|
||||||
|
DependencyTree_Arrow* arrow = myArrows[ i->first ];
|
||||||
|
arrow->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getViewName()
|
||||||
|
// purpose : return the name of current view
|
||||||
|
//=================================================================================
|
||||||
QString DependencyTree_View::getViewName() const
|
QString DependencyTree_View::getViewName() const
|
||||||
{
|
{
|
||||||
return tr( "DEPENDENCY_TREE" );
|
return tr( "DEPENDENCY_TREE" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::drawTree()
|
//=================================================================================
|
||||||
|
// function : getStudyId()
|
||||||
|
// purpose : return Id of current study
|
||||||
|
//=================================================================================
|
||||||
|
int DependencyTree_View::getStudyId() const
|
||||||
{
|
{
|
||||||
myComputedCost = 0;
|
return myStudy->StudyId();
|
||||||
calcTotalCost();
|
|
||||||
std::cout << "\n\n\n TOTAL COST = " << myTotalCost << std::endl;
|
|
||||||
|
|
||||||
if( !myIsCompute )
|
|
||||||
return;
|
|
||||||
|
|
||||||
clearView( false );
|
|
||||||
clearSelected();
|
|
||||||
|
|
||||||
// draw nodes on scene
|
|
||||||
std::map< std::string, int > entryLevelMap;
|
|
||||||
std::map< int, std::vector< std::string > > levelObjects;
|
|
||||||
int currentLevel;
|
|
||||||
int horDistance, verDistance;
|
|
||||||
GEOMUtils::TreeModel::const_reverse_iterator i;
|
|
||||||
for( i = myTreeModel.rbegin(); i != myTreeModel.rend(); i++ ) {
|
|
||||||
if( !myIsCompute )
|
|
||||||
return;
|
|
||||||
currentLevel = 0;
|
|
||||||
myComputedCost++;
|
|
||||||
std::string objectEntry = i->first;
|
|
||||||
DependencyTree_Object* objectItem = myTreeMap[ objectEntry ];
|
|
||||||
horDistance = 100 + int( objectItem->boundingRect().width() );
|
|
||||||
verDistance = 3 * int( objectItem->boundingRect().height() );
|
|
||||||
if( isItemAdded( objectItem ) )
|
|
||||||
currentLevel = entryLevelMap[ objectEntry ];
|
|
||||||
else {
|
|
||||||
addNewItem( objectItem );
|
|
||||||
objectItem->unselect();
|
|
||||||
entryLevelMap[ objectEntry ] = currentLevel;
|
|
||||||
levelObjects[ currentLevel ].push_back( objectEntry );
|
|
||||||
}
|
|
||||||
objectItem->setIsMainObject( true );
|
|
||||||
|
|
||||||
if( myDisplayAscendants->isChecked() )
|
|
||||||
drawWard( i->second.first, entryLevelMap, levelObjects, currentLevel, -1 );
|
|
||||||
if( myDisplayDescendants->isChecked() )
|
|
||||||
drawWard( i->second.second, entryLevelMap, levelObjects, currentLevel, 1 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map< int, std::vector< std::string > >::const_iterator level;
|
//=================================================================================
|
||||||
for( level = levelObjects.begin(); level != levelObjects.end(); level++ ) {
|
// function : getObjectByEntry()
|
||||||
int step = -horDistance * ( level->second.size() - 1 ) / 2;
|
// purpose : return DependencyTree_Object by entry
|
||||||
std::cout<<"\n\n LEVEL = " << level->first << std::endl;
|
//=================================================================================
|
||||||
for( int objIter = 0; objIter < level->second.size(); objIter++ ) {
|
DependencyTree_Object* DependencyTree_View::getObjectByEntry( const std::string& theEntry )
|
||||||
std::cout << level->second.at( objIter ) << ", ";
|
|
||||||
DependencyTree_Object* anObject = myTreeMap[ level->second.at( objIter ) ];
|
|
||||||
anObject->setPos( step, verDistance * level->first );
|
|
||||||
step += horDistance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw arrows on scene
|
|
||||||
GEOMUtils::TreeModel::const_iterator j;
|
|
||||||
for( j = myTreeModel.begin(); j != myTreeModel.end(); j++ ) {
|
|
||||||
DependencyTree_Object* Main_object = myTreeMap[ j->first ];
|
|
||||||
if( j->second.first.size() > 0 ) {
|
|
||||||
GEOMUtils::LevelInfo Levelup = j->second.first.at(0);
|
|
||||||
if( myDisplayAscendants ->isChecked() ) {
|
|
||||||
GEOMUtils::LevelInfo::const_iterator node;
|
|
||||||
for (node = Levelup.begin(); node != Levelup.end(); node++ ) {
|
|
||||||
DependencyTree_Object* object = myTreeMap[node->first];
|
|
||||||
DependencyTree_Arrow* arrow = myArrows[std::pair<DependencyTree_Object*,DependencyTree_Object*>(Main_object, object)];
|
|
||||||
if( arrow && !isItemAdded( arrow) )
|
|
||||||
addNewItem( arrow );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( myDisplayAscendants->isChecked() )
|
|
||||||
drawWardArrows( j->second.first );
|
|
||||||
if( myDisplayDescendants->isChecked() )
|
|
||||||
drawWardArrows( j->second.second );
|
|
||||||
}
|
|
||||||
std::cout << "\n ComputedCost = " << myComputedCost << std::endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::customEvent( QEvent * event )
|
|
||||||
{
|
{
|
||||||
if( event->type() == UPDATE_EVENT ) {
|
return myTreeMap[ theEntry ];
|
||||||
|
|
||||||
QPushButton* cancelButton = dynamic_cast<QPushButton*>( cancelAction->defaultWidget() );
|
|
||||||
QProgressBar* progressBar = dynamic_cast<QProgressBar*>( progressAction->defaultWidget() );
|
|
||||||
|
|
||||||
if ( !cancelButton->isChecked() )
|
|
||||||
progressBar->setValue( progressBar->maximum() * getComputeProgress() );
|
|
||||||
|
|
||||||
std::cout << "\n\n *** qthread->isFinished() = " << qthread->isFinished() << std::endl;
|
|
||||||
if( !myIsCompute || qthread->isFinished() ) {
|
|
||||||
changeWidgetState( false );
|
|
||||||
cancelButton->setChecked( false );
|
|
||||||
progressBar->setValue(0);
|
|
||||||
fitAll();
|
|
||||||
QApplication::removePostedEvents( this, ( QEvent::Type )UPDATE_EVENT );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event->accept();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::addNewItem( QGraphicsItem* theObject )
|
//=================================================================================
|
||||||
|
// function : updateObjectName()
|
||||||
|
// purpose : update object name, having edited it in Object Browser
|
||||||
|
//=================================================================================
|
||||||
|
bool DependencyTree_View::updateObjectName( const std::string& theEntry )
|
||||||
{
|
{
|
||||||
if( theObject )
|
bool res = false;
|
||||||
addItem( theObject );
|
for( initSelected(); moreSelected(); nextSelected() ) {
|
||||||
qthread->sleepDraw();
|
if( DependencyTree_Object* aDepObject = dynamic_cast<DependencyTree_Object*>( selectedObject() ) ) {
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
aDepObject->updateName();
|
||||||
QApplication::postEvent( this, new QEvent( ( QEvent::Type )UPDATE_EVENT ) );
|
res = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void DependencyTree_View::mouseMoveEvent(QMouseEvent *event)
|
return res;
|
||||||
{
|
|
||||||
QGraphicsView::mouseMoveEvent( event );
|
|
||||||
ArrowsInfo::const_iterator j;
|
|
||||||
for (j = myArrows.begin(); j != myArrows.end(); j++ ) {
|
|
||||||
DependencyTree_Arrow* arrow = myArrows[ j->first ];
|
|
||||||
arrow->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DependencyTree_Object* DependencyTree_View::getObjectByEntry( QString theEntry )
|
|
||||||
{
|
|
||||||
return myTreeMap[theEntry.toStdString()];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setHierarchyType()
|
||||||
|
// purpose : set hierarchy type of dependency tree
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setHierarchyType( const int theType )
|
void DependencyTree_View::setHierarchyType( const int theType )
|
||||||
{
|
{
|
||||||
myIsUpdate = false;
|
myIsUpdate = false;
|
||||||
@ -301,17 +213,23 @@ void DependencyTree_View::setHierarchyType( const int theType )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
myIsUpdate = true;
|
myIsUpdate = true;
|
||||||
|
|
||||||
myLevelsNumber = checkMaxLevelsNumber();
|
myLevelsNumber = checkMaxLevelsNumber();
|
||||||
|
|
||||||
onHierarchyType();
|
onHierarchyType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setNodesMovable()
|
||||||
|
// purpose : set possibility to move nodes or not
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setNodesMovable( const bool theIsMovable )
|
void DependencyTree_View::setNodesMovable( const bool theIsMovable )
|
||||||
{
|
{
|
||||||
myNodesMovable->setChecked( theIsMovable );
|
myNodesMovable->setChecked( theIsMovable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setPrefBackgroundColor()
|
||||||
|
// purpose : set background color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setPrefBackgroundColor( const QColor& theColor )
|
void DependencyTree_View::setPrefBackgroundColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
if( isForegroundEnabled() )
|
if( isForegroundEnabled() )
|
||||||
@ -323,6 +241,10 @@ void DependencyTree_View::setPrefBackgroundColor( const QColor& theColor )
|
|||||||
setBackgroundColor( theColor );
|
setBackgroundColor( theColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setNodeColor()
|
||||||
|
// purpose : set node color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setNodeColor( const QColor& theColor )
|
void DependencyTree_View::setNodeColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
EntryObjectMap::const_iterator i;
|
EntryObjectMap::const_iterator i;
|
||||||
@ -332,6 +254,10 @@ void DependencyTree_View::setNodeColor( const QColor& theColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setMainNodeColor()
|
||||||
|
// purpose : set main node color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setMainNodeColor( const QColor& theColor )
|
void DependencyTree_View::setMainNodeColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
EntryObjectMap::const_iterator i;
|
EntryObjectMap::const_iterator i;
|
||||||
@ -341,6 +267,10 @@ void DependencyTree_View::setMainNodeColor( const QColor& theColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setSelectNodeColor()
|
||||||
|
// purpose : set selected node color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setSelectNodeColor( const QColor& theColor )
|
void DependencyTree_View::setSelectNodeColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
EntryObjectMap::const_iterator i;
|
EntryObjectMap::const_iterator i;
|
||||||
@ -350,95 +280,67 @@ void DependencyTree_View::setSelectNodeColor( const QColor& theColor )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setArrowColor()
|
||||||
|
// purpose : set arrow color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setArrowColor( const QColor& theColor )
|
void DependencyTree_View::setArrowColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
ArrowsInfo::const_iterator j;
|
ArrowsInfo::const_iterator i;
|
||||||
for (j = myArrows.begin(); j != myArrows.end(); j++ ) {
|
for( i = myArrows.begin(); i != myArrows.end(); i++ ) {
|
||||||
DependencyTree_Arrow* arrow = myArrows[ j->first ];
|
DependencyTree_Arrow* arrow = myArrows[ i->first ];
|
||||||
arrow->setColor( theColor );
|
arrow->setColor( theColor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setHighlightArrowColor()
|
||||||
|
// purpose : set highlighted arrow color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setHighlightArrowColor( const QColor& theColor )
|
void DependencyTree_View::setHighlightArrowColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
ArrowsInfo::const_iterator j;
|
ArrowsInfo::const_iterator i;
|
||||||
for (j = myArrows.begin(); j != myArrows.end(); j++ ) {
|
for( i = myArrows.begin(); i != myArrows.end(); i++ ) {
|
||||||
DependencyTree_Arrow* arrow = myArrows[ j->first ];
|
DependencyTree_Arrow* arrow = myArrows[ i->first ];
|
||||||
arrow->setHighlightColor( theColor );
|
arrow->setHighlightColor( theColor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setSelectArrowColor()
|
||||||
|
// purpose : set selected arrow color from preferences
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::setSelectArrowColor( const QColor& theColor )
|
void DependencyTree_View::setSelectArrowColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
ArrowsInfo::const_iterator j;
|
ArrowsInfo::const_iterator i;
|
||||||
for (j = myArrows.begin(); j != myArrows.end(); j++ ) {
|
for( i = myArrows.begin(); i != myArrows.end(); i++ ) {
|
||||||
DependencyTree_Arrow* arrow = myArrows[ j->first ];
|
DependencyTree_Arrow* arrow = myArrows[ i->first ];
|
||||||
arrow->setSelectColor( theColor );
|
arrow->setSelectColor( theColor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::setIsCompute( bool theIsCompute )
|
//=================================================================================
|
||||||
{
|
// function : onRebuildModel()
|
||||||
myIsCompute = theIsCompute;
|
// purpose : slot for updating tree model using selected objects in viewer
|
||||||
}
|
//=================================================================================
|
||||||
|
|
||||||
bool DependencyTree_View::getIsCompute()
|
|
||||||
{
|
|
||||||
return myIsCompute;
|
|
||||||
}
|
|
||||||
|
|
||||||
//void DependencyTree_View::timerEvent(QTimerEvent *event)
|
|
||||||
//{
|
|
||||||
// QPushButton* cancelButton = dynamic_cast<QPushButton*>( cancelAction->defaultWidget() );
|
|
||||||
// QProgressBar* progressBar = dynamic_cast<QProgressBar*>( progressAction->defaultWidget() );
|
|
||||||
//
|
|
||||||
// std::cout << "TIMER! " << std::endl;
|
|
||||||
// if ( !cancelButton->isChecked() )
|
|
||||||
// progressBar->setValue( progressBar->maximum() * getComputeProgress() );
|
|
||||||
//
|
|
||||||
// if( !myIsCompute || qthread->isFinished() ) {
|
|
||||||
// changeWidgetState( false );
|
|
||||||
// killTimer( myTimer );
|
|
||||||
// cancelButton->setChecked( false );
|
|
||||||
// progressBar->setValue(0);
|
|
||||||
// }
|
|
||||||
// event->accept();
|
|
||||||
//}
|
|
||||||
|
|
||||||
void DependencyTree_View::closeEvent( QCloseEvent* event )
|
|
||||||
{
|
|
||||||
if(qthread->isRunning())
|
|
||||||
{
|
|
||||||
event->ignore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::onUpdateModel()
|
|
||||||
{
|
|
||||||
updateModel( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::onRebuildModel()
|
void DependencyTree_View::onRebuildModel()
|
||||||
{
|
{
|
||||||
updateModel( true, false );
|
updateModel( true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::updateView()
|
//=================================================================================
|
||||||
|
// function : onUpdateModel()
|
||||||
|
// purpose : slot for updating tree model for main objects in viewer
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::onUpdateModel()
|
||||||
{
|
{
|
||||||
if( !myIsUpdate )
|
updateModel( false );
|
||||||
return;
|
|
||||||
|
|
||||||
changeWidgetState( true );
|
|
||||||
|
|
||||||
qthread->start();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onMoveNodes()
|
||||||
|
// purpose : slot for setting the possibility to move nodes in viewer
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::onMoveNodes( bool theIsMoveNodes )
|
void DependencyTree_View::onMoveNodes( bool theIsMoveNodes )
|
||||||
{
|
{
|
||||||
EntryObjectMap::const_iterator i;
|
EntryObjectMap::const_iterator i;
|
||||||
@ -449,6 +351,10 @@ void DependencyTree_View::onMoveNodes( bool theIsMoveNodes )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onHierarchyType()
|
||||||
|
// purpose : slot for setting the hierarchy type of tree
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::onHierarchyType()
|
void DependencyTree_View::onHierarchyType()
|
||||||
{
|
{
|
||||||
myHierarchyDepth->setRange( 0, checkMaxLevelsNumber() );
|
myHierarchyDepth->setRange( 0, checkMaxLevelsNumber() );
|
||||||
@ -463,47 +369,12 @@ void DependencyTree_View::onHierarchyType()
|
|||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::onCancel()
|
//=================================================================================
|
||||||
{
|
// function : parseTree()
|
||||||
qthread->cancel();
|
// purpose : parse created model to initialize all nodes and arrows
|
||||||
//qthread->deleteLater();
|
//=================================================================================
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::addNode( const std::string& theEntry )
|
|
||||||
{
|
|
||||||
if( !myTreeMap[theEntry] )
|
|
||||||
myTreeMap[theEntry] = new DependencyTree_Object( theEntry );
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::addArrow( DependencyTree_Object *startItem, DependencyTree_Object *endItem )
|
|
||||||
{
|
|
||||||
bool isFind = false;
|
|
||||||
|
|
||||||
std::cout << " " << startItem->getEntry() << " " << endItem->getEntry() << std::endl;
|
|
||||||
ArrowsInfo::const_iterator i;
|
|
||||||
for (i = myArrows.begin(); i != myArrows.end(); i++ ) {
|
|
||||||
DependencyTree_Arrow* arrow = i->second;
|
|
||||||
if( arrow->getStartItem() == startItem && arrow->getEndItem() == endItem ) {
|
|
||||||
isFind = true;
|
|
||||||
std::cout<<" theSame " << std::endl;
|
|
||||||
}
|
|
||||||
else if( arrow->getStartItem() == endItem && arrow->getEndItem() == startItem ) {
|
|
||||||
arrow->setIsBiLink( true );
|
|
||||||
std::cout<<" Bilink " << std::endl;
|
|
||||||
isFind = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !isFind ) {
|
|
||||||
DependencyTree_Arrow *arrow = new DependencyTree_Arrow(startItem, endItem);
|
|
||||||
myArrows[std::pair<DependencyTree_Object*,DependencyTree_Object*>( startItem, endItem )] = arrow;
|
|
||||||
std::cout<<" addArrow " << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::parseTree()
|
void DependencyTree_View::parseTree()
|
||||||
{
|
{
|
||||||
|
|
||||||
GEOMUtils::TreeModel::const_iterator i;
|
GEOMUtils::TreeModel::const_iterator i;
|
||||||
for( i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) {
|
for( i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) {
|
||||||
std::string objectEntry = i->first;
|
std::string objectEntry = i->first;
|
||||||
@ -529,21 +400,28 @@ void DependencyTree_View::parseTree()
|
|||||||
parseTreeWardArrow( i->second.first );
|
parseTreeWardArrow( i->second.first );
|
||||||
parseTreeWardArrow( i->second.second );
|
parseTreeWardArrow( i->second.second );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void DependencyTree_View::parseTreeWard(const GEOMUtils::LevelsList theWard)
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : parseTreeWard()
|
||||||
|
// purpose : parse tree ward to initialize all nodes of current ward
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::parseTreeWard( const GEOMUtils::LevelsList& theWard )
|
||||||
{
|
{
|
||||||
int levelsNumber = theWard.size();
|
int levelsNumber = theWard.size();
|
||||||
for( int level = 0; level < levelsNumber; level++ ) {
|
for( int level = 0; level < levelsNumber; level++ ) {
|
||||||
GEOMUtils::LevelInfo levelInfo = theWard[ level ];
|
GEOMUtils::LevelInfo levelInfo = theWard[ level ];
|
||||||
GEOMUtils::LevelInfo::const_iterator node;
|
GEOMUtils::LevelInfo::const_iterator node;
|
||||||
for (node = levelInfo.begin(); node != levelInfo.end(); node++ ) {
|
for( node = levelInfo.begin(); node != levelInfo.end(); node++ )
|
||||||
addNode( node->first );
|
addNode( node->first );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
void DependencyTree_View::parseTreeWardArrow(const GEOMUtils::LevelsList theWard)
|
//=================================================================================
|
||||||
|
// function : parseTreeWardArrow()
|
||||||
|
// purpose : parse tree ward to initialize all arrows of current ward
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::parseTreeWardArrow( const GEOMUtils::LevelsList& theWard)
|
||||||
{
|
{
|
||||||
for( int j = 0; j < theWard.size(); j++ ) {
|
for( int j = 0; j < theWard.size(); j++ ) {
|
||||||
GEOMUtils::LevelInfo Level = theWard.at(j);
|
GEOMUtils::LevelInfo Level = theWard.at(j);
|
||||||
@ -560,22 +438,130 @@ void DependencyTree_View::parseTreeWardArrow(const GEOMUtils::LevelsList theWard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : addNode()
|
||||||
|
// purpose : add node to viewer
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::addNode( const std::string& theEntry )
|
||||||
|
{
|
||||||
|
if( !myTreeMap[theEntry] )
|
||||||
|
myTreeMap[theEntry] = new DependencyTree_Object( theEntry );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : addArrow()
|
||||||
|
// purpose : add arrow to viewer
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::addArrow( DependencyTree_Object* startItem, DependencyTree_Object* endItem )
|
||||||
|
{
|
||||||
|
bool isFind = false;
|
||||||
|
|
||||||
|
ArrowsInfo::const_iterator i;
|
||||||
|
for( i = myArrows.begin(); i != myArrows.end(); i++ ) {
|
||||||
|
DependencyTree_Arrow* arrow = i->second;
|
||||||
|
if( arrow->getStartItem() == startItem && arrow->getEndItem() == endItem )
|
||||||
|
isFind = true;
|
||||||
|
else if( arrow->getStartItem() == endItem && arrow->getEndItem() == startItem ) {
|
||||||
|
arrow->setIsBiLink( true );
|
||||||
|
isFind = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !isFind ) {
|
||||||
|
DependencyTree_Arrow *arrow = new DependencyTree_Arrow( startItem, endItem );
|
||||||
|
myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( startItem, endItem ) ] = arrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : drawTree()
|
||||||
|
// purpose : redraw dependency tree using existing model
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::drawTree()
|
||||||
|
{
|
||||||
|
clearView( false );
|
||||||
|
clearSelected();
|
||||||
|
|
||||||
|
// draw nodes on scene
|
||||||
|
std::map< std::string, int > entryLevelMap;
|
||||||
|
std::map< int, std::vector< std::string > > levelObjects;
|
||||||
|
int currentLevel;
|
||||||
|
int horDistance, verDistance;
|
||||||
|
GEOMUtils::TreeModel::const_reverse_iterator i;
|
||||||
|
for( i = myTreeModel.rbegin(); i != myTreeModel.rend(); i++ ) {
|
||||||
|
currentLevel = 0;
|
||||||
|
std::string objectEntry = i->first;
|
||||||
|
DependencyTree_Object* objectItem = myTreeMap[ objectEntry ];
|
||||||
|
horDistance = 100 + int( objectItem->boundingRect().width() );
|
||||||
|
verDistance = 3 * int( objectItem->boundingRect().height() );
|
||||||
|
if( isItemAdded( objectItem ) )
|
||||||
|
currentLevel = entryLevelMap[ objectEntry ];
|
||||||
|
else {
|
||||||
|
addItem( objectItem );
|
||||||
|
objectItem->unselect();
|
||||||
|
entryLevelMap[ objectEntry ] = currentLevel;
|
||||||
|
levelObjects[ currentLevel ].push_back( objectEntry );
|
||||||
|
}
|
||||||
|
objectItem->setIsMainObject( true );
|
||||||
|
|
||||||
|
if( myDisplayAscendants->isChecked() )
|
||||||
|
drawWard( i->second.first, entryLevelMap, levelObjects, currentLevel, -1 );
|
||||||
|
if( myDisplayDescendants->isChecked() )
|
||||||
|
drawWard( i->second.second, entryLevelMap, levelObjects, currentLevel, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map< int, std::vector< std::string > >::const_iterator level;
|
||||||
|
for( level = levelObjects.begin(); level != levelObjects.end(); level++ ) {
|
||||||
|
int step = -horDistance * ( level->second.size() - 1 ) / 2;
|
||||||
|
for( int objIter = 0; objIter < level->second.size(); objIter++ ) {
|
||||||
|
DependencyTree_Object* anObject = myTreeMap[ level->second.at( objIter ) ];
|
||||||
|
anObject->setPos( step, verDistance * level->first );
|
||||||
|
step += horDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw arrows on scene
|
||||||
|
GEOMUtils::TreeModel::const_iterator j;
|
||||||
|
for( j = myTreeModel.begin(); j != myTreeModel.end(); j++ ) {
|
||||||
|
DependencyTree_Object* Main_object = myTreeMap[ j->first ];
|
||||||
|
if( j->second.first.size() > 0 ) {
|
||||||
|
GEOMUtils::LevelInfo Levelup = j->second.first.at(0);
|
||||||
|
if( myDisplayAscendants ->isChecked() ) {
|
||||||
|
GEOMUtils::LevelInfo::const_iterator node;
|
||||||
|
for( node = Levelup.begin(); node != Levelup.end(); node++ ) {
|
||||||
|
DependencyTree_Object* object = myTreeMap[ node->first ];
|
||||||
|
DependencyTree_Arrow* arrow =
|
||||||
|
myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( Main_object, object )];
|
||||||
|
if( arrow && !isItemAdded( arrow ) )
|
||||||
|
addItem( arrow );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( myDisplayAscendants->isChecked() )
|
||||||
|
drawWardArrows( j->second.first );
|
||||||
|
if( myDisplayDescendants->isChecked() )
|
||||||
|
drawWardArrows( j->second.second );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : drawWard()
|
||||||
|
// purpose : draw nodes of dependency tree ward (ascendant or descendant)
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::drawWard( const GEOMUtils::LevelsList& theWard,
|
void DependencyTree_View::drawWard( const GEOMUtils::LevelsList& theWard,
|
||||||
std::map< std::string, int >& theEntryLevelMap,
|
std::map< std::string, int >& theEntryLevelMap,
|
||||||
std::map< int, std::vector< std::string > >& theLevelObjects,
|
std::map< int, std::vector< std::string > >& theLevelObjects,
|
||||||
int theCurrentLevel, const int theLevelStep )
|
int theCurrentLevel, const int theLevelStep )
|
||||||
{
|
{
|
||||||
for( int level = 0; level < theWard.size(); level++ ) {
|
for( int level = 0; level < theWard.size(); level++ ) {
|
||||||
if( level >= myLevelsNumber || !myIsCompute )
|
if( level >= myLevelsNumber )
|
||||||
return;
|
return;
|
||||||
myComputedCost++;
|
|
||||||
theCurrentLevel += theLevelStep;
|
theCurrentLevel += theLevelStep;
|
||||||
GEOMUtils::LevelInfo levelInfo = theWard.at( level );
|
GEOMUtils::LevelInfo levelInfo = theWard.at( level );
|
||||||
GEOMUtils::LevelInfo::const_iterator node;
|
GEOMUtils::LevelInfo::const_iterator node;
|
||||||
for( node = levelInfo.begin(); node != levelInfo.end(); node++ ) {
|
for( node = levelInfo.begin(); node != levelInfo.end(); node++ ) {
|
||||||
DependencyTree_Object* object = myTreeMap[ node->first ];
|
DependencyTree_Object* object = myTreeMap[ node->first ];
|
||||||
if( !isItemAdded( object ) ) {
|
if( object && !isItemAdded( object ) ) {
|
||||||
addNewItem( object );
|
addItem( object );
|
||||||
object->unselect();
|
object->unselect();
|
||||||
theEntryLevelMap[ node->first ] = theCurrentLevel;
|
theEntryLevelMap[ node->first ] = theCurrentLevel;
|
||||||
theLevelObjects[ theCurrentLevel ].push_back( node->first );
|
theLevelObjects[ theCurrentLevel ].push_back( node->first );
|
||||||
@ -584,12 +570,15 @@ void DependencyTree_View::drawWard( const GEOMUtils::LevelsList& theWard,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::drawWardArrows( GEOMUtils::LevelsList theWard )
|
//=================================================================================
|
||||||
|
// function : drawWardArrows()
|
||||||
|
// purpose : draw arrows of dependency tree ward (ascendant or descendant)
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::drawWardArrows( const GEOMUtils::LevelsList& theWard )
|
||||||
{
|
{
|
||||||
for( int j = 0; j < theWard.size(); j++ ) {
|
for( int j = 0; j < theWard.size(); j++ ) {
|
||||||
if( j >= myLevelsNumber || !myIsCompute )
|
if( j >= myLevelsNumber )
|
||||||
break;
|
break;
|
||||||
myComputedCost++;
|
|
||||||
GEOMUtils::LevelInfo Level = theWard.at(j);
|
GEOMUtils::LevelInfo Level = theWard.at(j);
|
||||||
GEOMUtils::LevelInfo::const_iterator node;
|
GEOMUtils::LevelInfo::const_iterator node;
|
||||||
for( node = Level.begin(); node != Level.end(); node++ ) {
|
for( node = Level.begin(); node != Level.end(); node++ ) {
|
||||||
@ -600,16 +589,65 @@ void DependencyTree_View::drawWardArrows( GEOMUtils::LevelsList theWard )
|
|||||||
if( isItemAdded( object ) && isItemAdded( LinkObject ) ) {
|
if( isItemAdded( object ) && isItemAdded( LinkObject ) ) {
|
||||||
DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( object, LinkObject ) ];
|
DependencyTree_Arrow* arrow = myArrows[ std::pair<DependencyTree_Object*,DependencyTree_Object*>( object, LinkObject ) ];
|
||||||
if( arrow && !isItemAdded( arrow ) )
|
if( arrow && !isItemAdded( arrow ) )
|
||||||
addNewItem( arrow );
|
addItem( arrow );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateView()
|
||||||
|
// purpose : update viewer using created dependency tree model
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::updateView()
|
||||||
|
{
|
||||||
|
if( !myIsUpdate )
|
||||||
|
return;
|
||||||
|
|
||||||
|
drawTree();
|
||||||
|
fitAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : clearView()
|
||||||
|
// purpose : clear viewer and initialize all variables
|
||||||
|
//=================================================================================
|
||||||
|
void DependencyTree_View::clearView( bool isClearModel )
|
||||||
|
{
|
||||||
|
EntryObjectMap::const_iterator objectIter;
|
||||||
|
for( objectIter = myTreeMap.begin(); objectIter != myTreeMap.end(); objectIter++ ) {
|
||||||
|
DependencyTree_Object* object = objectIter->second;
|
||||||
|
if( object )
|
||||||
|
if( isItemAdded( object ) )
|
||||||
|
removeItem( object );
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrowsInfo::const_iterator arrowIter;
|
||||||
|
for( arrowIter = myArrows.begin(); arrowIter != myArrows.end(); arrowIter++ ) {
|
||||||
|
DependencyTree_Arrow* object = arrowIter->second;
|
||||||
|
if( object )
|
||||||
|
if( isItemAdded( object ) )
|
||||||
|
removeItem( object );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( isClearModel ) {
|
||||||
|
myTreeMap.clear();
|
||||||
|
myArrows.clear();
|
||||||
|
myTreeModel.clear();
|
||||||
|
myLevelsNumber = 0;
|
||||||
|
myMaxDownwardLevelsNumber = 0;
|
||||||
|
myMaxUpwardLevelsNumber = 0;
|
||||||
|
myIsUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getNewTreeModel()
|
||||||
|
// purpose : get dependency tree model from engine
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_View::getNewTreeModel( bool theUseSelectedObject, bool theUseOB )
|
void DependencyTree_View::getNewTreeModel( bool theUseSelectedObject, bool theUseOB )
|
||||||
{
|
{
|
||||||
|
|
||||||
GEOM::string_array_var objectsEntry = new GEOM::string_array();
|
GEOM::string_array_var objectsEntry = new GEOM::string_array();
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
|
|
||||||
@ -630,12 +668,9 @@ void DependencyTree_View::getNewTreeModel( bool theUseSelectedObject, bool theUs
|
|||||||
else {
|
else {
|
||||||
objectsEntry->length( nbSelected() );
|
objectsEntry->length( nbSelected() );
|
||||||
for( initSelected(); moreSelected(); nextSelected(), iter++ )
|
for( initSelected(); moreSelected(); nextSelected(), iter++ )
|
||||||
if( DependencyTree_Object* treeObject = dynamic_cast<DependencyTree_Object*>( selectedObject() ) ) {
|
if( DependencyTree_Object* treeObject = dynamic_cast<DependencyTree_Object*>( selectedObject() ) )
|
||||||
objectsEntry[ iter ] = treeObject->getEntry().c_str();
|
objectsEntry[ iter ] = treeObject->getEntry().c_str();
|
||||||
std::cout << "\n\n\n ----------- entry = " << treeObject->getEntry() << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
myMainEntries = objectsEntry;
|
myMainEntries = objectsEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,120 +679,26 @@ void DependencyTree_View::getNewTreeModel( bool theUseSelectedObject, bool theUs
|
|||||||
GeometryGUI::GetGeomGen()->GetDependencyTree( myStudy, myMainEntries );
|
GeometryGUI::GetGeomGen()->GetDependencyTree( myStudy, myMainEntries );
|
||||||
char* buf = (char*)&SeqFile[0];
|
char* buf = (char*)&SeqFile[0];
|
||||||
|
|
||||||
std::cout << "\n\n\n\n\n TREE = " << buf << std::endl;
|
|
||||||
|
|
||||||
clearView( true );
|
clearView( true );
|
||||||
|
mySelectionMgr->clearSelected();
|
||||||
|
|
||||||
// get dependency tree structure
|
// get dependency tree structure
|
||||||
GEOMUtils::ConvertStringToTree( buf, myTreeModel );
|
GEOMUtils::ConvertStringToTree( buf, myTreeModel );
|
||||||
|
|
||||||
mySelectionMgr->clearSelected();
|
|
||||||
|
|
||||||
parseTree();
|
parseTree();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::clearView( bool isClearModel )
|
|
||||||
{
|
|
||||||
EntryObjectMap::const_iterator objectIter;
|
|
||||||
for( objectIter = myTreeMap.begin(); objectIter != myTreeMap.end(); objectIter++ ) {
|
|
||||||
DependencyTree_Object* object = objectIter->second;
|
|
||||||
if( object )
|
|
||||||
if( isItemAdded( object ) )
|
|
||||||
removeItem( object );
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrowsInfo::const_iterator arrowIter;
|
|
||||||
for( arrowIter = myArrows.begin(); arrowIter != myArrows.end(); arrowIter++ ) {
|
|
||||||
DependencyTree_Arrow* object = arrowIter->second;
|
|
||||||
if( object )
|
|
||||||
if( isItemAdded( object ) )
|
|
||||||
removeItem( object );
|
|
||||||
}
|
|
||||||
if( isClearModel ) {
|
|
||||||
myTreeMap.clear();
|
|
||||||
myArrows.clear();
|
|
||||||
myTreeModel.clear();
|
|
||||||
myMaxDownwardLevelsNumber = 0;
|
|
||||||
myMaxUpwardLevelsNumber = 0;
|
|
||||||
myLevelsNumber = 0;
|
|
||||||
myIsCompute = false;
|
|
||||||
myIsUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : checkMaxLevelsNumber()
|
||||||
|
// purpose : calculate max levels number
|
||||||
|
//=================================================================================
|
||||||
int DependencyTree_View::checkMaxLevelsNumber()
|
int DependencyTree_View::checkMaxLevelsNumber()
|
||||||
{
|
{
|
||||||
if( myDisplayAscendants->isChecked() && myDisplayDescendants->isChecked() )
|
if( myDisplayAscendants->isChecked() && myDisplayDescendants->isChecked() )
|
||||||
return myMaxUpwardLevelsNumber>myMaxDownwardLevelsNumber?myMaxUpwardLevelsNumber:myMaxDownwardLevelsNumber;
|
return myMaxUpwardLevelsNumber > myMaxDownwardLevelsNumber ?
|
||||||
|
myMaxUpwardLevelsNumber : myMaxDownwardLevelsNumber;
|
||||||
else if( myDisplayAscendants ->isChecked() )
|
else if( myDisplayAscendants ->isChecked() )
|
||||||
return myMaxUpwardLevelsNumber;
|
return myMaxUpwardLevelsNumber;
|
||||||
else if( myDisplayDescendants->isChecked() )
|
else if( myDisplayDescendants->isChecked() )
|
||||||
return myMaxDownwardLevelsNumber;
|
return myMaxDownwardLevelsNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DependencyTree_View::calcTotalCost()
|
|
||||||
{
|
|
||||||
myTotalCost = myTreeModel.size();
|
|
||||||
GEOMUtils::TreeModel::const_iterator i;
|
|
||||||
for( i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) {
|
|
||||||
if( myDisplayAscendants->isChecked() )
|
|
||||||
myTotalCost += 2*( myLevelsNumber < i->second.first.size() ? myLevelsNumber : i->second.first.size() );
|
|
||||||
if( myDisplayDescendants->isChecked() )
|
|
||||||
myTotalCost += 2*( myLevelsNumber < i->second.second.size() ? myLevelsNumber : i->second.second.size() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double DependencyTree_View::getComputeProgress()
|
|
||||||
{
|
|
||||||
return double( myComputedCost ) / double( myTotalCost );
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_View::changeWidgetState( bool theIsCompute )
|
|
||||||
{
|
|
||||||
cancelAction->setVisible( theIsCompute );
|
|
||||||
progressAction->setVisible( theIsCompute );
|
|
||||||
|
|
||||||
myHierarchyDepth->setEnabled( !theIsCompute );
|
|
||||||
myDisplayAscendants->setEnabled( !theIsCompute );
|
|
||||||
myDisplayDescendants->setEnabled( !theIsCompute );
|
|
||||||
updateButton->setEnabled( !theIsCompute );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DependencyTree_View::updateObjectName( const std::string &theEntry )
|
|
||||||
{
|
|
||||||
bool res = false;
|
|
||||||
for( initSelected(); moreSelected(); nextSelected() ) {
|
|
||||||
if( DependencyTree_Object* aDepObject = dynamic_cast<DependencyTree_Object*>( selectedObject() ) ) {
|
|
||||||
aDepObject->updateName();
|
|
||||||
res = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
DependencyTree_QThread::DependencyTree_QThread( DependencyTree_View* theView )
|
|
||||||
{
|
|
||||||
myView = theView;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_QThread::run()
|
|
||||||
{
|
|
||||||
myView->myMutex.lock();
|
|
||||||
// QMutexLocker lock( &myView->myMutex );
|
|
||||||
myView->setIsCompute( true );
|
|
||||||
myView->drawTree();
|
|
||||||
|
|
||||||
QApplication::postEvent( myView, new QEvent( ( QEvent::Type )UPDATE_EVENT ) );
|
|
||||||
myView->myMutex.unlock();
|
|
||||||
//exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_QThread::sleepDraw()
|
|
||||||
{
|
|
||||||
msleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DependencyTree_QThread::cancel()
|
|
||||||
{
|
|
||||||
myView->setIsCompute( false );
|
|
||||||
}
|
|
||||||
|
@ -31,36 +31,14 @@
|
|||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
|
|
||||||
// QT includes
|
// QT includes
|
||||||
#include <QWidgetAction>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QThread>
|
|
||||||
#include <QMutex>
|
|
||||||
|
|
||||||
class DependencyTree_Object;
|
class DependencyTree_Object;
|
||||||
class DependencyTree_Arrow;
|
class DependencyTree_Arrow;
|
||||||
class DependencyTree_View;
|
class DependencyTree_View;
|
||||||
|
|
||||||
class DependencyTree_QThread : public QThread
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DependencyTree_QThread( DependencyTree_View* );
|
|
||||||
void sleepDraw();
|
|
||||||
void cancel();
|
|
||||||
|
|
||||||
DependencyTree_View* getView() { return myView; };
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void run();
|
|
||||||
|
|
||||||
private:
|
|
||||||
DependencyTree_View* myView;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::map<std::string,DependencyTree_Object*> EntryObjectMap;
|
typedef std::map<std::string,DependencyTree_Object*> EntryObjectMap;
|
||||||
typedef std::map<std::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> ArrowsInfo;
|
typedef std::map<std::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> ArrowsInfo;
|
||||||
|
|
||||||
@ -75,14 +53,14 @@ public:
|
|||||||
|
|
||||||
void init( GraphicsView_ViewFrame* );
|
void init( GraphicsView_ViewFrame* );
|
||||||
void updateModel( bool = true, bool = true );
|
void updateModel( bool = true, bool = true );
|
||||||
void drawTree();
|
|
||||||
|
|
||||||
QString getViewName() const;
|
|
||||||
|
|
||||||
virtual void customEvent ( QEvent* );
|
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
DependencyTree_Object* getObjectByEntry( QString );
|
QString getViewName() const;
|
||||||
|
int getStudyId() const;
|
||||||
|
|
||||||
|
DependencyTree_Object* getObjectByEntry( const std::string& );
|
||||||
|
bool updateObjectName( const std::string& theEntry );
|
||||||
|
|
||||||
void setHierarchyType( const int );
|
void setHierarchyType( const int );
|
||||||
void setNodesMovable( const bool );
|
void setNodesMovable( const bool );
|
||||||
@ -94,50 +72,36 @@ public:
|
|||||||
void setHighlightArrowColor( const QColor& );
|
void setHighlightArrowColor( const QColor& );
|
||||||
void setSelectArrowColor( const QColor& );
|
void setSelectArrowColor( const QColor& );
|
||||||
|
|
||||||
void setIsCompute( bool );
|
|
||||||
bool getIsCompute();
|
|
||||||
|
|
||||||
bool updateObjectName( const std::string &theEntry );
|
|
||||||
|
|
||||||
QMutex myMutex;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onUpdateModel();
|
|
||||||
void onRebuildModel();
|
void onRebuildModel();
|
||||||
|
|
||||||
protected:
|
|
||||||
void closeEvent( QCloseEvent* );
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateView();
|
|
||||||
|
void onUpdateModel();
|
||||||
void onMoveNodes( bool );
|
void onMoveNodes( bool );
|
||||||
void onHierarchyType();
|
void onHierarchyType();
|
||||||
void onCancel();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void parseTree();
|
||||||
|
void parseTreeWard( const GEOMUtils::LevelsList& );
|
||||||
|
void parseTreeWardArrow( const GEOMUtils::LevelsList& );
|
||||||
|
|
||||||
void addNode( const std::string& );
|
void addNode( const std::string& );
|
||||||
void addArrow( DependencyTree_Object*, DependencyTree_Object* );
|
void addArrow( DependencyTree_Object*, DependencyTree_Object* );
|
||||||
void addNewItem( QGraphicsItem* );
|
|
||||||
|
|
||||||
void parseTree();
|
|
||||||
void parseTreeWard(const GEOMUtils::LevelsList);
|
|
||||||
void parseTreeWardArrow(const GEOMUtils::LevelsList);
|
|
||||||
|
|
||||||
|
void drawTree();
|
||||||
void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
|
void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
|
||||||
std::map< int, std::vector< std::string > >&, int, const int );
|
std::map< int, std::vector< std::string > >&, int, const int );
|
||||||
void drawWardArrows( GEOMUtils::LevelsList );
|
void drawWardArrows( const GEOMUtils::LevelsList& );
|
||||||
|
|
||||||
void getNewTreeModel( bool = true, bool = true );
|
void updateView();
|
||||||
void clearView( bool );
|
void clearView( bool );
|
||||||
|
|
||||||
int checkMaxLevelsNumber();
|
void getNewTreeModel( bool = true, bool = true );
|
||||||
void calcTotalCost();
|
|
||||||
double getComputeProgress();
|
|
||||||
|
|
||||||
void changeWidgetState( bool );
|
int checkMaxLevelsNumber();
|
||||||
|
|
||||||
GEOMUtils::TreeModel myTreeModel;
|
GEOMUtils::TreeModel myTreeModel;
|
||||||
|
|
||||||
@ -152,26 +116,13 @@ private:
|
|||||||
QSpinBox* myHierarchyDepth;
|
QSpinBox* myHierarchyDepth;
|
||||||
QCheckBox* myDisplayAscendants;
|
QCheckBox* myDisplayAscendants;
|
||||||
QCheckBox* myDisplayDescendants;
|
QCheckBox* myDisplayDescendants;
|
||||||
QWidgetAction* cancelAction;
|
|
||||||
QWidgetAction* progressAction;
|
|
||||||
QPushButton* updateButton;
|
QPushButton* updateButton;
|
||||||
|
|
||||||
int myTimer;
|
|
||||||
|
|
||||||
bool myIsUpdate;
|
|
||||||
|
|
||||||
bool myIsCompute;
|
|
||||||
|
|
||||||
int myTotalCost;
|
|
||||||
int myComputedCost;
|
|
||||||
|
|
||||||
DependencyTree_QThread* qthread;
|
|
||||||
|
|
||||||
GEOM::string_array_var myMainEntries;
|
|
||||||
|
|
||||||
SALOMEDS::Study_var myStudy;
|
SALOMEDS::Study_var myStudy;
|
||||||
LightApp_SelectionMgr* mySelectionMgr;
|
LightApp_SelectionMgr* mySelectionMgr;
|
||||||
|
GEOM::string_array_var myMainEntries;
|
||||||
|
|
||||||
|
bool myIsUpdate;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// internal includes
|
||||||
#include "DependencyTree_ViewModel.h"
|
#include "DependencyTree_ViewModel.h"
|
||||||
#include "DependencyTree_View.h"
|
#include "DependencyTree_View.h"
|
||||||
|
|
||||||
@ -33,7 +34,6 @@
|
|||||||
// QT includes
|
// QT includes
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
|
|
||||||
DependencyTree_ViewModel::DependencyTree_ViewModel( const QString& title )
|
DependencyTree_ViewModel::DependencyTree_ViewModel( const QString& title )
|
||||||
: GraphicsView_Viewer( title )
|
: GraphicsView_Viewer( title )
|
||||||
{
|
{
|
||||||
@ -48,6 +48,10 @@ DependencyTree_ViewModel::~DependencyTree_ViewModel()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onShowSelected()
|
||||||
|
// purpose : slot for showing selected objects in OCC Viewer
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_ViewModel::onShowSelected()
|
void DependencyTree_ViewModel::onShowSelected()
|
||||||
{
|
{
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
@ -76,6 +80,10 @@ void DependencyTree_ViewModel::onShowSelected()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onShowOnlySelected()
|
||||||
|
// purpose : slot for showing only selected objects in OCC Viewer
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_ViewModel::onShowOnlySelected()
|
void DependencyTree_ViewModel::onShowOnlySelected()
|
||||||
{
|
{
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
@ -103,6 +111,10 @@ void DependencyTree_ViewModel::onShowOnlySelected()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : contextMenuPopup()
|
||||||
|
// purpose : process calling of context menu popup
|
||||||
|
//=================================================================================
|
||||||
void DependencyTree_ViewModel::contextMenuPopup( QMenu* theMenu )
|
void DependencyTree_ViewModel::contextMenuPopup( QMenu* theMenu )
|
||||||
{
|
{
|
||||||
GraphicsView_Viewer::contextMenuPopup( theMenu );
|
GraphicsView_Viewer::contextMenuPopup( theMenu );
|
||||||
|
@ -28,6 +28,7 @@ class DependencyTree_ViewModel: public GraphicsView_Viewer
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DependencyTree_ViewModel( const QString& title );
|
DependencyTree_ViewModel( const QString& title );
|
||||||
DependencyTree_ViewModel( const QString& title, QWidget* w );
|
DependencyTree_ViewModel( const QString& title, QWidget* w );
|
||||||
~DependencyTree_ViewModel();
|
~DependencyTree_ViewModel();
|
||||||
@ -35,6 +36,7 @@ public:
|
|||||||
virtual void contextMenuPopup( QMenu* );
|
virtual void contextMenuPopup( QMenu* );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void onShowSelected();
|
void onShowSelected();
|
||||||
void onShowOnlySelected();
|
void onShowOnlySelected();
|
||||||
|
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
<source>UPDATE</source>
|
<source>UPDATE</source>
|
||||||
<translation>Update</translation>
|
<translation>Update</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>CANCEL</source>
|
|
||||||
<translation>Cancel</translation>
|
|
||||||
</message>
|
|
||||||
<name>DependencyTree_ViewModel</name>
|
<name>DependencyTree_ViewModel</name>
|
||||||
<message>
|
<message>
|
||||||
<source>REBUILD_THE_TREE</source>
|
<source>REBUILD_THE_TREE</source>
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
<source>UPDATE</source>
|
<source>UPDATE</source>
|
||||||
<translation type="unfinished">Update</translation>
|
<translation type="unfinished">Update</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>CANCEL</source>
|
|
||||||
<translation type="unfinished">Cancel</translation>
|
|
||||||
</message>
|
|
||||||
<name>DependencyTree_ViewModel</name>
|
<name>DependencyTree_ViewModel</name>
|
||||||
<message>
|
<message>
|
||||||
<source>REBUILD_THE_TREE</source>
|
<source>REBUILD_THE_TREE</source>
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
<source>UPDATE</source>
|
<source>UPDATE</source>
|
||||||
<translation type="unfinished">Update</translation>
|
<translation type="unfinished">Update</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>CANCEL</source>
|
|
||||||
<translation type="unfinished">Cancel</translation>
|
|
||||||
</message>
|
|
||||||
<name>DependencyTree_ViewModel</name>
|
<name>DependencyTree_ViewModel</name>
|
||||||
<message>
|
<message>
|
||||||
<source>REBUILD_THE_TREE</source>
|
<source>REBUILD_THE_TREE</source>
|
||||||
|
Loading…
Reference in New Issue
Block a user