From d2d52a8e9db07ea887c3fc469bf6ea6eead04f5d Mon Sep 17 00:00:00 2001 From: rnc Date: Thu, 12 Jul 2012 13:28:58 +0000 Subject: [PATCH] small bug fix in color of edges and spinbox values update --- src/EntityGUI/EntityGUI_3DSketcherDlg.cxx | 44 ++++++++++++++++------- src/EntityGUI/EntityGUI_SketcherDlg.cxx | 6 ++-- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index f552e01a8..d2de7d95f 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -46,6 +46,8 @@ #include #include +#include + //OCCT includes //#include //#include @@ -270,23 +272,30 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode ) Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) ); - if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() ); - if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() ); - if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() ); + if (myMode == 1) + { + if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() ); + if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() ); + if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() ); + } Group3Spin->buttonApply->setFocus(); } else if ( mode == 1) { // DXDY Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) ); - if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x ); - if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y ); - if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z ); + if (myMode == 0) + { + if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x ); + if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y ); + if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z ); + } Group3Spin->buttonApply->setFocus(); } - else { + else if (mode == 2){ // Angles Group3Spin->hide(); GroupAngles->show(); + GroupAngles->buttonApply->setFocus(); } Group3Spin->SpinBox_DX->blockSignals(blocked); @@ -744,12 +753,18 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, const double lineWidth, const int displayMode, const int color ) -{ - // Set color for preview shape - getDisplayer()->SetColor( Quantity_NOC_RED ); - +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + + QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0)); + Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name(); + // set width of displayed shape - getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth ); + int lw = lineWidth; + if(lw == -1) { + lw = resMgr->integerValue("Geometry", "preview_edge_width", -1); + } + getDisplayer()->SetWidth( lw ); // Disable activation of selection getDisplayer()->SetToActivate( activate ); @@ -763,6 +778,9 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, if ( !createShapes( object, anApplyedWire, aLastSegment ) ) return; + // Set color for preview shape + getDisplayer()->SetColor( line_color ); + // Build prs SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); if ( aPrs != 0 && !aPrs->IsNull() ) @@ -773,6 +791,8 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); + + getDisplayer()->SetColor( line_color ); // Display trihedron // if(GroupType->RadioButton3->isChecked()) diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 6b117c091..d0333cd59 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -2494,7 +2494,7 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object ); getDisplayer()->SetName( objStr.in() ); - // Create wire from applayed object + // Create wire from applied object TopoDS_Shape anApplyedWire, aLastSegment; if ( !createShapes( object, anApplyedWire, aLastSegment ) ) return; @@ -2509,9 +2509,9 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); - getDisplayer()->SetColor( Quantity_NOC_VIOLET ); - + getDisplayer()->SetColor( Quantity_NOC_VIOLET ); aPrs = getDisplayer()->BuildPrs( aLastSegment ); + if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); -- 2.39.2