Implementation of the issue 20984: EDF 1566 SMESH: Better visibility of the elements in a shrinked representation.

This commit is contained in:
rnv 2011-09-28 08:43:35 +00:00
parent 6722eec5f5
commit 48a0df2a9e
10 changed files with 207 additions and 59 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -12,7 +12,8 @@ parameters:
<li><b>Surface color</b> - color of surface of elements (seen in Shading mode).</li> <li><b>Surface color</b> - color of surface of elements (seen in Shading mode).</li>
<li><b>Back surface color</b> - color of interior surface of elements. Use slider to select this color. This color <li><b>Back surface color</b> - color of interior surface of elements. Use slider to select this color. This color
generated on base of the <b>Surface color</b> by changing it's brightness and saturation.</li> generated on base of the <b>Surface color</b> by changing it's brightness and saturation.</li>
<li><b>Outline</b> - color of borders of elements.</li> <li><b>Outline color</b> - color of borders of elements.</li>
<li><b>Wireframe color</b> - color of borders of elements in wireframe mode.</li>
<li><b>0D slements</b> - color of 0D elements.</li> <li><b>0D slements</b> - color of 0D elements.</li>
<li><b>Size of 0D slements</b> - size of 0D elements.</li> <li><b>Size of 0D slements</b> - size of 0D elements.</li>
<li><b>Width</b> - width of lines (edges and borders of elements).</li> <li><b>Width</b> - width of lines (edges and borders of elements).</li>

View File

@ -30,7 +30,8 @@
<!-- Other module preferences --> <!-- Other module preferences -->
<parameter name="node_color" value="255, 0, 0"/> <parameter name="node_color" value="255, 0, 0"/>
<parameter name="fill_color" value="0, 170, 255|-100"/> <parameter name="fill_color" value="0, 170, 255|-100"/>
<parameter name="outline_color" value="0, 170, 255"/> <parameter name="wireframe_color" value="0, 170, 255"/>
<parameter name="outline_color" value="0, 70, 0"/>
<parameter name="elem0d_color" value="0, 255, 0"/> <parameter name="elem0d_color" value="0, 255, 0"/>
<parameter name="highlight_color" value="0, 255, 255"/> <parameter name="highlight_color" value="0, 255, 255"/>
<parameter name="group_name_color" value="255, 255, 255"/> <parameter name="group_name_color" value="255, 255, 255"/>

View File

@ -242,7 +242,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myEdgeProp->SetAmbient(1.0); myEdgeProp->SetAmbient(1.0);
myEdgeProp->SetDiffuse(0.0); myEdgeProp->SetDiffuse(0.0);
myEdgeProp->SetSpecular(0.0); myEdgeProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); SMESH::GetColor( "SMESH", "wireframe_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myEdgeProp->SetLineWidth(aLineWidth); myEdgeProp->SetLineWidth(aLineWidth);
@ -379,6 +379,15 @@ SMESH_ActorDef::SMESH_ActorDef()
myHighlightProp->SetPointSize(aElem0DSize); // ?? myHighlightProp->SetPointSize(aElem0DSize); // ??
myHighlightProp->SetRepresentation(1); myHighlightProp->SetRepresentation(1);
myOutLineProp = vtkProperty::New();
myOutLineProp->SetAmbient(1.0);
myOutLineProp->SetDiffuse(0.0);
myOutLineProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myOutLineProp->SetPointSize(aElem0DSize); // ??
myOutLineProp->SetRepresentation(1);
myPreselectProp = vtkProperty::New(); myPreselectProp = vtkProperty::New();
myPreselectProp->SetAmbient(1.0); myPreselectProp->SetAmbient(1.0);
myPreselectProp->SetDiffuse(0.0); myPreselectProp->SetDiffuse(0.0);
@ -1210,6 +1219,8 @@ void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){
my2DExtActor->SetShrinkFactor(theValue); my2DExtActor->SetShrinkFactor(theValue);
my3DActor->SetShrinkFactor(theValue); my3DActor->SetShrinkFactor(theValue);
my3DExtActor->SetShrinkFactor(theValue); my3DExtActor->SetShrinkFactor(theValue);
my3DExtActor->SetShrinkFactor(theValue);
myHighlitableActor->SetShrinkFactor(theValue);
Modified(); Modified();
} }
@ -1226,6 +1237,7 @@ void SMESH_ActorDef::SetShrink(){
my2DExtActor->SetShrink(); my2DExtActor->SetShrink();
my3DActor->SetShrink(); my3DActor->SetShrink();
my3DExtActor->SetShrink(); my3DExtActor->SetShrink();
myHighlitableActor->SetShrink();
myIsShrunk = true; myIsShrunk = true;
Modified(); Modified();
@ -1243,6 +1255,7 @@ void SMESH_ActorDef::UnShrink(){
my2DExtActor->UnShrink(); my2DExtActor->UnShrink();
my3DActor->UnShrink(); my3DActor->UnShrink();
my3DExtActor->UnShrink(); my3DExtActor->UnShrink();
myHighlitableActor->UnShrink();
myIsShrunk = false; myIsShrunk = false;
Modified(); Modified();
@ -1613,36 +1626,44 @@ bool SMESH_ActorDef::GetPointRepresentation(){
void SMESH_ActorDef::UpdateHighlight(){ void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetVisibility(false);
myHighlitableActor->SetHighlited(false); myHighlitableActor->SetHighlited(false);
myHighlitableActor->SetVisibility(false);
if(myIsHighlighted){
myHighlitableActor->SetProperty(myHighlightProp);
}else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp);
}
bool anIsVisible = GetVisibility(); bool anIsVisible = GetVisibility();
if(myIsHighlighted || myIsPreselected){ switch(myRepresentation){
if(GetUnstructuredGrid()->GetNumberOfCells()){ case SMESH_DeviceActor::eSurface:
myHighlitableActor->SetHighlited(anIsVisible); case SMESH_DeviceActor::eWireframe:
{
if(myIsHighlighted) {
myHighlitableActor->SetProperty(myHighlightProp);
}else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp);
} else if(anIsVisible){
(myRepresentation == eSurface) ?
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
}
if(GetUnstructuredGrid()->GetNumberOfCells()) {
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
}
myHighlitableActor->SetVisibility(anIsVisible); myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()-> break;
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells); }
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); case SMESH_DeviceActor::ePoint:
}else if(myRepresentation == ePoint || GetPointRepresentation()){ {
myHighlitableActor->SetHighlited(anIsVisible); if(myIsHighlighted) {
myHighlitableActor->GetExtractUnstructuredGrid()-> myNodeActor->SetProperty(myHighlightProp);
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); }else if(myIsPreselected) {
myHighlitableActor->SetVisibility(anIsVisible); myNodeActor->SetProperty(myPreselectProp);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint); } else if(anIsVisible) {
myNodeActor->SetProperty(myNodeProp);
VTK::MarkerType aMarkerType = GetMarkerType(); }
if(aMarkerType != VTK::MT_USER) myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
myHighlitableActor->SetMarkerStd(aMarkerType, GetMarkerScale()); myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
else break;
myHighlitableActor->SetMarkerTexture(GetMarkerTexture(), myMarkerTexture);
} }
} }
} }
@ -1787,6 +1808,16 @@ void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType&
::GetColor(myEdgeProp,r,g,b); ::GetColor(myEdgeProp,r,g,b);
} }
void SMESH_ActorDef::SetOutlineColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myOutLineProp->SetColor(r,g,b);
Modified();
}
void SMESH_ActorDef::GetOutlineColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(myOutLineProp,r,g,b);
}
void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myNodeProp->SetColor(r,g,b); myNodeProp->SetColor(r,g,b);
myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b); myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);

View File

@ -69,6 +69,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; virtual void SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; virtual void GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
virtual void SetOutlineColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetOutlineColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
virtual void Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0; virtual void Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0; virtual void Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;

View File

@ -110,6 +110,10 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
virtual void SetOutlineColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetOutlineColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
virtual void SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b); virtual void SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b); virtual void GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
@ -232,7 +236,9 @@ class SMESH_ActorDef : public SMESH_Actor
SMESH_DeviceActor* myPickableActor; SMESH_DeviceActor* myPickableActor;
vtkProperty* myHighlightProp; vtkProperty* myHighlightProp;
vtkProperty* myOutLineProp;
vtkProperty* myPreselectProp; vtkProperty* myPreselectProp;
SMESH_DeviceActor* myHighlitableActor; SMESH_DeviceActor* myHighlitableActor;
eControl myControlMode; eControl myControlMode;

View File

@ -1032,7 +1032,7 @@
return; return;
} }
case 1132:{ case 1132:{
QColor c, e, b, n, c0D, o; QColor c, e, b, n, c0D, o, outl, selection, preselection;
int delta; int delta;
int size0D = 0; int size0D = 0;
int Edgewidth = 0; int Edgewidth = 0;
@ -1077,6 +1077,27 @@
c2 = int (color0D[2] * 255); c2 = int (color0D[2] * 255);
c0D.setRgb(c0, c1, c2); c0D.setRgb(c0, c1, c2);
vtkFloatingPointType outlineColor[3];
anActor->GetOutlineColor(outlineColor[0], outlineColor[1], outlineColor[2]);
c0 = int (outlineColor[0] * 255);
c1 = int (outlineColor[1] * 255);
c2 = int (outlineColor[2] * 255);
outl.setRgb(c0, c1, c2);
vtkFloatingPointType hColor[3];
anActor->GetHighlightColor(hColor[0], hColor[1], hColor[2]);
c0 = int (hColor[0] * 255);
c1 = int (hColor[1] * 255);
c2 = int (hColor[2] * 255);
selection.setRgb(c0, c1, c2);
vtkFloatingPointType phColor[3];
anActor->GetPreHighlightColor(phColor[0], phColor[1], phColor[2]);
c0 = int (phColor[0] * 255);
c1 = int (phColor[1] * 255);
c2 = int (phColor[2] * 255);
preselection.setRgb(c0, c1, c2);
size0D = (int)anActor->Get0DSize(); size0D = (int)anActor->Get0DSize();
if(size0D == 0) if(size0D == 0)
size0D = 1; size0D = 1;
@ -1111,6 +1132,7 @@
aDlg->SetColor(1, c); aDlg->SetColor(1, c);
aDlg->SetColor(2, e); aDlg->SetColor(2, e);
aDlg->SetColor(3, n); aDlg->SetColor(3, n);
aDlg->SetColor(4, outl);
aDlg->SetDeltaBrightness(delta); aDlg->SetDeltaBrightness(delta);
aDlg->SetColor(5, c0D); aDlg->SetColor(5, c0D);
aDlg->SetColor(6, o); aDlg->SetColor(6, o);
@ -1119,6 +1141,8 @@
aDlg->SetIntValue(3, size0D); aDlg->SetIntValue(3, size0D);
aDlg->SetDoubleValue(1, faces_orientation_scale); aDlg->SetDoubleValue(1, faces_orientation_scale);
aDlg->SetBooleanValue(1, faces_orientation_3dvectors); aDlg->SetBooleanValue(1, faces_orientation_3dvectors);
aDlg->SetColor(7, selection);
aDlg->SetColor(8, preselection);
aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] ); aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] );
@ -1131,9 +1155,11 @@
QColor color = aDlg->GetColor(1); QColor color = aDlg->GetColor(1);
QColor edgecolor = aDlg->GetColor(2); QColor edgecolor = aDlg->GetColor(2);
QColor nodecolor = aDlg->GetColor(3); QColor nodecolor = aDlg->GetColor(3);
QColor backfacecolor = aDlg->GetColor(4); QColor outlinecolor = aDlg->GetColor(4);
QColor color0D = aDlg->GetColor(5); QColor color0D = aDlg->GetColor(5);
QColor faces_orientation_color = aDlg->GetColor(6); QColor faces_orientation_color = aDlg->GetColor(6);
QColor selectioncolor = aDlg->GetColor(7);
QColor preSelectioncolor = aDlg->GetColor(8);
int delta = aDlg->GetDeltaBrightness(); int delta = aDlg->GetDeltaBrightness();
/* Point marker */ /* Point marker */
@ -1153,6 +1179,20 @@
anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255., anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
vtkFloatingPointType (edgecolor.green()) / 255., vtkFloatingPointType (edgecolor.green()) / 255.,
vtkFloatingPointType (edgecolor.blue()) / 255.); vtkFloatingPointType (edgecolor.blue()) / 255.);
/* edge outline */
anActor->SetOutlineColor(vtkFloatingPointType (outlinecolor.red()) / 255.,
vtkFloatingPointType (outlinecolor.green()) / 255.,
vtkFloatingPointType (outlinecolor.blue()) / 255.);
/* selection */
anActor->SetHighlightColor(vtkFloatingPointType (selectioncolor.red()) / 255.,
vtkFloatingPointType (selectioncolor.green()) / 255.,
vtkFloatingPointType (selectioncolor.blue()) / 255.);
/* pre-selection */
anActor->SetPreHighlightColor(vtkFloatingPointType (preSelectioncolor.red()) / 255.,
vtkFloatingPointType (preSelectioncolor.green()) / 255.,
vtkFloatingPointType (preSelectioncolor.blue()) / 255.);
/* Shrink factor and size edges */ /* Shrink factor and size edges */
anActor->SetShrinkFactor(aDlg->GetIntValue(2) / 100.); anActor->SetShrinkFactor(aDlg->GetIntValue(2) / 100.);
@ -4502,24 +4542,25 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( elemGroup, "columns", 2 ); setPreferenceProperty( elemGroup, "columns", 2 );
int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" ); int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" ); addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" );
setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") ); setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") );
int grpSelection = addPreference( tr( "PREF_GROUP_SELECTION" ), meshTab );
setPreferenceProperty( grpSelection, "columns", 2 );
addPreference( tr( "PREF_SELECTION" ), grpSelection, LightApp_Preferences::Color, "SMESH", "selection_object_color" );
addPreference( tr( "PREF_PRE_SELECTION" ), grpSelection, LightApp_Preferences::Color, "SMESH", "highlight_color" );
int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab ); int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab );
setPreferenceProperty( grpGroup, "columns", 2 ); setPreferenceProperty( grpGroup, "columns", 2 );
addPreference( tr( "PREF_GRP_NAMES" ), grpGroup, LightApp_Preferences::Color, "SMESH", "group_name_color" ); addPreference( tr( "PREF_GRP_NAMES" ), grpGroup, LightApp_Preferences::Color, "SMESH", "group_name_color" );
//int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
//setPreferenceProperty( sp, "hstretch", 0 );
//setPreferenceProperty( sp, "vstretch", 0 );
int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup, int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size"); LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup, int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "element_width"); LightApp_Preferences::IntSpin, "SMESH", "element_width");
int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup, int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
@ -4528,9 +4569,6 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( size0d, "min", 1 ); setPreferenceProperty( size0d, "min", 1 );
setPreferenceProperty( size0d, "max", 10 ); setPreferenceProperty( size0d, "max", 10 );
setPreferenceProperty( sp, "hstretch", 0 );
setPreferenceProperty( sp, "vstretch", 0 );
setPreferenceProperty( elemW, "min", 1 ); setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 ); setPreferenceProperty( elemW, "max", 5 );
@ -5102,6 +5140,12 @@ void SMESHGUI::storeVisualParameters (int savePoint)
colorStr += gDigitsSep; colorStr += QString::number(g); colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b); colorStr += gDigitsSep; colorStr += QString::number(b);
aSmeshActor->GetOutlineColor(r, g, b);
colorStr += gDigitsSep; colorStr += "outline";
colorStr += gDigitsSep; colorStr += QString::number(r);
colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b);
aSmeshActor->GetNodeColor(r, g, b); aSmeshActor->GetNodeColor(r, g, b);
colorStr += gDigitsSep; colorStr += "node"; colorStr += gDigitsSep; colorStr += "node";
colorStr += gDigitsSep; colorStr += QString::number(r); colorStr += gDigitsSep; colorStr += QString::number(r);
@ -5459,16 +5503,17 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
// Colors // Colors
else if (paramNameStr == "Colors") { else if (paramNameStr == "Colors") {
QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts); QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
if (colors.count() == 16 || colors.count() == 14 ) { if (colors.count() == 16 || colors.count() == 17 ) {
if (colors[0] != "surface" || colors[4] != "backsurface" || if (colors[0] != "surface" || colors[4] != "backsurface" ||
(colors[8] != "edge" && colors[6] != "edge" ) || (colors[12] != "node" && colors[10] != "node")) { (colors[8] != "edge" && colors[6] != "edge" ) || (colors[12] != "node" && colors[10] != "node")) {
MESSAGE("Invalid order of data in Colors, must be: " MESSAGE("Invalid order of data in Colors, must be: "
"surface:r:g:b:backsurface:r:g:b:edge:r:g:b:node:r:g:b or surface:r:g:b:backsurface:delta:edge:r:g:b:node:r:g:b"); "surface:r:g:b:backsurface:r:g:b:edge:r:g:b:node:r:g:b or surface:r:g:b:backsurface:delta:edge:r:g:b:node:r:g:b:outline:r:g:b");
} }
else { else {
int delta = 0; int delta = 0;
float er,eg,eb; float er,eg,eb;
float nr,ng,nb; float nr,ng,nb;
vtkFloatingPointType otr,otg,otb;
//Old case backsurface color is independent //Old case backsurface color is independent
if( colors.count() == 16 ) { if( colors.count() == 16 ) {
QColor ffc; QColor ffc;
@ -5480,6 +5525,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
nr = colors[13].toFloat(); nr = colors[13].toFloat();
ng = colors[14].toFloat(); ng = colors[14].toFloat();
nb = colors[15].toFloat(); nb = colors[15].toFloat();
SMESH::GetColor("SMESH", "outline_color", otr, otg, otb, QColor( 0, 70, 0 ) );
} else { } else {
//New case backsurface color depends on surface color //New case backsurface color depends on surface color
delta = colors[5].toInt(); delta = colors[5].toInt();
@ -5491,10 +5537,15 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
nr = colors[11].toFloat(); nr = colors[11].toFloat();
ng = colors[12].toFloat(); ng = colors[12].toFloat();
nb = colors[13].toFloat(); nb = colors[13].toFloat();
otr = colors[14].toFloat();
otg = colors[15].toFloat();
otb = colors[16].toFloat();
} }
aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat(), delta); aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat(), delta);
aSmeshActor->SetEdgeColor(er,eg,eb); aSmeshActor->SetEdgeColor(er,eg,eb);
aSmeshActor->SetNodeColor(nr,ng,nb); aSmeshActor->SetNodeColor(nr,ng,nb);
aSmeshActor->SetOutlineColor(otr,otg,otb);
} }
} }
} }

View File

@ -85,9 +85,12 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
toolSurfColor = new QtxBiColorTool(ButtonGroup1); toolSurfColor = new QtxBiColorTool(ButtonGroup1);
toolSurfColor->setText("Back surface color"); toolSurfColor->setText("Back surface color");
QLabel* TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1 ); QLabel* TextLabel_Outline = new QLabel( tr( "Outline color" ), ButtonGroup1 );
btnOutlineColor = new QtxColorButton( ButtonGroup1 ); btnOutlineColor = new QtxColorButton( ButtonGroup1 );
QLabel* TextLabel_Wireframe = new QLabel( tr( "Wireframe color" ), ButtonGroup1 );
btnWireframeColor = new QtxColorButton( ButtonGroup1 );
QLabel* TextLabel_0DElements_Color = new QLabel( tr( "0D elements" ), ButtonGroup1 ); QLabel* TextLabel_0DElements_Color = new QLabel( tr( "0D elements" ), ButtonGroup1 );
btn0DElementsColor = new QtxColorButton( ButtonGroup1 ); btn0DElementsColor = new QtxColorButton( ButtonGroup1 );
@ -117,12 +120,18 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 ); ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 );
ButtonGroup1Layout->addWidget( toolSurfColor, 0, 1, 1, 3 ); ButtonGroup1Layout->addWidget( toolSurfColor, 0, 1, 1, 3 );
ButtonGroup1Layout->addWidget( TextLabel_Outine, 1, 0 );
ButtonGroup1Layout->addWidget( TextLabel_Outline, 1, 0 );
ButtonGroup1Layout->addWidget( btnOutlineColor, 1, 1 ); ButtonGroup1Layout->addWidget( btnOutlineColor, 1, 1 );
ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 1, 2 ); ButtonGroup1Layout->addWidget( TextLabel_Wireframe, 1, 2 );
ButtonGroup1Layout->addWidget( btn0DElementsColor, 1, 3 ); ButtonGroup1Layout->addWidget( btnWireframeColor, 1, 3 );
ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size, 2, 0 );
ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size, 2, 1 ); ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 2, 0 );
ButtonGroup1Layout->addWidget( btn0DElementsColor, 2, 1 );
ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size, 2, 2 );
ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size, 2, 3 );
ButtonGroup1Layout->addWidget( TextLabel_Width, 3, 0 ); ButtonGroup1Layout->addWidget( TextLabel_Width, 3, 0 );
ButtonGroup1Layout->addWidget( SpinBox_Width, 3, 1 ); ButtonGroup1Layout->addWidget( SpinBox_Width, 3, 1 );
ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 3, 2 ); ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 3, 2 );
@ -175,6 +184,23 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
ButtonGroup3Layout->addWidget( SpinBox_Orientation_Scale, 0, 3 ); ButtonGroup3Layout->addWidget( SpinBox_Orientation_Scale, 0, 3 );
ButtonGroup3Layout->addWidget( CheckBox_Orientation_3DVectors, 1, 0, 1, 4 ); ButtonGroup3Layout->addWidget( CheckBox_Orientation_3DVectors, 1, 0, 1, 4 );
// -------------------------------
QGroupBox* ButtonGroup4 = new QGroupBox( tr( "Selection" ), this );
QGridLayout* ButtonGroup4Layout = new QGridLayout( ButtonGroup4 );
ButtonGroup3Layout->setSpacing( SPACING );
ButtonGroup3Layout->setMargin( MARGIN );
QLabel* TextLabel_Selection_Color = new QLabel( tr( "Selection color" ), ButtonGroup4 );
btnSelectionColor = new QtxColorButton( ButtonGroup4 );
QLabel* TextLabel_Preselection_Color = new QLabel( tr( "Pre-selection color" ), ButtonGroup4 );
btnPreselectionColor = new QtxColorButton( ButtonGroup4 );
ButtonGroup4Layout->addWidget( TextLabel_Selection_Color, 0, 0 );
ButtonGroup4Layout->addWidget( btnSelectionColor, 0, 1 );
ButtonGroup4Layout->addWidget( TextLabel_Preselection_Color, 0, 2 );
ButtonGroup4Layout->addWidget( btnPreselectionColor, 0, 3 );
// ------------------------------- // -------------------------------
QGroupBox* GroupButtons = new QGroupBox( this ); QGroupBox* GroupButtons = new QGroupBox( this );
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
@ -201,6 +227,9 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
topLayout->addWidget( ButtonGroup1 ); topLayout->addWidget( ButtonGroup1 );
topLayout->addWidget( ButtonGroup2 ); topLayout->addWidget( ButtonGroup2 );
topLayout->addWidget( ButtonGroup3 ); topLayout->addWidget( ButtonGroup3 );
// rnv: Selection and preselection colors are defined only in the Preferences
// topLayout->addWidget( ButtonGroup4 );
ButtonGroup4->hide();
topLayout->addWidget( GroupButtons ); topLayout->addWidget( GroupButtons );
// ------------------------------- // -------------------------------
@ -306,11 +335,14 @@ void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog()
void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color ) void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color )
{ {
switch ( type ) { switch ( type ) {
case 1 : toolSurfColor->setMainColor( color ); break; // fill case 1 : toolSurfColor->setMainColor( color ); break; // fill
case 2 : btnOutlineColor->setColor( color ); break; // outline case 2 : btnWireframeColor->setColor( color ); break; // wireframe
case 3 : btnNodeColor->setColor( color ); break; // node case 3 : btnNodeColor->setColor( color ); break; // node
case 5 : btn0DElementsColor->setColor( color ); break; // 0d elements case 4 : btnOutlineColor->setColor( color ); break; // outline
case 6 : btnOrientationColor->setColor( color ); break; // orientation of faces case 5 : btn0DElementsColor->setColor( color ); break; // 0d elements
case 6 : btnOrientationColor->setColor( color ); break; // orientation of faces
case 7 : btnSelectionColor->setColor( color ); break; // selection color
case 8 : btnPreselectionColor->setColor( color ); break; // pre-selection color
default: break; default: break;
} }
} }
@ -323,11 +355,15 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type )
{ {
QColor color; QColor color;
switch ( type ) { switch ( type ) {
case 1 : color = toolSurfColor->mainColor(); break; // fill case 1 : color = toolSurfColor->mainColor(); break; // fill
case 2 : color = btnOutlineColor->color(); break; // outline case 2 : color = btnWireframeColor->color(); break; // outline
case 3 : color = btnNodeColor->color(); break; // node case 3 : color = btnNodeColor->color(); break; // node
case 5 : color = btn0DElementsColor->color(); break; // 0d elements case 4 : color = btnOutlineColor->color(); break; // node
case 6 : color = btnOrientationColor->color(); break; // orientation of faces case 5 : color = btn0DElementsColor->color(); break; // 0d elements
case 6 : color = btnOrientationColor->color(); break; // orientation of faces
case 7 : color = btnSelectionColor->color(); break; // selection color
case 8 : color = btnPreselectionColor->color(); break; // pre-selection color
default: break; default: break;
} }
return color; return color;

View File

@ -88,6 +88,7 @@ private:
SMESHGUI* mySMESHGUI; SMESHGUI* mySMESHGUI;
QtxBiColorTool* toolSurfColor; QtxBiColorTool* toolSurfColor;
QtxColorButton* btnWireframeColor;
QtxColorButton* btnOutlineColor; QtxColorButton* btnOutlineColor;
QtxColorButton* btn0DElementsColor; QtxColorButton* btn0DElementsColor;
SalomeApp_IntSpinBox* SpinBox_0DElements_Size; SalomeApp_IntSpinBox* SpinBox_0DElements_Size;
@ -98,6 +99,8 @@ private:
QtxColorButton* btnOrientationColor; QtxColorButton* btnOrientationColor;
SMESHGUI_SpinBox* SpinBox_Orientation_Scale; SMESHGUI_SpinBox* SpinBox_Orientation_Scale;
QCheckBox* CheckBox_Orientation_3DVectors; QCheckBox* CheckBox_Orientation_3DVectors;
QtxColorButton* btnPreselectionColor;
QtxColorButton* btnSelectionColor;
QString myHelpFileName; QString myHelpFileName;
}; };

View File

@ -3552,6 +3552,22 @@ Please, create VTK viewer and try again</translation>
<source>PREF_BACKFACE</source> <source>PREF_BACKFACE</source>
<translation>Back surface color</translation> <translation>Back surface color</translation>
</message> </message>
<message>
<source>PREF_WIREFRAME</source>
<translation>Wireframe color</translation>
</message>
<message>
<source>PREF_GROUP_SELECTION</source>
<translation>Selection</translation>
</message>
<message>
<source>PREF_SELECTION</source>
<translation>Selection color</translation>
</message>
<message>
<source>PREF_PRE_SELECTION</source>
<translation>Pre-selection color</translation>
</message>
<message> <message>
<source>PREF_COLOR</source> <source>PREF_COLOR</source>
<translation>Color</translation> <translation>Color</translation>
@ -3706,7 +3722,7 @@ Please, create VTK viewer and try again</translation>
</message> </message>
<message> <message>
<source>PREF_OUTLINE</source> <source>PREF_OUTLINE</source>
<translation>Outline</translation> <translation>Outline color</translation>
</message> </message>
<message> <message>
<source>PREF_PRECISION_USE</source> <source>PREF_PRECISION_USE</source>