mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
PR: Merge V1_2c - step 1
This commit is contained in:
parent
1cbc894787
commit
23ceb9c5ca
@ -72,6 +72,8 @@ SMESH_Actor::SMESH_Actor()
|
|||||||
EdgeShrinkDevice->VisibilityOff();
|
EdgeShrinkDevice->VisibilityOff();
|
||||||
EdgeShrinkDevice->PickableOff();
|
EdgeShrinkDevice->PickableOff();
|
||||||
|
|
||||||
|
DataSource = NULL;
|
||||||
|
|
||||||
myIO = NULL;
|
myIO = NULL;
|
||||||
myName = "";
|
myName = "";
|
||||||
myDisplayMode = 0;
|
myDisplayMode = 0;
|
||||||
|
@ -130,6 +130,7 @@ using namespace std;
|
|||||||
#include "VTKViewer_ViewFrame.h"
|
#include "VTKViewer_ViewFrame.h"
|
||||||
#include <vtkLegendBoxActor.h>
|
#include <vtkLegendBoxActor.h>
|
||||||
#include <vtkFeatureEdges.h>
|
#include <vtkFeatureEdges.h>
|
||||||
|
#include <vtkDoubleArray.h>
|
||||||
|
|
||||||
|
|
||||||
// Open CASCADE Includes
|
// Open CASCADE Includes
|
||||||
@ -1316,8 +1317,10 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
|
|||||||
case 0 : {
|
case 0 : {
|
||||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||||
if (ac->getDisplayMode()==2) {
|
if (ac->getDisplayMode()==2) {
|
||||||
|
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
|
||||||
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
||||||
meshMapper->SetInput(ac->DataSource);
|
meshMapper->SetInput(ac->DataSource);
|
||||||
|
meshMapper->SetScalarVisibility(isColored); //SAL3899
|
||||||
}
|
}
|
||||||
ac->setDisplayMode(0);
|
ac->setDisplayMode(0);
|
||||||
ac->GetProperty()->SetRepresentationToWireframe();
|
ac->GetProperty()->SetRepresentationToWireframe();
|
||||||
@ -1328,8 +1331,10 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
|
|||||||
case 1 : {
|
case 1 : {
|
||||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||||
if (ac->getDisplayMode()==2) {
|
if (ac->getDisplayMode()==2) {
|
||||||
|
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
|
||||||
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
||||||
meshMapper->SetInput(ac->DataSource);
|
meshMapper->SetInput(ac->DataSource);
|
||||||
|
meshMapper->SetScalarVisibility(isColored); //SAL3899
|
||||||
}
|
}
|
||||||
ac->setDisplayMode(1);
|
ac->setDisplayMode(1);
|
||||||
ac->GetProperty()->SetRepresentationToSurface();
|
ac->GetProperty()->SetRepresentationToSurface();
|
||||||
@ -1342,13 +1347,14 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
|
|||||||
// ChangeRepresentation(ac, 1);
|
// ChangeRepresentation(ac, 1);
|
||||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||||
ac->setDisplayMode(2);
|
ac->setDisplayMode(2);
|
||||||
|
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
|
||||||
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
||||||
meshMapper->SetInput(ac->DataSource);
|
|
||||||
vtkShrinkFilter *shrink = vtkShrinkFilter::New();
|
vtkShrinkFilter *shrink = vtkShrinkFilter::New();
|
||||||
shrink->SetInput(meshMapper->GetInput());
|
shrink->SetInput(ac->DataSource);
|
||||||
shrink->SetShrinkFactor(ac->GetShrinkFactor());
|
shrink->SetShrinkFactor(ac->GetShrinkFactor());
|
||||||
|
|
||||||
meshMapper->SetInput( shrink->GetOutput() );
|
meshMapper->SetInput( shrink->GetOutput() );
|
||||||
|
meshMapper->SetScalarVisibility(isColored); //SAL3899
|
||||||
ac->SetMapper( meshMapper );
|
ac->SetMapper( meshMapper );
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
// }
|
// }
|
||||||
@ -1418,6 +1424,7 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
|
|||||||
ac->SetNodeSize(aDlg->GetIntValue(2)) ;
|
ac->SetNodeSize(aDlg->GetIntValue(2)) ;
|
||||||
|
|
||||||
if (ac->getDisplayMode()==2) {
|
if (ac->getDisplayMode()==2) {
|
||||||
|
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
|
||||||
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
|
||||||
meshMapper->SetInput(ac->DataSource);
|
meshMapper->SetInput(ac->DataSource);
|
||||||
vtkShrinkFilter *shrink = vtkShrinkFilter::New();
|
vtkShrinkFilter *shrink = vtkShrinkFilter::New();
|
||||||
@ -1425,6 +1432,7 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
|
|||||||
shrink->SetShrinkFactor(ac->GetShrinkFactor());
|
shrink->SetShrinkFactor(ac->GetShrinkFactor());
|
||||||
|
|
||||||
meshMapper->SetInput( shrink->GetOutput() );
|
meshMapper->SetInput( shrink->GetOutput() );
|
||||||
|
meshMapper->SetScalarVisibility(isColored); //SAL3899
|
||||||
ac->SetMapper( meshMapper );
|
ac->SetMapper( meshMapper );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4535,9 +4543,7 @@ void SMESHGUI::Control(int theCommandID)
|
|||||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||||
DisplayScalarBar( false );
|
DisplayScalarBar( false );
|
||||||
|
|
||||||
// mpv porting vtk 4.2.2
|
vtkDoubleArray *scalars = vtkDoubleArray::New();
|
||||||
// vtkScalars *scalars = vtkScalars::New();
|
|
||||||
vtkIntArray *scalars = vtkIntArray::New();
|
|
||||||
scalars->SetNumberOfComponents(1);
|
scalars->SetNumberOfComponents(1);
|
||||||
|
|
||||||
vtkDataSetMapper* meshMapper = 0;
|
vtkDataSetMapper* meshMapper = 0;
|
||||||
@ -4553,140 +4559,60 @@ void SMESHGUI::Control(int theCommandID)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValidateScalars = false;
|
vtkDataSet* aDataSet = MeshActor->DataSource;
|
||||||
if ( result ) {
|
typedef double (*TScalarFun)(vtkCell* theCell);
|
||||||
|
TScalarFun aScalarFun;
|
||||||
|
if(result){
|
||||||
QString type;
|
QString type;
|
||||||
switch (theCommandID)
|
switch (theCommandID){
|
||||||
{
|
case 6001: {
|
||||||
case 6001: //Length Edges
|
type = tr( "SMESH_CONTROL_LENGTH_EDGES");
|
||||||
{
|
aDataSet = MeshActor->EdgeDevice->GetMapper()->GetInput();
|
||||||
type = tr( "SMESH_CONTROL_LENGTH_EDGES");
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::LengthEdges);
|
||||||
meshMapper = (vtkDataSetMapper*)MeshActor->EdgeDevice->GetMapper();
|
MESSAGE ( " init minimum length " << aDataSet->GetNumberOfCells() );
|
||||||
vtkUnstructuredGrid* grid = (vtkUnstructuredGrid*)meshMapper->GetInput();
|
if(MeshActor->getDisplayMode() != 0)
|
||||||
MESSAGE ( " init minimum length " << grid->GetNumberOfCells() )
|
ChangeRepresentation( MeshActor, 1);// limitation; in Wireframe, colored edges are not visible
|
||||||
for (int i=0; i<grid->GetNumberOfCells(); i++ ) {
|
break;
|
||||||
vtkCell* cell = grid->GetCell(i);
|
}
|
||||||
float len = SMESHGUI_ComputeScalarValue::LengthEdges(cell);
|
case 6011: {
|
||||||
if (len == 0) continue;
|
type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
|
||||||
else {
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::AreaElements);
|
||||||
ValidateScalars = true;
|
if(MeshActor->getDisplayMode() != 1)
|
||||||
// mpv porting vtk 4.2.2
|
ChangeRepresentation( MeshActor, 1 );
|
||||||
// scalars->InsertScalar(i,len);
|
break;
|
||||||
scalars->InsertTuple1(i,len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ValidateScalars && (MeshActor->getDisplayMode()!=0))
|
|
||||||
ChangeRepresentation( MeshActor, 1 );// limitation; in Wireframe, colored edges are not visible
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6011: // Area Elements
|
|
||||||
{
|
|
||||||
type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
|
|
||||||
for (int i=0; i< MeshActor->GetMapper()->GetInput()->GetNumberOfCells(); i++ ) {
|
|
||||||
vtkCell* cell = MeshActor->GetMapper()->GetInput()->GetCell(i);
|
|
||||||
float area = SMESHGUI_ComputeScalarValue::AreaElements(cell);
|
|
||||||
if (area == 0) continue;
|
|
||||||
else {
|
|
||||||
ValidateScalars = true;
|
|
||||||
// mpv porting vtk 4.2.2
|
|
||||||
// scalars->InsertScalar(i,area);
|
|
||||||
scalars->InsertTuple1(i,area);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
|
|
||||||
ChangeRepresentation( MeshActor, 1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6012: // Taper
|
|
||||||
{
|
|
||||||
type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
|
|
||||||
for (int i=0; i< MeshActor->DataSource->GetNumberOfCells(); i++ ) {
|
|
||||||
vtkCell* cell = MeshActor->DataSource->GetCell(i);
|
|
||||||
float taper = SMESHGUI_ComputeScalarValue::Taper(cell);
|
|
||||||
if (taper == 0) continue;
|
|
||||||
else {
|
|
||||||
ValidateScalars = true;
|
|
||||||
// mpv porting vtk 4.2.2
|
|
||||||
// scalars->InsertScalar(i,taper);
|
|
||||||
scalars->InsertTuple1(i,taper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6013: // Aspect ratio
|
|
||||||
{
|
|
||||||
type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
|
|
||||||
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
|
|
||||||
vtkCell* cell = MeshActor->DataSource->GetCell(i);
|
|
||||||
float aspect = SMESHGUI_ComputeScalarValue::AspectRatio(cell);
|
|
||||||
if (aspect == 0) continue;
|
|
||||||
else {
|
|
||||||
ValidateScalars = true;
|
|
||||||
// mpv porting vtk 4.2.2
|
|
||||||
// scalars->InsertScalar(i,aspect);
|
|
||||||
scalars->InsertTuple1(i,aspect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
|
|
||||||
ChangeRepresentation( MeshActor, 1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6014: // Minimum angle
|
|
||||||
{
|
|
||||||
type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
|
|
||||||
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
|
|
||||||
vtkCell* cell = MeshActor->DataSource->GetCell(i);
|
|
||||||
float angle = SMESHGUI_ComputeScalarValue::MinimumAngle(cell);
|
|
||||||
if (angle == 0) continue;
|
|
||||||
else {
|
|
||||||
ValidateScalars = true;
|
|
||||||
// mpv porting vtk 4.2.2
|
|
||||||
// scalars->InsertScalar(i,angle);
|
|
||||||
scalars->InsertTuple1(i,angle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
|
|
||||||
ChangeRepresentation( MeshActor, 1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6015: // Warp
|
|
||||||
{
|
|
||||||
type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
|
|
||||||
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
|
|
||||||
vtkCell* cell = MeshActor->DataSource->GetCell(i);
|
|
||||||
float Warp = SMESHGUI_ComputeScalarValue::Warp(cell);
|
|
||||||
if (Warp == 0) continue;
|
|
||||||
else {
|
|
||||||
ValidateScalars = true;
|
|
||||||
// mpv porting vtk 4.2.2
|
|
||||||
// scalars->InsertScalar(i,Warp);
|
|
||||||
scalars->InsertTuple1(i,Warp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6016: // Skew
|
|
||||||
{
|
|
||||||
type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
|
|
||||||
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
|
|
||||||
vtkCell* cell = MeshActor->DataSource->GetCell(i);
|
|
||||||
float angle = SMESHGUI_ComputeScalarValue::Skew(cell);
|
|
||||||
if (angle == 0) continue;
|
|
||||||
else {
|
|
||||||
ValidateScalars = true;
|
|
||||||
// mpv porting vtk 4.2.2
|
|
||||||
// scalars->InsertScalar(i,angle);
|
|
||||||
scalars->InsertTuple1(i,angle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !ValidateScalars ) {
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
case 6012: {
|
||||||
|
type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
|
||||||
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::Taper);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6013: {
|
||||||
|
type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
|
||||||
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::AspectRatio);
|
||||||
|
if(MeshActor->getDisplayMode() != 1)
|
||||||
|
ChangeRepresentation( MeshActor, 1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6014: {
|
||||||
|
type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
|
||||||
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::MinimumAngle);
|
||||||
|
if(MeshActor->getDisplayMode() != 1)
|
||||||
|
ChangeRepresentation( MeshActor, 1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6015: {
|
||||||
|
type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
|
||||||
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::Warp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6016: {
|
||||||
|
type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
|
||||||
|
aScalarFun = &(SMESHGUI_ComputeScalarValue::Skew);
|
||||||
|
break;
|
||||||
|
}}
|
||||||
|
|
||||||
|
for(int i = 0, iEnd = aDataSet->GetNumberOfCells(); i < iEnd; i++)
|
||||||
|
scalars->InsertTuple1(i,aScalarFun(aDataSet->GetCell(i)));
|
||||||
|
|
||||||
float range[2];
|
float range[2];
|
||||||
scalars->GetRange(range);
|
scalars->GetRange(range);
|
||||||
@ -4699,7 +4625,7 @@ void SMESHGUI::Control(int theCommandID)
|
|||||||
|
|
||||||
if (!meshMapper) meshMapper = (vtkDataSetMapper*) (MeshActor->getMapper());
|
if (!meshMapper) meshMapper = (vtkDataSetMapper*) (MeshActor->getMapper());
|
||||||
meshMapper->SetScalarModeToUseCellData();
|
meshMapper->SetScalarModeToUseCellData();
|
||||||
meshMapper->GetInput()->GetCellData()->SetScalars(scalars);
|
MeshActor->DataSource->GetCellData()->SetScalars(scalars);
|
||||||
meshMapper->SetScalarRange( range );
|
meshMapper->SetScalarRange( range );
|
||||||
meshMapper->ScalarVisibilityOn();
|
meshMapper->ScalarVisibilityOn();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user