mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 09:20:34 +05:00
0023580: [EDF] AsterStudy: more distinct display of selected items in 3D view
This commit is contained in:
parent
9374764094
commit
98e8c17721
@ -115,6 +115,8 @@
|
||||
<parameter name="parametric_precision" value="-6" />
|
||||
<parameter name="area_precision" value="-6" />
|
||||
<parameter name="vol_precision" value="-6" />
|
||||
<parameter name="selection_increment" value="0" />
|
||||
<parameter name="controls_increment" value="2" />
|
||||
</section>
|
||||
<section name="smesh_help" >
|
||||
<parameter name="User's Guide/Mesh module/User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/index.html"/>
|
||||
|
@ -79,6 +79,7 @@ SET(SMESHObject_HEADERS
|
||||
SMESH_Actor.h
|
||||
SMESH_Object.h
|
||||
SMESH_ObjectDef.h
|
||||
SMESH_ActorProps.h
|
||||
SMESH_ActorUtils.h
|
||||
SMESH_ActorDef.h
|
||||
SMESH_DeviceActor.h
|
||||
@ -98,6 +99,7 @@ SET(SMESHObject_SOURCES
|
||||
SMESH_Object.cxx
|
||||
SMESH_DeviceActor.cxx
|
||||
SMESH_Actor.cxx
|
||||
SMESH_ActorProps.cxx
|
||||
SMESH_PreviewActorsCollection.cxx
|
||||
SMESH_ExtractGeometry.cxx
|
||||
SMESH_ActorUtils.cxx
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "SMESH_ActorDef.h"
|
||||
|
||||
#include "SMDS_UnstructuredGrid.hxx"
|
||||
#include "SMESH_ActorProps.h"
|
||||
#include "SMESH_ActorUtils.h"
|
||||
#include "SMESH_CellLabelActor.h"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
@ -87,9 +88,6 @@ static int MYDEBUG = 0;
|
||||
static int MYDEBUG = 0;
|
||||
#endif
|
||||
|
||||
static int aLineWidthInc = 2;
|
||||
|
||||
|
||||
SMESH_ActorDef* SMESH_ActorDef::New(){
|
||||
return new SMESH_ActorDef();
|
||||
}
|
||||
@ -141,6 +139,9 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
|
||||
myIsFacesOriented = false;
|
||||
|
||||
int controlsIncrement = SMESH_ActorProps::props()->controlsIncrement();
|
||||
int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement();
|
||||
|
||||
myControlsPrecision = -1;
|
||||
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
|
||||
|
||||
@ -240,6 +241,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
anRGB[0] = 1 - anRGB[0];
|
||||
anRGB[1] = 1 - anRGB[1];
|
||||
anRGB[2] = 1 - anRGB[2];
|
||||
my2DExtProp->SetLineWidth(aLineWidth + controlsIncrement);
|
||||
my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
|
||||
my2DExtActor = SMESH_DeviceActor::New();
|
||||
@ -290,6 +292,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
anRGB[0] = 1 - anRGB[0];
|
||||
anRGB[1] = 1 - anRGB[1];
|
||||
anRGB[2] = 1 - anRGB[2];
|
||||
my3DExtProp->SetLineWidth(aLineWidth + controlsIncrement);
|
||||
my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
|
||||
my3DExtActor = SMESH_DeviceActor::New();
|
||||
@ -345,7 +348,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
|
||||
my1DProp = vtkProperty::New();
|
||||
my1DProp->DeepCopy(myEdgeProp);
|
||||
my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
|
||||
my1DProp->SetLineWidth(aLineWidth + controlsIncrement);
|
||||
my1DProp->SetPointSize(aElem0DSize);
|
||||
|
||||
my1DExtProp = vtkProperty::New();
|
||||
@ -354,7 +357,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
anRGB[1] = 1 - anRGB[1];
|
||||
anRGB[2] = 1 - anRGB[2];
|
||||
my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
|
||||
my1DExtProp->SetLineWidth(aLineWidth + controlsIncrement);
|
||||
my1DExtProp->SetPointSize(aElem0DSize);
|
||||
|
||||
// my1DExtActor is used to show filtered edges or links between nodes
|
||||
@ -485,7 +488,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
|
||||
myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
myHighlightProp->SetPointSize(aElem0DSize); // ??
|
||||
myHighlightProp->SetLineWidth(aLineWidth);
|
||||
myHighlightProp->SetLineWidth(aLineWidth + selectionIncrement);
|
||||
myHighlightProp->SetRepresentation(1);
|
||||
|
||||
myOutLineProp = vtkProperty::New();
|
||||
@ -504,7 +507,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
|
||||
myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||
myPreselectProp->SetPointSize(aElem0DSize); // ??
|
||||
myPreselectProp->SetLineWidth(aLineWidth);
|
||||
myPreselectProp->SetLineWidth(aLineWidth + selectionIncrement);
|
||||
myPreselectProp->SetRepresentation(1);
|
||||
|
||||
myHighlitableActor = SMESH_DeviceActor::New();
|
||||
@ -2197,29 +2200,19 @@ void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b)
|
||||
::GetColor(myBallProp,r,g,b);
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::SetHighlightColor(double r,double g,double b)
|
||||
{
|
||||
myHighlightProp->SetColor(r,g,b);
|
||||
void SMESH_ActorDef::UpdateSelectionProps()
|
||||
{
|
||||
QColor selectionColor = SMESH_ActorProps::props()->selectionColor();
|
||||
QColor highlightColor = SMESH_ActorProps::props()->highlightColor();
|
||||
int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement();
|
||||
double width = GetLineWidth();
|
||||
myHighlightProp->SetColor(selectionColor.redF(), selectionColor.greenF(), selectionColor.blueF());
|
||||
myHighlightProp->SetLineWidth(width + selectionIncrement);
|
||||
myPreselectProp->SetColor(highlightColor.redF(), highlightColor.greenF(), highlightColor.blueF());
|
||||
myPreselectProp->SetLineWidth(width + selectionIncrement);
|
||||
Modified();
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b)
|
||||
{
|
||||
::GetColor(myHighlightProp,r,g,b);
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b)
|
||||
{
|
||||
myPreselectProp->SetColor(r,g,b);
|
||||
Modified();
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::GetPreHighlightColor(double& r,double& g,double& b)
|
||||
{
|
||||
::GetColor(myPreselectProp,r,g,b);
|
||||
}
|
||||
|
||||
|
||||
double SMESH_ActorDef::GetLineWidth()
|
||||
{
|
||||
return myEdgeProp->GetLineWidth();
|
||||
@ -2228,15 +2221,17 @@ double SMESH_ActorDef::GetLineWidth()
|
||||
|
||||
void SMESH_ActorDef::SetLineWidth(double theVal)
|
||||
{
|
||||
int controlsIncrement = SMESH_ActorProps::props()->controlsIncrement();
|
||||
int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement();
|
||||
|
||||
myEdgeProp->SetLineWidth(theVal);
|
||||
|
||||
my1DProp->SetLineWidth(theVal + aLineWidthInc);
|
||||
my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
|
||||
my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
|
||||
my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
|
||||
myOutLineProp->SetLineWidth(theVal);
|
||||
myHighlightProp->SetLineWidth(theVal);
|
||||
myPreselectProp->SetLineWidth(theVal);
|
||||
my1DProp->SetLineWidth(theVal + controlsIncrement);
|
||||
my1DExtProp->SetLineWidth(theVal + controlsIncrement);
|
||||
my2DExtProp->SetLineWidth(theVal + controlsIncrement);
|
||||
my3DExtProp->SetLineWidth(theVal + controlsIncrement);
|
||||
myHighlightProp->SetLineWidth(theVal + selectionIncrement);
|
||||
myPreselectProp->SetLineWidth(theVal + selectionIncrement);
|
||||
Modified();
|
||||
}
|
||||
|
||||
|
@ -83,12 +83,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
|
||||
virtual void SetBallColor(double r,double g,double b) = 0;
|
||||
virtual void GetBallColor(double& r,double& g,double& b) = 0;
|
||||
|
||||
virtual void SetHighlightColor(double r,double g,double b) = 0;
|
||||
virtual void GetHighlightColor(double& r,double& g,double& b) = 0;
|
||||
|
||||
virtual void SetPreHighlightColor(double r,double g,double b) = 0;
|
||||
virtual void GetPreHighlightColor(double& r,double& g,double& b) = 0;
|
||||
|
||||
virtual void UpdateSelectionProps() = 0;
|
||||
|
||||
virtual double GetLineWidth() = 0;
|
||||
virtual void SetLineWidth(double theVal) = 0;
|
||||
|
||||
|
@ -127,11 +127,7 @@ class SMESH_ActorDef : public SMESH_Actor
|
||||
virtual void SetBallColor(double r,double g,double b);
|
||||
virtual void GetBallColor(double& r,double& g,double& b);
|
||||
|
||||
virtual void SetHighlightColor(double r,double g,double b);
|
||||
virtual void GetHighlightColor(double& r,double& g,double& b);
|
||||
|
||||
virtual void SetPreHighlightColor(double r,double g,double b);
|
||||
virtual void GetPreHighlightColor(double& r,double& g,double& b);
|
||||
virtual void UpdateSelectionProps();
|
||||
|
||||
virtual double GetLineWidth();
|
||||
virtual void SetLineWidth(double theVal);
|
||||
|
73
src/OBJECT/SMESH_ActorProps.cxx
Normal file
73
src/OBJECT/SMESH_ActorProps.cxx
Normal file
@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include "SMESH_ActorProps.h"
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
|
||||
SMESH_ActorProps* SMESH_ActorProps::props()
|
||||
{
|
||||
static SMESH_ActorProps* g_props = 0;
|
||||
if (!g_props)
|
||||
g_props = new SMESH_ActorProps();
|
||||
return g_props;
|
||||
}
|
||||
|
||||
void SMESH_ActorProps::reset()
|
||||
{
|
||||
props()->initialize();
|
||||
}
|
||||
|
||||
SMESH_ActorProps::SMESH_ActorProps()
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
void SMESH_ActorProps::initialize()
|
||||
{
|
||||
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
|
||||
m_selection_color = mgr->colorValue("SMESH", "selection_object_color", Qt::white);
|
||||
m_highlight_color = mgr->colorValue("SMESH", "highlight_color", Qt::cyan);
|
||||
m_selection_increment = qBound(0, mgr->integerValue("SMESH", "selection_increment", 0), 5);
|
||||
m_controls_increment = qBound(0, mgr->integerValue("SMESH", "controls_increment", 2), 5);
|
||||
}
|
||||
|
||||
QColor SMESH_ActorProps::selectionColor() const
|
||||
{
|
||||
return m_selection_color;
|
||||
}
|
||||
|
||||
QColor SMESH_ActorProps::highlightColor() const
|
||||
{
|
||||
return m_highlight_color;
|
||||
}
|
||||
|
||||
int SMESH_ActorProps::selectionIncrement() const
|
||||
{
|
||||
return m_selection_increment;
|
||||
}
|
||||
|
||||
int SMESH_ActorProps::controlsIncrement() const
|
||||
{
|
||||
return m_controls_increment;
|
||||
}
|
48
src/OBJECT/SMESH_ActorProps.h
Normal file
48
src/OBJECT/SMESH_ActorProps.h
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef SMESH_ACTORPROPS_H
|
||||
#define SMESH_ACTORPROPS_H
|
||||
|
||||
#include "SMESH_Object.h"
|
||||
#include <QColor>
|
||||
|
||||
class SMESHOBJECT_EXPORT SMESH_ActorProps
|
||||
{
|
||||
public:
|
||||
static SMESH_ActorProps* props();
|
||||
static void reset();
|
||||
|
||||
QColor selectionColor() const;
|
||||
QColor highlightColor() const;
|
||||
int selectionIncrement() const;
|
||||
int controlsIncrement() const;
|
||||
|
||||
private:
|
||||
SMESH_ActorProps();
|
||||
void initialize();
|
||||
|
||||
QColor m_selection_color, m_highlight_color;
|
||||
int m_selection_increment, m_controls_increment;
|
||||
};
|
||||
|
||||
#endif //SMESH_ACTORPROPS_H
|
@ -5137,6 +5137,11 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( doubleNodesTol, "max", 1000000.0 );
|
||||
setPreferenceProperty( doubleNodesTol, "step", 0.0000001 );
|
||||
|
||||
/*
|
||||
int cinc = addPreference(tr("PREF_CONTROLS_INCREMENT"), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_increment");
|
||||
setPreferenceProperty( cinc, "min", 0 );
|
||||
setPreferenceProperty( cinc, "max", 5 );
|
||||
*/
|
||||
|
||||
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
|
||||
setPreferenceProperty( exportgroup, "columns", 2 );
|
||||
@ -5370,6 +5375,10 @@ void SMESHGUI::createPreferences()
|
||||
addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
|
||||
addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
|
||||
|
||||
int sinc = addPreference(tr("PREF_SELECTION_INCREMENT"), selTab, LightApp_Preferences::IntSpin, "SMESH", "selection_increment");
|
||||
setPreferenceProperty( sinc, "min", 0 );
|
||||
setPreferenceProperty( sinc, "max", 5 );
|
||||
|
||||
// Scalar Bar tab ------------------------------------------------------------------------
|
||||
int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
|
||||
int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
|
||||
@ -5469,7 +5478,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
||||
name== "highlight_color" ||
|
||||
name=="selection_precision_node" ||
|
||||
name=="selection_precision_element" ||
|
||||
name=="selection_precision_object" )
|
||||
name=="selection_precision_object" ||
|
||||
name=="selection_increment")
|
||||
{
|
||||
SMESH::UpdateSelectionProp( this );
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ActorProps.h"
|
||||
#include "SMESH_ActorUtils.h"
|
||||
#include "SMESH_CellLabelActor.h"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
@ -903,6 +904,8 @@ namespace SMESH
|
||||
return;
|
||||
}
|
||||
|
||||
SMESH_ActorProps::props()->reset();
|
||||
|
||||
QColor
|
||||
aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
|
||||
aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
|
||||
@ -944,12 +947,7 @@ namespace SMESH
|
||||
aCollection->InitTraversal();
|
||||
while ( vtkActor *anAct = aCollection->GetNextActor() ) {
|
||||
if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct) ) {
|
||||
anActor->SetHighlightColor(aHiColor.red()/255.,
|
||||
aHiColor.green()/255.,
|
||||
aHiColor.blue()/255.);
|
||||
anActor->SetPreHighlightColor(aPreColor.red()/255.,
|
||||
aPreColor.green()/255.,
|
||||
aPreColor.blue()/255.);
|
||||
anActor->UpdateSelectionProps();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4830,6 +4830,10 @@ Please, create VTK viewer and try again</translation>
|
||||
<source>PREF_OBJECTS</source>
|
||||
<translation>Objects</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SELECTION_INCREMENT</source>
|
||||
<translation>Elements width increment</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_OBJECT_COLOR</source>
|
||||
<translation>Object color</translation>
|
||||
|
@ -4780,6 +4780,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
|
||||
<source>PREF_OBJECTS</source>
|
||||
<translation>Objets</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SELECTION_INCREMENT</source>
|
||||
<translation type="unfinished">Elements width increment</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_OBJECT_COLOR</source>
|
||||
<translation>Couleur d'objet</translation>
|
||||
|
@ -4731,6 +4731,10 @@
|
||||
<source>PREF_OBJECTS</source>
|
||||
<translation>オブジェクト</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SELECTION_INCREMENT</source>
|
||||
<translation type="unfinished">Elements width increment</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_OBJECT_COLOR</source>
|
||||
<translation>オブジェクトの色</translation>
|
||||
|
Loading…
Reference in New Issue
Block a user