small bug fix in color of edges and spinbox values update

This commit is contained in:
rnc 2012-07-12 13:28:58 +00:00
parent de4f7327f4
commit d2d52a8e9d
2 changed files with 35 additions and 15 deletions

View File

@ -46,6 +46,8 @@
#include <LightApp_Application.h> #include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <SalomeApp_Tools.h>
//OCCT includes //OCCT includes
//#include <BRep_Tool.hxx> //#include <BRep_Tool.hxx>
//#include <TopExp.hxx> //#include <TopExp.hxx>
@ -270,23 +272,30 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) ); Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() ); if (myMode == 1)
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 ( 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(); Group3Spin->buttonApply->setFocus();
} }
else if ( mode == 1) { // DXDY else if ( mode == 1) { // DXDY
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) ); Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) ); Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) ); Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x ); if (myMode == 0)
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 ( 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(); Group3Spin->buttonApply->setFocus();
} }
else { else if (mode == 2){ // Angles
Group3Spin->hide(); Group3Spin->hide();
GroupAngles->show(); GroupAngles->show();
GroupAngles->buttonApply->setFocus();
} }
Group3Spin->SpinBox_DX->blockSignals(blocked); Group3Spin->SpinBox_DX->blockSignals(blocked);
@ -744,12 +753,18 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
const double lineWidth, const double lineWidth,
const int displayMode, const int displayMode,
const int color ) const int color )
{ {
// Set color for preview shape SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
getDisplayer()->SetColor( Quantity_NOC_RED );
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 // 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 // Disable activation of selection
getDisplayer()->SetToActivate( activate ); getDisplayer()->SetToActivate( activate );
@ -763,6 +778,9 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
if ( !createShapes( object, anApplyedWire, aLastSegment ) ) if ( !createShapes( object, anApplyedWire, aLastSegment ) )
return; return;
// Set color for preview shape
getDisplayer()->SetColor( line_color );
// Build prs // Build prs
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
if ( aPrs != 0 && !aPrs->IsNull() ) if ( aPrs != 0 && !aPrs->IsNull() )
@ -773,6 +791,8 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
if ( aPrs != 0 && !aPrs->IsNull() ) if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update ); GEOMBase_Helper::displayPreview( aPrs, append, update );
getDisplayer()->SetColor( line_color );
// Display trihedron // Display trihedron
// if(GroupType->RadioButton3->isChecked()) // if(GroupType->RadioButton3->isChecked())

View File

@ -2494,7 +2494,7 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object ); CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
getDisplayer()->SetName( objStr.in() ); getDisplayer()->SetName( objStr.in() );
// Create wire from applayed object // Create wire from applied object
TopoDS_Shape anApplyedWire, aLastSegment; TopoDS_Shape anApplyedWire, aLastSegment;
if ( !createShapes( object, anApplyedWire, aLastSegment ) ) if ( !createShapes( object, anApplyedWire, aLastSegment ) )
return; return;
@ -2509,9 +2509,9 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
if ( aPrs != 0 && !aPrs->IsNull() ) if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update ); GEOMBase_Helper::displayPreview( aPrs, append, update );
getDisplayer()->SetColor( Quantity_NOC_VIOLET ); getDisplayer()->SetColor( Quantity_NOC_VIOLET );
aPrs = getDisplayer()->BuildPrs( aLastSegment ); aPrs = getDisplayer()->BuildPrs( aLastSegment );
if ( aPrs != 0 && !aPrs->IsNull() ) if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update ); GEOMBase_Helper::displayPreview( aPrs, append, update );