connect(Group3Pnts2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
- 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_ARC" ));
ConstructorsClicked( 0 );
{
case 0:
{
+ globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
Group3Pnts->show();
}
case 1:
{
+ globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
Group3Pnts->hide();
return true;
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
switch (getConstructorId())
{
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
// Get Selected object if selected subshape
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())
+ {
+ 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 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
- aName.append( ":vertex_" + QString::number( anIndex ) );
- }
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ int anIndex = aMap(1);
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected(); // ???
+
+ aName += QString(":vertex_%1").arg(anIndex);
+ }
+ else // Global Selection
+ {
+ if (aShape.ShapeType() != TopAbs_VERTEX) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
}
+ }
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
switch (getConstructorId())
{
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// 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
//
//
//
myPoints = new GEOM::ListOfGO();
myPoints->length( 0 );
- // globalSelection( GEOM_POINT );
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ globalSelection(GEOM_POINT);
+ //globalSelection(); // close local contexts, if any
+ //localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_CURVE" ) );
return -1;
}
+
//=================================================================================
/*! function : removeUnnecessaryPnt()
* purpose : Remove unnecessary points from list \a theOldPoints
int k=0;
for (list<GEOM::GEOM_Object_var>::iterator j=aList.begin();j!=aList.end();j++)
- myPoints[k++] = *j;
+ myPoints[k++] = *j;
if(IOC == 0)
myOrderedSel.clear();
void BasicGUI_CurveDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- // myGeomGUI->SetState( 0 );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- // globalSelection( GEOM_POINT );
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ globalSelection(GEOM_POINT);
+ //globalSelection(); // close local contexts, if any
+ //localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
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
//
//
//
{
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
+ globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
myPoint = myDir = GEOM::GEOM_Object::_nil();
- // myGeomGUI->SetState( 0 );
-
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupPoints->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_ELLIPSE" ) );
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1;
- globalSelection( GEOM_POINT );
-
+ //globalSelection(GEOM_POINT);
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+
return true;
}
}
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ Handle(SALOME_InteractiveObject) anIO = firstIObject();
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
// Get Selected object if selected subshape
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(anIO, 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 += QString(":edge_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(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 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
- aName.append( ":edge_" + QString::number( anIndex ) );
- else
- aName.append( ":vertex_" + QString::number( 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 ) myDir = aSelectedObject;
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
myEditCurrentArgument->setFocus();
+ globalSelection(); // close local contexts, if any
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
else
void BasicGUI_EllipseDlg::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()));
+
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit2->setText( "" );
myPoint = myDir = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_POINT );
+ //globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
//=================================================================================
// 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 : ~BasicGUI_LineDlg()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
void BasicGUI_LineDlg::Init()
{
/* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
-
- myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
-
- // myGeomGUI->SetState( 0 );
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ //myEditCurrentArgument = GroupPoints->LineEdit1;
+ //myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
+ //globalSelection(); // close local contexts, if any
+ //localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(GroupFaces->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupFaces->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- ConstructorsClicked (0);
+ ConstructorsClicked(0);
initName( tr("GEOM_LINE") );
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void BasicGUI_LineDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
{
if ( !onAccept() )
return false;
- GroupPoints->LineEdit1->setText( "" );
- GroupPoints->LineEdit2->setText( "" );
- GroupFaces->LineEdit1->setText( "" );
- GroupFaces->LineEdit2->setText( "" );
- myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
- myEditCurrentArgument = GroupPoints->LineEdit1;
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select vertex on all shapes
+
initName();
+ ConstructorsClicked(getConstructorId());
return true;
}
{
case 0:
{
- globalSelection(GEOM_POINT); // to break previous local selection
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText("");
myPoint1 = GEOM::GEOM_Object::_nil();
}
case 1:
{
- globalSelection(GEOM_PLANE); // to break previous local selection
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+
myEditCurrentArgument = GroupFaces->LineEdit1;
myEditCurrentArgument->setText("");
myFace1 = GEOM::GEOM_Object::_nil();
GroupFaces->show();
break;
}
- }
+ }
updateGeometry();
- resize( minimumSize() );
+ resize(minimumSize());
SelectionIntoArgument();
}
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
+ if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = GEOM::GEOM_Object::_nil();
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- TopoDS_Shape aShape;
- QString aName = GEOMBase::GetName( aSelectedObject );
+ QString aName = GEOMBase::GetName(aSelectedObject);
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupFaces->LineEdit1 ||
+ myEditCurrentArgument == GroupFaces->LineEdit2)
+ aNeedType = TopAbs_FACE;
+
+ 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_FACE)
+ aName += QString(":face_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(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 == GroupFaces->LineEdit1 ||
- myEditCurrentArgument == GroupFaces->LineEdit2 )
- aName.append( ":face_" + 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 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
GEOMBase_Skeleton::LineEditReturnPressed();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_LineDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- // myGeomGUI->SetState( 0 );
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- myEditCurrentArgument = GroupPoints->LineEdit1;
- myEditCurrentArgument->setFocus();
-
- GroupPoints->LineEdit1->setText( "" );
- GroupPoints->LineEdit2->setText( "" );
- GroupFaces->LineEdit1->setText( "" );
- GroupFaces->LineEdit2->setText( "" );
- myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
void BasicGUI_LineDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
{
GEOMBase_Skeleton::closeEvent( e );
}
-
Init();
}
-
//=================================================================================
// function : ~BasicGUI_MarkerDlg()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
initName( tr( "LCS_NAME" ) );
ConstructorsClicked( 0 );
-
//@
/*
QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
{
if ( myConstructorId == constructorId && myConstructorId == 0 )
{
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
activate( GEOM_MARKER );
displayPreview();
myConstructorId = constructorId;
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch (constructorId)
- {
- case 0:
+ {
+ case 0:
{
Group1->hide();
Group2->hide();
resize(0, 0);
aMainGrp->show();
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
activate( GEOM_MARKER );
break;
}
- case 1:
- {
- Group2->hide();
- aMainGrp->hide();
- //PAL6669: resize(0, 0);
- Group1->show();
-
- globalSelection( GEOM_ALLGEOM );
- myEditCurrentArgument = Group1->LineEdit1;
- Group1->LineEdit1->setText("");
- break;
- }
- case 2:
- {
- aMainGrp->hide();
- Group1->show();
- //PAL6669: resize(0, 0);
- Group2->show();
-
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
- myEditCurrentArgument = Group2->LineEdit1;
- Group2->LineEdit1->setText("");
- Group2->LineEdit2->setText("");
- Group2->LineEdit3->setText("");
- break;
- }
+ case 1:
+ {
+ Group2->hide();
+ aMainGrp->hide();
+ //PAL6669: resize(0, 0);
+ Group1->show();
+
+ globalSelection( GEOM_ALLGEOM );
+ myEditCurrentArgument = Group1->LineEdit1;
+ Group1->LineEdit1->setText("");
+ break;
+ }
+ case 2:
+ {
+ aMainGrp->hide();
+ Group1->show();
+ //PAL6669: resize(0, 0);
+ Group2->show();
+
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ myEditCurrentArgument = Group2->LineEdit1;
+ Group2->LineEdit1->setText("");
+ Group2->LineEdit2->setText("");
+ Group2->LineEdit3->setText("");
+ break;
}
+ }
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(onSelectionDone()));
onSelectionDone();
}
//=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone0()
{
- if ( IObjectCount() == 1 )
+ if (IObjectCount() == 1)
{
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
- GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+ GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- if ( aRes && !aSelectedObj->_is_nil() )
+ if (aRes && !aSelectedObj->_is_nil())
{
TopoDS_Shape aShape;
- if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ if (GEOMBase::GetShape(aSelectedObj, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{
// Existing LCS selected
- if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE )
+ if (aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE)
{
- TopoDS_Face aFace = TopoDS::Face( aShape );
- Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
+ TopoDS_Face aFace = TopoDS::Face(aShape);
+ Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aFace));
- if ( !aPlane.IsNull() )
+ if (!aPlane.IsNull())
{
gp_Ax3 anAx3 = aPlane->Pln().Position();
gp_Pnt aLoc = anAx3.Location();
else
{
TColStd_IndexedMapOfInteger aMap;
- aSelMgr->GetIndexes( anIO, aMap );
- if ( aMap.Extent() == 1 )
+ aSelMgr->GetIndexes(anIO, aMap);
+ if (aMap.Extent() == 1) // Local Selection
{
- int anIndex = aMap( 1 );
+ int anIndex = aMap(1);
TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
- aSelMgr->clearSelected();
+ TopExp::MapShapes(aShape, aShapes);
+ aShape = aShapes.FindKey(anIndex);
+ aSelMgr->clearSelected(); // ???
}
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+ if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
{
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() );
displayPreview();
}
-
//=================================================================================
// function : onSelectionDone()
// purpose : Called when selection as changed or other case
//=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone()
{
- if ( getConstructorId() == 0 ) {
+ if (getConstructorId() == 0) {
onSelectionDone0();
return;
}
myEditCurrentArgument->setText("");
- QString aName;
- if ( IObjectCount() == 1 ) {
+ if (IObjectCount() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
- GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+ GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
- if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
- aName = GEOMBase::GetName( aSelectedObj );
+ if (!CORBA::is_nil(aSelectedObj) && aRes) {
+ QString aName = GEOMBase::GetName(aSelectedObj);
- if ( getConstructorId() == 1 ) { // by shape position
+ if (getConstructorId() == 1) { // by shape position
// Get shape's position
CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz, Yx,Yy,Yz;
Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0;
myData[ DY2 ]->SetValue( Yy );
myData[ DZ2 ]->SetValue( Yz );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
- else if ( getConstructorId() == 2 ) { // by point and two vectors
+ else if (getConstructorId() == 2) { // by point and two vectors
TopoDS_Shape aShape;
- if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
- GEOM::short_array anIndexes;
+ if (GEOMBase::GetShape(aSelectedObj, aShape, TopAbs_SHAPE))
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
+ if (myEditCurrentArgument == Group2->LineEdit1)
+ aNeedType = TopAbs_VERTEX;
TColStd_IndexedMapOfInteger aMap;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- aSelMgr->GetIndexes( anIO, aMap );
+ aSelMgr->GetIndexes(anIO, aMap);
- if ( !aMap.IsEmpty() ) {
- int anIndex = aMap( 1 );
+ if (!aMap.IsEmpty()) {
+ int anIndex = aMap(1);
TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
+ TopExp::MapShapes(aShape, aShapes);
+ aShape = aShapes.FindKey(anIndex);
+
+ if (aNeedType == TopAbs_EDGE)
+ aName += QString("_edge_%1").arg(anIndex);
+ else
+ aName += QString("_vertex_%1").arg(anIndex);
}
if (myEditCurrentArgument == Group2->LineEdit1) {
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else {
myData[ X ]->SetValue( 0 );
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
- gp_Dir aDir(gp_Vec(aP1, aP2));
+ gp_Dir aDir (gp_Vec(aP1, aP2));
myData[ DX1 ]->SetValue( aDir.X() );
myData[ DY1 ]->SetValue( aDir.Y() );
myData[ DZ1 ]->SetValue( aDir.Z() );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else {
myData[ DX1 ]->SetValue( 0 );
myData[ DX2 ]->SetValue( aDir.X() );
myData[ DY2 ]->SetValue( aDir.Y() );
myData[ DZ2 ]->SetValue( aDir.Z() );
- myEditCurrentArgument->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else {
myData[ DX2 ]->SetValue( 0 );
{
QPushButton* send = (QPushButton*)sender();
- if(send == Group1->PushButton1) {
+ if (send == Group1->PushButton1) {
myEditCurrentArgument = Group1->LineEdit1;
globalSelection( GEOM_ALLGEOM );
}
- else if(send == Group2->PushButton1) {
+ else if (send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1;
- globalSelection( GEOM_POINT );
+ //globalSelection( GEOM_POINT );
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
- else if(send == Group2->PushButton2) {
+ else if (send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2;
- globalSelection( GEOM_LINE );
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ //globalSelection( GEOM_LINE );
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
- else if(send == Group2->PushButton3) {
+ else if (send == Group2->PushButton3) {
myEditCurrentArgument = Group2->LineEdit3;
+ globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
void BasicGUI_MarkerDlg::onActivate()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(onSelectionDone()));
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
{
- GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(
- getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
- myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
- myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
+ GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(getOperation())->
+ MakeMarker(myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
+ myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
+ myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue());
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
// 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)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->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_PLANE" ) );
//=================================================================================
void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
- switch ( constructorId )
+ switch (constructorId)
{
- case 0: /* plane from a point and a direction (vector, edge...) */
- {
- Group3Pnts->hide();
- GroupFace->hide();
- resize(0, 0);
- GroupPntDir->show();
-
- myEditCurrentArgument = GroupPntDir->LineEdit1;
- GroupPntDir->LineEdit1->setText(tr(""));
- GroupPntDir->LineEdit2->setText(tr(""));
-
- /* for the first argument */
- globalSelection( GEOM_POINT ); // to break previous local selection
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
- break;
- }
- case 1: /* plane from 3 points */
- {
- GroupPntDir->hide();
- GroupFace->hide();
- resize(0, 0);
- Group3Pnts->show();
-
- myEditCurrentArgument = Group3Pnts->LineEdit1;
- Group3Pnts->LineEdit1->setText("");
- Group3Pnts->LineEdit2->setText("");
- Group3Pnts->LineEdit3->setText("");
-
- /* for the first argument */
- globalSelection( GEOM_POINT ); // to break previous local selection
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
- break;
- }
- case 2: /* plane from a planar face selection */
- {
- GroupPntDir->hide();
- Group3Pnts->hide();
- resize(0, 0);
- GroupFace->show();
-
- myEditCurrentArgument = GroupFace->LineEdit1;
- GroupFace->LineEdit1->setText(tr(""));
-
- /* for the first argument */
- globalSelection( GEOM_PLANE );
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_PLANE );
- aMap.Add( GEOM_MARKER );
- globalSelection( aMap );
- break;
- }
+ case 0: /* plane from a point and a direction (vector, edge...) */
+ {
+ Group3Pnts->hide();
+ GroupFace->hide();
+ resize(0, 0);
+ GroupPntDir->show();
+
+ myEditCurrentArgument = GroupPntDir->LineEdit1;
+ GroupPntDir->LineEdit1->setText(tr(""));
+ GroupPntDir->LineEdit2->setText(tr(""));
+
+ /* for the first argument */
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ break;
+ }
+ case 1: /* plane from 3 points */
+ {
+ GroupPntDir->hide();
+ GroupFace->hide();
+ resize(0, 0);
+ Group3Pnts->show();
+
+ myEditCurrentArgument = Group3Pnts->LineEdit1;
+ Group3Pnts->LineEdit1->setText("");
+ Group3Pnts->LineEdit2->setText("");
+ Group3Pnts->LineEdit3->setText("");
+
+ /* for the first argument */
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ break;
}
+ case 2: /* plane from a planar face selection */
+ {
+ GroupPntDir->hide();
+ Group3Pnts->hide();
+ resize(0, 0);
+ GroupFace->show();
+
+ myEditCurrentArgument = GroupFace->LineEdit1;
+ GroupFace->LineEdit1->setText(tr(""));
+
+ /* for the first argument */
+ //globalSelection( GEOM_PLANE );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_PLANE );
+ aMap.Add( GEOM_MARKER );
+ globalSelection( aMap );
+ break;
+ }
+ }
myEditCurrentArgument->setFocus();
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil();
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
- TopoDS_Shape aShape;
- QString aName = GEOMBase::GetName( aSelectedObject );
+ QString aName = GEOMBase::GetName(aSelectedObject);
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
+ {
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupPntDir->LineEdit2)
+ aNeedType = TopAbs_EDGE;
+ else if (myEditCurrentArgument == GroupFace->LineEdit1)
+ aNeedType = TopAbs_FACE;
+
+ 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 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
- aName.append( ":edge_" + QString::number( anIndex ) );
- else
- aName.append( ":vertex_" + QString::number( 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 += QString(":edge_%1").arg(anIndex);
+ else if (aNeedType == TopAbs_FACE)
+ aName += QString(":face_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(anIndex);
}
- myEditCurrentArgument->setText( aName );
+ else // Global Selection
+ {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
+ }
+ }
+
+ myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject;
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject;
}
+
displayPreview();
}
myEditCurrentArgument->setFocus();
- if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
+ if (myEditCurrentArgument == GroupPntDir->LineEdit2) {
+ globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
- else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
- globalSelection( GEOM_PLANE );
+ }
+ else if (myEditCurrentArgument == GroupFace->LineEdit1) {
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER );
globalSelection( aMap );
}
- else
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ else { // 3 Pnts
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ }
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_PlaneDlg::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()));
- // myGeomGUI->SetState( 0 );
-
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
void BasicGUI_PlaneDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
Init();
}
-
//=================================================================================
// function : ~BasicGUI_PointDlg()
// purpose : Destructor
{
}
-
//=================================================================================
// function : Init()
// purpose :
connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double)));
- connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double)));
-
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupOnCurve->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupXYZ->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupXYZ->SpinBox_DY, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupXYZ->SpinBox_DZ, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupRefPoint->SpinBox_DX, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupRefPoint->SpinBox_DY, SLOT(SetStep(double)));
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
+ GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double)));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName( tr("GEOM_VERTEX") );
ConstructorsClicked( 0 );
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
+void BasicGUI_PointDlg::ConstructorsClicked (int constructorId)
{
- switch ( constructorId )
+ globalSelection(); // close local contexts, if any
+
+ switch (constructorId)
{
case 0:
{
- globalSelection( GEOM_POINT); // to break previous local selection
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupRefPoint->hide();
GroupOnCurve->hide();
myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText("");
myRefPoint = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_POINT); // to break previous local selection
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupXYZ->hide();
GroupOnCurve->hide();
myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText("");
myEdge = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_LINE); // to break previous local selection
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
GroupXYZ->hide();
GroupRefPoint->hide();
GroupLineIntersection->LineEdit2->setText("");
myLine1 = GEOM::GEOM_Object::_nil();
myLine2 = GEOM::GEOM_Object::_nil();
- globalSelection( GEOM_EDGE); // to break previous local selection
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
GroupXYZ->hide();
GroupRefPoint->hide();
SelectionIntoArgument();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void BasicGUI_PointDlg::ClickOnOk()
{
- if ( onAccept() )
+ if (onAccept())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool BasicGUI_PointDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
return true;
}
-
//=================================================================================
// function : ClickOnCancel()
// purpose :
GEOMBase_Skeleton::ClickOnCancel();
}
-
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed (for constructors not using local context)
{
const int id = getConstructorId();
- if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 )
+ if ((id == 1 || id == 2) && myEditCurrentArgument != 0)
{
myEditCurrentArgument->setText("");
myX->setText( "" );
myRefPoint = myEdge = GEOM::GEOM_Object::_nil();
}
- if ( IObjectCount() == 1 )
+ if (IObjectCount() == 1)
{
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
- QString aName = GEOMBase::GetName( aSelectedObject );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
TopoDS_Shape aShape;
- 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 )
- {
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- if ( id == 2 || id == 3 )
- aName.append( ":edge_" + QString::number( anIndex ) );
- else
- aName.append( ":vertex_" + QString::number( anIndex ) );
- aSelMgr->clearSelected();
- }
- }
-
- if ( id == 0 )
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{
- GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
-
- if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
- return;
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (id == 2 || id == 3)
+ 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 += QString(":edge_%1").arg(anIndex);
+ else
+ aName += QString(":vertex_%1").arg(anIndex);
+ }
+ else // Global Selection
+ {
+ if (aShape.ShapeType() != aNeedType) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ if (id == 0) return;
+ }
+ }
+ }
+ if (id == 0)
+ {
+ if (aShape.IsNull()) return;
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() );
GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() );
}
- else if ( id == 1 )
+ else if (id == 1)
{
myRefPoint = aSelectedObject;
- GroupRefPoint->LineEdit1->setText( aName );
+ GroupRefPoint->LineEdit1->setText(aName);
}
- else if ( id == 2 )
+ else if (id == 2)
{
myEdge = aSelectedObject;
- GroupOnCurve->LineEdit1->setText( aName );
+ GroupOnCurve->LineEdit1->setText(aName);
}
- else if ( id == 3 )
+ else if (id == 3)
{
if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
myLine1 = aSelectedObject;
- GroupLineIntersection->LineEdit1->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
myLine2 = aSelectedObject;
- GroupLineIntersection->LineEdit2->setText( aName );
+ myEditCurrentArgument->setText(aName);
}
}
}
displayPreview();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void BasicGUI_PointDlg::SetEditCurrentArgument()
{
+ globalSelection(); // close local contexts, if any
+
QPushButton* send = (QPushButton*)sender();
globalSelection( GEOM_POINT); // to break previous local selection
ActivateThisDialog();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
ConstructorsClicked( getConstructorId() );
}
-
//=================================================================================
// function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active
GEOMBase_Skeleton::DeactivateActiveDialog();
}
-
//=================================================================================
// function : ValueChangedInSpinBox()
// 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
//
//
//
connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr("GEOM_VECTOR") );
//=================================================================================
void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId )
{
- disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myPoint1 = GEOM::GEOM_Object::_nil();
myPoint2 = GEOM::GEOM_Object::_nil();
switch (constructorId)
- {
+ {
case 0:
- {
- GroupDimensions->hide();
- resize(0, 0);
- GroupPoints->show();
-
- myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setText("");
- GroupPoints->LineEdit2->setText("");
-
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
- connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- break;
- }
+ {
+ GroupDimensions->hide();
+ resize(0, 0);
+ GroupPoints->show();
+
+ myEditCurrentArgument = GroupPoints->LineEdit1;
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
+
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ break;
+ }
case 1:
- {
- GroupPoints->hide();
- resize( 0, 0 );
- GroupDimensions->show();
-
- double dx( 0. ), dy( 0. ), dz( 0. );
- GroupDimensions->SpinBox_DX->SetValue( dx );
- GroupDimensions->SpinBox_DY->SetValue( dy );
- GroupDimensions->SpinBox_DZ->SetValue( dz );
+ {
+ GroupPoints->hide();
+ resize( 0, 0 );
+ GroupDimensions->show();
- GroupDimensions->CheckBox1->setChecked( FALSE );
- break;
- }
+ double dx( 0. ), dy( 0. ), dz( 0. );
+ GroupDimensions->SpinBox_DX->SetValue( dx );
+ GroupDimensions->SpinBox_DY->SetValue( dy );
+ GroupDimensions->SpinBox_DZ->SetValue( dz );
+
+ GroupDimensions->CheckBox1->setChecked( FALSE );
+ break;
}
+ }
displayPreview();
}
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 )
+ if (IObjectCount() != 1)
{
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
+ if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint1 = GEOM::GEOM_Object::_nil();
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myPoint2 = GEOM::GEOM_Object::_nil();
return;
}
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes)
{
+ QString aName = GEOMBase::GetName(aSelectedObject);
+
TopoDS_Shape aShape;
- 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
+ {
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ int anIndex = aMap(1);
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ aSelMgr->clearSelected(); // ???
- if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+ aName += QString(":vertex_%1").arg(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 );
- aName.append( ":vertex_" + QString::number( anIndex ) );
- aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- aSelMgr->clearSelected();
- }
+ if (aShape.ShapeType() != TopAbs_VERTEX) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ }
}
- myEditCurrentArgument->setText( aName );
+ }
+
+ myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
displayPreview();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
GEOMBase_Skeleton::LineEditReturnPressed();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_VectorDlg::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() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
//=================================================================================
void BasicGUI_VectorDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
return res;
}
-
QString aName;
const int id = getConstructorId();
- if ( IObjectCount() != 1 ) {
- if(id == 0)
+ if (IObjectCount() != 1) {
+ if (id == 0)
myFace = GEOM::GEOM_Object::_nil();
- else if(id == 1) {
+ else if (id == 1) {
if (myEditCurrentArgument == Group2->LineEdit1)
myVectX = GEOM::GEOM_Object::_nil();
else if (myEditCurrentArgument == Group2->LineEdit2)
Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
- if(!aRes || CORBA::is_nil( aSelectedObject ))
+ if (!aRes || CORBA::is_nil(aSelectedObject))
return;
- aName = GEOMBase::GetName( aSelectedObject );
+ aName = GEOMBase::GetName(aSelectedObject);
- if(myEditCurrentArgument == Group1->LineEdit1)
+ if (myEditCurrentArgument == Group1->LineEdit1)
myFace = aSelectedObject;
- else if(myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit2) {
- if ( aRes && !aSelectedObject->_is_nil() )
- {
- TopoDS_Shape aShape;
- 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 )
- {
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- getGeomEngine()->GetIShapesOperations( getStudyId() );
- int anIndex = aMap( 1 );
- TopTools_IndexedMapOfShape aShapes;
- TopExp::MapShapes( aShape, aShapes );
- aShape = aShapes.FindKey( anIndex );
- aName = aName + " Edge_" + QString::number( anIndex );
- if(myEditCurrentArgument == Group2->LineEdit1)
- myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- else
- myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
- }
- else {
- if(myEditCurrentArgument == Group2->LineEdit1)
- myVectX = aSelectedObject;
- else
- myVectZ = aSelectedObject;
- }
- aSelMgr->clearSelected();
- }
- }
+ else if (myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit2)
+ {
+ if ( aRes && !aSelectedObject->_is_nil() )
+ {
+ TopoDS_Shape aShape;
+ 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 )
+ {
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations( getStudyId() );
+ int anIndex = aMap( 1 );
+ TopTools_IndexedMapOfShape aShapes;
+ TopExp::MapShapes( aShape, aShapes );
+ aShape = aShapes.FindKey( anIndex );
+ aName = aName + ":edge_" + QString::number( anIndex );
+ if(myEditCurrentArgument == Group2->LineEdit1)
+ myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ else
+ myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else {
+ if (myEditCurrentArgument == Group2->LineEdit1)
+ myVectX = aSelectedObject;
+ else
+ myVectZ = aSelectedObject;
+ }
+ aSelMgr->clearSelected();
+ }
}
+ }
myEditCurrentArgument->setText( aName );
-
+
updateWPlane();
}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
{
QPushButton* send = (QPushButton*)sender();
- if(send == Group1->PushButton1) {
+ if (send == Group1->PushButton1) {
myEditCurrentArgument = Group1->LineEdit1;
globalSelection( GEOM_PLANE );
}
- else if(send == Group2->PushButton1) {
+ else if (send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1;
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
- else if(send == Group2->PushButton2) {
+ else if (send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2;
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
SelectionIntoArgument();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
}
}
-
//=================================================================================
// function : onReverse()
// purpose :
updateWPlane();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
ConstructorsClicked( getConstructorId() );
}
-
//=================================================================================
// function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active
//=================================================================================
void BasicGUI_WorkingPlaneDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
-//=======================================================================
+//=================================================================================
// function : ClickOnCancel()
// purpose :
-//=======================================================================
+//=================================================================================
void BasicGUI_WorkingPlaneDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
GEOMBase_Skeleton::closeEvent( e );
}
-
//=================================================================================
// function : updateWPlane
// purpose :
showError( "Wrong shape selected (has to be a planar face)" );
return false;
}
-
- } else if (id == 1) { // by two vectors (Ox & Oz)
+ }
+ else if (id == 1) { // by two vectors (Ox & Oz)
if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) {
if(!showPreview)
showError( "Two vectors have to be selected" );
}
myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX);
-
- } else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX)
+ }
+ else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX)
gp_Ax2 anAx2;
if (aOriginType == 1) anAx2 = gp::XOY();
else if (aOriginType == 0) anAx2 = gp::ZOX();
myWPlane = gp_Ax3(anAx2);
-
- } else {
+ }
+ else {
return false;
}
-
+
if (myReverseCB->isChecked())
- {
- myWPlane.YReverse();
- myWPlane.ZReverse();
- }
-
+ {
+ myWPlane.YReverse();
+ myWPlane.ZReverse();
+ }
+
if (showPreview)
- {
- GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() );
- GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(),
- myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
- myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() );
- displayPreview(anObj);
- }
+ {
+ GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations(getStudyId());
+ GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker
+ (myWPlane.Location().X() , myWPlane.Location().Y() , myWPlane.Location().Z(),
+ myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
+ myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z());
+ displayPreview(anObj);
+ }
return true;
}