<ul>
<li><b>Elements</b></li>
<ul>
-<li><b>Fill</b> - color of surface of elements (seen in Shading mode).</li>
-<li><b>Back Face</b> - color of interior surface of elements.</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
+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>0D slements</b> - color of 0D elements.</li>
<li><b>Size of 0D slements</b> - size of 0D elements.</li>
<parameter name="version" value="@VERSION@"/>
<!-- Other module preferences -->
<parameter name="node_color" value="255, 0, 0"/>
- <parameter name="fill_color" value="0, 170, 255"/>
+ <parameter name="fill_color" value="0, 170, 255|-100"/>
<parameter name="outline_color" value="0, 170, 255"/>
- <parameter name="backface_color" value="0, 0, 255"/>
<parameter name="elem0d_color" value="0, 255, 0"/>
<parameter name="highlight_color" value="0, 255, 255"/>
<parameter name="group_name_color" value="255, 255, 255"/>
#include "SUIT_Session.h"
#include "SUIT_ResourceMgr.h"
+#include <Qtx.h>
+
#ifndef DISABLE_PLOT2DVIEWER
#include <SPlot2d_Histogram.h>
#endif
//-----------------------------------------
vtkFloatingPointType anRGB[3] = {1,1,1};
mySurfaceProp = vtkProperty::New();
- SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
- mySurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
+ QColor ffc, bfc;
+ int delta;
+ SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
+ mySurfaceProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
+ myDeltaBrightness = delta;
myBackSurfaceProp = vtkProperty::New();
- SMESH::GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
- myBackSurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
+ bfc = Qtx::mainColorToSecondary(ffc, delta);
+ myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
my2DActor = SMESH_DeviceActor::New();
my2DActor->SetUserMatrix(aMatrix);
}
-void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta){
mySurfaceProp->SetColor(r,g,b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Face ||
aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b);
+
+ myDeltaBrightness = delta;
+ QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
+ myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
Modified();
}
-void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta){
::GetColor(mySurfaceProp,r,g,b);
my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
-}
-
-void SMESH_ActorDef::SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
- myBackSurfaceProp->SetColor(r,g,b);
- Modified();
-}
-
-void SMESH_ActorDef::GetBackSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
- ::GetColor(myBackSurfaceProp,r,g,b);
+ delta = myDeltaBrightness;
}
void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
const char* theName,
int theIsClear);
- virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
- virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
-
- virtual void SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
- virtual void GetBackSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
-
+ virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta ) = 0;
+ virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta ) = 0;
+
virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
virtual void SetOpacity(vtkFloatingPointType theValue);
virtual vtkFloatingPointType GetOpacity();
- virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
- virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
-
- virtual void SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
- virtual void GetBackSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
+ virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta );
+ virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta);
virtual void SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
#endif
bool myIsFacesOriented;
+
+ int myDeltaBrightness;
VTK::MarkerTexture myMarkerTexture;
#include <Plot2d_ViewManager.h>
#endif
+#include <Qtx.h>
+
#include "utilities.h"
b = ib / 255.;
}
+
+ void
+ GetColor( const QString& theSect,
+ const QString& theName,
+ QColor& color,
+ int& delta,
+ QString def)
+ {
+
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ if ( mgr ) {
+ QString str = mgr->stringValue( theSect, theName, def );
+ Qtx::stringToBiColor(str,color,delta);
+ }
+ }
+
+
#ifndef DISABLE_PLOT2DVIEWER
//=======================================================================
/**
vtkFloatingPointType&,
const QColor& = QColor() );
+ SMESHOBJECT_EXPORT
+ void
+ GetColor( const QString& theSect,
+ const QString& theName,
+ QColor& color,
+ int& delta,
+ QString def);
+
SMESHOBJECT_EXPORT
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
else if( aGroupObject->GetType() == SMESH::ELEM0D )
anActor->Set0DColor( aColor.R, aColor.G, aColor.B );
- else
- anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
+ else {
+ QColor c;
+ int delta;
+ SMESH::GetColor("SMESH", "fill_color", c, delta, "0,170,255|-100");
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta );
+ }
}
}
}
}
case 1132:{
QColor c, e, b, n, c0D, o;
+ int delta;
int size0D = 0;
int Edgewidth = 0;
vtkFloatingPointType Shrink = 0.0;
if(IObject->hasEntry()){
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
vtkFloatingPointType color[3];
- anActor->GetSufaceColor(color[0], color[1], color[2]);
+ anActor->GetSufaceColor(color[0], color[1], color[2],delta);
int c0 = int (color[0] * 255);
int c1 = int (color[1] * 255);
int c2 = int (color[2] * 255);
c2 = int (edgecolor[2] * 255);
e.setRgb(c0, c1, c2);
- vtkFloatingPointType backfacecolor[3];
- anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
- c0 = int (backfacecolor[0] * 255);
- c1 = int (backfacecolor[1] * 255);
- c2 = int (backfacecolor[2] * 255);
- b.setRgb(c0, c1, c2);
-
vtkFloatingPointType nodecolor[3];
anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
c0 = int (nodecolor[0] * 255);
aDlg->SetColor(1, c);
aDlg->SetColor(2, e);
aDlg->SetColor(3, n);
- aDlg->SetColor(4, b);
+ aDlg->SetDeltaBrightness(delta);
aDlg->SetColor(5, c0D);
aDlg->SetColor(6, o);
aDlg->SetIntValue(1, Edgewidth);
QColor backfacecolor = aDlg->GetColor(4);
QColor color0D = aDlg->GetColor(5);
QColor faces_orientation_color = aDlg->GetColor(6);
+ int delta = aDlg->GetDeltaBrightness();
/* Point marker */
theMarkerMap[ aStudy->StudyId() ] = aDlg->getCustomMarkerMap();
/* actor color and backface color */
anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
vtkFloatingPointType (color.green()) / 255.,
- vtkFloatingPointType (color.blue()) / 255.);
- anActor->SetBackSufaceColor(vtkFloatingPointType (backfacecolor.red()) / 255.,
- vtkFloatingPointType (backfacecolor.green()) / 255.,
- vtkFloatingPointType (backfacecolor.blue()) / 255.);
-
+ vtkFloatingPointType (color.blue()) / 255.,
+ delta);
/* edge color */
anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
vtkFloatingPointType (edgecolor.green()) / 255.,
int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
setPreferenceProperty( elemGroup, "columns", 2 );
- addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::Color, "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_BACKFACE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "backface_color" );
addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
+
+ setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") );
+
int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab );
setPreferenceProperty( grpGroup, "columns", 2 );
// Colors (surface:edge:)
vtkFloatingPointType r, g, b;
-
- aSmeshActor->GetSufaceColor(r, g, b);
+ int delta;
+
+ aSmeshActor->GetSufaceColor(r, g, b, delta);
QString colorStr ("surface");
colorStr += gDigitsSep; colorStr += QString::number(r);
colorStr += gDigitsSep; colorStr += QString::number(g);
colorStr += gDigitsSep; colorStr += QString::number(b);
- aSmeshActor->GetBackSufaceColor(r, g, b);
- colorStr += gDigitsSep; colorStr += "backsurface";
- colorStr += gDigitsSep; colorStr += QString::number(r);
- colorStr += gDigitsSep; colorStr += QString::number(g);
- colorStr += gDigitsSep; colorStr += QString::number(b);
+ colorStr += gDigitsSep; colorStr += "backsurface";
+ colorStr += gDigitsSep; colorStr += QString::number(delta);
+
aSmeshActor->GetEdgeColor(r, g, b);
colorStr += gDigitsSep; colorStr += "edge";
// Colors
else if (paramNameStr == "Colors") {
QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
- if (colors.count() == 16) {
+ if (colors.count() == 16 || colors.count() == 14 ) {
if (colors[0] != "surface" || colors[4] != "backsurface" ||
- colors[8] != "edge" || colors[12] != "node") {
+ (colors[8] != "edge" && colors[6] != "edge" ) || (colors[12] != "node" && colors[10] != "node")) {
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");
+ "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");
}
else {
- aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat());
- aSmeshActor->SetBackSufaceColor(colors[5].toFloat(), colors[6].toFloat(), colors[7].toFloat());
- aSmeshActor->SetEdgeColor(colors[9].toFloat(), colors[10].toFloat(), colors[11].toFloat());
- aSmeshActor->SetNodeColor(colors[13].toFloat(), colors[14].toFloat(), colors[15].toFloat());
+ int delta = 0;
+ float er,eg,eb;
+ float nr,ng,nb;
+ //Old case backsurface color is independent
+ if( colors.count() == 16 ) {
+ QColor ffc;
+ SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
+ er = colors[9].toFloat();
+ eg = colors[10].toFloat();
+ eb = colors[11].toFloat();
+
+ nr = colors[13].toFloat();
+ ng = colors[14].toFloat();
+ nb = colors[15].toFloat();
+ } else {
+ //New case backsurface color depends on surface color
+ delta = colors[5].toInt();
+
+ er = colors[7].toFloat();
+ eg = colors[8].toFloat();
+ eb = colors[9].toFloat();
+
+ nr = colors[11].toFloat();
+ ng = colors[12].toFloat();
+ nb = colors[13].toFloat();
+ }
+ aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat(), delta);
+ aSmeshActor->SetEdgeColor(er,eg,eb);
+ aSmeshActor->SetNodeColor(nr,ng,nb);
}
}
}
case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
case 2:
- case 3: anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B ); break;
+ case 3:
+ {
+ QColor c;
+ int delta;
+ SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
+ }
}
}
}
ButtonGroup1Layout->setSpacing( SPACING );
ButtonGroup1Layout->setMargin( MARGIN );
- QLabel* TextLabel_Fill = new QLabel( tr( "Fill" ), ButtonGroup1 );
- btnFillColor = new QtxColorButton( ButtonGroup1 );
+ QLabel* TextLabel_Fill = new QLabel( tr( "Surface color" ), ButtonGroup1 );
- QLabel* TextLabel_BackFace = new QLabel( tr( "Back Face" ), ButtonGroup1 );
- btnBackFaceColor = new QtxColorButton( ButtonGroup1 );
+ toolSurfColor = new QtxBiColorTool(ButtonGroup1);
+ toolSurfColor->setText("Back surface color");
QLabel* TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1 );
btnOutlineColor = new QtxColorButton( ButtonGroup1 );
SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus );
ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 );
- ButtonGroup1Layout->addWidget( btnFillColor, 0, 1 );
- ButtonGroup1Layout->addWidget( TextLabel_BackFace, 0, 2 );
- ButtonGroup1Layout->addWidget( btnBackFaceColor, 0, 3 );
+ ButtonGroup1Layout->addWidget( toolSurfColor, 0, 1, 1, 3 );
ButtonGroup1Layout->addWidget( TextLabel_Outine, 1, 0 );
ButtonGroup1Layout->addWidget( btnOutlineColor, 1, 1 );
ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 1, 2 );
void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color )
{
switch ( type ) {
- case 1 : btnFillColor->setColor( color ); break; // fill
+ case 1 : toolSurfColor->setMainColor( color ); break; // fill
case 2 : btnOutlineColor->setColor( color ); break; // outline
case 3 : btnNodeColor->setColor( color ); break; // node
- case 4 : btnBackFaceColor->setColor( color ); break; // back face
case 5 : btn0DElementsColor->setColor( color ); break; // 0d elements
case 6 : btnOrientationColor->setColor( color ); break; // orientation of faces
default: break;
{
QColor color;
switch ( type ) {
- case 1 : color = btnFillColor->color(); break; // fill
+ case 1 : color = toolSurfColor->mainColor(); break; // fill
case 2 : color = btnOutlineColor->color(); break; // outline
case 3 : color = btnNodeColor->color(); break; // node
- case 4 : color = btnBackFaceColor->color(); break; // back face
case 5 : color = btn0DElementsColor->color(); break; // 0d elements
case 6 : color = btnOrientationColor->color(); break; // orientation of faces
default: break;
return MarkerWidget->getCustomMarkerID();
}
+//=================================================================================
+// function : SetDeltaBrightness(int)
+// purpose :
+//=================================================================================
+void SMESHGUI_Preferences_ColorDlg::SetDeltaBrightness(int delta)
+{
+ toolSurfColor->setDelta(delta);
+}
+//=================================================================================
+// function : GetDeltaBrightness()
+// purpose :
+//=================================================================================
+int SMESHGUI_Preferences_ColorDlg::GetDeltaBrightness()
+{
+ return toolSurfColor->delta();
+}
+
//=================================================================================
// function : keyPressEvent()
// purpose :
// SALOME GUI includes
#include <VTKViewer_MarkerDef.h>
+#include <QtxBiColorTool.h>
// Qt includes
#include <QDialog>
void setCustomMarkerMap( VTK::MarkerMap );
VTK::MarkerMap getCustomMarkerMap();
+ void SetDeltaBrightness(int);
+ int GetDeltaBrightness();
+
void setStandardMarker( VTK::MarkerType, VTK::MarkerScale );
void setCustomMarker( int );
VTK::MarkerType getMarkerType() const;
private:
SMESHGUI* mySMESHGUI;
-
- QtxColorButton* btnFillColor;
- QtxColorButton* btnBackFaceColor;
+
+ QtxBiColorTool* toolSurfColor;
QtxColorButton* btnOutlineColor;
QtxColorButton* btn0DElementsColor;
SalomeApp_IntSpinBox* SpinBox_0DElements_Size;
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( aSObj ));
if(!CORBA::is_nil(aGroup) && anActor)
{
+ QColor c;int delta;
+ SMESH::GetColor( "SMESH", "fill_color", c, delta, "0,170,255|-100" );
SALOMEDS::Color aColor = aGroup->GetColor();
- if( !( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) )
+ if( !( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ))
{
- int r = 0, g = 0, b = 0;
- SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
- aColor.R = (float)r / 255.0;
- aColor.G = (float)g / 255.0;
- aColor.B = (float)b / 255.0;
+ aColor.R = (float)c.red() / 255.0;
+ aColor.G = (float)c.green() / 255.0;
+ aColor.B = (float)c.blue() / 255.0;
aGroup->SetColor( aColor );
}
if( aGroup->GetType() == SMESH::NODE )
else if( aGroup->GetType() == SMESH::ELEM0D )
anActor->Set0DColor( aColor.R, aColor.G, aColor.B );
else
- anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
+ anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta );
}
}
}
</message>
<message>
<source>PREF_BACKFACE</source>
- <translation>Back face</translation>
+ <translation>Back surface color</translation>
</message>
<message>
<source>PREF_COLOR</source>
</message>
<message>
<source>PREF_FILL</source>
- <translation>Fill</translation>
+ <translation>Surface color</translation>
</message>
<message>
<source>PREF_NOTIFY_MODE</source>