mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 03:30:36 +05:00
Fix for "0023306: [EDF 8444] Mesh controls behavior" issue.
This commit is contained in:
parent
b3cb4c5a57
commit
9341b16ef3
@ -988,28 +988,33 @@ SetControlMode( eControl theMode, bool theCheckEntityMode )
|
|||||||
|
|
||||||
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
|
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
|
||||||
vtkIdType aNbCells = aGrid->GetNumberOfCells();
|
vtkIdType aNbCells = aGrid->GetNumberOfCells();
|
||||||
|
bool aShowOnlyScalarBarTitle = false;
|
||||||
if(aNbCells){
|
if(aNbCells){
|
||||||
myControlMode = theMode;
|
myControlMode = theMode;
|
||||||
switch(myControlMode){
|
switch(myControlMode){
|
||||||
case eFreeNodes:
|
case eFreeNodes:
|
||||||
case eCoincidentNodes:
|
case eCoincidentNodes:
|
||||||
myNodeExtActor->SetExtControlMode(myFunctor);
|
myNodeExtActor->SetExtControlMode(myFunctor);
|
||||||
|
aShowOnlyScalarBarTitle = true;
|
||||||
break;
|
break;
|
||||||
case eFreeEdges:
|
case eFreeEdges:
|
||||||
case eFreeBorders:
|
case eFreeBorders:
|
||||||
case eCoincidentElems1D:
|
case eCoincidentElems1D:
|
||||||
my1DExtActor->SetExtControlMode(myFunctor);
|
my1DExtActor->SetExtControlMode(myFunctor);
|
||||||
|
aShowOnlyScalarBarTitle = true;
|
||||||
break;
|
break;
|
||||||
case eFreeFaces:
|
case eFreeFaces:
|
||||||
case eBareBorderFace:
|
case eBareBorderFace:
|
||||||
case eOverConstrainedFace:
|
case eOverConstrainedFace:
|
||||||
case eCoincidentElems2D:
|
case eCoincidentElems2D:
|
||||||
my2DExtActor->SetExtControlMode(myFunctor);
|
my2DExtActor->SetExtControlMode(myFunctor);
|
||||||
|
aShowOnlyScalarBarTitle = true;
|
||||||
break;
|
break;
|
||||||
case eBareBorderVolume:
|
case eBareBorderVolume:
|
||||||
case eOverConstrainedVolume:
|
case eOverConstrainedVolume:
|
||||||
case eCoincidentElems3D:
|
case eCoincidentElems3D:
|
||||||
my3DExtActor->SetExtControlMode(myFunctor);
|
my3DExtActor->SetExtControlMode(myFunctor);
|
||||||
|
aShowOnlyScalarBarTitle = true;
|
||||||
break;
|
break;
|
||||||
case eLength2D:
|
case eLength2D:
|
||||||
case eMultiConnection2D:
|
case eMultiConnection2D:
|
||||||
@ -1020,6 +1025,7 @@ SetControlMode( eControl theMode, bool theCheckEntityMode )
|
|||||||
myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
|
myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
|
||||||
UpdateDistribution();
|
UpdateDistribution();
|
||||||
}
|
}
|
||||||
|
myScalarBarActor->SetTitleOnlyVisibility(aShowOnlyScalarBarTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(theCheckEntityMode) {
|
if(theCheckEntityMode) {
|
||||||
@ -1057,6 +1063,9 @@ SetControlMode( eControl theMode, bool theCheckEntityMode )
|
|||||||
SetEntityMode(eVolumes);
|
SetEntityMode(eVolumes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QString aTitle = QString(myScalarBarActor->GetTitle());
|
||||||
|
aTitle.replace(QRegExp("(:\\s).*"),"\\1"+ QString::number(GetNumberControlEntities()));
|
||||||
|
myScalarBarActor->SetTitle(aTitle.toLatin1().constData());
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1081,6 +1090,34 @@ SetControlMode( eControl theMode, bool theCheckEntityMode )
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SMESH_ActorDef::
|
||||||
|
GetNumberControlEntities(){
|
||||||
|
SMESH_DeviceActor* anAct = NULL;
|
||||||
|
switch(myControlMode){
|
||||||
|
case eFreeNodes:
|
||||||
|
case eCoincidentNodes:
|
||||||
|
anAct = myNodeExtActor;
|
||||||
|
break;
|
||||||
|
case eFreeEdges:
|
||||||
|
case eFreeBorders:
|
||||||
|
case eCoincidentElems1D:
|
||||||
|
anAct = my1DExtActor;
|
||||||
|
break;
|
||||||
|
case eFreeFaces:
|
||||||
|
case eBareBorderFace:
|
||||||
|
case eOverConstrainedFace:
|
||||||
|
case eCoincidentElems2D:
|
||||||
|
anAct = my2DExtActor;
|
||||||
|
break;
|
||||||
|
case eBareBorderVolume:
|
||||||
|
case eOverConstrainedVolume:
|
||||||
|
case eCoincidentElems3D:
|
||||||
|
anAct = my3DExtActor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (anAct) ? anAct->GetUnstructuredGrid()->GetNumberOfCells() : -1;
|
||||||
|
}
|
||||||
|
|
||||||
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
|
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
|
||||||
|
|
||||||
@ -1424,10 +1461,10 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
|
|||||||
case eLength2D:
|
case eLength2D:
|
||||||
case eMultiConnection2D:
|
case eMultiConnection2D:
|
||||||
my1DExtActor->VisibilityOn();
|
my1DExtActor->VisibilityOn();
|
||||||
default:
|
break;
|
||||||
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
|
|
||||||
myScalarBarActor->VisibilityOn();
|
|
||||||
}
|
}
|
||||||
|
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
|
||||||
|
myScalarBarActor->VisibilityOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myRepresentation != ePoint)
|
if(myRepresentation != ePoint)
|
||||||
|
@ -150,6 +150,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
|
|||||||
virtual void SetControlMode(eControl theMode) = 0;
|
virtual void SetControlMode(eControl theMode) = 0;
|
||||||
virtual eControl GetControlMode() = 0;
|
virtual eControl GetControlMode() = 0;
|
||||||
virtual SMESH::Controls::FunctorPtr GetFunctor() = 0;
|
virtual SMESH::Controls::FunctorPtr GetFunctor() = 0;
|
||||||
|
virtual int GetNumberControlEntities() = 0;
|
||||||
|
|
||||||
virtual SMESH_ScalarBarActor* GetScalarBarActor() = 0;
|
virtual SMESH_ScalarBarActor* GetScalarBarActor() = 0;
|
||||||
|
|
||||||
|
@ -207,6 +207,7 @@ class SMESH_ActorDef : public SMESH_Actor
|
|||||||
virtual bool GetFacesOrientation3DVectors();
|
virtual bool GetFacesOrientation3DVectors();
|
||||||
|
|
||||||
virtual void SetControlMode(eControl theMode);
|
virtual void SetControlMode(eControl theMode);
|
||||||
|
virtual int GetNumberControlEntities();
|
||||||
virtual eControl GetControlMode(){ return myControlMode;}
|
virtual eControl GetControlMode(){ return myControlMode;}
|
||||||
virtual SMESH::Controls::FunctorPtr GetFunctor() { return myFunctor; }
|
virtual SMESH::Controls::FunctorPtr GetFunctor() { return myFunctor; }
|
||||||
|
|
||||||
|
@ -115,6 +115,9 @@ SMESH_ScalarBarActor::SMESH_ScalarBarActor() {
|
|||||||
|
|
||||||
// By default monocolor
|
// By default monocolor
|
||||||
myDistributionColoringType = SMESH_MONOCOLOR_TYPE;
|
myDistributionColoringType = SMESH_MONOCOLOR_TYPE;
|
||||||
|
|
||||||
|
// By default scalar map is shown
|
||||||
|
myTitleOnlyVisibility = false;
|
||||||
// rnv end
|
// rnv end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,19 +197,20 @@ int SMESH_ScalarBarActor::RenderOverlay(vtkViewport *viewport)
|
|||||||
{
|
{
|
||||||
renderedSomething += this->TitleActor->RenderOverlay(viewport);
|
renderedSomething += this->TitleActor->RenderOverlay(viewport);
|
||||||
}
|
}
|
||||||
this->ScalarBarActor->RenderOverlay(viewport);
|
if (!myTitleOnlyVisibility) {
|
||||||
this->myDistributionActor->RenderOverlay(viewport);
|
this->ScalarBarActor->RenderOverlay(viewport);
|
||||||
if( this->TextActors == NULL)
|
this->myDistributionActor->RenderOverlay(viewport);
|
||||||
{
|
if( this->TextActors == NULL)
|
||||||
vtkWarningMacro(<<"Need a mapper to render a scalar bar");
|
{
|
||||||
return renderedSomething;
|
vtkWarningMacro(<<"Need a mapper to render a scalar bar");
|
||||||
}
|
return renderedSomething;
|
||||||
|
}
|
||||||
for (i=0; i<this->NumberOfLabels; i++)
|
|
||||||
{
|
|
||||||
renderedSomething += this->TextActors[i]->RenderOverlay(viewport);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (i=0; i<this->NumberOfLabels; i++)
|
||||||
|
{
|
||||||
|
renderedSomething += this->TextActors[i]->RenderOverlay(viewport);
|
||||||
|
}
|
||||||
|
}
|
||||||
renderedSomething = (renderedSomething > 0)?(1):(0);
|
renderedSomething = (renderedSomething > 0)?(1):(0);
|
||||||
|
|
||||||
return renderedSomething;
|
return renderedSomething;
|
||||||
@ -574,7 +578,7 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport)
|
|||||||
|
|
||||||
// rnv begin
|
// rnv begin
|
||||||
// Customization of the vtkScalarBarActor to show distribution histogram.
|
// Customization of the vtkScalarBarActor to show distribution histogram.
|
||||||
if(myNbValues[i] && myDistributionColoringType == SMESH_MULTICOLOR_TYPE && GetDistributionVisibility() && distrVisibility)
|
if(myDistributionColoringType == SMESH_MULTICOLOR_TYPE && GetDistributionVisibility() && distrVisibility)
|
||||||
{
|
{
|
||||||
rgb = distColors->GetPointer(3*dcCount); //write into array directly
|
rgb = distColors->GetPointer(3*dcCount); //write into array directly
|
||||||
rgb[0] = rgba[0];
|
rgb[0] = rgba[0];
|
||||||
@ -920,3 +924,11 @@ void SMESH_ScalarBarActor::SetDistributionColor (double rgb[3]) {
|
|||||||
void SMESH_ScalarBarActor::GetDistributionColor (double rgb[3]) {
|
void SMESH_ScalarBarActor::GetDistributionColor (double rgb[3]) {
|
||||||
myDistributionActor->GetProperty()->GetColor(rgb);
|
myDistributionActor->GetProperty()->GetColor(rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMESH_ScalarBarActor::SetTitleOnlyVisibility( bool theTitleOnlyVisibility) {
|
||||||
|
myTitleOnlyVisibility = theTitleOnlyVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMESH_ScalarBarActor::GetTitleOnlyVisibility() {
|
||||||
|
return myTitleOnlyVisibility;
|
||||||
|
}
|
||||||
|
@ -192,7 +192,13 @@ class SMESHOBJECT_EXPORT SMESH_ScalarBarActor: public vtkActor2D {
|
|||||||
// Get Distribution Color
|
// Get Distribution Color
|
||||||
void GetDistributionColor (double rgb[3]);
|
void GetDistributionColor (double rgb[3]);
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Set visibility status of scalar map
|
||||||
|
void SetTitleOnlyVisibility( bool );
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Get visibility status of scalar map
|
||||||
|
bool GetTitleOnlyVisibility();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMESH_ScalarBarActor();
|
SMESH_ScalarBarActor();
|
||||||
@ -237,6 +243,7 @@ class SMESHOBJECT_EXPORT SMESH_ScalarBarActor: public vtkActor2D {
|
|||||||
vtkPolyDataMapper2D* myDistributionMapper; //Distribution mapper
|
vtkPolyDataMapper2D* myDistributionMapper; //Distribution mapper
|
||||||
std::vector<int> myNbValues; //Nb values for the range
|
std::vector<int> myNbValues; //Nb values for the range
|
||||||
int myDistributionColoringType; //Distribution color type (monocolor or multicolor)
|
int myDistributionColoringType; //Distribution color type (monocolor or multicolor)
|
||||||
|
bool myTitleOnlyVisibility; //Show scalar map or not
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_ScalarBarActor(const SMESH_ScalarBarActor&); // Not implemented.
|
SMESH_ScalarBarActor(const SMESH_ScalarBarActor&); // Not implemented.
|
||||||
|
@ -1668,6 +1668,9 @@ namespace
|
|||||||
if ( anActor->GetControlMode() != aControl )
|
if ( anActor->GetControlMode() != aControl )
|
||||||
anActor->SetControlMode( aControl );
|
anActor->SetControlMode( aControl );
|
||||||
QString functorName = functorToString( anActor->GetFunctor() );
|
QString functorName = functorToString( anActor->GetFunctor() );
|
||||||
|
int anEntitiesCount = anActor->GetNumberControlEntities();
|
||||||
|
if (anEntitiesCount >= 0)
|
||||||
|
functorName = functorName + ": " + QString::number(anEntitiesCount);
|
||||||
anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() );
|
anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() );
|
||||||
SMESH::RepaintCurrentView();
|
SMESH::RepaintCurrentView();
|
||||||
#ifndef DISABLE_PLOT2DVIEWER
|
#ifndef DISABLE_PLOT2DVIEWER
|
||||||
|
@ -63,6 +63,34 @@
|
|||||||
<source>AREA_ELEMENTS</source>
|
<source>AREA_ELEMENTS</source>
|
||||||
<translation>Area</translation>
|
<translation>Area</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FREE_NODES</source>
|
||||||
|
<translation>Free nodes</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FREE_EDGES</source>
|
||||||
|
<translation>Free edges</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FREE_FACES</source>
|
||||||
|
<translation>Free faces</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>BARE_BORDER_FACE</source>
|
||||||
|
<translation>Faces with bare border</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>OVER_CONSTRAINED_FACE</source>
|
||||||
|
<translation>Over-constrained faces</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>BARE_BORDER_VOLUME</source>
|
||||||
|
<translation>Volumes with bare border</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>OVER_CONSTRAINED_VOLUME</source>
|
||||||
|
<translation>Over-constrained volumes</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MIN_DIAG_ELEMENTS</source>
|
<source>MIN_DIAG_ELEMENTS</source>
|
||||||
<translation>Minimum diagonal</translation>
|
<translation>Minimum diagonal</translation>
|
||||||
|
Loading…
Reference in New Issue
Block a user