mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 01:58:36 +05:00
Fix for bug PAL12858(EDF210 GEOM Preferences menu of GEOM: color of the wireframe?)
This commit is contained in:
parent
309210eeaf
commit
af12d871fc
@ -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() );
|
||||
|
@ -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"
|
||||
|
||||
|
@ -1647,18 +1647,31 @@ void GeometryGUI::createPreferences()
|
||||
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
|
||||
|
||||
int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
|
||||
addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
|
||||
LightApp_Preferences::Color, "Geometry", "shading_color" );
|
||||
int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
|
||||
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
|
||||
setPreferenceProperty( genGroup, "columns", 1 );
|
||||
|
||||
int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
|
||||
LightApp_Preferences::Selector, "Geometry", "display_mode" );
|
||||
|
||||
setPreferenceProperty( genGroup, "columns", 1 );
|
||||
addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
|
||||
LightApp_Preferences::Color, "Geometry", "shading_color" );
|
||||
|
||||
setPreferenceProperty( step, "min", 0.001 );
|
||||
setPreferenceProperty( step, "max", 10000 );
|
||||
setPreferenceProperty( step, "precision", 3 );
|
||||
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" );
|
||||
|
||||
// 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 )
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "GEOM_AssemblyBuilder.h"
|
||||
#include "GEOM_Actor.h"
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
|
||||
#include <vtkProperty.h>
|
||||
|
||||
// Open CASCADE Includes
|
||||
@ -80,11 +82,18 @@ 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();
|
||||
@ -93,22 +102,33 @@ 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();
|
||||
@ -117,10 +137,14 @@ 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();
|
||||
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user