]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fixed visualization bugs in the sketcher:
authorrnc <rnc@opencascade.com>
Thu, 8 Mar 2012 14:36:13 +0000 (14:36 +0000)
committerrnc <rnc@opencascade.com>
Thu, 8 Mar 2012 14:36:13 +0000 (14:36 +0000)
- created object were violet)
- preferences values were not used for preview linewidth and edge and wire colors

src/EntityGUI/EntityGUI_SketcherDlg.cxx
src/EntityGUI/EntityGUI_SketcherDlg.h

index a9b37aa9392f7ddc12825b3bc5b16e6280e80364..e59c75038c36ca88b0bfbf70c084490ae8fa8253 100644 (file)
@@ -58,6 +58,7 @@
 #include <Sketcher_Profile.hxx>
 
 #include <SalomeApp_Study.h>
+#include <SalomeApp_Tools.h>
 
 #include <gp_Pln.hxx>
 
@@ -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
index 252127e1ff901aebd523a7aa32b184d2b4ef2d32..53e743d63e3383b37d2285153e14bec17170d6f4 100644 (file)
@@ -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);