From 30f78ce5783d46a7697df6cd2237dce61e07a171 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 27 Dec 2004 11:58:51 +0000 Subject: [PATCH] Bug PAL7334 DEVELOPMENT : Control Improvement --- src/OBJECT/SMESH_Actor.cxx | 133 ++++++++++++---------------- src/OBJECT/SMESH_Actor.h | 2 +- src/OBJECT/SMESH_ActorDef.h | 4 - src/OBJECT/SMESH_DeviceActor.cxx | 10 +-- src/OBJECT/SMESH_DeviceActor.h | 8 +- src/SMESHGUI/SMESHGUI.cxx | 8 +- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 1 + src/SMESHGUI/SMESH_msg_en.po | 3 + 8 files changed, 74 insertions(+), 95 deletions(-) diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 7f52d9b3f..f29273b4c 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -285,7 +285,6 @@ SMESH_ActorDef::SMESH_ActorDef(){ myIO = NULL; myControlMode = eNone; - my1DColorMode = e1DNone; myControlActor = my2DActor; //Definition of myScalarBarActor @@ -624,7 +623,6 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled){ void SMESH_ActorDef::SetControlMode(eControl theMode){ myControlMode = eNone; - my1DColorMode = e1DNone; my1DActor->GetMapper()->SetScalarVisibility(false); my2DActor->GetMapper()->SetScalarVisibility(false); @@ -636,7 +634,7 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ if(anIsScalarVisible){ SMESH::Controls::FunctorPtr aFunctor; switch(theMode){ - case eLengthEdges: + case eLength: { SMESH::Controls::Length* aControl = new SMESH::Controls::Length(); aControl->SetPrecision( myControlsPrecision ); @@ -644,7 +642,7 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ myControlActor = my1DActor; break; } - case eLength: + case eLength2D: { aFunctor.reset(new SMESH::Controls::Length2D()); myControlActor = my2DActor; @@ -726,15 +724,15 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ vtkIdType aNbCells = aGrid->GetNumberOfCells(); if(aNbCells){ myControlMode = theMode; - if(theMode == eFreeBorders || theMode == eFreeEdges){ - my1DColorMode = e1DHighlited; + switch(myControlMode){ + case eFreeEdges: + case eFreeBorders: my1DExtActor->SetExtControlMode(aFunctor,myControlActor); - } else if (theMode == eLength){ - my1DColorMode = e1DColored; - my1DExtActor->SetLength2DControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable); - } else{ - if(myControlActor == my1DActor) - my1DColorMode = e1DColored; + break; + case eLength2D: + my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable); + break; + default: myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); } } @@ -993,58 +991,57 @@ void SMESH_ActorDef::SetVisibility(int theMode){ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ 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(theIsUpdateRepersentation) SetRepresentation(GetRepresentation()); - if(myControlMode != eNone){ - if(my1DColorMode == e1DHighlited || myControlMode == eLength) - my1DExtActor->VisibilityOn(); - else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) + switch(myControlMode){ + case eNone: + break; + case eFreeEdges: + case eFreeBorders: + my1DExtActor->VisibilityOn(); + break; + case eLength2D: + my1DExtActor->VisibilityOn(); + default: + if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) myScalarBarActor->VisibilityOn(); } if(myRepresentation != ePoint) myPickableActor->VisibilityOn(); - my1DActor->VisibilityOn(); - - my2DActor->VisibilityOn(); - my3DActor->VisibilityOn(); - + if(myEntityMode & eEdges) + my1DActor->VisibilityOn(); + + if(myEntityMode & eFaces) + my2DActor->VisibilityOn(); + + if(myEntityMode & eVolumes) + my3DActor->VisibilityOn(); + if(myIsPointsLabeled) myPointLabels->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(); } -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){ if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) @@ -1059,24 +1056,9 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){ if(!theMode) 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; + + SetVisibility(GetVisibility(),false); } void SMESH_ActorDef::SetRepresentation(int theMode){ @@ -1146,22 +1128,19 @@ void SMESH_ActorDef::SetRepresentation(int theMode){ my3DActor->SetRepresentation(aReperesent); my1DExtActor->SetVisibility(false); -// switch(my1DColorMode){ -// case e1DColored: -// aProp = aBackProp = my1DProp; -// if(myRepresentation != ePoint) -// aReperesent = SMESH_DeviceActor::eInsideframe; -// break; -// case e1DHighlited: -// my1DExtActor->SetVisibility(true); -// break; -// } - if (my1DColorMode == e1DColored){ + + switch(myControlMode){ + case eLength: + case eMultiConnection: aProp = aBackProp = my1DProp; if(myRepresentation != ePoint) aReperesent = SMESH_DeviceActor::eInsideframe; - } else if (my1DColorMode == e1DHighlited || myControlMode == eLength){ + break; + case eLength2D: + case eFreeEdges: + case eFreeBorders: my1DExtActor->SetVisibility(true); + break; } my1DActor->SetProperty(aProp); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 9ff838366..cb4921917 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -93,7 +93,7 @@ class SMESH_Actor: public SALOME_Actor virtual void SetCellsLabeled(bool theIsCellsLabeled) = 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, eAspectRatio3D}; virtual void SetControlMode(eControl theMode) = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 4a9577aa2..943fc5ee5 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -148,9 +148,6 @@ class SMESH_ActorDef : public SMESH_Actor{ virtual void SetControlMode(eControl theMode); virtual eControl GetControlMode(){ return myControlMode;} - enum e1DControl{e1DNone, e1DColored, e1DHighlited}; - e1DControl Get1DControlMode(){ return my1DColorMode;} - virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;} 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* myControlActor; - e1DControl my1DColorMode; vtkProperty* my1DProp; SMESH_DeviceActor* my1DActor; vtkProperty* my1DExtProp; diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 7713b0301..9670ad3d0 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -24,7 +24,7 @@ // File : SMESH_Actor.cxx // Author : Nicolas REJNERI // 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" @@ -260,10 +260,10 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, theScalarBarActor->SetVisibility(anIsInitialized); } -void SMESH_DeviceActor::SetLength2DControlMode(SMESH::Controls::FunctorPtr theFunctor, - SMESH_DeviceActor* theDeviceActor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable) +void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, + SMESH_DeviceActor* theDeviceActor, + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h index 87930f91c..90cd78943 100644 --- a/src/OBJECT/SMESH_DeviceActor.h +++ b/src/OBJECT/SMESH_DeviceActor.h @@ -94,10 +94,10 @@ class SMESH_DeviceActor: public vtkLODActor{ void SetControlMode(SMESH::Controls::FunctorPtr theFunctor, vtkScalarBarActor* theScalarBarActor, vtkLookupTable* theLookupTable); - void SetLength2DControlMode(SMESH::Controls::FunctorPtr theFunctor, - SMESH_DeviceActor* theDeviceActor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable); + void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, + SMESH_DeviceActor* theDeviceActor, + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable); void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, SMESH_DeviceActor* theDeviceActor); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index e62725065..f407960d4 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -545,11 +545,11 @@ namespace{ switch ( theCommandID ){ case 6001: aTitle = QObject::tr( "LENGTH_EDGES" ); - aControl = SMESH_Actor::eLengthEdges; + aControl = SMESH_Actor::eLength; break; case 6018: aTitle = QObject::tr( "LENGTH2D_EDGES" ); - aControl = SMESH_Actor::eLength; + aControl = SMESH_Actor::eLength2D; break; case 6002: aTitle = QObject::tr( "FREE_EDGES" ); @@ -2445,9 +2445,9 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString if ( mi && mi->popup() ) { SMESH_Actor::eControl cMode = anActor->GetControlMode(); switch ( cMode ) { - case SMESH_Actor::eLengthEdges: - mi->popup()->setItemChecked( 6001, true ); break; case SMESH_Actor::eLength: + mi->popup()->setItemChecked( 6001, true ); break; + case SMESH_Actor::eLength2D: mi->popup()->setItemChecked( 6018, true ); break; case SMESH_Actor::eFreeEdges: mi->popup()->setItemChecked( 6002, true ); diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 34c438840..fff798a30 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1286,6 +1286,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria( const int theType ) static QMap aCriteria; if ( aCriteria.isEmpty() ) { + aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" ); aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" ); aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" ); } diff --git a/src/SMESHGUI/SMESH_msg_en.po b/src/SMESHGUI/SMESH_msg_en.po index f608db365..a84e68a07 100644 --- a/src/SMESHGUI/SMESH_msg_en.po +++ b/src/SMESHGUI/SMESH_msg_en.po @@ -967,6 +967,9 @@ msgstr "Length" msgid "SMESHGUI_FilterTable::ASPECT_RATIO" msgstr "Aspect ratio" +msgid "SMESHGUI_FilterTable::ASPECT_RATIO_3D" +msgstr "Aspect ratio 3D" + msgid "SMESHGUI_FilterTable::WARPING" msgstr "Warping" -- 2.39.2