mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-22 18:35:36 +05:00
IMP 0021069: Hide selected in explode function
This commit is contained in:
parent
ae3549a5e4
commit
8afa92f295
@ -29,22 +29,31 @@
|
|||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
|
|
||||||
|
#include <OCCViewer_ViewModel.h>
|
||||||
|
#include <SVTK_ViewModel.h>
|
||||||
|
#include <SalomeApp_Study.h>
|
||||||
|
#include <SalomeApp_Application.h>
|
||||||
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_ViewManager.h>
|
#include <SUIT_ViewManager.h>
|
||||||
#include <SUIT_ViewWindow.h>
|
#include <SUIT_ViewWindow.h>
|
||||||
#include <OCCViewer_ViewModel.h>
|
|
||||||
#include <SalomeApp_Application.h>
|
#include <TopExp.hxx>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
#include <TopoDS_Iterator.hxx>
|
|
||||||
#include <TopExp_Explorer.hxx>
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <GEOMImpl_Types.hxx>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : EntityGUI_SubShapeDlg
|
// class : EntityGUI_SubShapeDlg
|
||||||
// purpose : Constructs a EntityGUI_SubShapeDlg which is a child of 'parent', with the
|
// purpose : Constructs a EntityGUI_SubShapeDlg which is a child of 'parent', with the
|
||||||
@ -69,13 +78,16 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg( GeometryGUI* theGeometryGUI, QWidg
|
|||||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
mainFrame()->RadioButton3->close();
|
mainFrame()->RadioButton3->close();
|
||||||
|
|
||||||
GroupPoints = new DlgRef_1Sel1Check1List( centralWidget() );
|
GroupPoints = new DlgRef_1Sel1List1Check3Btn(centralWidget());
|
||||||
|
|
||||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE"));
|
||||||
GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT"));
|
GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT"));
|
||||||
GroupPoints->PushButton1->setIcon(image1);
|
GroupPoints->PushButton1->setIcon(image1);
|
||||||
|
GroupPoints->PushButton2->setText(tr("SHOW_ONLY_SELECTED"));
|
||||||
|
GroupPoints->PushButton3->setText(tr("HIDE_SELECTED"));
|
||||||
|
GroupPoints->PushButton4->setText(tr("SHOW_ALL_SUB_SHAPES"));
|
||||||
GroupPoints->LineEdit1->setReadOnly(true);
|
GroupPoints->LineEdit1->setReadOnly(true);
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
@ -92,7 +104,6 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg( GeometryGUI* theGeometryGUI, QWidg
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~EntityGUI_SubShapeDlg()
|
// function : ~EntityGUI_SubShapeDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -101,7 +112,6 @@ EntityGUI_SubShapeDlg::~EntityGUI_SubShapeDlg()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -141,6 +151,10 @@ void EntityGUI_SubShapeDlg::Init()
|
|||||||
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
||||||
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled()));
|
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled()));
|
||||||
|
|
||||||
|
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
|
||||||
|
connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
|
||||||
|
connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
|
||||||
|
|
||||||
connect(myGeomGUI->getApp()->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
@ -149,6 +163,38 @@ void EntityGUI_SubShapeDlg::Init()
|
|||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : enterEvent()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void EntityGUI_SubShapeDlg::enterEvent(QEvent*)
|
||||||
|
{
|
||||||
|
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||||
|
ActivateThisDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ActivateThisDialog()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void EntityGUI_SubShapeDlg::ActivateThisDialog()
|
||||||
|
{
|
||||||
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
SubShapeToggled();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
//function : closeEvent
|
||||||
|
//purpose : remove temporary geom object
|
||||||
|
//=================================================================================
|
||||||
|
void EntityGUI_SubShapeDlg::closeEvent(QCloseEvent* e)
|
||||||
|
{
|
||||||
|
erasePreview(true);
|
||||||
|
GEOMBase_Skeleton::closeEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -161,7 +207,6 @@ void EntityGUI_SubShapeDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -193,11 +238,9 @@ bool EntityGUI_SubShapeDlg::ClickOnApply()
|
|||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection as changed or other case
|
// purpose : Called when selection has changed or other case
|
||||||
// : used only by SelectButtonC1A1 (LineEditC1A1)
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_SubShapeDlg::SelectionIntoArgument()
|
void EntityGUI_SubShapeDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
@ -292,7 +335,6 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument()
|
|||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -307,7 +349,6 @@ void EntityGUI_SubShapeDlg::SetEditCurrentArgument()
|
|||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -323,43 +364,6 @@ void EntityGUI_SubShapeDlg::LineEditReturnPressed()
|
|||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : DeactivateActiveDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void EntityGUI_SubShapeDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if ( mainFrame()->GroupConstructors->isEnabled() ) {
|
|
||||||
GEOMBase_Skeleton::DeactivateActiveDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ActivateThisDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void EntityGUI_SubShapeDlg::ActivateThisDialog()
|
|
||||||
{
|
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
SubShapeToggled();
|
|
||||||
updateButtonState();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : enterEvent()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void EntityGUI_SubShapeDlg::enterEvent( QEvent* )
|
|
||||||
{
|
|
||||||
if ( !mainFrame()->GroupConstructors->isEnabled() )
|
|
||||||
ActivateThisDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ResetStateOfDialog()
|
// function : ResetStateOfDialog()
|
||||||
// purpose : Completely reset the state of method including local context
|
// purpose : Completely reset the state of method including local context
|
||||||
@ -395,7 +399,6 @@ void EntityGUI_SubShapeDlg::ResetStateOfDialog()
|
|||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SubShapeToggled()
|
// function : SubShapeToggled()
|
||||||
// purpose : Allow user selection of all or only selected sub shapes
|
// purpose : Allow user selection of all or only selected sub shapes
|
||||||
@ -403,13 +406,9 @@ void EntityGUI_SubShapeDlg::ResetStateOfDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_SubShapeDlg::SubShapeToggled()
|
void EntityGUI_SubShapeDlg::SubShapeToggled()
|
||||||
{
|
{
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
activateSelection();
|
||||||
|
|
||||||
if ( !isAllSubShapes() )
|
|
||||||
localSelection( myObject, shapeType() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ComboTextChanged()
|
// function : ComboTextChanged()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -421,7 +420,6 @@ void EntityGUI_SubShapeDlg::ComboTextChanged()
|
|||||||
SubShapeToggled();
|
SubShapeToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : NumberOfSubShapes()
|
// function : NumberOfSubShapes()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -507,6 +505,156 @@ int EntityGUI_SubShapeDlg::shapeType() const
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : showOnlySelected
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void EntityGUI_SubShapeDlg::showOnlySelected()
|
||||||
|
{
|
||||||
|
if (CORBA::is_nil(myObject) || isAllSubShapes())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
if (send == GroupPoints->PushButton4) {
|
||||||
|
activateSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
SALOME_ListIO aSelList;
|
||||||
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
GEOM_Displayer* aDisplayer = getDisplayer();
|
||||||
|
|
||||||
|
if (send == GroupPoints->PushButton3) {
|
||||||
|
aDisplayer->Erase(aSelList, false, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aDisplayer->EraseAll();
|
||||||
|
aDisplayer->Display(aSelList, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getSelectedSubshapes
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
int EntityGUI_SubShapeDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex)
|
||||||
|
{
|
||||||
|
theMapIndex.Clear();
|
||||||
|
|
||||||
|
SalomeApp_Application* app = myGeomGUI->getApp();
|
||||||
|
if (!app || myObject->_is_nil())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||||
|
SALOME_ListIO aSelList;
|
||||||
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
|
// try to find out and process the global selection
|
||||||
|
// (of not published objects and of published sub-shapes)
|
||||||
|
{
|
||||||
|
SALOME_ListIteratorOfListIO anIter (aSelList);
|
||||||
|
for (int i = 0; anIter.More(); anIter.Next(), i++)
|
||||||
|
{
|
||||||
|
Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
|
||||||
|
QString anEntry = anIObj->getEntry();
|
||||||
|
QString str = "_";
|
||||||
|
int index = anEntry.lastIndexOf(str);
|
||||||
|
if (index > 0) // selection among special preview
|
||||||
|
{
|
||||||
|
anEntry.remove(0, index+1);
|
||||||
|
int anIndex = anEntry.toInt();
|
||||||
|
if (anIndex)
|
||||||
|
theMapIndex.Add(anIndex);
|
||||||
|
}
|
||||||
|
else // selection among published shapes
|
||||||
|
{
|
||||||
|
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
|
||||||
|
if (!appStudy) return 0;
|
||||||
|
_PTR(Study) aStudy = appStudy->studyDS();
|
||||||
|
|
||||||
|
_PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
|
||||||
|
GEOM::GEOM_Object_var aGeomObj =
|
||||||
|
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
|
||||||
|
TopoDS_Shape aShape;
|
||||||
|
if (GEOMBase::GetShape(aGeomObj, aShape)) {
|
||||||
|
if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == (TopAbs_ShapeEnum)shapeType()) {
|
||||||
|
TopTools_IndexedMapOfShape aMainMap;
|
||||||
|
TopExp::MapShapes(myShape, aMainMap);
|
||||||
|
|
||||||
|
TopExp_Explorer anExp (aShape, (TopAbs_ShapeEnum)shapeType());
|
||||||
|
for (; anExp.More(); anExp.Next()) {
|
||||||
|
TopoDS_Shape aSubShape = anExp.Current();
|
||||||
|
int anIndex = aMainMap.FindIndex(aSubShape);
|
||||||
|
if (anIndex >= 0) {
|
||||||
|
theMapIndex.Add(anIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // for aSelList
|
||||||
|
}
|
||||||
|
|
||||||
|
return theMapIndex.Extent();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : activateSelection
|
||||||
|
// purpose : Activate selection in accordance with myEditCurrentArgument
|
||||||
|
//=================================================================================
|
||||||
|
void EntityGUI_SubShapeDlg::activateSelection()
|
||||||
|
{
|
||||||
|
erasePreview(false);
|
||||||
|
|
||||||
|
// local selection
|
||||||
|
if (!myObject->_is_nil() && !isAllSubShapes())
|
||||||
|
{
|
||||||
|
GEOM_Displayer* aDisplayer = getDisplayer();
|
||||||
|
int prevDisplayMode = aDisplayer->SetDisplayMode(0);
|
||||||
|
|
||||||
|
SUIT_ViewWindow* aViewWindow = 0;
|
||||||
|
SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
|
||||||
|
if (activeStudy)
|
||||||
|
aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||||
|
if (aViewWindow == 0) return;
|
||||||
|
|
||||||
|
SUIT_ViewManager* aViewManager = aViewWindow->getViewManager();
|
||||||
|
if (aViewManager->getType() != OCCViewer_Viewer::Type() &&
|
||||||
|
aViewManager->getType() != SVTK_Viewer::Type())
|
||||||
|
return;
|
||||||
|
|
||||||
|
SUIT_ViewModel* aViewModel = aViewManager->getViewModel();
|
||||||
|
SALOME_View* aView = dynamic_cast<SALOME_View*>(aViewModel);
|
||||||
|
if (aView == 0) return;
|
||||||
|
|
||||||
|
//TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myObject);
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape aSubShapesMap;
|
||||||
|
TopExp::MapShapes(myShape, aSubShapesMap);
|
||||||
|
CORBA::String_var aMainEntry = myObject->GetStudyEntry();
|
||||||
|
QString anEntryBase = aMainEntry.in();
|
||||||
|
|
||||||
|
TopExp_Explorer anExp (myShape, (TopAbs_ShapeEnum)shapeType());
|
||||||
|
for (; anExp.More(); anExp.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Shape aSubShape = anExp.Current();
|
||||||
|
int index = aSubShapesMap.FindIndex(aSubShape);
|
||||||
|
QString anEntry = anEntryBase + QString("_%1").arg(index);
|
||||||
|
|
||||||
|
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
|
||||||
|
if (aPrs) {
|
||||||
|
displayPreview(aPrs, true, false); // append, do not update
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aDisplayer->UpdateViewer();
|
||||||
|
aDisplayer->SetDisplayMode(prevDisplayMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
globalSelection(GEOM_ALLSHAPES);
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -532,21 +680,13 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg)
|
|||||||
if (isAllSubShapes())
|
if (isAllSubShapes())
|
||||||
isOk = true;
|
isOk = true;
|
||||||
else {
|
else {
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
|
||||||
SALOME_ListIO aSelList;
|
|
||||||
aSelMgr->selectedObjects(aSelList);
|
|
||||||
|
|
||||||
if (aSelList.Extent() == 1) {
|
|
||||||
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
|
||||||
if ( !anObj->_is_nil() ) {
|
|
||||||
TColStd_IndexedMapOfInteger aMapIndex;
|
TColStd_IndexedMapOfInteger aMapIndex;
|
||||||
aSelMgr->GetIndexes(aSelList.First(), aMapIndex);
|
int nbSel = getSelectedSubshapes(aMapIndex);
|
||||||
isOk = aMapIndex.Extent() > 0;
|
isOk = nbSel > 0;
|
||||||
|
|
||||||
if (!isOk)
|
if (!isOk)
|
||||||
msg += tr("NO_SUBSHAPES_SELECTED");
|
msg += tr("NO_SUBSHAPES_SELECTED");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
@ -566,25 +706,18 @@ bool EntityGUI_SubShapeDlg::execute (ObjectList& objects)
|
|||||||
// Throw away sub-shapes not selected by user if not in preview mode
|
// Throw away sub-shapes not selected by user if not in preview mode
|
||||||
// and manual selection is active
|
// and manual selection is active
|
||||||
if (!isAllSubShapes()) {
|
if (!isAllSubShapes()) {
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
|
||||||
SALOME_ListIO aSelList;
|
|
||||||
aSelMgr->selectedObjects(aSelList);
|
|
||||||
|
|
||||||
if (aSelList.Extent() == 1) {
|
|
||||||
GEOM::GEOM_Object_var anObj =
|
|
||||||
GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
|
|
||||||
|
|
||||||
if ( !anObj->_is_nil() ) {
|
|
||||||
TColStd_IndexedMapOfInteger aMapIndex;
|
TColStd_IndexedMapOfInteger aMapIndex;
|
||||||
aSelMgr->GetIndexes(aSelList.First(), aMapIndex);
|
int nbSel = getSelectedSubshapes(aMapIndex);
|
||||||
|
|
||||||
|
if (nbSel > 0) {
|
||||||
GEOM::GEOM_ILocalOperations_var aLocOp =
|
GEOM::GEOM_ILocalOperations_var aLocOp =
|
||||||
getGeomEngine()->GetILocalOperations(getStudyId());
|
getGeomEngine()->GetILocalOperations(getStudyId());
|
||||||
|
|
||||||
for (int i = 0, n = aList->length(); i < n; i++)
|
for (int i = 0, n = aList->length(); i < n; i++)
|
||||||
if (aMapIndex.Contains(aLocOp->GetSubShapeIndex(myObject, aList[i])))
|
if (aMapIndex.Contains(aLocOp->GetSubShapeIndex(myObject, aList[i])))
|
||||||
objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
|
objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
|
||||||
}
|
else
|
||||||
|
aList[i]->UnRegister();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -604,6 +737,10 @@ GEOM::GEOM_Object_ptr EntityGUI_SubShapeDlg::getFather( GEOM::GEOM_Object_ptr )
|
|||||||
return myObject;
|
return myObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
// Function : getNewObjectName
|
||||||
|
// Purpose :
|
||||||
|
//================================================================
|
||||||
QString EntityGUI_SubShapeDlg::getNewObjectName() const
|
QString EntityGUI_SubShapeDlg::getNewObjectName() const
|
||||||
{
|
{
|
||||||
return QString::null;
|
return QString::null;
|
||||||
|
@ -18,18 +18,19 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// GEOM GEOMGUI : GUI for Geometry component
|
// GEOM GEOMGUI : GUI for Geometry component
|
||||||
// File : EntityGUI_SubShapeDlg.h
|
// File : EntityGUI_SubShapeDlg.h
|
||||||
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
||||||
//
|
|
||||||
#ifndef ENTITYGUI_SUBSHAPEDLG_H
|
#ifndef ENTITYGUI_SUBSHAPEDLG_H
|
||||||
#define ENTITYGUI_SUBSHAPEDLG_H
|
#define ENTITYGUI_SUBSHAPEDLG_H
|
||||||
|
|
||||||
#include <GEOMBase_Skeleton.h>
|
#include <GEOMBase_Skeleton.h>
|
||||||
|
|
||||||
class DlgRef_1Sel1Check1List;
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
|
|
||||||
|
class DlgRef_1Sel1List1Check3Btn;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : EntityGUI_SubShapeDlg
|
// class : EntityGUI_SubShapeDlg
|
||||||
@ -51,25 +52,31 @@ protected:
|
|||||||
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
|
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
|
||||||
virtual QString getNewObjectName() const;
|
virtual QString getNewObjectName() const;
|
||||||
|
|
||||||
|
void closeEvent (QCloseEvent*);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
bool ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ActivateThisDialog();
|
void ActivateThisDialog();
|
||||||
void DeactivateActiveDialog();
|
|
||||||
void LineEditReturnPressed();
|
void LineEditReturnPressed();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void SubShapeToggled();
|
void SubShapeToggled();
|
||||||
void ComboTextChanged();
|
void ComboTextChanged();
|
||||||
|
|
||||||
|
void showOnlySelected();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent (QEvent*);
|
void enterEvent (QEvent*);
|
||||||
|
|
||||||
void ResetStateOfDialog();
|
void ResetStateOfDialog();
|
||||||
|
|
||||||
unsigned int NumberOfSubShapes (const TopoDS_Shape&,
|
unsigned int NumberOfSubShapes (const TopoDS_Shape&,
|
||||||
const int) const;
|
const int) const;
|
||||||
|
|
||||||
|
void activateSelection();
|
||||||
|
int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex);
|
||||||
void updateButtonState();
|
void updateButtonState();
|
||||||
bool isAllSubShapes() const;
|
bool isAllSubShapes() const;
|
||||||
int shapeType() const;
|
int shapeType() const;
|
||||||
@ -80,8 +87,7 @@ private:
|
|||||||
|
|
||||||
bool myWithShape;
|
bool myWithShape;
|
||||||
|
|
||||||
DlgRef_1Sel1Check1List* GroupPoints;
|
DlgRef_1Sel1List1Check3Btn* GroupPoints;
|
||||||
ObjectList myResult;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENTITYGUI_SUBSHAPEDLG_H
|
#endif // ENTITYGUI_SUBSHAPEDLG_H
|
||||||
|
@ -4263,6 +4263,18 @@ Otherwise the dimensions will be kept without modifications.</translation>
|
|||||||
<source>GEOM_PLUGINS_OTHER</source>
|
<source>GEOM_PLUGINS_OTHER</source>
|
||||||
<translation>Other</translation>
|
<translation>Other</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SHOW_ONLY_SELECTED</source>
|
||||||
|
<translation>Show only selected</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>HIDE_SELECTED</source>
|
||||||
|
<translation>Hide selected</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SHOW_ALL_SUB_SHAPES</source>
|
||||||
|
<translation>Show all sub-shapes</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BasicGUI_CurveDlg</name>
|
<name>BasicGUI_CurveDlg</name>
|
||||||
@ -4513,18 +4525,6 @@ Number of sketch points too small</translation>
|
|||||||
<source>REMOVE</source>
|
<source>REMOVE</source>
|
||||||
<translation>Remove</translation>
|
<translation>Remove</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>SHOW_ONLY_SELECTED</source>
|
|
||||||
<translation>Show only selected</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>HIDE_SELECTED</source>
|
|
||||||
<translation>Hide selected</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>SHOW_ALL_SUB_SHAPES</source>
|
|
||||||
<translation>Show all sub-shapes</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>SELECT_ALL</source>
|
<source>SELECT_ALL</source>
|
||||||
<translation>Select All</translation>
|
<translation>Select All</translation>
|
||||||
|
@ -4231,6 +4231,18 @@ le paramètre '%1' aux préférences du module Géométrie.</translati
|
|||||||
<source>GEOM_PLUGINS_OTHER</source>
|
<source>GEOM_PLUGINS_OTHER</source>
|
||||||
<translation>Autre</translation>
|
<translation>Autre</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SHOW_ONLY_SELECTED</source>
|
||||||
|
<translation>Afficher uniquement la sélection</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>HIDE_SELECTED</source>
|
||||||
|
<translation>Cacher la sélection</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SHOW_ALL_SUB_SHAPES</source>
|
||||||
|
<translation>Afficher tous les sous-objets</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BasicGUI_CurveDlg</name>
|
<name>BasicGUI_CurveDlg</name>
|
||||||
@ -4473,18 +4485,6 @@ Le nombre de points n'est pas suffisant</translation>
|
|||||||
<source>REMOVE</source>
|
<source>REMOVE</source>
|
||||||
<translation>Supprimer</translation>
|
<translation>Supprimer</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>SHOW_ONLY_SELECTED</source>
|
|
||||||
<translation>Afficher uniquement la sélection</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>HIDE_SELECTED</source>
|
|
||||||
<translation>Cacher la sélection</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>SHOW_ALL_SUB_SHAPES</source>
|
|
||||||
<translation>Afficher tous les sous-objets</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>SELECT_ALL</source>
|
<source>SELECT_ALL</source>
|
||||||
<translation>Tout sélectionner</translation>
|
<translation>Tout sélectionner</translation>
|
||||||
|
Loading…
Reference in New Issue
Block a user