GroupPntDir->PushButton2->setIcon( image3 );
GroupPntDir->LineEdit1->setReadOnly( true );
GroupPntDir->LineEdit2->setReadOnly( true );
+ GroupPntDir->PushButton1->setDown( true );
+ GroupPntDir->LineEdit1->setEnabled( true );
+ GroupPntDir->LineEdit2->setEnabled( false );
Group3Pnts = new DlgRef_3Sel1Spin( centralWidget() );
Group3Pnts->GroupBox1->setTitle( tr( "GEOM_3_POINTS" ) );
Group3Pnts->PushButton1->setIcon( image3 );
Group3Pnts->PushButton2->setIcon( image3 );
Group3Pnts->PushButton3->setIcon( image3 );
+ Group3Pnts->PushButton1->setDown( true );
Group3Pnts->LineEdit1->setReadOnly( true );
Group3Pnts->LineEdit2->setReadOnly( true );
Group3Pnts->LineEdit3->setReadOnly( true );
+ Group3Pnts->LineEdit1->setEnabled( true );
+ Group3Pnts->LineEdit2->setEnabled( false );
+ Group3Pnts->LineEdit3->setEnabled( false );
GroupFace = new DlgRef_1Sel1Spin( centralWidget() );
GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE_OR_LCS" ) );
GroupFace->TextLabel1->setText( tr( "GEOM_SELECTION" ) );
GroupFace->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) );
GroupFace->PushButton1->setIcon( image3 );
+ GroupFace->PushButton1->setDown( true );
GroupFace->LineEdit1->setReadOnly( true );
connect( Group3Pnts->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupFace->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- // VSR: TODO ->>
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPntDir->SpinBox_DX, SLOT( SetStep( double ) ) );
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), Group3Pnts->SpinBox_DX, SLOT( SetStep( double ) ) );
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupFace->SpinBox_DX, SLOT( SetStep( double ) ) );
- // <<-
+ connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( 0 );
}
+//=================================================================================
+// function : SetDoubleSpinBoxStep()
+// purpose : Double spin box management
+//=================================================================================
+void BasicGUI_PlaneDlg::SetDoubleSpinBoxStep( double step )
+{
+ GroupPntDir->SpinBox_DX->setSingleStep(step);
+ Group3Pnts->SpinBox_DX->setSingleStep(step);
+ GroupFace->SpinBox_DX->setSingleStep(step);
+}
+
//=================================================================================
// function : ConstructorsClicked()
myEditCurrentArgument = GroupPntDir->LineEdit1;
GroupPntDir->LineEdit1->setText( "" );
GroupPntDir->LineEdit2->setText( "" );
+ GroupPntDir->PushButton1->setDown( true );
+ GroupPntDir->PushButton2->setDown( false );
+ GroupPntDir->LineEdit1->setEnabled( true );
+ GroupPntDir->LineEdit2->setEnabled( false );
/* for the first argument */
globalSelection(); // close local contexts, if any
Group3Pnts->LineEdit1->setText( "" );
Group3Pnts->LineEdit2->setText( "" );
Group3Pnts->LineEdit3->setText( "" );
+ Group3Pnts->PushButton1->setDown( true );
+ Group3Pnts->PushButton2->setDown( false );
+ Group3Pnts->PushButton3->setDown( false );
+ Group3Pnts->LineEdit1->setEnabled( true );
+ Group3Pnts->LineEdit2->setEnabled( false );
+ Group3Pnts->LineEdit3->setEnabled( false );
/* for the first argument */
globalSelection(); // close local contexts, if any
myEditCurrentArgument = GroupFace->LineEdit1;
GroupFace->LineEdit1->setText( "" );
+ GroupFace->PushButton1->setDown( true );
/* for the first argument */
//globalSelection( GEOM_PLANE );
{
myEditCurrentArgument->setText("");
- if ( IObjectCount() != 1 ) {
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ if (aSelList.Extent() != 1) {
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
// nbSel == 1
Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject );
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
+ aNeedType = TopAbs_EDGE;
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 );
+ aSelMgr->GetIndexes(aSelList.First(), aMap);
if ( aMap.Extent() == 1 ) { // Local Selection
int anIndex = aMap( 1 );
if ( aNeedType == TopAbs_EDGE )
myEditCurrentArgument->setText( aName );
- if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
- else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject;
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
- else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
- else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject;
+ if (!aSelectedObject->_is_nil()) { // clear selection if something selected
+ globalSelection();
+ if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_PLANE );
+ aMap.Add( GEOM_MARKER );
+ globalSelection( aMap );
+ }
+ else
+ localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ }
+
+ if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) {
+ myPoint = aSelectedObject;
+ if ( !myPoint->_is_nil() && myDir->_is_nil() )
+ GroupPntDir->PushButton2->click();
+ }
+ else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
+ myDir = aSelectedObject;
+ if ( !myDir->_is_nil() && myPoint->_is_nil() )
+ GroupPntDir->PushButton1->click();
+ }
+ else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
+ myPoint1 = aSelectedObject;
+ if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+ Group3Pnts->PushButton2->click();
+ }
+ else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
+ myPoint2 = aSelectedObject;
+ if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
+ Group3Pnts->PushButton3->click();
+ }
+ else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
+ myPoint3 = aSelectedObject;
+ if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
+ Group3Pnts->PushButton1->click();
+ }
+ else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
+ myFace = aSelectedObject;
}
displayPreview();
QPushButton* send = (QPushButton*)sender();
globalSelection( GEOM_POINT );
- if ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1;
- else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2;
- else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1;
- else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2;
- else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3;
- else if ( send == GroupFace->PushButton1 ) myEditCurrentArgument = GroupFace->LineEdit1;
+ if ( send == GroupPntDir->PushButton1 ) {
+ myEditCurrentArgument = GroupPntDir->LineEdit1;
+ GroupPntDir->PushButton2->setDown( false );
+ GroupPntDir->LineEdit1->setEnabled( true );
+ GroupPntDir->LineEdit2->setEnabled( false );
+ }
+ else if ( send == GroupPntDir->PushButton2 ) {
+ myEditCurrentArgument = GroupPntDir->LineEdit2;
+ GroupPntDir->PushButton1->setDown( false );
+ GroupPntDir->LineEdit1->setEnabled( false );
+ GroupPntDir->LineEdit2->setEnabled( true );
+ }
+ else if ( send == Group3Pnts->PushButton1 ) {
+ myEditCurrentArgument = Group3Pnts->LineEdit1;
+ Group3Pnts->PushButton2->setDown( false );
+ Group3Pnts->PushButton3->setDown( false );
+ Group3Pnts->LineEdit1->setEnabled( true );
+ Group3Pnts->LineEdit2->setEnabled( false );
+ Group3Pnts->LineEdit3->setEnabled( false );
+ }
+ else if ( send == Group3Pnts->PushButton2 ) {
+ myEditCurrentArgument = Group3Pnts->LineEdit2;
+ Group3Pnts->PushButton1->setDown( false );
+ Group3Pnts->PushButton3->setDown( false );
+ Group3Pnts->LineEdit1->setEnabled( false );
+ Group3Pnts->LineEdit2->setEnabled( true );
+ Group3Pnts->LineEdit3->setEnabled( false );
+ }
+ else if ( send == Group3Pnts->PushButton3 ) {
+ myEditCurrentArgument = Group3Pnts->LineEdit3;
+ Group3Pnts->PushButton1->setDown( false );
+ Group3Pnts->PushButton2->setDown( false );
+ Group3Pnts->LineEdit1->setEnabled( false );
+ Group3Pnts->LineEdit2->setEnabled( false );
+ Group3Pnts->LineEdit3->setEnabled( true );
+ }
+ else if ( send == GroupFace->PushButton1 ) {
+ myEditCurrentArgument = GroupFace->LineEdit1;
+ GroupFace->PushButton1->setDown( true );
+ }
myEditCurrentArgument->setFocus();
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
- globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
}
else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
globalSelection( aMap );
}
else { // 3 Pnts
- globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
- SelectionIntoArgument();
+ // SelectionIntoArgument();
+ myEditCurrentArgument->setFocus();
+ send->setDown(true);
+ displayPreview();
}
return 0.;
}
+//=================================================================================
+// function : getSize()
+// purpose :
+//=================================================================================
+QString BasicGUI_PlaneDlg::getSizeAsString() const
+{
+ switch ( getConstructorId() ) {
+ case 0 : return GroupPntDir->SpinBox_DX->text();
+ case 1 : return Group3Pnts->SpinBox_DX->text();
+ case 2 : return GroupFace->SpinBox_DX->text();
+ }
+ return QString();
+}
+
//=================================================================================
// function : createOperation
// purpose :
msg = QString( "Please, enter size greater than 0." );
return false;
}
- if ( id == 0 )
- return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir );
- else if ( id == 1 )
+
+ if ( id == 0 ) {
+ bool ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() );
+ return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) && ok;
+ }
+ else if ( id == 1 ) {
+ bool ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() );
return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) &&
- !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
- else if ( id == 2 )
- return !CORBA::is_nil( myFace );
+ !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ) && ok;
+ }
+ else if ( id == 2 ) {
+ bool ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() );
+ return !CORBA::is_nil( myFace ) && ok;
+ }
return false;
}
res = true;
break;
}
-
- if ( !anObj->_is_nil() )
- objects.push_back( anObj._retn() );
+ if ( !anObj->_is_nil() ) {
+ if ( !IsPreview() )
+ anObj->SetParameters(getSizeAsString().toLatin1().constData());
+ objects.push_back( anObj._retn() );
+ }
return res;
}
//=================================================================================