mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-31 22:37:48 +05:00
NPAL18363: EDF635: We can now select any object in all window.
This commit is contained in:
parent
582aab65e3
commit
156fe6ad40
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// 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
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -152,39 +152,39 @@ void PrimitiveGUI_BoxDlg::Init()
|
|||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double)));
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
initName( tr( "GEOM_BOX" ) );
|
initName( tr( "GEOM_BOX" ) );
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
|
void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
|
||||||
{
|
{
|
||||||
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
switch (constructorId)
|
switch (constructorId)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// globalSelection( GEOM_POINT );
|
// globalSelection( GEOM_POINT );
|
||||||
|
globalSelection(); // close local contexts, if any
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
|
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
resize(0, 0);
|
resize(0, 0);
|
||||||
GroupPoints->show();
|
GroupPoints->show();
|
||||||
|
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
GroupPoints->LineEdit1->setText("");
|
GroupPoints->LineEdit1->setText("");
|
||||||
GroupPoints->LineEdit2->setText("");
|
GroupPoints->LineEdit2->setText("");
|
||||||
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,6 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -211,7 +210,6 @@ void PrimitiveGUI_BoxDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -226,63 +224,68 @@ bool PrimitiveGUI_BoxDlg::ClickOnApply()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection as changed
|
// purpose : Called when selection as changed
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
|
void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if ( getConstructorId() != 0 )
|
if (getConstructorId() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
if (IObjectCount() != 1)
|
if (IObjectCount() != 1)
|
||||||
{
|
{
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint1 = GEOM::GEOM_Object::_nil();
|
myPoint1 = GEOM::GEOM_Object::_nil();
|
||||||
else if ( myEditCurrentArgument == GroupPoints->LineEdit2)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
myPoint2 = GEOM::GEOM_Object::_nil();
|
myPoint2 = GEOM::GEOM_Object::_nil();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nbSel == 1
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
|
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
|
||||||
|
|
||||||
if(!testResult || CORBA::is_nil( aSelectedObject ))
|
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||||
|
{
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
|
aSelMgr->GetIndexes(firstIObject(), aMap);
|
||||||
|
if (aMap.Extent() == 1) // Local Selection
|
||||||
{
|
{
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||||
aSelMgr->GetIndexes( firstIObject(), aMap );
|
int anIndex = aMap( 1 );
|
||||||
if ( aMap.Extent() == 1 )
|
aName.append( ":vertex_" + QString::number( anIndex ) );
|
||||||
{
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
aSelMgr->clearSelected(); // ???
|
||||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
|
||||||
int anIndex = aMap( 1 );
|
|
||||||
aName.append( ":vertex_" + QString::number( anIndex ) );
|
|
||||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
|
||||||
aSelMgr->clearSelected();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else // Global Selection
|
||||||
|
{
|
||||||
|
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
||||||
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
|
aName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
myEditCurrentArgument->setText( aName );
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint1 = aSelectedObject;
|
myPoint1 = aSelectedObject;
|
||||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
myPoint2 = aSelectedObject;
|
myPoint2 = aSelectedObject;
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -290,20 +293,20 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
|
|||||||
void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
|
void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1)
|
if(send == GroupPoints->PushButton1)
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
else if(send == GroupPoints->PushButton2)
|
else if(send == GroupPoints->PushButton2)
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
|
||||||
// globalSelection( GEOM_POINT );
|
// globalSelection( GEOM_POINT );
|
||||||
|
globalSelection(); // close local contexts, if any
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -326,9 +329,9 @@ void PrimitiveGUI_BoxDlg::LineEditReturnPressed()
|
|||||||
void PrimitiveGUI_BoxDlg::ActivateThisDialog()
|
void PrimitiveGUI_BoxDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
ConstructorsClicked( getConstructorId() );
|
ConstructorsClicked( getConstructorId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// 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
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -166,7 +166,7 @@ void PrimitiveGUI_ConeDlg::Init()
|
|||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double)));
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
|
|
||||||
initName( tr( "GEOM_CONE" ) );
|
initName( tr( "GEOM_CONE" ) );
|
||||||
@ -180,14 +180,15 @@ void PrimitiveGUI_ConeDlg::Init()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId)
|
void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId)
|
||||||
{
|
{
|
||||||
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
switch(constructorId)
|
switch(constructorId)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
{
|
{
|
||||||
// globalSelection( GEOM_POINT );
|
// globalSelection( GEOM_POINT );
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
globalSelection(); // to break prvious local selection
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
resize(0, 0);
|
resize(0, 0);
|
||||||
GroupPoints->show();
|
GroupPoints->show();
|
||||||
@ -197,7 +198,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId)
|
|||||||
GroupPoints->LineEdit2->setText(tr(""));
|
GroupPoints->LineEdit2->setText(tr(""));
|
||||||
myPoint = myDir = GEOM::GEOM_Object::_nil();
|
myPoint = myDir = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -256,17 +257,17 @@ void PrimitiveGUI_ConeDlg::ClickOnCancel()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
|
void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if ( getConstructorId() != 0 )
|
if (getConstructorId() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(IObjectCount() != 1)
|
if (IObjectCount() != 1)
|
||||||
{
|
{
|
||||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
myDir = GEOM::GEOM_Object::_nil();
|
myDir = GEOM::GEOM_Object::_nil();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nbSel == 1 */
|
/* nbSel == 1 */
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
@ -278,35 +279,48 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
|
|||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
QString aName = GEOMBase::GetName( aSelectedObject );
|
||||||
|
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
|
aNeedType = TopAbs_EDGE;
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
|
aSelMgr->GetIndexes( firstIObject(), aMap );
|
||||||
|
if (aMap.Extent() == 1)
|
||||||
{
|
{
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||||
aSelMgr->GetIndexes( firstIObject(), aMap );
|
int anIndex = aMap(1);
|
||||||
if ( aMap.Extent() == 1 )
|
|
||||||
{
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
aSelMgr->clearSelected(); // ???
|
||||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
|
||||||
int anIndex = aMap( 1 );
|
if (aNeedType == TopAbs_EDGE)
|
||||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
|
aName.append(":edge_" + QString::number(anIndex));
|
||||||
aName.append( ":edge_" + QString::number( anIndex ) );
|
else
|
||||||
else
|
aName.append(":vertex_" + QString::number(anIndex));
|
||||||
aName.append( ":vertex_" + QString::number( anIndex ) );
|
|
||||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
|
||||||
aSelMgr->clearSelected();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
myEditCurrentArgument->setText( aName );
|
else
|
||||||
|
{
|
||||||
|
if (aShape.ShapeType() != aNeedType) {
|
||||||
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
|
aName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
myDir = aSelectedObject;
|
myDir = aSelectedObject;
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -346,7 +360,6 @@ void PrimitiveGUI_ConeDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -354,12 +367,11 @@ void PrimitiveGUI_ConeDlg::LineEditReturnPressed()
|
|||||||
void PrimitiveGUI_ConeDlg::ActivateThisDialog()
|
void PrimitiveGUI_ConeDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
ConstructorsClicked( getConstructorId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ConstructorsClicked(getConstructorId());
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : DeactivateActiveDialog()
|
// function : DeactivateActiveDialog()
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// 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
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -159,7 +159,7 @@ void PrimitiveGUI_CylinderDlg::Init()
|
|||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
|
|
||||||
initName( tr( "GEOM_CYLINDER" ) );
|
initName( tr( "GEOM_CYLINDER" ) );
|
||||||
@ -173,13 +173,13 @@ void PrimitiveGUI_CylinderDlg::Init()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId)
|
void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId)
|
||||||
{
|
{
|
||||||
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
switch(constructorId)
|
switch (constructorId)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
{
|
{
|
||||||
// globalSelection( GEOM_POINT );
|
globalSelection( GEOM_POINT ); // to break previous local selection
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
|
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
@ -191,7 +191,7 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId)
|
|||||||
GroupPoints->LineEdit2->setText(tr(""));
|
GroupPoints->LineEdit2->setText(tr(""));
|
||||||
myPoint = myDir = GEOM::GEOM_Object::_nil();
|
myPoint = myDir = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -250,48 +250,61 @@ void PrimitiveGUI_CylinderDlg::ClickOnCancel()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
|
void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if ( getConstructorId() != 0 )
|
if (getConstructorId() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
if(IObjectCount() != 1)
|
if (IObjectCount() != 1)
|
||||||
{
|
{
|
||||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
myDir = GEOM::GEOM_Object::_nil();
|
myDir = GEOM::GEOM_Object::_nil();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nbSel == 1 */
|
/* nbSel == 1 */
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
|
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
|
||||||
|
|
||||||
if(!testResult || CORBA::is_nil( aSelectedObject ))
|
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
|
aNeedType = TopAbs_EDGE;
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
|
aSelMgr->GetIndexes(firstIObject(), aMap);
|
||||||
|
if (aMap.Extent() == 1) // Local Selection
|
||||||
{
|
{
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||||
aSelMgr->GetIndexes( firstIObject(), aMap );
|
int anIndex = aMap(1);
|
||||||
if ( aMap.Extent() == 1 )
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
{
|
aSelMgr->clearSelected(); // ???
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
|
||||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
if (aNeedType == TopAbs_EDGE)
|
||||||
int anIndex = aMap( 1 );
|
aName.append(":edge_" + QString::number(anIndex));
|
||||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
|
else
|
||||||
aName.append( ":edge_" + QString::number( anIndex ) );
|
aName.append(":vertex_" + QString::number(anIndex));
|
||||||
else
|
|
||||||
aName.append( ":vertex_" + QString::number( anIndex ) );
|
|
||||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
|
||||||
aSelMgr->clearSelected();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
myEditCurrentArgument->setText( aName );
|
else // Global Selection
|
||||||
|
{
|
||||||
|
if (aShape.ShapeType() != aNeedType) {
|
||||||
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
|
aName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
@ -300,7 +313,6 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -309,12 +321,12 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
|
|||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if (send == GroupPoints->PushButton1) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
globalSelection( GEOM_POINT ); // to break previous local selection
|
globalSelection( GEOM_POINT ); // to break previous local selection
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
}
|
}
|
||||||
else if(send == GroupPoints->PushButton2) {
|
else if (send == GroupPoints->PushButton2) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
globalSelection( GEOM_LINE ); // to break previous local selection
|
globalSelection( GEOM_LINE ); // to break previous local selection
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
|
||||||
@ -340,7 +352,6 @@ void PrimitiveGUI_CylinderDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -348,12 +359,11 @@ void PrimitiveGUI_CylinderDlg::LineEditReturnPressed()
|
|||||||
void PrimitiveGUI_CylinderDlg::ActivateThisDialog()
|
void PrimitiveGUI_CylinderDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
ConstructorsClicked( getConstructorId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ConstructorsClicked(getConstructorId());
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
@ -464,7 +474,6 @@ double PrimitiveGUI_CylinderDlg::getRadius() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : getHeight()
|
// function : getHeight()
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// 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
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -90,7 +90,6 @@ PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg(GeometryGUI* theGeometryGUI, QWid
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~PrimitiveGUI_SphereDlg()
|
// function : ~PrimitiveGUI_SphereDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -100,7 +99,6 @@ PrimitiveGUI_SphereDlg::~PrimitiveGUI_SphereDlg()
|
|||||||
/* no need to delete child widgets, Qt does it all for us */
|
/* no need to delete child widgets, Qt does it all for us */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -134,29 +132,31 @@ void PrimitiveGUI_SphereDlg::Init()
|
|||||||
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||||
|
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
|
GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
|
||||||
|
GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
initName(tr("GEOM_SPHERE"));
|
initName(tr("GEOM_SPHERE"));
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
|
void PrimitiveGUI_SphereDlg::ConstructorsClicked (int constructorId)
|
||||||
{
|
{
|
||||||
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
switch (constructorId)
|
switch (constructorId)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
|
globalSelection(); // close local contexts, if any
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
resize(0, 0);
|
resize(0, 0);
|
||||||
@ -166,7 +166,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
|
|||||||
GroupPoints->LineEdit1->setText("");
|
GroupPoints->LineEdit1->setText("");
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -182,7 +182,6 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -193,7 +192,6 @@ void PrimitiveGUI_SphereDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -208,67 +206,71 @@ bool PrimitiveGUI_SphereDlg::ClickOnApply()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// function : ClickOnCancel()
|
// function : ClickOnCancel()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_SphereDlg::ClickOnCancel()
|
void PrimitiveGUI_SphereDlg::ClickOnCancel()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ClickOnCancel();
|
GEOMBase_Skeleton::ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection as changed or other case
|
// purpose : Called when selection as changed or other case
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
|
void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if ( getConstructorId() != 0 )
|
if (getConstructorId() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
if(IObjectCount() != 1)
|
if (IObjectCount() != 1)
|
||||||
{
|
{
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
myPoint = GEOM::GEOM_Object::_nil();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nbSel == 1 ! */
|
/* nbSel == 1 ! */
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
|
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
|
||||||
|
|
||||||
if (!testResult || CORBA::is_nil( aSelectedObject ))
|
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||||
|
{
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
|
aSelMgr->GetIndexes(firstIObject(), aMap);
|
||||||
|
if (aMap.Extent() == 1) // Local Selection
|
||||||
{
|
{
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||||
aSelMgr->GetIndexes( firstIObject(), aMap );
|
int anIndex = aMap( 1 );
|
||||||
if ( aMap.Extent() == 1 )
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
{
|
aSelMgr->clearSelected();
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
|
||||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
|
||||||
int anIndex = aMap( 1 );
|
|
||||||
aName.append( ":vertex_" + QString::number( anIndex ) );
|
|
||||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
|
||||||
aSelMgr->clearSelected();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setText( aName );
|
aName.append( ":vertex_" + QString::number( anIndex ) );
|
||||||
|
}
|
||||||
|
else // Global Selection
|
||||||
|
{
|
||||||
|
if (aShape.ShapeType() != TopAbs_VERTEX) {
|
||||||
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
|
aName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -283,7 +285,6 @@ void PrimitiveGUI_SphereDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -292,15 +293,15 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument()
|
|||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if (send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
globalSelection(); // close local contexts, if any
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -308,12 +309,11 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument()
|
|||||||
void PrimitiveGUI_SphereDlg::ActivateThisDialog()
|
void PrimitiveGUI_SphereDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
ConstructorsClicked( getConstructorId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ConstructorsClicked(getConstructorId());
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : DeactivateActiveDialog()
|
// function : DeactivateActiveDialog()
|
||||||
@ -324,7 +324,6 @@ void PrimitiveGUI_SphereDlg::DeactivateActiveDialog()
|
|||||||
GEOMBase_Skeleton::DeactivateActiveDialog();
|
GEOMBase_Skeleton::DeactivateActiveDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -335,7 +334,6 @@ void PrimitiveGUI_SphereDlg::enterEvent(QEvent* e)
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -345,7 +343,6 @@ void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -355,7 +352,6 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_SphereDlg::createOperation()
|
|||||||
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
|
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -369,33 +365,35 @@ bool PrimitiveGUI_SphereDlg::isValid( QString& msg )
|
|||||||
// function : execute
|
// function : execute
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
|
bool PrimitiveGUI_SphereDlg::execute (ObjectList& objects)
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
|
||||||
switch ( getConstructorId() )
|
switch (getConstructorId())
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0:
|
||||||
{
|
{
|
||||||
if ( !CORBA::is_nil( myPoint ) ) {
|
if (!CORBA::is_nil(myPoint)) {
|
||||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
|
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
|
||||||
|
MakeSpherePntR(myPoint, getRadius());
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1 :
|
case 1:
|
||||||
{
|
{
|
||||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
|
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
|
||||||
|
MakeSphereR(getRadius());
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !anObj->_is_nil() )
|
if (!anObj->_is_nil())
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back(anObj._retn());
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,12 +403,9 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e )
|
void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e )
|
||||||
{
|
{
|
||||||
//myGeomGUI->SetState( -1 );
|
|
||||||
GEOMBase_Skeleton::closeEvent( e );
|
GEOMBase_Skeleton::closeEvent( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : getRadius()
|
// function : getRadius()
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -159,19 +159,18 @@ void PrimitiveGUI_TorusDlg::Init()
|
|||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
|
||||||
GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
|
||||||
|
|
||||||
connect(myGeomGUI->getApp()->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
initName( tr( "GEOM_TORUS" ) );
|
initName( tr( "GEOM_TORUS" ) );
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
|
void PrimitiveGUI_TorusDlg::ConstructorsClicked (int constructorId)
|
||||||
{
|
{
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
@ -179,7 +178,8 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
globalSelection(); // close local contexts, if any
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
|
|
||||||
GroupDimensions->hide();
|
GroupDimensions->hide();
|
||||||
resize(0, 0);
|
resize(0, 0);
|
||||||
@ -216,7 +216,7 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_TorusDlg::ClickOnOk()
|
void PrimitiveGUI_TorusDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
if ( ClickOnApply() )
|
if (ClickOnApply())
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void PrimitiveGUI_TorusDlg::ClickOnOk()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool PrimitiveGUI_TorusDlg::ClickOnApply()
|
bool PrimitiveGUI_TorusDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if ( !onAccept() )
|
if (!onAccept())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
@ -241,7 +241,7 @@ bool PrimitiveGUI_TorusDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
|
void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
if ( getConstructorId() != 0 )
|
if (getConstructorId() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
@ -257,32 +257,46 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
/* nbSel == 1 */
|
/* nbSel == 1 */
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
|
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
|
||||||
|
|
||||||
if (!testResult || CORBA::is_nil( aSelectedObject ))
|
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString aName = GEOMBase::GetName( aSelectedObject );
|
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
|
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
|
aNeedType = TopAbs_EDGE;
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
|
TColStd_IndexedMapOfInteger aMap;
|
||||||
|
aSelMgr->GetIndexes(firstIObject(), aMap);
|
||||||
|
if (aMap.Extent() == 1) // Local Selection
|
||||||
{
|
{
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
TColStd_IndexedMapOfInteger aMap;
|
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
||||||
aSelMgr->GetIndexes( firstIObject(), aMap );
|
int anIndex = aMap(1);
|
||||||
if ( aMap.Extent() == 1 )
|
|
||||||
{
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
aSelMgr->clearSelected();
|
||||||
getGeomEngine()->GetIShapesOperations( getStudyId() );
|
|
||||||
int anIndex = aMap( 1 );
|
if (aNeedType == TopAbs_EDGE)
|
||||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
|
aName.append(":edge_" + QString::number(anIndex));
|
||||||
aName.append( ":edge_" + QString::number( anIndex ) );
|
else
|
||||||
else
|
aName.append(":vertex_" + QString::number(anIndex));
|
||||||
aName.append( ":vertex_" + QString::number( anIndex ) );
|
|
||||||
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
|
||||||
aSelMgr->clearSelected();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
myEditCurrentArgument->setText( aName );
|
else // Global Selection
|
||||||
|
{
|
||||||
|
if (aShape.ShapeType() != aNeedType) {
|
||||||
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
|
aName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
@ -292,7 +306,6 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
|
|||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -378,7 +391,6 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_TorusDlg::createOperation()
|
|||||||
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
|
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : isValid
|
// function : isValid
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -388,7 +400,6 @@ bool PrimitiveGUI_TorusDlg::isValid( QString& msg )
|
|||||||
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
|
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : execute
|
// function : execute
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -426,7 +437,6 @@ bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects )
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : getRadius1()
|
// function : getRadius1()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -441,7 +451,6 @@ double PrimitiveGUI_TorusDlg::getRadius1() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : getRadius2()
|
// function : getRadius2()
|
||||||
// purpose :
|
// purpose :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user