Implementation of the "0022102: EDF 1496 SMESH : Displaying of discrete elements in SMESH relating to their attribute (diameter)" issue.

This commit is contained in:
rnv 2013-09-13 10:00:15 +00:00
parent 535d13a0f8
commit 519f45e495
17 changed files with 202 additions and 79 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -156,6 +156,7 @@ later sessions with this module.
borders.
- <b>Wireframe color</b> - allows to select the color of borders of
elements in the wireframe mode.
- <b>Preview color</b> - allows to select the preview color of the elements.
- <b>Size of 0D elements</b> - specifies default size of 0D elements.
- <b>Size of ball elements</b> - specifies default size of discrete
elements (balls).

View File

@ -34,6 +34,7 @@
<parameter name="node_color" value="255, 0, 0"/>
<parameter name="fill_color" value="#00aaff|100"/>
<parameter name="volume_color" value="255, 0, 170|-100"/>
<parameter name="preview_color" value="0, 255, 0|-100"/>
<parameter name="wireframe_color" value="0, 170, 255"/>
<parameter name="outline_color" value="#004600"/>
<parameter name="elem0d_color" value="0, 255, 0"/>

View File

@ -375,7 +375,6 @@ SMESH_ActorDef::SMESH_ActorDef()
my0DActor->SetProperty(my0DProp);
my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
aFilter = my0DActor->GetExtractUnstructuredGrid();
//aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_VERTEX);
@ -394,6 +393,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myBallActor->SetVisibility(false);
myBallActor->SetProperty(myBallProp);
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
myBallActor->SetBallEnabled(true);
aFilter = myBallActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
@ -474,11 +474,6 @@ SMESH_ActorDef::SMESH_ActorDef()
myHighlightProp->SetLineWidth(aLineWidth);
myHighlightProp->SetRepresentation(1);
myBallHighlightProp = vtkProperty::New();
myBallHighlightProp->DeepCopy(myHighlightProp);
myBallHighlightProp->SetPointSize(aBallElemSize);
myOutLineProp = vtkProperty::New();
myOutLineProp->SetAmbient(1.0);
myOutLineProp->SetDiffuse(0.0);
@ -498,10 +493,6 @@ SMESH_ActorDef::SMESH_ActorDef()
myPreselectProp->SetLineWidth(aLineWidth);
myPreselectProp->SetRepresentation(1);
myBallPreselectProp = vtkProperty::New();
myBallPreselectProp->DeepCopy(myPreselectProp);
myBallPreselectProp->SetPointSize(aBallElemSize);
myHighlitableActor = SMESH_DeviceActor::New();
myHighlitableActor->SetUserMatrix(aMatrix);
myHighlitableActor->PickableOff();
@ -602,9 +593,6 @@ SMESH_ActorDef::~SMESH_ActorDef()
myOutLineProp->Delete();
myPreselectProp->Delete();
myBallHighlightProp->Delete();
myBallPreselectProp->Delete();
myHighlitableActor->Delete();
my2DExtProp->Delete();
@ -678,8 +666,6 @@ void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int the
{
if(my3DActor) {
my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
SetRepresentation( GetRepresentation() );
myTimeStamp->Modified();
}
if(my2DActor) {
my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
@ -1094,8 +1080,6 @@ SetControlMode(eControl theMode,
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
//myHighlightActor->AddToRender(theRenderer);
theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor);
@ -1108,7 +1092,6 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
my1DActor ->AddToRender(theRenderer);
my0DActor ->AddToRender(theRenderer);
myBallActor ->AddToRender(theRenderer);
//theRenderer->AddActor(my0DExtActor);
theRenderer->AddActor(myHighlitableActor);
@ -1157,6 +1140,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myVisualObj = theVisualObj;
myVisualObj->Update(theIsClear);
SMESH_SVTKActor::SafeDownCast(myHighlightActor)->SetVisualObject(myVisualObj);
SMESH_SVTKActor::SafeDownCast(myPreHighlightActor)->SetVisualObject(myVisualObj);
myNodeActor->Init(myVisualObj,myImplicitBoolean);
myBaseActor->Init(myVisualObj,myImplicitBoolean);
@ -1559,7 +1545,6 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
if (myEntityMode & eBallElem) {
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
aHightFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
}
if (myEntityMode & eEdges) {
@ -1638,9 +1623,9 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
if (theMode < 0) {
myRepresentation = eSurface;
if (!aNbFaces && !aNbVolumes && aNbEdges) {
if (!aNbFaces && !aNbVolumes && !aNbBalls && aNbEdges) {
myRepresentation = eEdge;
} else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
} else if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNbBalls) {
myRepresentation = ePoint;
}
} else {
@ -1710,17 +1695,13 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
my3DActor->SetBackfaceProperty(aPropVR);
my3DActor->SetRepresentation(aReperesent);
//my0DExtActor->SetVisibility(false);
my1DExtActor->SetVisibility(false);
my2DExtActor->SetVisibility(false);
my3DExtActor->SetVisibility(false);
// ???
//my0DActor->SetProperty(aProp);
//my0DActor->SetBackfaceProperty(aBackProp);
my0DActor->SetRepresentation(aReperesent);
myBallActor->SetRepresentation(aReperesent);
//my0DExtActor->SetRepresentation(aReperesent);
switch(myControlMode){
case eLength:
@ -1770,7 +1751,6 @@ bool SMESH_ActorDef::GetPointRepresentation(){
void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetHighlited(false);
myHighlitableActor->SetVisibility(false);
bool anIsVisible = GetVisibility();
switch(myRepresentation){
@ -1779,12 +1759,9 @@ void SMESH_ActorDef::UpdateHighlight(){
{
if(myIsHighlighted) {
myHighlitableActor->SetProperty(myHighlightProp);
myBallActor->SetProperty(myBallHighlightProp);
}else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp);
myBallActor->SetProperty(myBallPreselectProp);
} else if(anIsVisible){
myBallActor->SetProperty(myBallProp);
(myRepresentation == eSurface) ?
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
}
@ -2042,7 +2019,6 @@ void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b){
void SMESH_ActorDef::SetHighlightColor(double r,double g,double b){
myHighlightProp->SetColor(r,g,b);
myBallHighlightProp->SetColor(r,g,b);
Modified();
}
@ -2052,7 +2028,6 @@ void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b){
void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b){
myPreselectProp->SetColor(r,g,b);
myBallPreselectProp->SetColor(r,g,b);
Modified();
}
@ -2111,8 +2086,7 @@ double SMESH_ActorDef::Get0DSize(){
void SMESH_ActorDef::SetBallSize(double theVal){
myBallProp->SetPointSize(theVal);
myBallHighlightProp->SetPointSize(theVal);
myBallPreselectProp->SetPointSize(theVal);
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
aCustom->SetBallSize(theVal);
}

View File

@ -259,9 +259,6 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* myOutLineProp;
vtkProperty* myPreselectProp;
vtkProperty* myBallHighlightProp;
vtkProperty* myBallPreselectProp;
SMESH_DeviceActor* myHighlitableActor;
eControl myControlMode;

View File

@ -27,6 +27,7 @@
#include <VTKViewer_TransformFilter.h>
#include <VTKViewer_CellCenters.h>
#include <VTKViewer_ExtractUnstructuredGrid.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
@ -152,7 +153,9 @@ void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) {
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues(aNbElem);
for(int anId = 0; anId < aNbElem; anId++){
int aSMDSId = myVisualObj->GetElemObjId(anId);
vtkIdType id = myExtractUnstructuredGrid->GetInputId(anId);
id = (id >=0) ? id : anId;
int aSMDSId = myVisualObj->GetElemObjId(id);
anArray->SetValue(anId,aSMDSId);
}
aDataSet->GetCellData()->SetScalars(anArray);

View File

@ -228,6 +228,11 @@ SMESH_DeviceActor
myExtractUnstructuredGrid->SetInputData(theGrid);
myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
//Pass diameters of the balls
if(myMapper->GetBallEnabled()) {
myMergeFilter->SetScalarsConnection(myExtractUnstructuredGrid->GetOutputPort());
}
myExtractGeometry->SetInputConnection(myMergeFilter->GetOutputPort());
@ -935,6 +940,14 @@ void SMESH_DeviceActor::SetMarkerEnabled( bool theMarkerEnabled )
myMapper->SetMarkerEnabled( theMarkerEnabled );
}
/*!
* Set point marker enabled
* \param theBallEnabled flag to enable/disable ball drawing
*/
void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
myMapper->SetBallEnabled( theBallEnabled );
}
/*!
* Set standard point marker
* \param theMarkerType type of the marker

View File

@ -144,6 +144,7 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
void SetMarkerEnabled( bool );
void SetBallEnabled( bool );
void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
void SetMarkerTexture( int, VTK::MarkerTexture );
VTK::MarkerType GetMarkerType();

View File

@ -30,6 +30,7 @@
#include "SMDS_Mesh.hxx"
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
#include "SMDS_BallElement.hxx"
#include "SMESH_Actor.h"
#include "SMESH_ControlsDef.hxx"
#include "SalomeApp_Application.h"
@ -43,7 +44,7 @@
#include <vtkIdList.h>
#include <vtkCellArray.h>
#include <vtkUnsignedCharArray.h>
#include <vtkCellData.h>
#include <vtkUnstructuredGrid.h>
#include <memory>
@ -279,7 +280,9 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
//MESSAGE(myGrid->GetReferenceCount());
//MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
//MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints() );
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"buildPrs.vtu" );
if( MYDEBUGWITHFILES ) {
SMESH::WriteUnstructuredGrid( myGrid,"myPrs.vtu" );
}
}
}
@ -417,7 +420,13 @@ void SMESH_VisualObjDef::buildElemPrs()
aConnect.reserve(VTK_CELL_SIZE);
SMDS_Mesh::CheckMemory(); // PAL16631
bool hasBalls = nbEnts[ SMDSAbs_Ball ] > 0;
vtkDataArray* aScalars = 0;
if(hasBalls) {
aScalars = vtkDataArray::CreateDataArray(VTK_DOUBLE);
aScalars->SetNumberOfComponents(1);
aScalars->SetNumberOfTuples(aNbCells);
}
for ( int i = 0; i < nbTypes; i++ ) // iterate through all types of elements
{
if ( nbEnts[ aTypes[ i ] ] > 0 ) {
@ -475,8 +484,19 @@ void SMESH_VisualObjDef::buildElemPrs()
}
}
}
aConnectivity->InsertNextCell( anIdList );
vtkIdType aCurId = aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( vtkElemType );
//Store diameters of the balls
if(aScalars) {
double aDiam = 0;
if(aType == SMDSAbs_Ball) {
if (const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>(anElem) ) {
aDiam = ball->GetDiameter();
}
}
aScalars->SetTuple(aCurId,&aDiam);
}
iElem++;
}
@ -497,6 +517,7 @@ void SMESH_VisualObjDef::buildElemPrs()
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
myGrid->GetCellData()->SetScalars(aScalars);
aCellLocationsArray->Delete();
aCellTypesArray->Delete();

View File

@ -39,6 +39,7 @@
#include <vtkCell.h>
#include <vtkDataSetMapper.h>
#include <vtkPolyhedron.h>
#include <vtkCellData.h>
#include <Utils_SALOME_Exception.hxx>
@ -53,6 +54,7 @@ SMESH_SVTKActor::SMESH_SVTKActor():
{
my0DActor = SVTK_DeviceActor::New();
myBallActor = SVTK_DeviceActor::New();
myBallActor->SetBallEnabled(true);
myBallActor->SetResolveCoincidentTopology(false);
myBallActor->SetCoincident3DAllowed(true);
@ -121,8 +123,18 @@ SMESH_SVTKActor
SVTK::CopyPoints( GetSource(), aSourceDataSet );
SVTK::CopyPoints( myBallGrid, aSourceDataSet );
SVTK::CopyPoints( my0DGrid, aSourceDataSet );
int aNbOfParts = theMapIndex.Extent();
vtkCellData* cd = 0;
vtkCellData* outputCD = 0;
//Copy deamaters of the balls
if(myVisualObj) {
outputCD = myBallGrid->GetCellData();
cd = aSourceDataSet->GetCellData();
}
outputCD->CopyAllocate(cd,aNbOfParts,aNbOfParts/2);
for(int ind = 1; ind <= aNbOfParts; ind++){
int aPartId = theMapIndex( ind );
if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
@ -132,7 +144,10 @@ SMESH_SVTKActor
if(aCell->GetCellType() == VTK_VERTEX ) {
my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
} else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
vtkIdType newCellId = myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
if(myVisualObj) {
outputCD->CopyData(cd, myVisualObj->GetElemVTKId(aPartId), newCellId);
}
} else {
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
}
@ -182,3 +197,7 @@ void SMESH_SVTKActor::SetBallSize(float theSize) {
myBallActor->GetProperty()->SetPointSize(theSize);
}
void SMESH_SVTKActor::SetVisualObject(TVisualObjPtr theVisualObj) {
myVisualObj = theVisualObj;
}

View File

@ -68,12 +68,15 @@ public:
void
RemoveFromRender(vtkRenderer* theRendere);
void SetVisualObject(TVisualObjPtr theVisualObj);
protected:
SVTK_DeviceActor* my0DActor;
SVTK_DeviceActor* myBallActor;
vtkUnstructuredGrid* my0DGrid;
vtkUnstructuredGrid* myBallGrid;
TVisualObjPtr myVisualObj;
SMESH_SVTKActor();
virtual ~SMESH_SVTKActor();

View File

@ -4994,6 +4994,7 @@ void SMESHGUI::createPreferences()
addPreference( tr( "PREF_BALL_COLOR" ), elemGroup, LightApp_Preferences::Color, "SMESH", "ball_elem_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" );
addPreference( tr( "PREF_PREVIEW_COLOR" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "preview_color" );
int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab );

View File

@ -51,6 +51,10 @@
#include <SalomeApp_Application.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <VTKViewer_PolyDataMapper.h>
#include <SVTK_Renderer.h>
#include <Qtx.h>
// IDL incldues
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
@ -65,6 +69,7 @@
#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkCellData.h>
// Qt includes
#include <QComboBox>
@ -95,6 +100,10 @@ namespace SMESH
SALOME_Actor* myPreviewActor;
vtkDataSetMapper* myMapper;
vtkUnstructuredGrid* myGrid;
SALOME_Actor* myBallActor;
VTKViewer_PolyDataMapper* myBallMapper;
vtkPolyData* myBallPolyData;
SALOME_Actor* myFaceOrientation;
vtkPolyDataMapper* myFaceOrientationDataMapper;
@ -120,16 +129,18 @@ namespace SMESH
myPreviewActor->VisibilityOff();
myPreviewActor->SetMapper(myMapper);
double anRGB[3];
QColor ffc, bfc;
int delta;
vtkProperty* aProp = vtkProperty::New();
GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
SMESH::GetColor( "SMESH", "preview_color", ffc, delta, "0, 255, 0|-100" ) ;
aProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
myPreviewActor->SetProperty( aProp );
aProp->Delete();
vtkProperty* aBackProp = vtkProperty::New();
GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
aBackProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
bfc = Qtx::mainColorToSecondary(ffc, delta);
aBackProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
myPreviewActor->SetBackfaceProperty( aBackProp );
aBackProp->Delete();
@ -148,12 +159,34 @@ namespace SMESH
myFaceOrientation->SetMapper(myFaceOrientationDataMapper);
vtkProperty* anOrientationProp = vtkProperty::New();
double anRGB[3];
GetColor( "SMESH", "orientation_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
anOrientationProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
myFaceOrientation->SetProperty( anOrientationProp );
anOrientationProp->Delete();
myVTKViewWindow->AddActor(myFaceOrientation);
// Preview for the balls
vtkProperty* aBallProp = vtkProperty::New();
aBallProp->SetColor(ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255.);
double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
aBallProp->SetPointSize(aBallElemSize);
myBallPolyData = vtkPolyData::New();
myBallPolyData->Allocate();
myBallMapper = VTKViewer_PolyDataMapper::New();
myBallMapper->SetInputData(myBallPolyData);
myBallMapper->SetBallEnabled(true);
myBallActor = SALOME_Actor::New();
myBallActor->PickableOff();
myBallActor->SetVisibility(false);
myBallActor->SetProperty(aBallProp);
myBallActor->SetMapper(myBallMapper);
aBallProp->Delete();
myVTKViewWindow->AddActor(myBallActor);
}
typedef std::vector<vtkIdType> TVTKIds;
@ -163,7 +196,7 @@ namespace SMESH
{
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
myGrid->SetPoints(aGrid->GetPoints());
myGrid->Reset();
myGrid->Reset();
const std::vector<int>& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( theType ));
SMDS_MeshCell::applyInterlace( interlace, theIds );
@ -177,36 +210,68 @@ namespace SMESH
myGrid->Modified();
SetVisibility(true, theActor->GetFacesOriented());
SetVisibility(true, theActor->GetFacesOriented(), false);
}
void SetBallPosition(SMESH_Actor* theActor,TVTKIds& theIds, double theDiameter) {
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
myBallPolyData->Reset();
myBallPolyData->DeleteCells();
myBallPolyData->SetPoints(aGrid->GetPoints());
vtkDataArray* aScalars = vtkDataArray::CreateDataArray(VTK_DOUBLE);
aScalars->SetNumberOfComponents(1);
aScalars->SetNumberOfTuples(theIds.size());
myBallPolyData->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
void SetVisibility (bool theVisibility, bool theShowOrientation = false)
vtkIdList *anIds = vtkIdList::New();
anIds->SetNumberOfIds(1);
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++){
anIds->InsertId(0,theIds[i]);
vtkIdType anId = myBallPolyData->InsertNextCell(VTK_POLY_VERTEX,anIds);
double d = theDiameter;
aScalars->SetTuple(anId,&d);
anIds->Reset();
}
anIds->Delete();
myBallPolyData->Modified();
SetVisibility (false, false, true);
}
void SetVisibility (bool theVisibility, bool theShowOrientation = false, bool theShowBalls = false)
{
myPreviewActor->SetVisibility(theVisibility);
myFaceOrientation->SetVisibility(theShowOrientation);
myBallActor->SetVisibility(theShowBalls);
RepaintCurrentView();
}
~TElementSimulation()
{
myMapper->RemoveAllInputs();
myFaceOrientationDataMapper->RemoveAllInputs();
myBallMapper->RemoveAllInputs();
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) {
myVTKViewWindow->RemoveActor(myPreviewActor);
myVTKViewWindow->RemoveActor(myFaceOrientation);
myVTKViewWindow->RemoveActor(myPreviewActor,false,false);
myVTKViewWindow->RemoveActor(myFaceOrientation,false,false);
myVTKViewWindow->RemoveActor(myBallActor,false,false);
}
myMapper->Delete();
myGrid->Delete();
myPreviewActor->Delete();
myFaceOrientationFilter->Delete();
myFaceOrientationDataMapper->Delete();
myFaceOrientation->Delete();
myMapper->RemoveAllInputs();
myMapper->Delete();
myFaceOrientationFilter->Delete();
myFaceOrientationDataMapper->RemoveAllInputs();
myFaceOrientationDataMapper->Delete();
myGrid->Delete();
myBallMapper->Delete();
myBallPolyData->Delete();
myBallActor->Delete();
}
};
}
@ -363,6 +428,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theMo
DiameterSpinBox->RangeStepAndValidator( 1e-7, 1e+9, 0.1 );
DiameterSpinBox->SetValue( 1. );
connect( DiameterSpinBox, SIGNAL( valueChanged ( double ) ), this, SLOT( onDiameterChanged( ) ) );
}
/* Add to group ************************************************/
GroupGroups = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), this );
@ -578,9 +644,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
mySelector->ClearIndex();
mySelectionMgr->setSelectedObjects( aList, false );
SMESH::UpdateView();
mySimulation->SetVisibility(false);
SMESH::UpdateView();
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
@ -608,7 +674,6 @@ void SMESHGUI_AddMeshElementDlg::ClickOnOk()
//=================================================================================
void SMESHGUI_AddMeshElementDlg::reject()
{
//mySelectionMgr->clearSelected();
mySimulation->SetVisibility(false);
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
@ -808,7 +873,11 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation()
}
vtkIdType aType = SMDS_MeshCell::toVtkType( myGeomType );
mySimulation->SetPosition(myActor,aType,anIds);
if(aType == VTK_POLY_VERTEX) {
mySimulation->SetBallPosition(myActor,anIds,DiameterSpinBox->GetValue());
} else {
mySimulation->SetPosition(myActor,aType,anIds);
}
SMESH::UpdateView();
}
}
@ -905,6 +974,14 @@ void SMESHGUI_AddMeshElementDlg::keyPressEvent( QKeyEvent* e )
}
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
void SMESHGUI_AddMeshElementDlg::onDiameterChanged(){
displaySimulation();
}
//=================================================================================
// function : isValid
// purpose :

View File

@ -64,7 +64,6 @@ namespace SMESH
class SMESHGUI_EXPORT SMESHGUI_AddMeshElementDlg : public QDialog
{
Q_OBJECT
public:
SMESHGUI_AddMeshElementDlg( SMESHGUI*, SMDSAbs_EntityType = SMDSEntity_Edge );
~SMESHGUI_AddMeshElementDlg();
@ -119,6 +118,7 @@ private:
protected slots:
virtual void reject();
void onDiameterChanged();
private slots:
void ClickOnOk();

View File

@ -55,6 +55,8 @@
#include <SalomeApp_Application.h>
#include <Qtx.h>
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
@ -146,17 +148,19 @@ namespace SMESH
myPreviewActor->PickableOff();
myPreviewActor->VisibilityOff();
myPreviewActor->SetMapper(myMapper);
QColor ffc, bfc;
int delta;
vtkProperty* myProp = vtkProperty::New();
double aRGB[3], aBackRGB[3];
GetColor( "SMESH", "fill_color", aRGB[0], aRGB[1], aRGB[2], QColor( 0, 170, 255 ) );
myProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
SMESH::GetColor( "SMESH", "preview_color", ffc, delta, "0, 255, 0|-100" ) ;
myProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
myPreviewActor->SetProperty( myProp );
myProp->Delete();
vtkProperty* myBackProp = vtkProperty::New();
GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) );
myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] );
bfc = Qtx::mainColorToSecondary(ffc, delta);
myBackProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
myPreviewActor->SetBackfaceProperty( myBackProp );
myBackProp->Delete();
@ -175,6 +179,7 @@ namespace SMESH
myFaceOrientation->SetMapper(myFaceOrientationDataMapper);
vtkProperty* anOrientationProp = vtkProperty::New();
double aRGB[3];
GetColor( "SMESH", "orientation_color", aRGB[0], aRGB[1], aRGB[2], QColor( 255, 255, 255 ) );
anOrientationProp->SetColor( aRGB[0], aRGB[1], aRGB[2] );
myFaceOrientation->SetProperty( anOrientationProp );

View File

@ -141,17 +141,20 @@ void SMESH::OrientedPlane::Init()
myActor->SetInfinitive(true);
myActor->SetMapper(myMapper);
double anRGB[3];
QColor ffc, bfc;
int delta;
SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "255, 170, 0|-100" ) ;
vtkProperty* aProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "255, 170, 0|-100" ) ;
aProp->SetColor(ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255.);
aProp->SetOpacity(0.75);
myActor->SetProperty(aProp);
aProp->Delete();
vtkProperty* aBackProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
bfc = Qtx::mainColorToSecondary(ffc, delta);
aBackProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255.);
aBackProp->SetOpacity(0.75);
myActor->SetBackfaceProperty(aBackProp);
aBackProp->Delete();

View File

@ -4302,6 +4302,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_FILL</source>
<translation>Surface color</translation>
</message>
<message>
<source>PREF_PREVIEW_COLOR</source>
<translation>Preview color</translation>
</message>
<message>
<source>PREF_NOTIFY_MODE</source>
<translation>Show a computation result notification</translation>