]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for bug PAL12858(EDF210 GEOM Preferences menu of GEOM: color of the wireframe?)
authormzn <mzn@opencascade.com>
Fri, 25 Aug 2006 14:05:16 +0000 (14:05 +0000)
committermzn <mzn@opencascade.com>
Fri, 25 Aug 2006 14:05:16 +0000 (14:05 +0000)
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GEOM_msg_en.po
src/GEOMGUI/GeometryGUI.cxx
src/OBJECT/GEOM_AssemblyBuilder.cxx

index 105d748796f239d4a1d30e7f3a7fd4d9837d9554..7176ffeb779bdfaa080eb8c24858fd7e61a2b543 100644 (file)
@@ -69,6 +69,7 @@
 // OCCT Includes
 #include <AIS_Drawer.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <Prs3d_IsoAspect.hxx>
 #include <Prs3d_PointAspect.hxx>
 #include <Graphic3d_AspectMarker3d.hxx>
 #include <StdSelect_TypeOfEdge.hxx>
@@ -530,6 +531,53 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
             AISShape->Attributes()->SetPointAspect( anAspect );
           }
         }
+       else
+         {
+           SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+
+           // Set color for iso lines
+           QColor col = aResMgr->colorValue( "Geometry", "isos_color", QColor(int(0.5*255), int(0.5*255), int(0.5*255)) );
+           Quantity_Color aColor = SalomeApp_Tools::color( col );
+
+           Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
+            anAspect->SetColor( aColor );
+            AISShape->Attributes()->SetUIsoAspect( anAspect );
+
+           anAspect = AISShape->Attributes()->VIsoAspect();
+            anAspect->SetColor( aColor );
+            AISShape->Attributes()->SetVIsoAspect( anAspect );
+           
+           if ( myShape.ShapeType() == TopAbs_FACE )
+             {
+               col = aResMgr->colorValue( "Geometry", "face_color", QColor( 0, 255, 0 ) );
+               aColor = SalomeApp_Tools::color( col );
+
+               AISShape->SetColor( aColor );
+             }
+           else if ( myShape.ShapeType() == TopAbs_EDGE || myShape.ShapeType() == TopAbs_WIRE )
+             {
+               col = aResMgr->colorValue( "Geometry", "edge_wire_color", QColor( 255, 0, 0 ) );
+               aColor = SalomeApp_Tools::color( col );
+               
+               AISShape->SetColor( aColor );
+             }
+           else if ( myShape.ShapeType() == TopAbs_VERTEX )
+             {
+               col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) );
+               aColor = SalomeApp_Tools::color( col );
+               
+               Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+               anAspect->SetColor( aColor );
+               AISShape->Attributes()->SetPointAspect( anAspect );
+             }
+           else
+             {
+               col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) );
+               aColor = SalomeApp_Tools::color( col );
+               
+               AISShape->SetColor( aColor );
+             }
+         }
 
         if ( HasWidth() )
           AISShape->SetWidth( GetWidth() );
index f27c3eef5a525058c4be3bfeecd181b3949d9654..92576204e710d564c607f276ca249fef33f6c347 100644 (file)
@@ -2935,6 +2935,21 @@ msgstr "General"
 msgid "PREF_SHADING_COLOR"
 msgstr "Default shading color"
 
+msgid "PREF_WIREFRAME_COLOR"
+msgstr "Default wireframe color"
+
+msgid "PREF_FACE_COLOR"
+msgstr "Color of faces"
+
+msgid "PREF_EDGE_WIRE_COLOR"
+msgstr "Color of edges and wires"
+
+msgid "PREF_POINT_COLOR"
+msgstr "Color of points"
+
+msgid "PREF_ISOS_COLOR"
+msgstr "Color of isolines"
+
 msgid "PREF_STEP_VALUE"
 msgstr "Step value for spin boxes"
 
index 8db643a1705d5ecc28dcd03d33094bc0f0deaad0..f49100919e0238aa1bc194c55b15ed0c50e8b704 100644 (file)
@@ -1647,18 +1647,31 @@ void GeometryGUI::createPreferences()
   int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
 
   int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
+  setPreferenceProperty( genGroup, "columns", 1 );
+
+  int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
+                           LightApp_Preferences::Selector, "Geometry", "display_mode" );
+
   addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
                 LightApp_Preferences::Color, "Geometry", "shading_color" );
+  
+  addPreference( tr( "PREF_WIREFRAME_COLOR" ), genGroup,
+                LightApp_Preferences::Color, "Geometry", "wireframe_color" );
+  
+  addPreference( tr( "PREF_FACE_COLOR" ), genGroup,
+                LightApp_Preferences::Color, "Geometry", "face_color" );
+  
+  addPreference( tr( "PREF_EDGE_WIRE_COLOR"), genGroup,
+                LightApp_Preferences::Color, "Geometry", "edge_wire_color" );
+  
+  addPreference( tr( "PREF_POINT_COLOR"), genGroup,
+                LightApp_Preferences::Color, "Geometry", "point_color" );
+  
+  addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
+                LightApp_Preferences::Color, "Geometry", "isos_color" );
+  
   int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
                            LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
-  int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
-                           LightApp_Preferences::Selector, "Geometry", "display_mode" );
-
-  setPreferenceProperty( genGroup, "columns", 1 );
-
-  setPreferenceProperty( step, "min", 0.001 );
-  setPreferenceProperty( step, "max", 10000 );
-  setPreferenceProperty( step, "precision", 3 );
 
   // Set property for default display mode
   QStringList aModesList;
@@ -1671,6 +1684,12 @@ void GeometryGUI::createPreferences()
   
   setPreferenceProperty( dispmode, "strings", aModesList );
   setPreferenceProperty( dispmode, "indexes", anIndexesList );
+  
+  // Set property for step value for spinboxes
+  setPreferenceProperty( step, "min", 0.001 );
+  setPreferenceProperty( step, "max", 10000 );
+  setPreferenceProperty( step, "precision", 3 );
+  
 }
 
 void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
index 603a071c901f4ba55259aacea5bf59216d909db8..b78e9f78a5465b199901049cfe59249940863606 100644 (file)
@@ -34,6 +34,8 @@
 #include "GEOM_AssemblyBuilder.h"
 #include "GEOM_Actor.h"
 
+#include <SUIT_Session.h>
+
 #include <vtkProperty.h>
 
 // Open CASCADE Includes
@@ -80,12 +82,19 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
   FaceProp->SetDiffuseColor(0.780392, 0.568627, 0.113725);
   FaceProp->SetSpecularColor(0.992157, 0.941176, 0.807843);
 
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  QColor aColor;
+
   // Wireframe for iso
+  aColor = aResMgr->colorValue( "Geometry", "isos_color", QColor( int(0.5*255), int(0.5*255), int(0.5*255) ) );
+  float red = aColor.red()/255.0;
+  float green = aColor.green()/255.0;
+  float blue = aColor.blue()/255.0;
   IsoProp->SetRepresentationToWireframe();
-  IsoProp->SetAmbientColor(0.5, 0.5, 0.5);
-  IsoProp->SetDiffuseColor(0.5, 0.5, 0.5);
-  IsoProp->SetSpecularColor(0.5, 0.5, 0.5);
-
+  IsoProp->SetAmbientColor(red, green, blue);
+  IsoProp->SetDiffuseColor(red, green, blue);
+  IsoProp->SetSpecularColor(red, green, blue);
+  
   // Wireframe for iso
   IsoPVProp->SetRepresentationToWireframe();
   IsoPVProp->SetAmbientColor(0, 1, 1);
@@ -93,23 +102,34 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
   IsoPVProp->SetSpecularColor(0, 1, 1);
 
   // Wireframe for shared edge 
+  aColor = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) );
+  red = aColor.red()/255.0;
+  green = aColor.green()/255.0;
+  blue = aColor.blue()/255.0;
   EdgeSProp->SetRepresentationToWireframe();
-  EdgeSProp->SetAmbientColor(1, 1, 0);
-  EdgeSProp->SetDiffuseColor(1, 1, 0);
-  EdgeSProp->SetSpecularColor(1, 1, 0);
-
+  EdgeSProp->SetAmbientColor(red, green, blue);
+  EdgeSProp->SetDiffuseColor(red, green, blue);
+  EdgeSProp->SetSpecularColor(red, green, blue);
+  
   // Wireframe for free edge 
+  aColor = aResMgr->colorValue( "Geometry", "face_color", QColor( 0, 255, 0 ) );
+  red = aColor.red()/255.0;
+  green = aColor.green()/255.0;
+  blue = aColor.blue()/255.0;
   EdgeFProp->SetRepresentationToWireframe();
-  EdgeFProp->SetAmbientColor(0, 1, 0);
-  EdgeFProp->SetDiffuseColor(0, 1, 0);
-  EdgeFProp->SetSpecularColor(0, 1, 0);
+  EdgeFProp->SetAmbientColor(red, green, blue);
+  EdgeFProp->SetDiffuseColor(red, green, blue);
+  EdgeFProp->SetSpecularColor(red, green, blue);
 
   // Wireframe for isolated edge 
+  aColor = aResMgr->colorValue( "Geometry", "edge_wire_color", QColor( 255, 0, 0 ) );
+  red = aColor.red()/255.0;
+  green = aColor.green()/255.0;
+  blue = aColor.blue()/255.0;
   EdgeIProp->SetRepresentationToWireframe();
-  EdgeIProp->SetAmbientColor(1, 0, 0);
-  EdgeIProp->SetDiffuseColor(1, 0, 0);
-  EdgeIProp->SetSpecularColor(1, 0, 0);
-
+  EdgeIProp->SetAmbientColor(red, green, blue);
+  EdgeIProp->SetDiffuseColor(red, green, blue);
+  
   // Wireframe for Preview edge 
   EdgePVProp->SetRepresentationToWireframe();
   EdgePVProp->SetAmbientColor(1, 1, 0);
@@ -117,11 +137,15 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
   EdgePVProp->SetSpecularColor(1, 1, 0);
 
   // Wireframe for vertex 
+  aColor = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) );
+  red = aColor.red()/255.0;
+  green = aColor.green()/255.0;
+  blue = aColor.blue()/255.0;
   VertexProp->SetRepresentationToWireframe();
-  VertexProp->SetAmbientColor(1, 1, 0);
-  VertexProp->SetDiffuseColor(1, 1, 0);
-  VertexProp->SetSpecularColor(1, 1, 0);
-
+  VertexProp->SetAmbientColor(red, green, blue);
+  VertexProp->SetDiffuseColor(red, green, blue);
+  VertexProp->SetSpecularColor(red, green, blue);
+  
   // Wireframe for vertex 
   VertexPVProp->SetRepresentationToWireframe();
   VertexPVProp->SetAmbientColor(0, 1, 1);
@@ -225,11 +249,13 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap
          continue;
        }
        
+       /*  PAL12858: we should to unify colors with OCC
        // compute the number of faces
        Standard_Integer nbf = edgemap.FindFromKey(ex2.Current()).Extent();
        GEOM_Actor* EdgeActor = GEOM_Actor::New();
        EdgeActor->SubShapeOn();
        EdgeActor->setInputShape(ex2.Current(),deflection,mode);
+       
        switch (nbf) {
          
        case 0 : // isolated edge
@@ -252,6 +278,22 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap
            EdgeActor->SetWireframeProperty(EdgeSProp);
          }
        }
+       */
+       GEOM_Actor* EdgeActor = GEOM_Actor::New();
+       EdgeActor->SubShapeOn();
+       EdgeActor->setInputShape(ex2.Current(),deflection,mode);
+
+       if ( myShape.ShapeType() == 4 )
+         {
+           EdgeActor->SetShadingProperty(EdgeFProp);
+           EdgeActor->SetWireframeProperty(EdgeFProp);
+         }
+       else
+         {
+           EdgeActor->SetShadingProperty(EdgeSProp);
+           EdgeActor->SetWireframeProperty(EdgeSProp);
+         }
+       
        EdgeActor->SetPreviewProperty(EdgePVProp);
        AISActors->AddItem(EdgeActor);
       }