Bug PAL7334

DEVELOPMENT : Control Improvement
This commit is contained in:
apo 2004-12-27 11:58:51 +00:00
parent 212f14870c
commit 30f78ce578
8 changed files with 74 additions and 95 deletions

View File

@ -285,7 +285,6 @@ SMESH_ActorDef::SMESH_ActorDef(){
myIO = NULL; myIO = NULL;
myControlMode = eNone; myControlMode = eNone;
my1DColorMode = e1DNone;
myControlActor = my2DActor; myControlActor = my2DActor;
//Definition of myScalarBarActor //Definition of myScalarBarActor
@ -624,7 +623,6 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled){
void SMESH_ActorDef::SetControlMode(eControl theMode){ void SMESH_ActorDef::SetControlMode(eControl theMode){
myControlMode = eNone; myControlMode = eNone;
my1DColorMode = e1DNone;
my1DActor->GetMapper()->SetScalarVisibility(false); my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false); my2DActor->GetMapper()->SetScalarVisibility(false);
@ -636,7 +634,7 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
if(anIsScalarVisible){ if(anIsScalarVisible){
SMESH::Controls::FunctorPtr aFunctor; SMESH::Controls::FunctorPtr aFunctor;
switch(theMode){ switch(theMode){
case eLengthEdges: case eLength:
{ {
SMESH::Controls::Length* aControl = new SMESH::Controls::Length(); SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
aControl->SetPrecision( myControlsPrecision ); aControl->SetPrecision( myControlsPrecision );
@ -644,7 +642,7 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
myControlActor = my1DActor; myControlActor = my1DActor;
break; break;
} }
case eLength: case eLength2D:
{ {
aFunctor.reset(new SMESH::Controls::Length2D()); aFunctor.reset(new SMESH::Controls::Length2D());
myControlActor = my2DActor; myControlActor = my2DActor;
@ -726,15 +724,15 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
vtkIdType aNbCells = aGrid->GetNumberOfCells(); vtkIdType aNbCells = aGrid->GetNumberOfCells();
if(aNbCells){ if(aNbCells){
myControlMode = theMode; myControlMode = theMode;
if(theMode == eFreeBorders || theMode == eFreeEdges){ switch(myControlMode){
my1DColorMode = e1DHighlited; case eFreeEdges:
case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor); my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
} else if (theMode == eLength){ break;
my1DColorMode = e1DColored; case eLength2D:
my1DExtActor->SetLength2DControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable); my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
} else{ break;
if(myControlActor == my1DActor) default:
my1DColorMode = e1DColored;
myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
} }
} }
@ -993,58 +991,57 @@ void SMESH_ActorDef::SetVisibility(int theMode){
void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
SALOME_Actor::SetVisibility(theMode); SALOME_Actor::SetVisibility(theMode);
myNodeActor->VisibilityOff();
myBaseActor->VisibilityOff();
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
my2DActor->VisibilityOff();
my3DActor->VisibilityOff();
myScalarBarActor->VisibilityOff();
myPointLabels->VisibilityOff();
myCellsLabels->VisibilityOff();
if(GetVisibility()){ if(GetVisibility()){
if(theIsUpdateRepersentation) if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation()); SetRepresentation(GetRepresentation());
if(myControlMode != eNone){ switch(myControlMode){
if(my1DColorMode == e1DHighlited || myControlMode == eLength) case eNone:
my1DExtActor->VisibilityOn(); break;
else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) case eFreeEdges:
case eFreeBorders:
my1DExtActor->VisibilityOn();
break;
case eLength2D:
my1DExtActor->VisibilityOn();
default:
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn(); myScalarBarActor->VisibilityOn();
} }
if(myRepresentation != ePoint) if(myRepresentation != ePoint)
myPickableActor->VisibilityOn(); myPickableActor->VisibilityOn();
my1DActor->VisibilityOn(); if(myEntityMode & eEdges)
my1DActor->VisibilityOn();
my2DActor->VisibilityOn(); if(myEntityMode & eFaces)
my3DActor->VisibilityOn(); my2DActor->VisibilityOn();
if(myEntityMode & eVolumes)
my3DActor->VisibilityOn();
if(myIsPointsLabeled) myPointLabels->VisibilityOn(); if(myIsPointsLabeled) myPointLabels->VisibilityOn();
if(myIsCellsLabeled) myCellsLabels->VisibilityOn(); if(myIsCellsLabeled) myCellsLabels->VisibilityOn();
}else{
myNodeActor->VisibilityOff();
myBaseActor->VisibilityOff();
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
my2DActor->VisibilityOff();
my3DActor->VisibilityOff();
myScalarBarActor->VisibilityOff();
myPointLabels->VisibilityOff();
myCellsLabels->VisibilityOff();
} }
Modified(); Modified();
} }
namespace{
inline bool UpdateEntityMode(unsigned int& theOutputMode,
unsigned int theInputMode,
unsigned int theMode,
int theCondition)
{
if(!theCondition)
theOutputMode &= ~theMode;
return theOutputMode & theMode && theCondition;
}
}
void SMESH_ActorDef::SetEntityMode(unsigned int theMode){ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
@ -1059,24 +1056,9 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
if(!theMode) if(!theMode)
return; return;
myScalarBarActor->VisibilityOff();
my1DExtActor->VisibilityOff();
my1DActor->VisibilityOff();
my2DActor->VisibilityOff();
my3DActor->VisibilityOff();
if(theMode & eEdges)
my1DActor->VisibilityOn();
if(theMode & eFaces)
my2DActor->VisibilityOn();
if(theMode & eVolumes)
my3DActor->VisibilityOn();
myEntityMode = theMode; myEntityMode = theMode;
SetVisibility(GetVisibility(),false);
} }
void SMESH_ActorDef::SetRepresentation(int theMode){ void SMESH_ActorDef::SetRepresentation(int theMode){
@ -1146,22 +1128,19 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
my3DActor->SetRepresentation(aReperesent); my3DActor->SetRepresentation(aReperesent);
my1DExtActor->SetVisibility(false); my1DExtActor->SetVisibility(false);
// switch(my1DColorMode){
// case e1DColored: switch(myControlMode){
// aProp = aBackProp = my1DProp; case eLength:
// if(myRepresentation != ePoint) case eMultiConnection:
// aReperesent = SMESH_DeviceActor::eInsideframe;
// break;
// case e1DHighlited:
// my1DExtActor->SetVisibility(true);
// break;
// }
if (my1DColorMode == e1DColored){
aProp = aBackProp = my1DProp; aProp = aBackProp = my1DProp;
if(myRepresentation != ePoint) if(myRepresentation != ePoint)
aReperesent = SMESH_DeviceActor::eInsideframe; aReperesent = SMESH_DeviceActor::eInsideframe;
} else if (my1DColorMode == e1DHighlited || myControlMode == eLength){ break;
case eLength2D:
case eFreeEdges:
case eFreeBorders:
my1DExtActor->SetVisibility(true); my1DExtActor->SetVisibility(true);
break;
} }
my1DActor->SetProperty(aProp); my1DActor->SetProperty(aProp);

View File

@ -93,7 +93,7 @@ class SMESH_Actor: public SALOME_Actor
virtual void SetCellsLabeled(bool theIsCellsLabeled) = 0; virtual void SetCellsLabeled(bool theIsCellsLabeled) = 0;
virtual bool GetCellsLabeled() = 0; virtual bool GetCellsLabeled() = 0;
enum eControl{eNone, eLengthEdges, eLength, eFreeBorders, eFreeEdges, eMultiConnection, enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew, eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
eAspectRatio3D}; eAspectRatio3D};
virtual void SetControlMode(eControl theMode) = 0; virtual void SetControlMode(eControl theMode) = 0;

View File

@ -148,9 +148,6 @@ class SMESH_ActorDef : public SMESH_Actor{
virtual void SetControlMode(eControl theMode); virtual void SetControlMode(eControl theMode);
virtual eControl GetControlMode(){ return myControlMode;} virtual eControl GetControlMode(){ return myControlMode;}
enum e1DControl{e1DNone, e1DColored, e1DHighlited};
e1DControl Get1DControlMode(){ return my1DColorMode;}
virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;} virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane); virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
@ -189,7 +186,6 @@ class SMESH_ActorDef : public SMESH_Actor{
SMESH_DeviceActor* my3DActor; SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor; SMESH_DeviceActor* myControlActor;
e1DControl my1DColorMode;
vtkProperty* my1DProp; vtkProperty* my1DProp;
SMESH_DeviceActor* my1DActor; SMESH_DeviceActor* my1DActor;
vtkProperty* my1DExtProp; vtkProperty* my1DExtProp;

View File

@ -24,7 +24,7 @@
// File : SMESH_Actor.cxx // File : SMESH_Actor.cxx
// Author : Nicolas REJNERI // Author : Nicolas REJNERI
// Module : SMESH // Module : SMESH
// $Header$Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_DeviceActor.cxx,v 1.5.2.1 2004/12/23 10:31:24 apo Exp $ // $Header$Header$
#include "SMESH_DeviceActor.h" #include "SMESH_DeviceActor.h"
@ -260,10 +260,10 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
theScalarBarActor->SetVisibility(anIsInitialized); theScalarBarActor->SetVisibility(anIsInitialized);
} }
void SMESH_DeviceActor::SetLength2DControlMode(SMESH::Controls::FunctorPtr theFunctor, void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor, SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable) vtkLookupTable* theLookupTable)
{ {
bool anIsInitialized = theFunctor; bool anIsInitialized = theFunctor;

View File

@ -94,10 +94,10 @@ class SMESH_DeviceActor: public vtkLODActor{
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable); vtkLookupTable* theLookupTable);
void SetLength2DControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor, SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable); vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor); SMESH_DeviceActor* theDeviceActor);

View File

@ -545,11 +545,11 @@ namespace{
switch ( theCommandID ){ switch ( theCommandID ){
case 6001: case 6001:
aTitle = QObject::tr( "LENGTH_EDGES" ); aTitle = QObject::tr( "LENGTH_EDGES" );
aControl = SMESH_Actor::eLengthEdges; aControl = SMESH_Actor::eLength;
break; break;
case 6018: case 6018:
aTitle = QObject::tr( "LENGTH2D_EDGES" ); aTitle = QObject::tr( "LENGTH2D_EDGES" );
aControl = SMESH_Actor::eLength; aControl = SMESH_Actor::eLength2D;
break; break;
case 6002: case 6002:
aTitle = QObject::tr( "FREE_EDGES" ); aTitle = QObject::tr( "FREE_EDGES" );
@ -2445,9 +2445,9 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
if ( mi && mi->popup() ) { if ( mi && mi->popup() ) {
SMESH_Actor::eControl cMode = anActor->GetControlMode(); SMESH_Actor::eControl cMode = anActor->GetControlMode();
switch ( cMode ) { switch ( cMode ) {
case SMESH_Actor::eLengthEdges:
mi->popup()->setItemChecked( 6001, true ); break;
case SMESH_Actor::eLength: case SMESH_Actor::eLength:
mi->popup()->setItemChecked( 6001, true ); break;
case SMESH_Actor::eLength2D:
mi->popup()->setItemChecked( 6018, true ); break; mi->popup()->setItemChecked( 6018, true ); break;
case SMESH_Actor::eFreeEdges: case SMESH_Actor::eFreeEdges:
mi->popup()->setItemChecked( 6002, true ); mi->popup()->setItemChecked( 6002, true );

View File

@ -1286,6 +1286,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
static QMap<int, QString> aCriteria; static QMap<int, QString> aCriteria;
if ( aCriteria.isEmpty() ) if ( aCriteria.isEmpty() )
{ {
aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" );
aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" ); aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" ); aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
} }

View File

@ -967,6 +967,9 @@ msgstr "Length"
msgid "SMESHGUI_FilterTable::ASPECT_RATIO" msgid "SMESHGUI_FilterTable::ASPECT_RATIO"
msgstr "Aspect ratio" msgstr "Aspect ratio"
msgid "SMESHGUI_FilterTable::ASPECT_RATIO_3D"
msgstr "Aspect ratio 3D"
msgid "SMESHGUI_FilterTable::WARPING" msgid "SMESHGUI_FilterTable::WARPING"
msgstr "Warping" msgstr "Warping"