From db7d2b88d38be45f9a5dbddcc24f6e732ff6271a Mon Sep 17 00:00:00 2001 From: rnc Date: Thu, 8 Mar 2012 14:36:13 +0000 Subject: [PATCH] Fixed visualization bugs in the sketcher: - created object were violet) - preferences values were not used for preview linewidth and edge and wire colors --- src/EntityGUI/EntityGUI_SketcherDlg.cxx | 18 ++++++++++++++---- src/EntityGUI/EntityGUI_SketcherDlg.h | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index a9b37aa93..e59c75038 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -58,6 +58,7 @@ #include #include +#include #include @@ -2260,11 +2261,17 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, 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 ); @@ -2279,6 +2286,7 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, return; // Build prs + getDisplayer()->SetColor( line_color ); SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire ); if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); @@ -2288,6 +2296,8 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, if ( aPrs != 0 && !aPrs->IsNull() ) GEOMBase_Helper::displayPreview( aPrs, append, update ); + getDisplayer()->SetColor( line_color ); + getDisplayer()->UnsetName(); // Enable activation of displayed objects diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index 252127e1f..53e743d63 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -68,7 +68,7 @@ class EntityGUI_SketcherDlg : public QDialog, GEOMBase_Helper public: EntityGUI_SketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, - const double = 2. ); + const double = -1 ); ~EntityGUI_SketcherDlg(); bool eventFilter (QObject* object, QEvent* event); -- 2.39.2