mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-12 00:29:17 +05:00
Implementation of the issue 20115: [CEA 308] Quadratic elements visualization.
This commit is contained in:
parent
daf3ca87d0
commit
c66c06508b
@ -418,6 +418,26 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
myImplicitBoolean = vtkImplicitBoolean::New();
|
||||
myImplicitBoolean->SetOperationTypeToIntersection();
|
||||
|
||||
|
||||
|
||||
//Quadratic 2D elements representation
|
||||
//-----------------------------------------------------------------------------
|
||||
int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
|
||||
if(aQuadratic2DMode == 0){
|
||||
myHighlitableActor->SetQuadraticArcMode(false);
|
||||
my2DActor->SetQuadraticArcMode(false);
|
||||
my1DActor->SetQuadraticArcMode(false);
|
||||
}
|
||||
else if(aQuadratic2DMode == 1){
|
||||
myHighlitableActor->SetQuadraticArcMode(true);
|
||||
my2DActor->SetQuadraticArcMode(true);
|
||||
my1DActor->SetQuadraticArcMode(true);
|
||||
}
|
||||
|
||||
int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
|
||||
myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
|
||||
my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
|
||||
|
||||
// Set color of the name actor
|
||||
SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
|
||||
myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
|
||||
@ -508,6 +528,7 @@ SMESH_ActorDef::~SMESH_ActorDef()
|
||||
void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
|
||||
{
|
||||
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
|
||||
|
||||
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
|
||||
|
||||
if ( myIsPointsLabeled )
|
||||
@ -1215,11 +1236,12 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
|
||||
myNodeExtActor->SetVisibility(false);
|
||||
vtkProperty *aProp = NULL, *aBackProp = NULL;
|
||||
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
|
||||
SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
|
||||
switch(myRepresentation){
|
||||
case ePoint:
|
||||
myPickableActor = myNodeActor;
|
||||
myNodeActor->SetVisibility(true);
|
||||
|
||||
aQuadraticMode = SMESH_Actor::eLines;
|
||||
aProp = aBackProp = myNodeProp;
|
||||
aReperesent = SMESH_DeviceActor::ePoint;
|
||||
break;
|
||||
@ -1238,6 +1260,11 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
|
||||
my2DActor->SetBackfaceProperty(aBackProp);
|
||||
my2DActor->SetRepresentation(aReperesent);
|
||||
|
||||
if(aQuadraticMode == SMESH_Actor::eLines)
|
||||
my2DActor->SetQuadraticArcMode(false);
|
||||
else if(aQuadraticMode == SMESH_Actor::eArcs)
|
||||
my2DActor->SetQuadraticArcMode(true);
|
||||
|
||||
my2DExtActor->SetRepresentation(aReperesent);
|
||||
|
||||
my3DActor->SetProperty(aProp);
|
||||
@ -1256,6 +1283,12 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
|
||||
break;
|
||||
}
|
||||
|
||||
if(aQuadraticMode == SMESH_Actor::eLines)
|
||||
my1DActor->SetQuadraticArcMode(false);
|
||||
else if(aQuadraticMode == SMESH_Actor::eArcs)
|
||||
my1DActor->SetQuadraticArcMode(true);
|
||||
|
||||
|
||||
my1DActor->SetProperty(aProp);
|
||||
my1DActor->SetBackfaceProperty(aBackProp);
|
||||
my1DActor->SetRepresentation(aReperesent);
|
||||
@ -1785,3 +1818,32 @@ void SMESH_ActorDef::UpdateScalarBar()
|
||||
myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
|
||||
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
|
||||
{
|
||||
switch(theMode) {
|
||||
case SMESH_Actor::eLines :
|
||||
myHighlitableActor->SetQuadraticArcMode(false);
|
||||
my2DActor->SetQuadraticArcMode(false);
|
||||
my1DActor->SetQuadraticArcMode(false);
|
||||
break;
|
||||
case SMESH_Actor::eArcs :
|
||||
myHighlitableActor->SetQuadraticArcMode(true);
|
||||
if(GetRepresentation() != SMESH_Actor::ePoint) {
|
||||
my2DActor->SetQuadraticArcMode(true);
|
||||
my1DActor->SetQuadraticArcMode(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
|
||||
{
|
||||
if(myHighlitableActor->GetQuadraticArcMode())
|
||||
return SMESH_Actor::eArcs;
|
||||
else
|
||||
return SMESH_Actor::eLines;
|
||||
}
|
||||
|
@ -75,9 +75,15 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
|
||||
enum EReperesent { ePoint, eEdge, eSurface};
|
||||
|
||||
enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
|
||||
|
||||
enum EQuadratic2DRepresentation { eLines = 0x01, eArcs = 0x02 };
|
||||
|
||||
virtual void SetEntityMode(unsigned int theMode) = 0;
|
||||
virtual unsigned int GetEntityMode() const = 0;
|
||||
|
||||
virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation) = 0;
|
||||
virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation() = 0;
|
||||
|
||||
virtual void SetPointRepresentation(bool theIsPointsVisible) = 0;
|
||||
virtual bool GetPointRepresentation() = 0;
|
||||
|
||||
|
@ -190,6 +190,10 @@ class SMESH_ActorDef : public SMESH_Actor
|
||||
|
||||
virtual void UpdateScalarBar();
|
||||
|
||||
|
||||
virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation);
|
||||
virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation();
|
||||
|
||||
protected:
|
||||
void SetControlMode(eControl theMode, bool theCheckEntityMode);
|
||||
void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
|
||||
|
@ -834,3 +834,29 @@ SMESH_DeviceActor
|
||||
myPolygonOffsetUnits = units;
|
||||
}
|
||||
|
||||
/*!
|
||||
* On/Off representation 2D quadratic element as arked polygon
|
||||
*/
|
||||
void SMESH_DeviceActor::SetQuadraticArcMode(bool theFlag){
|
||||
myGeomFilter->SetQuadraticArcMode(theFlag);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Return true if 2D quadratic element displayed as arked polygon
|
||||
*/
|
||||
bool SMESH_DeviceActor::GetQuadraticArcMode(){
|
||||
return myGeomFilter->GetQuadraticArcMode();
|
||||
}
|
||||
/*!
|
||||
* Set Max angle for representation 2D quadratic element as arked polygon
|
||||
*/
|
||||
void SMESH_DeviceActor::SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle){
|
||||
myGeomFilter->SetQuadraticArcAngle(theMaxAngle);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Return Max angle of the representation 2D quadratic element as arked polygon
|
||||
*/
|
||||
vtkFloatingPointType SMESH_DeviceActor::GetQuadraticArcAngle(){
|
||||
return myGeomFilter->GetQuadraticArcAngle();
|
||||
}
|
||||
|
@ -77,6 +77,14 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
|
||||
virtual void SetFacesOriented(bool theIsFacesOriented);
|
||||
virtual bool GetFacesOriented() { return myIsFacesOriented; }
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//! Setting for displaying quadratic elements
|
||||
virtual void SetQuadraticArcMode(bool theFlag);
|
||||
virtual bool GetQuadraticArcMode();
|
||||
|
||||
virtual void SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
|
||||
virtual vtkFloatingPointType GetQuadraticArcAngle();
|
||||
|
||||
void UpdateFaceOrientation();
|
||||
|
||||
vtkFloatingPointType GetShrinkFactor();
|
||||
|
@ -644,6 +644,14 @@
|
||||
case 215:
|
||||
anActor->SetRepresentation(SMESH_Actor::ePoint);
|
||||
break;
|
||||
case 231:
|
||||
if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eLines)
|
||||
anActor->SetQuadratic2DRepresentation(SMESH_Actor::eLines);
|
||||
break;
|
||||
case 232:
|
||||
if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eArcs)
|
||||
anActor->SetQuadratic2DRepresentation(SMESH_Actor::eArcs);
|
||||
break;
|
||||
case 1132:{
|
||||
vtkFloatingPointType color[3];
|
||||
anActor->GetSufaceColor(color[0], color[1], color[2]);
|
||||
@ -1443,6 +1451,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
::SetDisplayMode(theCommandID);
|
||||
break;
|
||||
|
||||
//2D quadratic representation
|
||||
case 231:
|
||||
case 232:
|
||||
::SetDisplayMode(theCommandID);
|
||||
break;
|
||||
|
||||
// Display Entity
|
||||
case 217: // Edges
|
||||
case 218: // Faces
|
||||
@ -2743,6 +2757,10 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
|
||||
createSMESHAction( 220, "ALL" );
|
||||
createSMESHAction( 221, "FACE_ORIENTATION", "", 0, true );
|
||||
|
||||
createSMESHAction( 231, "LINE_REPRESENTATION", "", 0, true );
|
||||
createSMESHAction( 232, "ARC_REPRESENTATION", "", 0, true );
|
||||
|
||||
createSMESHAction( 1100, "EDIT_HYPO" );
|
||||
createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 );
|
||||
createSMESHAction( 1102, "UNASSIGN" );
|
||||
@ -3270,6 +3288,21 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
popupMgr()->insert( separator(), -1, -1 );
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// Representation of the 2D Quadratic elements
|
||||
//-------------------------------------------------
|
||||
anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
|
||||
popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION
|
||||
popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
|
||||
popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
|
||||
|
||||
popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION
|
||||
popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
|
||||
popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
|
||||
|
||||
popupMgr()->insert( separator(), -1, -1 );
|
||||
|
||||
//-------------------------------------------------
|
||||
// Display / Erase
|
||||
//-------------------------------------------------
|
||||
@ -3469,6 +3502,25 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( dispmode, "strings", modes );
|
||||
setPreferenceProperty( dispmode, "indexes", indices );
|
||||
|
||||
int arcgroup = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), genTab );
|
||||
setPreferenceProperty( arcgroup, "columns", 2 );
|
||||
int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), arcgroup, LightApp_Preferences::Selector, "SMESH", "quadratic_mode" );
|
||||
QStringList quadraticModes;
|
||||
quadraticModes.append("Lines");
|
||||
quadraticModes.append("Arcs");
|
||||
indices.clear();
|
||||
indices.append( 0 );
|
||||
indices.append( 1 );
|
||||
setPreferenceProperty( quadraticmode, "strings", quadraticModes );
|
||||
setPreferenceProperty( quadraticmode, "indexes", indices );
|
||||
|
||||
int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), arcgroup, LightApp_Preferences::IntSpin,
|
||||
"SMESH", "max_angle" );
|
||||
setPreferenceProperty( maxAngle, "min", 1 );
|
||||
setPreferenceProperty( maxAngle, "max", 90 );
|
||||
|
||||
|
||||
|
||||
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
|
||||
setPreferenceProperty( exportgroup, "columns", 2 );
|
||||
addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
|
||||
|
@ -117,6 +117,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
|
||||
else if ( p=="isImported" ) val = QVariant( isImported( ind ) );
|
||||
else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
|
||||
else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
|
||||
else if ( p=="quadratic2DMode") val = QVariant(quadratic2DMode(ind));
|
||||
|
||||
if( val.isValid() )
|
||||
return val;
|
||||
@ -192,6 +193,24 @@ QString SMESHGUI_Selection::displayMode( int ind ) const
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : quadratic2DMode
|
||||
//purpose : return SMESH_Actor::EQuadratic2DRepresentation
|
||||
//=======================================================================
|
||||
QString SMESHGUI_Selection::quadratic2DMode( int ind ) const
|
||||
{
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
switch( actor->GetQuadratic2DRepresentation() ) {
|
||||
case SMESH_Actor::eLines: return "eLines";
|
||||
case SMESH_Actor::eArcs: return "eArcs";
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : shrinkMode
|
||||
//purpose : return either 'IsSrunk', 'IsNotShrunk' or 'IsNotShrinkable'
|
||||
@ -548,3 +567,4 @@ QString SMESHGUI_Selection::groupType( int ind ) const
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,8 @@ public:
|
||||
virtual QVariant hasReference( int ) const;
|
||||
virtual QVariant isVisible( int ) const;
|
||||
|
||||
virtual QString quadratic2DMode(int ) const;
|
||||
|
||||
// parameters got from actor return nothing if an actor is not visible
|
||||
virtual QList<QVariant> elemTypes( int ) const;
|
||||
virtual QList<QVariant> labeledTypes( int ) const;
|
||||
|
@ -549,6 +549,18 @@
|
||||
<source>MEN_SHADE</source>
|
||||
<translation>Shading</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_QUADRATIC_REPRESENT</source>
|
||||
<translation>2D Quadratic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_LINE_REPRESENTATION</source>
|
||||
<translation>Lines</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_ARC_REPRESENTATION</source>
|
||||
<translation>Arcs</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHOW</source>
|
||||
<translation>Show</translation>
|
||||
@ -2967,6 +2979,14 @@ Please, create VTK viewer and try again</translation>
|
||||
<source>PREF_DISPLAY_ENTITY</source>
|
||||
<translation>Display entity</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>QUADRATIC_REPRESENT_MODE</source>
|
||||
<translation>Representation of the 2D quadratic elements</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MAX_ARC_ANGLE</source>
|
||||
<translation>Maximum angle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_DISPLAY_MODE</source>
|
||||
<translation>Display mode</translation>
|
||||
|
Loading…
Reference in New Issue
Block a user