mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-12 09:40:35 +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
|
||||
//
|
||||
|
||||
// internal includes
|
||||
#include "DependencyTree_Arrow.h"
|
||||
#include "DependencyTree_Object.h"
|
||||
|
||||
@ -75,7 +76,7 @@ QRectF DependencyTree_Arrow::boundingRect() const
|
||||
qreal extra;
|
||||
QRectF boundingRect;
|
||||
if( myStartItem == myEndItem ) {
|
||||
extra = arrowSize / 2.0;
|
||||
extra = arrowSize / 2.0 + 2.0;
|
||||
boundingRect = mySelfDependencyArrow;
|
||||
}
|
||||
else {
|
||||
|
@ -17,6 +17,7 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// internal includes
|
||||
#include "DependencyTree_Object.h"
|
||||
|
||||
// GEOM includes
|
||||
@ -169,7 +170,6 @@ void DependencyTree_Object::updateName()
|
||||
|
||||
QString name = myGeomObject->GetName();
|
||||
QString studyEntry = myGeomObject->GetStudyEntry();
|
||||
std::cout<<"\n\n name = " << name.toStdString() << " studyEntry = " << studyEntry.toStdString() << std::endl;
|
||||
|
||||
if( studyEntry.isEmpty() ) {
|
||||
if( name.isEmpty() )
|
||||
|
@ -17,6 +17,7 @@
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// internal includes
|
||||
#include "DependencyTree_Selector.h"
|
||||
#include "DependencyTree_View.h"
|
||||
#include "DependencyTree_ViewModel.h"
|
||||
@ -28,8 +29,6 @@
|
||||
//GEOM includes
|
||||
#include <GEOMBase.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
DependencyTree_Selector::DependencyTree_Selector( DependencyTree_ViewModel* theModel, SUIT_SelectionMgr* theSelMgr )
|
||||
:LightApp_GVSelector( (GraphicsView_Viewer*)theModel, theSelMgr )
|
||||
{
|
||||
@ -50,21 +49,23 @@ void DependencyTree_Selector::getSelection( SUIT_DataOwnerPtrList& theList ) con
|
||||
if( DependencyTree_Object* treeObject = dynamic_cast<DependencyTree_Object*>( myView->selectedObject() ) ) {
|
||||
const char* entry;
|
||||
const char* name;
|
||||
if( !treeObject->getGeomObject()->_is_nil() ) {
|
||||
QString studyEntry = treeObject->getGeomObject()->GetStudyEntry();
|
||||
if( studyEntry.isEmpty() ) {
|
||||
entry = treeObject->getEntry().c_str();
|
||||
name = "TEMP_IO_UNPUBLISHED";
|
||||
}
|
||||
else {
|
||||
entry = studyEntry.toStdString().c_str();
|
||||
name = "TEMP_IO";
|
||||
}
|
||||
Handle(SALOME_InteractiveObject) tmpIO =
|
||||
new SALOME_InteractiveObject( entry, "GEOM", name);
|
||||
|
||||
theList.append( new LightApp_DataOwner( tmpIO ) );
|
||||
GEOM::GEOM_BaseObject_var anObj = GeometryGUI::GetGeomGen()->GetObject( myView->getStudyId(),
|
||||
treeObject->getEntry().c_str() );
|
||||
if( anObj->_is_nil() )
|
||||
continue;
|
||||
QString studyEntry = anObj->GetStudyEntry();
|
||||
if( studyEntry.isEmpty() ) {
|
||||
entry = treeObject->getEntry().c_str();
|
||||
name = "TEMP_IO_UNPUBLISHED";
|
||||
}
|
||||
else {
|
||||
entry = studyEntry.toStdString().c_str();
|
||||
name = "TEMP_IO";
|
||||
}
|
||||
Handle(SALOME_InteractiveObject) tmpIO =
|
||||
new SALOME_InteractiveObject( entry, "GEOM", name);
|
||||
|
||||
theList.append( new LightApp_DataOwner( tmpIO ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +94,7 @@ void DependencyTree_Selector::setSelection( const SUIT_DataOwnerPtrList& theList
|
||||
return;
|
||||
entry = geomObject->GetEntry();
|
||||
}
|
||||
DependencyTree_Object* object = myView->getObjectByEntry( QString( entry ) );
|
||||
DependencyTree_Object* object = myView->getObjectByEntry( entry );
|
||||
if( object ) {
|
||||
myView->setSelected( object );
|
||||
object->select( object->pos().x(), object->pos().y(), object->getRect() );
|
||||
|
@ -29,15 +29,18 @@ class DependencyTree_Selector: public LightApp_GVSelector
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DependencyTree_Selector( DependencyTree_ViewModel*, SUIT_SelectionMgr* );
|
||||
~DependencyTree_Selector();
|
||||
|
||||
protected:
|
||||
virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
|
||||
virtual void setSelection( const SUIT_DataOwnerPtrList& );
|
||||
|
||||
virtual void getSelection( SUIT_DataOwnerPtrList& ) const;
|
||||
virtual void setSelection( const SUIT_DataOwnerPtrList& );
|
||||
|
||||
private:
|
||||
DependencyTree_View* myView;
|
||||
|
||||
DependencyTree_View* myView;
|
||||
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,36 +31,14 @@
|
||||
#include <SalomeApp_Application.h>
|
||||
|
||||
// QT includes
|
||||
#include <QWidgetAction>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
|
||||
class DependencyTree_Object;
|
||||
class DependencyTree_Arrow;
|
||||
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::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> ArrowsInfo;
|
||||
|
||||
@ -73,105 +51,78 @@ public:
|
||||
DependencyTree_View( QWidget* = 0 );
|
||||
~DependencyTree_View();
|
||||
|
||||
void init( GraphicsView_ViewFrame* );
|
||||
void updateModel( bool = true, bool = true );
|
||||
void drawTree();
|
||||
void init( GraphicsView_ViewFrame* );
|
||||
void updateModel( bool = true, bool = true );
|
||||
|
||||
QString getViewName() const;
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
|
||||
virtual void customEvent ( QEvent* );
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
QString getViewName() const;
|
||||
int getStudyId() const;
|
||||
|
||||
DependencyTree_Object* getObjectByEntry( QString );
|
||||
DependencyTree_Object* getObjectByEntry( const std::string& );
|
||||
bool updateObjectName( const std::string& theEntry );
|
||||
|
||||
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& );
|
||||
|
||||
void setIsCompute( bool );
|
||||
bool getIsCompute();
|
||||
|
||||
bool updateObjectName( const std::string &theEntry );
|
||||
|
||||
QMutex myMutex;
|
||||
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& );
|
||||
|
||||
public slots:
|
||||
void onUpdateModel();
|
||||
void onRebuildModel();
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent* );
|
||||
void onRebuildModel();
|
||||
|
||||
private slots:
|
||||
void updateView();
|
||||
void onMoveNodes( bool );
|
||||
void onHierarchyType();
|
||||
void onCancel();
|
||||
|
||||
signals:
|
||||
void onUpdateModel();
|
||||
void onMoveNodes( bool );
|
||||
void onHierarchyType();
|
||||
|
||||
private:
|
||||
|
||||
void addNode( const std::string& );
|
||||
void addArrow( DependencyTree_Object*, DependencyTree_Object* );
|
||||
void addNewItem( QGraphicsItem* );
|
||||
void parseTree();
|
||||
void parseTreeWard( const GEOMUtils::LevelsList& );
|
||||
void parseTreeWardArrow( const GEOMUtils::LevelsList& );
|
||||
|
||||
void parseTree();
|
||||
void parseTreeWard(const GEOMUtils::LevelsList);
|
||||
void parseTreeWardArrow(const GEOMUtils::LevelsList);
|
||||
void addNode( const std::string& );
|
||||
void addArrow( DependencyTree_Object*, DependencyTree_Object* );
|
||||
|
||||
void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
|
||||
std::map< int, std::vector< std::string > >&, int, const int );
|
||||
void drawWardArrows( GEOMUtils::LevelsList );
|
||||
void drawTree();
|
||||
void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
|
||||
std::map< int, std::vector< std::string > >&, int, const int );
|
||||
void drawWardArrows( const GEOMUtils::LevelsList& );
|
||||
|
||||
void getNewTreeModel( bool = true, bool = true );
|
||||
void clearView( bool );
|
||||
void updateView();
|
||||
void clearView( bool );
|
||||
|
||||
int checkMaxLevelsNumber();
|
||||
void calcTotalCost();
|
||||
double getComputeProgress();
|
||||
void getNewTreeModel( bool = true, bool = true );
|
||||
|
||||
void changeWidgetState( bool );
|
||||
int checkMaxLevelsNumber();
|
||||
|
||||
GEOMUtils::TreeModel myTreeModel;
|
||||
GEOMUtils::TreeModel myTreeModel;
|
||||
|
||||
EntryObjectMap myTreeMap;
|
||||
ArrowsInfo myArrows;
|
||||
EntryObjectMap myTreeMap;
|
||||
ArrowsInfo myArrows;
|
||||
|
||||
int myLevelsNumber;
|
||||
int myMaxDownwardLevelsNumber;
|
||||
int myMaxUpwardLevelsNumber;
|
||||
int myLevelsNumber;
|
||||
int myMaxDownwardLevelsNumber;
|
||||
int myMaxUpwardLevelsNumber;
|
||||
|
||||
QCheckBox* myNodesMovable;
|
||||
QSpinBox* myHierarchyDepth;
|
||||
QCheckBox* myDisplayAscendants;
|
||||
QCheckBox* myDisplayDescendants;
|
||||
QWidgetAction* cancelAction;
|
||||
QWidgetAction* progressAction;
|
||||
QPushButton* updateButton;
|
||||
QCheckBox* myNodesMovable;
|
||||
QSpinBox* myHierarchyDepth;
|
||||
QCheckBox* myDisplayAscendants;
|
||||
QCheckBox* myDisplayDescendants;
|
||||
QPushButton* updateButton;
|
||||
|
||||
int myTimer;
|
||||
|
||||
bool myIsUpdate;
|
||||
|
||||
bool myIsCompute;
|
||||
|
||||
int myTotalCost;
|
||||
int myComputedCost;
|
||||
|
||||
DependencyTree_QThread* qthread;
|
||||
|
||||
GEOM::string_array_var myMainEntries;
|
||||
|
||||
SALOMEDS::Study_var myStudy;
|
||||
LightApp_SelectionMgr* mySelectionMgr;
|
||||
SALOMEDS::Study_var myStudy;
|
||||
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
|
||||
//
|
||||
|
||||
// internal includes
|
||||
#include "DependencyTree_ViewModel.h"
|
||||
#include "DependencyTree_View.h"
|
||||
|
||||
@ -33,7 +34,6 @@
|
||||
// QT includes
|
||||
#include <QMenu>
|
||||
|
||||
|
||||
DependencyTree_ViewModel::DependencyTree_ViewModel( const QString& 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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
GraphicsView_Viewer::contextMenuPopup( theMenu );
|
||||
|
@ -28,15 +28,17 @@ class DependencyTree_ViewModel: public GraphicsView_Viewer
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
DependencyTree_ViewModel( const QString& title );
|
||||
DependencyTree_ViewModel( const QString& title, QWidget* w );
|
||||
~DependencyTree_ViewModel();
|
||||
|
||||
virtual void contextMenuPopup( QMenu* );
|
||||
virtual void contextMenuPopup( QMenu* );
|
||||
|
||||
private slots:
|
||||
void onShowSelected();
|
||||
void onShowOnlySelected();
|
||||
|
||||
void onShowSelected();
|
||||
void onShowOnlySelected();
|
||||
|
||||
};
|
||||
|
||||
|
@ -31,10 +31,6 @@
|
||||
<source>UPDATE</source>
|
||||
<translation>Update</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL</source>
|
||||
<translation>Cancel</translation>
|
||||
</message>
|
||||
<name>DependencyTree_ViewModel</name>
|
||||
<message>
|
||||
<source>REBUILD_THE_TREE</source>
|
||||
|
@ -31,10 +31,6 @@
|
||||
<source>UPDATE</source>
|
||||
<translation type="unfinished">Update</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL</source>
|
||||
<translation type="unfinished">Cancel</translation>
|
||||
</message>
|
||||
<name>DependencyTree_ViewModel</name>
|
||||
<message>
|
||||
<source>REBUILD_THE_TREE</source>
|
||||
|
@ -31,10 +31,6 @@
|
||||
<source>UPDATE</source>
|
||||
<translation type="unfinished">Update</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL</source>
|
||||
<translation type="unfinished">Cancel</translation>
|
||||
</message>
|
||||
<name>DependencyTree_ViewModel</name>
|
||||
<message>
|
||||
<source>REBUILD_THE_TREE</source>
|
||||
|
Loading…
Reference in New Issue
Block a user