// License along with this library; if not, write to the Free Software
// 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
//
//
//
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, 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()));
initName( tr( "GEOM_BOX" ) );
ConstructorsClicked(0);
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
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)
{
case 0:
{
// globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
-
+
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText("");
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
displayPreview();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed
//=================================================================================
void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
-
+
myEditCurrentArgument->setText("");
-
+
if (IObjectCount() != 1)
- {
- if (myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint1 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2)
- myPoint2 = GEOM::GEOM_Object::_nil();
- return;
- }
+ {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myPoint1 = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myPoint2 = GEOM::GEOM_Object::_nil();
+ return;
+ }
// nbSel == 1
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
-
- if(!testResult || CORBA::is_nil( aSelectedObject ))
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
+
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
TopoDS_Shape aShape;
- QString aName = GEOMBase::GetName( aSelectedObject );
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ QString aName = GEOMBase::GetName(aSelectedObject);
+ 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();
- TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( firstIObject(), aMap );
- if ( aMap.Extent() == 1 )
- {
- 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();
- }
+ 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(); // ???
}
+ 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;
- else if(myEditCurrentArgument == GroupPoints->LineEdit2)
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myPoint2 = aSelectedObject;
-
+
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
-
+
if(send == GroupPoints->PushButton1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else if(send == GroupPoints->PushButton2)
myEditCurrentArgument = GroupPoints->LineEdit2;
-
+
// globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-
+
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void PrimitiveGUI_BoxDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
ConstructorsClicked( getConstructorId() );
}
// License along with this library; if not, write to the Free Software
// 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
//
//
//
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, 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())) ;
initName( tr( "GEOM_CONE" ) );
//=================================================================================
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)
{
case 0 :
{
// 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();
resize(0, 0);
GroupPoints->show();
GroupPoints->LineEdit2->setText(tr(""));
myPoint = myDir = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
//=================================================================================
void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
- if(IObjectCount() != 1)
- {
- if(myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2)
- myDir = GEOM::GEOM_Object::_nil();
- return;
- }
+ if (IObjectCount() != 1)
+ {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myPoint = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myDir = GEOM::GEOM_Object::_nil();
+ return;
+ }
/* nbSel == 1 */
Standard_Boolean testResult = Standard_False;
TopoDS_Shape aShape;
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)
+ {
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ int anIndex = aMap(1);
+
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected(); // ???
+
+ if (aNeedType == TopAbs_EDGE)
+ aName.append(":edge_" + QString::number(anIndex));
+ else
+ aName.append(":vertex_" + QString::number(anIndex));
+ }
+ else
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( firstIObject(), aMap );
- if ( aMap.Extent() == 1 )
- {
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- aName.append( ":edge_" + QString::number( anIndex ) );
- else
- aName.append( ":vertex_" + QString::number( anIndex ) );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
- }
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
}
- myEditCurrentArgument->setText( aName );
+ }
+
+ myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
- else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject;
-
+
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void PrimitiveGUI_ConeDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- ConstructorsClicked( getConstructorId() );
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(getConstructorId());
+}
//=================================================================================
// function : DeactivateActiveDialog()
// License along with this library; if not, write to the Free Software
// 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
//
//
//
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, 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())) ;
initName( tr( "GEOM_CYLINDER" ) );
//=================================================================================
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 :
{
- // globalSelection( GEOM_POINT );
+ globalSelection( GEOM_POINT ); // to break previous local selection
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupDimensions->hide();
GroupPoints->LineEdit2->setText(tr(""));
myPoint = myDir = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
//=================================================================================
void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
myEditCurrentArgument->setText("");
-
- if(IObjectCount() != 1)
- {
- if(myEditCurrentArgument == GroupPoints->LineEdit1)
- myPoint = GEOM::GEOM_Object::_nil();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2)
- myDir = GEOM::GEOM_Object::_nil();
- return;
- }
-
+
+ if (IObjectCount() != 1)
+ {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
+ myPoint = GEOM::GEOM_Object::_nil();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+ myDir = GEOM::GEOM_Object::_nil();
+ return;
+ }
+
/* nbSel == 1 */
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
-
- if(!testResult || CORBA::is_nil( aSelectedObject ))
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
+
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
- QString aName = GEOMBase::GetName( aSelectedObject );
+ QString aName = GEOMBase::GetName(aSelectedObject);
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();
- TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( firstIObject(), aMap );
- if ( aMap.Extent() == 1 )
- {
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- aName.append( ":edge_" + QString::number( anIndex ) );
- else
- aName.append( ":vertex_" + QString::number( anIndex ) );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
- }
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ int anIndex = aMap(1);
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected(); // ???
+
+ if (aNeedType == TopAbs_EDGE)
+ aName.append(":edge_" + QString::number(anIndex));
+ else
+ aName.append(":vertex_" + QString::number(anIndex));
}
- myEditCurrentArgument->setText( aName );
+ else // Global Selection
+ {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- if(send == GroupPoints->PushButton1) {
+ if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_POINT ); // to break previous local selection
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
- else if(send == GroupPoints->PushButton2) {
+ else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE ); // to break previous local selection
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void PrimitiveGUI_CylinderDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- ConstructorsClicked( getConstructorId() );
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(getConstructorId());
+}
//=================================================================================
// function : enterEvent()
return 0;
}
-
//=================================================================================
// function : getHeight()
// purpose :
// License along with this library; if not, write to the Free Software
// 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
//
//
//
Init();
}
-
//=================================================================================
// function : ~PrimitiveGUI_SphereDlg()
// purpose : Destroys the object and frees any allocated resources
/* no need to delete child widgets, Qt does it all for us */
}
-
//=================================================================================
// function : Init()
// purpose :
connect(GroupDimensions->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)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(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(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_SPHERE"));
ConstructorsClicked(0);
}
-
//=================================================================================
// function : ConstructorsClicked()
// 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)
{
case 0:
{
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupDimensions->hide();
resize(0, 0);
GroupPoints->LineEdit1->setText("");
myPoint = GEOM::GEOM_Object::_nil();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
displayPreview();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
return true;
}
-
-
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void PrimitiveGUI_SphereDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
-
+
myEditCurrentArgument->setText("");
-
- if(IObjectCount() != 1)
- {
- myPoint = GEOM::GEOM_Object::_nil();
- return;
- }
-
+
+ if (IObjectCount() != 1)
+ {
+ myPoint = GEOM::GEOM_Object::_nil();
+ return;
+ }
+
/* nbSel == 1 ! */
Standard_Boolean testResult = Standard_False;
- GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
-
- if (!testResult || CORBA::is_nil( aSelectedObject ))
+ GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
+
+ if (!testResult || CORBA::is_nil(aSelectedObject))
return;
- QString aName = GEOMBase::GetName( aSelectedObject );
+ QString aName = GEOMBase::GetName(aSelectedObject);
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();
- TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( firstIObject(), aMap );
- if ( aMap.Extent() == 1 )
- {
- 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();
- }
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ int anIndex = aMap( 1 );
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected();
+
+ aName.append( ":vertex_" + QString::number( anIndex ) );
+ }
+ else // Global Selection
+ {
+ if (aShape.ShapeType() != TopAbs_VERTEX) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
}
+ }
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
myPoint = aSelectedObject;
-
+
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- if(send == GroupPoints->PushButton1) {
+ if (send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
SelectionIntoArgument();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void PrimitiveGUI_SphereDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- ConstructorsClicked( getConstructorId() );
-}
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ ConstructorsClicked(getConstructorId());
+}
//=================================================================================
// function : DeactivateActiveDialog()
GEOMBase_Skeleton::DeactivateActiveDialog();
}
-
//=================================================================================
// function : enterEvent()
// purpose :
ActivateThisDialog();
}
-
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
displayPreview();
}
-
//=================================================================================
// function : createOperation
// purpose :
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
}
-
//=================================================================================
// function : isValid
// purpose :
// function : execute
// purpose :
//=================================================================================
-bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
+bool PrimitiveGUI_SphereDlg::execute (ObjectList& objects)
{
bool res = false;
-
+
GEOM::GEOM_Object_var anObj;
- switch ( getConstructorId() )
+ switch (getConstructorId())
{
- case 0 :
+ case 0:
{
- if ( !CORBA::is_nil( myPoint ) ) {
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
+ if (!CORBA::is_nil(myPoint)) {
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
+ MakeSpherePntR(myPoint, getRadius());
res = true;
}
break;
}
- case 1 :
+ case 1:
{
- anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
+ anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
+ MakeSphereR(getRadius());
res = true;
break;
}
}
-
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
-
+
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+
return res;
}
//=================================================================================
void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e )
{
- //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
-
-
//=================================================================================
// function : getRadius()
// purpose :
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
- connect(myGeomGUI->getApp()->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_TORUS" ) );
ConstructorsClicked(0);
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
+void PrimitiveGUI_TorusDlg::ConstructorsClicked (int constructorId)
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 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();
resize(0, 0);
//=================================================================================
void PrimitiveGUI_TorusDlg::ClickOnOk()
{
- if ( ClickOnApply() )
+ if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
bool PrimitiveGUI_TorusDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
//=================================================================================
void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
{
- if ( getConstructorId() != 0 )
+ if (getConstructorId() != 0)
return;
myEditCurrentArgument->setText("");
/* nbSel == 1 */
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;
- QString aName = GEOMBase::GetName( aSelectedObject );
+ QString aName = GEOMBase::GetName(aSelectedObject);
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
+ {
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ int anIndex = aMap(1);
+
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected();
+
+ if (aNeedType == TopAbs_EDGE)
+ aName.append(":edge_" + QString::number(anIndex));
+ else
+ aName.append(":vertex_" + QString::number(anIndex));
+ }
+ else // Global Selection
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( firstIObject(), aMap );
- if ( aMap.Extent() == 1 )
- {
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- aName.append( ":edge_" + QString::number( anIndex ) );
- else
- aName.append( ":vertex_" + QString::number( anIndex ) );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
- }
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
}
- myEditCurrentArgument->setText( aName );
+ }
+
+ myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject;
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
return getGeomEngine()->GetI3DPrimOperations( getStudyId() );
}
-
//=================================================================================
// function : isValid
// purpose :
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
}
-
//=================================================================================
// function : execute
// purpose :
return res;
}
-
//=================================================================================
// function : getRadius1()
// purpose :
return 0;
}
-
//=================================================================================
// function : getRadius2()
// purpose :