diff --git a/doc/salome/gui/SMESH/images/pref22.png b/doc/salome/gui/SMESH/images/pref22.png
index ff13403fb..f6a7b5978 100755
Binary files a/doc/salome/gui/SMESH/images/pref22.png and b/doc/salome/gui/SMESH/images/pref22.png differ
diff --git a/doc/salome/gui/SMESH/input/mesh_preferences.doc b/doc/salome/gui/SMESH/input/mesh_preferences.doc
index 80d751d6f..b93723a3e 100644
--- a/doc/salome/gui/SMESH/input/mesh_preferences.doc
+++ b/doc/salome/gui/SMESH/input/mesh_preferences.doc
@@ -156,6 +156,7 @@ later sessions with this module.
borders.
- Wireframe color - allows to select the color of borders of
elements in the wireframe mode.
+ - Preview color - allows to select the preview color of the elements.
- Size of 0D elements - specifies default size of 0D elements.
- Size of ball elements - specifies default size of discrete
elements (balls).
diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in
index 18ab16368..70bfd5226 100644
--- a/resources/SalomeApp.xml.in
+++ b/resources/SalomeApp.xml.in
@@ -34,6 +34,7 @@
+
diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx
index b2882117b..ec2a7c949 100644
--- a/src/OBJECT/SMESH_Actor.cxx
+++ b/src/OBJECT/SMESH_Actor.cxx
@@ -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);
}
diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h
index d412ac68a..c891d3cc8 100644
--- a/src/OBJECT/SMESH_ActorDef.h
+++ b/src/OBJECT/SMESH_ActorDef.h
@@ -259,9 +259,6 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* myOutLineProp;
vtkProperty* myPreselectProp;
- vtkProperty* myBallHighlightProp;
- vtkProperty* myBallPreselectProp;
-
SMESH_DeviceActor* myHighlitableActor;
eControl myControlMode;
diff --git a/src/OBJECT/SMESH_CellLabelActor.cxx b/src/OBJECT/SMESH_CellLabelActor.cxx
index 90d28e162..71add3460 100644
--- a/src/OBJECT/SMESH_CellLabelActor.cxx
+++ b/src/OBJECT/SMESH_CellLabelActor.cxx
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
#include
@@ -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);
diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx
index 562eaed73..4a46932cc 100644
--- a/src/OBJECT/SMESH_DeviceActor.cxx
+++ b/src/OBJECT/SMESH_DeviceActor.cxx
@@ -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
diff --git a/src/OBJECT/SMESH_DeviceActor.h b/src/OBJECT/SMESH_DeviceActor.h
index bcce5c974..e3c63a761 100644
--- a/src/OBJECT/SMESH_DeviceActor.h
+++ b/src/OBJECT/SMESH_DeviceActor.h
@@ -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();
diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx
index b4fcbf6db..466b9af64 100644
--- a/src/OBJECT/SMESH_Object.cxx
+++ b/src/OBJECT/SMESH_Object.cxx
@@ -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
#include
#include
-
+#include
#include
#include
@@ -279,7 +280,9 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
//MESSAGE(myGrid->GetReferenceCount());
//MESSAGE( "Update - myGrid->GetNumberOfCells() = "<GetNumberOfCells() );
//MESSAGE( "Update - myGrid->GetNumberOfPoints() = "<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(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();
diff --git a/src/OBJECT/SMESH_SVTKActor.cxx b/src/OBJECT/SMESH_SVTKActor.cxx
index de143a790..8d8f5a513 100644
--- a/src/OBJECT/SMESH_SVTKActor.cxx
+++ b/src/OBJECT/SMESH_SVTKActor.cxx
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
@@ -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;
+}
+
diff --git a/src/OBJECT/SMESH_SVTKActor.h b/src/OBJECT/SMESH_SVTKActor.h
index 08c47d3f4..e727181db 100644
--- a/src/OBJECT/SMESH_SVTKActor.h
+++ b/src/OBJECT/SMESH_SVTKActor.h
@@ -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();
diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx
index e3fb6fcd1..fe4352040 100644
--- a/src/SMESHGUI/SMESHGUI.cxx
+++ b/src/SMESHGUI/SMESHGUI.cxx
@@ -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 );
diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
index f198189ce..067f35b9b 100644
--- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
@@ -51,6 +51,10 @@
#include
#include
#include
+#include
+#include
+#include
+
// IDL incldues
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
@@ -65,6 +69,7 @@
#include
#include
#include
+#include
// Qt includes
#include
@@ -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 TVTKIds;
@@ -163,7 +196,7 @@ namespace SMESH
{
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
myGrid->SetPoints(aGrid->GetPoints());
- myGrid->Reset();
+ myGrid->Reset();
const std::vector& 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 :
diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h
index 1bc25cdb5..aa4bd8e20 100644
--- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h
+++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h
@@ -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();
diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx
index 652336eca..ab2a0743f 100644
--- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx
@@ -55,6 +55,8 @@
#include
+#include
+
// IDL includes
#include
#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 );
diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
index f426c5e1f..c1e63059d 100644
--- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx
@@ -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();
diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts
index e989562ed..3d5d74814 100644
--- a/src/SMESHGUI/SMESH_msg_en.ts
+++ b/src/SMESHGUI/SMESH_msg_en.ts
@@ -4302,6 +4302,10 @@ Please, create VTK viewer and try again
Surface color
+
+
+ Preview color
+
Show a computation result notification