0022768: [EDF] Model inspector: added documentation

This commit is contained in:
mpa 2014-12-17 17:29:10 +03:00
parent 1a61b19c1e
commit 41d989fa62
8 changed files with 124 additions and 39 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,24 @@
/*!
\page inspect_object_operation_page Inspect Object
This operation browses the contents of the selected shape.
To <b>Inspect Object</b> in the <b>Main Menu</b> select <b>Repair - > Inspect Object</b>.
\image html inspect_object.png
In this dialog:
- Click on the "Arrow" button and select in the Object Browser or in the viewer a shape (compound or single solid);
- Show/hide sub-shape in the 3D viewer, by pressing “eye” icon in the first column of the tree view;
- Show all/hide all sub-shapes in the 3D viewer, by pressing “eye” icon in the first column of the tree header;
- Specify name for selected item by double-clicking on the item;
- Show all selected items in the 3D viewer, by pressing <b>Show Selected</b> button;
- Show selected items in the 3D viewer and erase all currently shown objects, by pressing <b>Show Only Selected</b> button;
- Hide selected items from the 3D viewer, by pressing <b>Hide Selected</b> button;
- Publish selected shapes in the study, by pressing <b>Publish Selected</b> button;
- Close dialog box, by pressing <b>Close</b> button;
- Open context help page on this dialog box in the Help browser, by pressing <b>Help</b> button.
*/

View File

@ -35,6 +35,8 @@ removes selected vertices from a given wire in case if adjacent edges
are C1 continuous.</li>
<li>\subpage union_faces_operation_page "Union faces" -
unites on a given shape all faces sharing the same surface.</li>
<li>\subpage inspect_object_operation_page "Inspect Object" -
browses the contents of the selected shape.</li>
</ul>
*/

View File

@ -7023,14 +7023,6 @@ Do you want to create new material?</translation>
<source>GEOM_INSPECT_OBJECT_NAME</source>
<translation>Name</translation>
</message>
<message>
<source>RENAME_COMPONENT</source>
<translation>Change component name</translation>
</message>
<message>
<source>COMPONENT_NAME</source>
<translation>Name:</translation>
</message>
</context>
<context>
<name>GEOMGUI_CreationInfoWdg</name>

View File

@ -6987,14 +6987,6 @@ Voulez-vous en créer un nouveau ?</translation>
<source>GEOM_INSPECT_OBJECT_NAME</source>
<translation type="unfinished">Name</translation>
</message>
<message>
<source>RENAME_COMPONENT</source>
<translation>Changer le nom de la composante</translation>
</message>
<message>
<source>COMPONENT_NAME</source>
<translation>Nom:</translation>
</message>
</context>
<context>
<name>GEOMGUI_CreationInfoWdg</name>

View File

@ -6964,14 +6964,6 @@
<source>GEOM_INSPECT_OBJECT_NAME</source>
<translation type="unfinished">Name</translation>
</message>
<message>
<source>RENAME_COMPONENT</source>
<translation></translation>
</message>
<message>
<source>COMPONENT_NAME</source>
<translation></translation>
</message>
</context>
<context>
<name>GEOMGUI_CreationInfoWdg</name>

View File

@ -23,6 +23,7 @@
// GEOM includes
#include <GEOMBase.h>
#include <GEOM_Constants.h>
#include <GeometryGUI.h>
// GUI includes
#include <SUIT_Session.h>
@ -46,10 +47,10 @@
#include <QGridLayout>
#include <QPushButton>
#include <QHeaderView>
#include <QInputDialog>
#include <QItemDelegate>
//=================================================================================
// class : RepairGUI_InspectObjectDlg
// class : RepairGUI_InspectObjectDlg::TreeWidgetItem
// purpose : class for "Inspect Object" tree item creation
//=================================================================================
class RepairGUI_InspectObjectDlg::TreeWidgetItem : public QTreeWidgetItem
@ -88,6 +89,7 @@ RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem( QTreeWidgetItem* par
myShape( shape )
{
myIO = new SALOME_InteractiveObject( entry.toAscii(), "GEOM", "TEMP_IO" );
setFlags( flags() | Qt::ItemIsEditable );
}
RepairGUI_InspectObjectDlg::TreeWidgetItem::~TreeWidgetItem()
@ -115,6 +117,46 @@ Handle(SALOME_InteractiveObject) RepairGUI_InspectObjectDlg::TreeWidgetItem::get
return myIO;
}
//=================================================================================
// class : RepairGUI_InspectObjectDlg::Delegate
// purpose : class for "Inspect Object" tree item editing
//=================================================================================
class RepairGUI_InspectObjectDlg::Delegate : public QItemDelegate
{
public:
Delegate( QObject* = 0 );
~Delegate();
void setEditorData( QWidget*, const QModelIndex& ) const;
void setModelData( QWidget*, QAbstractItemModel*, const QModelIndex& ) const;
};
RepairGUI_InspectObjectDlg::Delegate::Delegate( QObject* parent )
: QItemDelegate( parent )
{
}
RepairGUI_InspectObjectDlg::Delegate::~Delegate()
{
}
void RepairGUI_InspectObjectDlg::Delegate::setEditorData( QWidget* editor,
const QModelIndex& index ) const
{
QItemDelegate::setEditorData( editor, index );
editor->setProperty( "___name___", editor->property( "text" ) );
}
void RepairGUI_InspectObjectDlg::Delegate::setModelData( QWidget* editor,
QAbstractItemModel* model,
const QModelIndex& index ) const
{
QString aNewName = editor->property( "text" ).toString();
if( aNewName.trimmed().isEmpty() )
editor->setProperty( "text", editor->property( "___name___" ) );
QItemDelegate::setModelData( editor, model, index );
}
//=================================================================================
// class : RepairGUI_InspectObjectDlg()
// purpose : Constructs a RepairGUI_InspectObjectDlg which is a child of 'parent'.
@ -180,6 +222,9 @@ RepairGUI_InspectObjectDlg::RepairGUI_InspectObjectDlg( SUIT_Desktop* parent )
myTreeObjects->header()->setMovable( false );
myTreeObjects->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
myTreeObjects->setSelectionMode( QAbstractItemView::ExtendedSelection );
myTreeObjects->setEditTriggers( QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed );
// set custom item delegate
myTreeObjects->setItemDelegate( new Delegate( myTreeObjects ) );
/********************** Buttons **********************/
@ -217,8 +262,8 @@ RepairGUI_InspectObjectDlg::RepairGUI_InspectObjectDlg( SUIT_Desktop* parent )
connect( myTreeObjects, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
connect( myTreeObjects, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
this, SLOT( onItemDoubleClicked( QTreeWidgetItem*, int ) ) );
connect( myTreeObjects, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ),
this, SLOT( onItemChanged( QTreeWidgetItem*, int ) ) );
connect( myTreeObjects, SIGNAL( itemExpanded ( QTreeWidgetItem* ) ),
this, SLOT( onItemExpanded( QTreeWidgetItem* ) ) );
connect( myTreeObjects, SIGNAL( itemSelectionChanged() ),
@ -446,20 +491,22 @@ void RepairGUI_InspectObjectDlg::onItemClicked( QTreeWidgetItem* theItem, int th
}
//=================================================================================
// function : onItemDoubleClicked()
// purpose : called when tree item was double clicked
// function : onItemChanged()
// purpose : called when tree item was changed
//=================================================================================
void RepairGUI_InspectObjectDlg::onItemDoubleClicked( QTreeWidgetItem* theItem, int theColumn )
void RepairGUI_InspectObjectDlg::onItemChanged( QTreeWidgetItem* theItem, int theColumn )
{
if( theColumn!= 0 || !( theItem->flags() & Qt::ItemIsSelectable ) )
if( theColumn!= 0 || !( theItem->flags() & Qt::ItemIsEditable ) )
return;
bool bOk;
QString label = QInputDialog::getText( this, RepairGUI_InspectObjectDlg::tr( "RENAME_COMPONENT" ),
RepairGUI_InspectObjectDlg::tr ( "COMPONENT_NAME" ), QLineEdit::Normal,
theItem->text(0), &bOk );
if ( bOk && !label.isEmpty() )
theItem->setText( 0, label );
// rename the same items in the tree
QTreeWidgetItemIterator it( myTreeObjects );
while(*it) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
if( anItem->getShape().IsSame( dynamic_cast<TreeWidgetItem*>( theItem )->getShape() ) )
anItem->setText( 0, theItem->text(0) );
++it;
}
}
//=================================================================================
@ -616,6 +663,39 @@ void RepairGUI_InspectObjectDlg::clickOnHide()
//=================================================================================
void RepairGUI_InspectObjectDlg::clickOnPublish()
{
_PTR(Study) studyDS = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() )->studyDS();
// find main object
TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
GEOM::GEOM_Object_var aMainObject = GEOMBase::ConvertIOinGEOMObject( aMainItem->getIO() );
// find unique indices of selected objects
QList<QTreeWidgetItem*> selectedItems = myTreeObjects->selectedItems();
QMap< int, QString > anIndices;
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
anArray->length( selectedItems.size() );
int j = 0;
for( int i = 0; i < selectedItems.size(); i++ ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( selectedItems.at(i) );
int anIndex = GEOMBase::GetIndex( anItem->getShape(), aMainItem->getShape() );
if( anIndices.find( anIndex ) == anIndices.end() &&
anItem != aMainItem ) {
anIndices[ anIndex ] = anItem->text(0);
anArray[j++] = anIndex;
}
}
anArray->length(j);
// get selected sub-shapes
GEOM::GEOM_IShapesOperations_var anOper = getGeomEngine()->GetIShapesOperations( getStudyId() );
GEOM::ListOfGO_var aList = anOper->MakeSubShapes( aMainObject, anArray );
// publish sub-shapes
for( int i = 0; i < aList->length(); i++ )
GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ), aList[i],
anIndices.values().at(i).toStdString().c_str(), aMainObject );
updateObjBrowser();
}
//=================================================================================
@ -624,5 +704,5 @@ void RepairGUI_InspectObjectDlg::clickOnPublish()
//=================================================================================
void RepairGUI_InspectObjectDlg::clickOnHelp()
{
myApp->onHelpContextModule( "GEOM", "inspect_object_page.html" );
myApp->onHelpContextModule( "GEOM", "inspect_object_operation_page.html" );
}

View File

@ -27,12 +27,14 @@
#include <QDialog>
#include <QTreeWidget>
#include <QLabel>
#include <QLineEdit>
class RepairGUI_InspectObjectDlg : public QDialog, public GEOMBase_Helper
{
Q_OBJECT
class TreeWidgetItem;
class Delegate;
public:
RepairGUI_InspectObjectDlg( SUIT_Desktop* );
@ -42,6 +44,7 @@ private slots:
void onEditMainShape();
void onItemClicked( QTreeWidgetItem*, int );
void onItemChanged( QTreeWidgetItem*, int );
void onItemSelectionChanged();
void onItemExpanded( QTreeWidgetItem* );
void onHeaderClicked( int );