Issue 0020613: EDF 1106 : Modify Node Marker in SMESH and VISU

This commit is contained in:
ouv 2010-03-25 13:55:29 +00:00
parent c3b2640450
commit 4d33eed28b
20 changed files with 509 additions and 94 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -0,0 +1,35 @@
/*!
\page colors_size_page Colors / Size
\image html colors_size.png
Using this dialog you can define the following set of mesh visualization
parameters:
<ul>
<li><b>Elements</b></li>
<ul>
<li><b>Fill</b> - color of surface of elements (seen in Shading mode).</li>
<li><b>Back Face</b> - color of interior surface of elements.</li>
<li><b>Outline</b> - color of borders of elements.</li>
<li><b>0D slements</b> - color of 0D elements.</li>
<li><b>Size of 0D slements</b> - size of 0D elements.</li>
<li><b>Width</b> - width of lines (edges and borders of elements).</li>
<li><b>Shrink coef.</b> - relative space of elements compared to gaps between
them in shrink mode.</li>
</ul>
<li><b>Nodes</b></li>
<ul>
<li><b>Color</b> - color of nodes.</li>
<li><b>Marker</b> - group of options allowing to change the representation of
points (see \subpage point_marker_page "Point Marker" page).</li>
</ul>
<li><b>Orientation of faces</b></li>
<ul>
<li><b>Color</b> - color of orientation vertors.</li>
<li><b>Scale</b> - size of orientation vectors.</li>
<li><b>3D vectors</b> - allows to choose between 2D planar and 3D vectors.</li>
</ul>
</ul>
*/

View File

@ -0,0 +1,53 @@
/*!
\page point_marker_page Point Marker
\n You can change the representation of points in
the 3D viewer either by selecting one of the predefined
shapes or by loading a custom texture from an external file.
- Standard point markers
The Mesh module provides a set of predefined point marker shapes
which can be used to display points in 3D viewer.
Each standard point marker has two attributes: type (defines shape
form) and scale factor (defines shape size).
\image html point_marker_widget1.png
<br>
\image html std_point_marker.png "Mesh presentation with standard point markers"
- Custom point markers
It is also possible to load a point marker shape from an external file.
This file should provide a description of the point texture as a set
of lines; each line is represented as sequence of "0" and "1" symbols,
where "1" symbol means an opaque pixel and "0" symbol means a
transparent pixel. The width of the texture correspond to the length
of the longest line in the file, expanded to the nearest byte-aligned
value. The height of the texture is equal to the number of non-empty
lines in the file. Note that missing symbols are replaced by "0".
Here is a texture file sample:
<pre>
00111100
00111100
11111111
11111111
11111111
11111111
00111100
00111100
</pre>
\image html point_marker_widget2.png
<br>
\image html custom_point_marker.png "Mesh presentation with custom point markers"
*/

View File

@ -40,7 +40,7 @@ of quadratic edges as broken <b>lines</b> or as <b>arcs</b></li>
faces of the selected mesh. Vector is shown for each 2D mesh element faces of the selected mesh. Vector is shown for each 2D mesh element
and for each free face of 3D mesh element. Vector direction is calculated by and for each free face of 3D mesh element. Vector direction is calculated by
the first three nodes of face as a cross product of vectors n1-n2 and n1-n3.</li> the first three nodes of face as a cross product of vectors n1-n2 and n1-n3.</li>
<li><b>Colors / Size</b> - allows to select color and size of <li>\subpage colors_size_page "Colors / Size" - allows to select color and size of
meshes.</li> meshes.</li>
<li>\subpage transparency_page "Transparency" - allows to change the <li>\subpage transparency_page "Transparency" - allows to change the
transparency of mesh elements.</li> transparency of mesh elements.</li>

View File

@ -33,7 +33,8 @@
<parameter name="backface_color" value="0, 0, 255"/> <parameter name="backface_color" value="0, 0, 255"/>
<parameter name="elem0d_color" value="0, 255, 0"/> <parameter name="elem0d_color" value="0, 255, 0"/>
<parameter name="highlight_color" value="0, 255, 255"/> <parameter name="highlight_color" value="0, 255, 255"/>
<parameter name="node_size" value="3" /> <parameter name="type_of_marker" value="1" />
<parameter name="marker_scale" value="9" />
<parameter name="elem0d_size" value="5" /> <parameter name="elem0d_size" value="5" />
<parameter name="element_width" value="1" /> <parameter name="element_width" value="1" />
<parameter name="shrink_coeff" value="75"/> <parameter name="shrink_coeff" value="75"/>

View File

@ -86,7 +86,6 @@ static int MYDEBUG = 0;
#endif #endif
static int aLineWidthInc = 2; static int aLineWidthInc = 2;
static int aPointSizeInc = 2;
SMESH_ActorDef* SMESH_ActorDef::New(){ SMESH_ActorDef* SMESH_ActorDef::New(){
@ -129,7 +128,6 @@ SMESH_ActorDef::SMESH_ActorDef()
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) ) if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1); myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
@ -224,7 +222,7 @@ SMESH_ActorDef::SMESH_ActorDef()
my1DProp = vtkProperty::New(); my1DProp = vtkProperty::New();
my1DProp->DeepCopy(myEdgeProp); my1DProp->DeepCopy(myEdgeProp);
my1DProp->SetLineWidth(aLineWidth + aLineWidthInc); my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
my1DProp->SetPointSize(aPointSize); my1DProp->SetPointSize(aElem0DSize);
my1DExtProp = vtkProperty::New(); my1DExtProp = vtkProperty::New();
my1DExtProp->DeepCopy(myEdgeProp); my1DExtProp->DeepCopy(myEdgeProp);
@ -233,7 +231,7 @@ SMESH_ActorDef::SMESH_ActorDef()
anRGB[2] = 1 - anRGB[2]; anRGB[2] = 1 - anRGB[2];
my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc); my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
my1DExtProp->SetPointSize(aPointSize + aPointSizeInc); my1DExtProp->SetPointSize(aElem0DSize);
my1DExtActor = SMESH_DeviceActor::New(); my1DExtActor = SMESH_DeviceActor::New();
my1DExtActor->SetUserMatrix(aMatrix); my1DExtActor->SetUserMatrix(aMatrix);
@ -294,7 +292,6 @@ SMESH_ActorDef::SMESH_ActorDef()
myNodeProp = vtkProperty::New(); myNodeProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) ); SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myNodeProp->SetPointSize(aPointSize);
myNodeActor = SMESH_DeviceActor::New(); myNodeActor = SMESH_DeviceActor::New();
myNodeActor->SetUserMatrix(aMatrix); myNodeActor->SetUserMatrix(aMatrix);
@ -312,7 +309,6 @@ SMESH_ActorDef::SMESH_ActorDef()
anRGB[1] = 1 - anRGB[1]; anRGB[1] = 1 - anRGB[1];
anRGB[2] = 1 - anRGB[2]; anRGB[2] = 1 - anRGB[2];
myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myNodeExtProp->SetPointSize(aPointSize);
myNodeExtActor = SMESH_DeviceActor::New(); myNodeExtActor = SMESH_DeviceActor::New();
myNodeExtActor->SetUserMatrix(aMatrix); myNodeExtActor->SetUserMatrix(aMatrix);
@ -342,8 +338,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myHighlightProp->SetSpecular(0.0); myHighlightProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) ); SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
//myHighlightProp->SetPointSize(aPointSize); myHighlightProp->SetPointSize(aElem0DSize); // ??
myHighlightProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
myHighlightProp->SetRepresentation(1); myHighlightProp->SetRepresentation(1);
myPreselectProp = vtkProperty::New(); myPreselectProp = vtkProperty::New();
@ -352,8 +347,7 @@ SMESH_ActorDef::SMESH_ActorDef()
myPreselectProp->SetSpecular(0.0); myPreselectProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) ); SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
//myPreselectProp->SetPointSize(aPointSize); myPreselectProp->SetPointSize(aElem0DSize); // ??
myPreselectProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
myPreselectProp->SetRepresentation(1); myPreselectProp->SetRepresentation(1);
myHighlitableActor = SMESH_DeviceActor::New(); myHighlitableActor = SMESH_DeviceActor::New();
@ -1012,6 +1006,10 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) ) if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
SetIsDisplayNameActor( true ); SetIsDisplayNameActor( true );
int aMarkerType = mgr->integerValue( "SMESH", "type_of_marker", 1 ); // dot
int aMarkerScale = mgr->integerValue( "SMESH", "marker_scale", 9 ); // 5 pixels
SetMarkerStd( (VTK::MarkerType)aMarkerType, (VTK::MarkerScale)aMarkerScale );
myTimeStamp->Modified(); myTimeStamp->Modified();
Modified(); Modified();
return true; return true;
@ -1219,15 +1217,15 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
my0DActor->VisibilityOn(); my0DActor->VisibilityOn();
} }
if(myEntityMode & eEdges){ if(myEntityMode & eEdges && GetRepresentation() != ePoint){
my1DActor->VisibilityOn(); my1DActor->VisibilityOn();
} }
if(myEntityMode & eFaces){ if(myEntityMode & eFaces && GetRepresentation() != ePoint){
my2DActor->VisibilityOn(); my2DActor->VisibilityOn();
} }
if(myEntityMode & eVolumes){ if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
my3DActor->VisibilityOn(); my3DActor->VisibilityOn();
} }
@ -1508,6 +1506,12 @@ void SMESH_ActorDef::UpdateHighlight(){
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myHighlitableActor->SetVisibility(anIsVisible); myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
VTK::MarkerType aMarkerType = GetMarkerType();
if(aMarkerType != VTK::MT_USER)
myHighlitableActor->SetMarkerStd(aMarkerType, GetMarkerScale());
else
myHighlitableActor->SetMarkerTexture(GetMarkerTexture(), myMarkerTexture);
} }
} }
} }
@ -1712,35 +1716,8 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
} }
void SMESH_ActorDef::SetNodeSize(vtkFloatingPointType theVal){
myNodeProp->SetPointSize(theVal);
myNodeExtProp->SetPointSize(theVal);
vtkFloatingPointType aPointSize = my0DProp->GetPointSize() > theVal ? my0DProp->GetPointSize() : theVal;
//myHighlightProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(aPointSize); // ??
//myPreselectProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(aPointSize); // ??
my1DProp->SetPointSize(theVal + aPointSizeInc);
my1DExtProp->SetPointSize(theVal + aPointSizeInc);
Modified();
}
vtkFloatingPointType SMESH_ActorDef::GetNodeSize(){
return myNodeProp->GetPointSize();
}
void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){ void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
my0DProp->SetPointSize(theVal); my0DProp->SetPointSize(theVal);
vtkFloatingPointType aPointSize = myNodeProp->GetPointSize() > theVal ? myNodeProp->GetPointSize() : theVal;
//myHighlightProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(aPointSize); // ??
//myPreselectProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(aPointSize); // ??
Modified(); Modified();
} }
@ -2049,3 +2026,18 @@ SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresenta
else else
return SMESH_Actor::eLines; return SMESH_Actor::eLines;
} }
void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
{
SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
}
void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
{
SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor
}

View File

@ -72,9 +72,6 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual vtkFloatingPointType GetLineWidth() = 0; virtual vtkFloatingPointType GetLineWidth() = 0;
virtual void SetLineWidth(vtkFloatingPointType theVal) = 0; virtual void SetLineWidth(vtkFloatingPointType theVal) = 0;
virtual void SetNodeSize(vtkFloatingPointType size) = 0;
virtual vtkFloatingPointType GetNodeSize() = 0;
virtual void Set0DSize(vtkFloatingPointType size) = 0; virtual void Set0DSize(vtkFloatingPointType size) = 0;
virtual vtkFloatingPointType Get0DSize() = 0; virtual vtkFloatingPointType Get0DSize() = 0;

View File

@ -127,9 +127,6 @@ class SMESH_ActorDef : public SMESH_Actor
virtual vtkFloatingPointType GetLineWidth(); virtual vtkFloatingPointType GetLineWidth();
virtual void SetLineWidth(vtkFloatingPointType theVal); virtual void SetLineWidth(vtkFloatingPointType theVal);
virtual void SetNodeSize(vtkFloatingPointType size) ;
virtual vtkFloatingPointType GetNodeSize() ;
virtual void Set0DSize(vtkFloatingPointType size); virtual void Set0DSize(vtkFloatingPointType size);
virtual vtkFloatingPointType Get0DSize(); virtual vtkFloatingPointType Get0DSize();
@ -209,6 +206,9 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation); virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation);
virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation(); virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation();
virtual void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
virtual void SetMarkerTexture( int, VTK::MarkerTexture );
protected: protected:
void SetControlMode(eControl theMode, bool theCheckEntityMode); void SetControlMode(eControl theMode, bool theCheckEntityMode);
void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed); void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
@ -283,6 +283,8 @@ class SMESH_ActorDef : public SMESH_Actor
bool myIsFacesOriented; bool myIsFacesOriented;
VTK::MarkerTexture myMarkerTexture;
SMESH_ActorDef(); SMESH_ActorDef();
~SMESH_ActorDef(); ~SMESH_ActorDef();

View File

@ -31,6 +31,7 @@
#include "SMESH_ActorUtils.h" #include "SMESH_ActorUtils.h"
#include "SMESH_FaceOrientationFilter.h" #include "SMESH_FaceOrientationFilter.h"
#include "VTKViewer_CellLocationsArray.h" #include "VTKViewer_CellLocationsArray.h"
#include "VTKViewer_PolyDataMapper.h"
#include <VTKViewer_Transform.h> #include <VTKViewer_Transform.h>
#include <VTKViewer_TransformFilter.h> #include <VTKViewer_TransformFilter.h>
@ -88,7 +89,7 @@ SMESH_DeviceActor
myRepresentation = eSurface; myRepresentation = eSurface;
myProperty = vtkProperty::New(); myProperty = vtkProperty::New();
myMapper = vtkPolyDataMapper::New(); myMapper = VTKViewer_PolyDataMapper::New();
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor, vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
myPolygonOffsetUnits); myPolygonOffsetUnits);
@ -703,6 +704,7 @@ SMESH_DeviceActor
myGeomFilter->SetWireframeMode(false); myGeomFilter->SetWireframeMode(false);
GetProperty()->SetRepresentation(theMode); GetProperty()->SetRepresentation(theMode);
} }
SetMarkerEnabled(theMode == ePoint);
myRepresentation = theMode; myRepresentation = theMode;
UpdateFaceOrientation(); UpdateFaceOrientation();
GetProperty()->Modified(); GetProperty()->Modified();
@ -901,3 +903,58 @@ void SMESH_DeviceActor::SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle){
vtkFloatingPointType SMESH_DeviceActor::GetQuadraticArcAngle(){ vtkFloatingPointType SMESH_DeviceActor::GetQuadraticArcAngle(){
return myGeomFilter->GetQuadraticArcAngle(); return myGeomFilter->GetQuadraticArcAngle();
} }
/*!
* Set point marker enabled
* \param theMarkerEnabled flag to enable/disable point marker
*/
void SMESH_DeviceActor::SetMarkerEnabled( bool theMarkerEnabled )
{
myMapper->SetMarkerEnabled( theMarkerEnabled );
}
/*!
* Set standard point marker
* \param theMarkerType type of the marker
*/
void SMESH_DeviceActor::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
{
myMapper->SetMarkerStd( theMarkerType, theMarkerScale );
}
/*!
* Set custom point marker
* \param theMarkerId id of the marker texture
* \param theMarkerTexture marker texture
*/
void SMESH_DeviceActor::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
{
myMapper->SetMarkerTexture( theMarkerId, theMarkerTexture );
}
/*!
* Get type of the point marker
* \return type of the point marker
*/
VTK::MarkerType SMESH_DeviceActor::GetMarkerType()
{
return myMapper->GetMarkerType();
}
/*!
Get scale of the point marker
\return scale of the point marker
*/
VTK::MarkerScale SMESH_DeviceActor::GetMarkerScale()
{
return myMapper->GetMarkerScale();
}
/*!
* Get texture identifier of the point marker
* \return texture identifier of the point marker
*/
int SMESH_DeviceActor::GetMarkerTexture()
{
return myMapper->GetMarkerTexture();
}

View File

@ -29,6 +29,7 @@
#define SMESH_DEVICE_ACTOR_H #define SMESH_DEVICE_ACTOR_H
#include <VTKViewer_GeometryFilter.h> #include <VTKViewer_GeometryFilter.h>
#include <VTKViewer_MarkerDef.h>
#include "SMESH_Controls.hxx" #include "SMESH_Controls.hxx"
#include "SMESH_Object.h" #include "SMESH_Object.h"
@ -39,7 +40,6 @@ class vtkCell;
class vtkProperty; class vtkProperty;
class vtkMergeFilter; class vtkMergeFilter;
class vtkShrinkFilter; class vtkShrinkFilter;
class vtkPolyDataMapper;
class vtkUnstructuredGrid; class vtkUnstructuredGrid;
class vtkScalarBarActor; class vtkScalarBarActor;
class vtkLookupTable; class vtkLookupTable;
@ -49,6 +49,7 @@ class vtkPassThroughFilter;
class VTKViewer_Transform; class VTKViewer_Transform;
class VTKViewer_TransformFilter; class VTKViewer_TransformFilter;
class VTKViewer_ExtractUnstructuredGrid; class VTKViewer_ExtractUnstructuredGrid;
class VTKViewer_PolyDataMapper;
class SMESH_ExtractGeometry; class SMESH_ExtractGeometry;
class SMESH_FaceOrientationFilter; class SMESH_FaceOrientationFilter;
@ -133,11 +134,18 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed); void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed);
bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;} bool IsImplicitFunctionUsed() const{ return myIsImplicitFunctionUsed;}
void SetMarkerEnabled( bool );
void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
void SetMarkerTexture( int, VTK::MarkerTexture );
VTK::MarkerType GetMarkerType();
VTK::MarkerScale GetMarkerScale();
int GetMarkerTexture();
protected: protected:
void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean); void Init(TVisualObjPtr theVisualObj, vtkImplicitBoolean* theImplicitBoolean);
void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid); void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
vtkPolyDataMapper *myMapper; VTKViewer_PolyDataMapper *myMapper;
TVisualObjPtr myVisualObj; TVisualObjPtr myVisualObj;
vtkProperty *myProperty; vtkProperty *myProperty;

View File

@ -153,7 +153,7 @@
void ExportMeshToFile(int theCommandID); void ExportMeshToFile(int theCommandID);
void SetDisplayMode(int theCommandID); void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap);
void SetDisplayEntity(int theCommandID); void SetDisplayEntity(int theCommandID);
@ -716,7 +716,7 @@
} }
} }
void SetDisplayMode(int theCommandID){ void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap){
SALOME_ListIO selected; SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app ) if( !app )
@ -814,7 +814,6 @@
int Edgewidth = (int)anActor->GetLineWidth(); int Edgewidth = (int)anActor->GetLineWidth();
if(Edgewidth == 0) if(Edgewidth == 0)
Edgewidth = 1; Edgewidth = 1;
int intValue = int(anActor->GetNodeSize());
vtkFloatingPointType Shrink = anActor->GetShrinkFactor(); vtkFloatingPointType Shrink = anActor->GetShrinkFactor();
vtkFloatingPointType faces_orientation_color[3]; vtkFloatingPointType faces_orientation_color[3];
@ -836,11 +835,21 @@
aDlg->SetColor(5, c0D); aDlg->SetColor(5, c0D);
aDlg->SetColor(6, o); aDlg->SetColor(6, o);
aDlg->SetIntValue(1, Edgewidth); aDlg->SetIntValue(1, Edgewidth);
aDlg->SetIntValue(2, intValue); aDlg->SetIntValue(2, int(Shrink*100.));
aDlg->SetIntValue(3, int(Shrink*100.)); aDlg->SetIntValue(3, size0D);
aDlg->SetIntValue(4, size0D);
aDlg->SetDoubleValue(1, faces_orientation_scale); aDlg->SetDoubleValue(1, faces_orientation_scale);
aDlg->SetBooleanValue(1, faces_orientation_3dvectors); aDlg->SetBooleanValue(1, faces_orientation_3dvectors);
aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] );
VTK::MarkerType aMarkerTypeCurrent = anActor->GetMarkerType();
VTK::MarkerScale aMarkerScaleCurrent = anActor->GetMarkerScale();
int aMarkerTextureCurrent = anActor->GetMarkerTexture();
if( aMarkerTypeCurrent != VTK::MT_USER )
aDlg->setStandardMarker( aMarkerTypeCurrent, aMarkerScaleCurrent );
else
aDlg->setCustomMarker( aMarkerTextureCurrent );
if(aDlg->exec()){ if(aDlg->exec()){
QColor color = aDlg->GetColor(1); QColor color = aDlg->GetColor(1);
QColor edgecolor = aDlg->GetColor(2); QColor edgecolor = aDlg->GetColor(2);
@ -862,20 +871,19 @@
vtkFloatingPointType (edgecolor.blue()) / 255.); vtkFloatingPointType (edgecolor.blue()) / 255.);
/* Shrink factor and size edges */ /* Shrink factor and size edges */
anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.); anActor->SetShrinkFactor(aDlg->GetIntValue(2) / 100.);
anActor->SetLineWidth(aDlg->GetIntValue(1)); anActor->SetLineWidth(aDlg->GetIntValue(1));
/* Nodes color and size */ /* Nodes color and size */
anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255., anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
vtkFloatingPointType (nodecolor.green()) / 255., vtkFloatingPointType (nodecolor.green()) / 255.,
vtkFloatingPointType (nodecolor.blue()) / 255.); vtkFloatingPointType (nodecolor.blue()) / 255.);
anActor->SetNodeSize(aDlg->GetIntValue(2));
/* 0D elements */ /* 0D elements */
anActor->Set0DColor(vtkFloatingPointType (color0D.red()) / 255., anActor->Set0DColor(vtkFloatingPointType (color0D.red()) / 255.,
vtkFloatingPointType (color0D.green()) / 255., vtkFloatingPointType (color0D.green()) / 255.,
vtkFloatingPointType (color0D.blue()) / 255.); vtkFloatingPointType (color0D.blue()) / 255.);
anActor->Set0DSize(aDlg->GetIntValue(4)); anActor->Set0DSize(aDlg->GetIntValue(3));
/* Faces orientation */ /* Faces orientation */
vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()), vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()),
@ -885,6 +893,21 @@
anActor->SetFacesOrientationScale(aDlg->GetDoubleValue(1)); anActor->SetFacesOrientationScale(aDlg->GetDoubleValue(1));
anActor->SetFacesOrientation3DVectors(aDlg->GetBooleanValue(1)); anActor->SetFacesOrientation3DVectors(aDlg->GetBooleanValue(1));
/* Point marker */
theMarkerMap[ aStudy->StudyId() ] = aDlg->getCustomMarkerMap();
VTK::MarkerType aMarkerTypeNew = aDlg->getMarkerType();
VTK::MarkerScale aMarkerScaleNew = aDlg->getStandardMarkerScale();
int aMarkerTextureNew = aDlg->getCustomMarkerID();
if( aMarkerTypeNew != VTK::MT_USER )
anActor->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
else {
const VTK::MarkerMap& aMarkerMap = theMarkerMap[ aStudy->StudyId() ];
VTK::MarkerMap::const_iterator anIter = aMarkerMap.find( aMarkerTextureNew );
if( anIter != aMarkerMap.end() )
anActor->SetMarkerTexture( aMarkerTextureNew, anIter->second.second );
}
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject); SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if( !aGroupObject->_is_nil() ) if( !aGroupObject->_is_nil() )
{ {
@ -1618,13 +1641,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 213: // Nodes case 213: // Nodes
case 212: // Nodes case 212: // Nodes
case 211: // Nodes case 211: // Nodes
::SetDisplayMode(theCommandID); ::SetDisplayMode(theCommandID, myMarkerMap);
break; break;
//2D quadratic representation //2D quadratic representation
case 231: case 231:
case 232: case 232:
::SetDisplayMode(theCommandID); ::SetDisplayMode(theCommandID, myMarkerMap);
break; break;
// Display Entity // Display Entity
@ -3797,13 +3820,34 @@ void SMESHGUI::createPreferences()
// Mesh tab ------------------------------------------------------------------------ // Mesh tab ------------------------------------------------------------------------
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) ); int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab ); int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
setPreferenceProperty( nodeGroup, "columns", 2 ); setPreferenceProperty( nodeGroup, "columns", 3 );
addPreference( tr( "PREF_COLOR" ), nodeGroup, LightApp_Preferences::Color, "SMESH", "node_color" ); addPreference( tr( "PREF_COLOR" ), nodeGroup, LightApp_Preferences::Color, "SMESH", "node_color" );
int nodeSz = addPreference( tr( "PREF_SIZE" ), nodeGroup, LightApp_Preferences::IntSpin, "SMESH", "node_size" );
setPreferenceProperty( nodeSz, "min", 1 ); int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), nodeGroup, LightApp_Preferences::Selector, "SMESH", "type_of_marker" );
setPreferenceProperty( nodeSz, "max", 5 );
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
QList<QVariant> aMarkerTypeIndicesList;
QList<QVariant> aMarkerTypeIconsList;
for ( int i = VTK::MT_POINT; i < VTK::MT_USER; i++ ) {
QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
aMarkerTypeIndicesList << i;
aMarkerTypeIconsList << pixmap;
}
setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), nodeGroup, LightApp_Preferences::Selector, "SMESH", "marker_scale" );
QList<QVariant> aMarkerScaleIndicesList;
QStringList aMarkerScaleValuesList;
for ( int i = VTK::MS_10; i <= VTK::MS_70; i++ ) {
aMarkerScaleIndicesList << i;
aMarkerScaleValuesList << QString::number( (i-(int)VTK::MS_10)*0.5 + 1.0 );
}
setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab ); int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
setPreferenceProperty( elemGroup, "columns", 2 ); setPreferenceProperty( elemGroup, "columns", 2 );
@ -4213,6 +4257,7 @@ SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReser
const char gSeparator = '_'; // character used to separate parameter names const char gSeparator = '_'; // character used to separate parameter names
const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b) const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
const char gPathSep = '|'; // character used to separate paths
/*! /*!
* \brief Store visual parameters * \brief Store visual parameters
@ -4238,6 +4283,39 @@ void SMESHGUI::storeVisualParameters (int savePoint)
savePoint); savePoint);
_PTR(IParameters) ip = ClientFactory::getIParameters(ap); _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
// store map of custom markers
const VTK::MarkerMap& aMarkerMap = myMarkerMap[ studyDS->StudyId() ];
if( !aMarkerMap.empty() )
{
VTK::MarkerMap::const_iterator anIter = aMarkerMap.begin();
for( ; anIter != aMarkerMap.end(); anIter++ )
{
int anId = anIter->first;
VTK::MarkerData aMarkerData = anIter->second;
std::string aMarkerFileName = aMarkerData.first;
VTK::MarkerTexture aMarkerTexture = aMarkerData.second;
if( aMarkerTexture.size() < 3 )
continue; // should contain at least width, height and the first value
QString aPropertyName( "texture" );
aPropertyName += gSeparator;
aPropertyName += QString::number( anId );
QString aPropertyValue = aMarkerFileName.c_str();
aPropertyValue += gPathSep;
VTK::MarkerTexture::const_iterator aTextureIter = aMarkerTexture.begin();
ushort aWidth = *aTextureIter++;
ushort aHeight = *aTextureIter++;
aPropertyValue += QString::number( aWidth ); aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aHeight ); aPropertyValue += gDigitsSep;
for( ; aTextureIter != aMarkerTexture.end(); aTextureIter++ )
aPropertyValue += QString::number( *aTextureIter );
ip->setProperty( aPropertyName.toStdString(), aPropertyValue.toStdString() );
}
}
// viewers counters are used for storing view_numbers in IParameters // viewers counters are used for storing view_numbers in IParameters
int vtkViewers = 0; int vtkViewers = 0;
@ -4345,14 +4423,32 @@ void SMESHGUI::storeVisualParameters (int savePoint)
// Sizes of lines and points // Sizes of lines and points
QString sizeStr ("line"); QString sizeStr ("line");
sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetLineWidth()); sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetLineWidth());
sizeStr += gDigitsSep; sizeStr += "node";
sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetNodeSize());
sizeStr += gDigitsSep; sizeStr += "shrink"; sizeStr += gDigitsSep; sizeStr += "shrink";
sizeStr += gDigitsSep; sizeStr += QString::number(aSmeshActor->GetShrinkFactor()); sizeStr += gDigitsSep; sizeStr += QString::number(aSmeshActor->GetShrinkFactor());
param = vtkParam + "Sizes"; param = vtkParam + "Sizes";
ip->setParameter(entry, param, sizeStr.toLatin1().data()); ip->setParameter(entry, param, sizeStr.toLatin1().data());
// Point marker
QString markerStr;
VTK::MarkerType aMarkerType = aSmeshActor->GetMarkerType();
if( aMarkerType == VTK::MT_USER ) {
markerStr += "custom";
markerStr += gDigitsSep;
markerStr += QString::number( aSmeshActor->GetMarkerTexture() );
}
else {
markerStr += "std";
markerStr += gDigitsSep;
markerStr += QString::number( (int)aMarkerType );
markerStr += gDigitsSep;
markerStr += QString::number( (int)aSmeshActor->GetMarkerScale() );
}
param = vtkParam + "PointMarker";
ip->setParameter(entry, param, markerStr.toLatin1().data());
// Opacity // Opacity
param = vtkParam + "Opacity"; param = vtkParam + "Opacity";
ip->setParameter(entry, param, ip->setParameter(entry, param,
@ -4411,6 +4507,63 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
savePoint); savePoint);
_PTR(IParameters) ip = ClientFactory::getIParameters(ap); _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
// restore map of custom markers
VTK::MarkerMap& aMarkerMap = myMarkerMap[ studyDS->StudyId() ];
std::vector<std::string> properties = ip->getProperties();
for (std::vector<std::string>::iterator propIt = properties.begin(); propIt != properties.end(); ++propIt)
{
std::string property = *propIt;
QString aPropertyName( property.c_str() );
QString aPropertyValue( ip->getProperty( property ).c_str() );
QStringList aPropertyNameList = aPropertyName.split( gSeparator, QString::SkipEmptyParts );
if( aPropertyNameList.size() != 2 )
continue;
int anId = 0;
bool ok = false;
if( aPropertyNameList[0] == "texture" )
anId = aPropertyNameList[1].toInt( &ok );
if( !ok || anId < 1 )
continue;
QStringList aPropertyValueList = aPropertyValue.split( gPathSep, QString::SkipEmptyParts );
if( aPropertyValueList.size() != 2 )
continue;
std::string aMarkerFileName = aPropertyValueList[0].toStdString();
QString aMarkerTextureString = aPropertyValueList[1];
QStringList aMarkerTextureStringList = aMarkerTextureString.split( gDigitsSep, QString::SkipEmptyParts );
if( aMarkerTextureStringList.size() != 3 )
continue;
ok = false;
ushort aWidth = aMarkerTextureStringList[0].toUShort( &ok );
if( !ok )
continue;
ok = false;
ushort aHeight = aMarkerTextureStringList[1].toUShort( &ok );
if( !ok )
continue;
VTK::MarkerTexture aMarkerTexture;
aMarkerTexture.push_back( aWidth );
aMarkerTexture.push_back( aHeight );
QString aMarkerTextureData = aMarkerTextureStringList[2];
for( int i = 0, n = aMarkerTextureData.length(); i < n; i++ )
{
QChar aChar = aMarkerTextureData.at( i );
if( aChar.isDigit() )
aMarkerTexture.push_back( aChar.digitValue() );
}
aMarkerMap[ anId ] = VTK::MarkerData( aMarkerFileName, aMarkerTexture );
}
std::vector<std::string> entries = ip->getEntries(); std::vector<std::string> entries = ip->getEntries();
for (std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt) for (std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt)
@ -4557,18 +4710,49 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
// Sizes of lines and points // Sizes of lines and points
else if (paramNameStr == "Sizes") { else if (paramNameStr == "Sizes") {
QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts); QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts);
if (sizes.count() == 6) { if (sizes.count() == 4) {
if (sizes[0] != "line" || sizes[2] != "shrink") {
MESSAGE("Invalid order of data in Sizes, must be: "
"line:int:shrink:float");
}
else {
aSmeshActor->SetLineWidth(sizes[1].toInt());
aSmeshActor->SetShrinkFactor(sizes[3].toFloat());
}
}
else if (sizes.count() == 6) { // just to support old format
if (sizes[0] != "line" || sizes[2] != "node" || sizes[4] != "shrink") { if (sizes[0] != "line" || sizes[2] != "node" || sizes[4] != "shrink") {
MESSAGE("Invalid order of data in Sizes, must be: " MESSAGE("Invalid order of data in Sizes, must be: "
"line:int:node:int:shrink:float"); "line:int:node:int:shrink:float");
} }
else { else {
aSmeshActor->SetLineWidth(sizes[1].toInt()); aSmeshActor->SetLineWidth(sizes[1].toInt());
aSmeshActor->SetNodeSize(sizes[3].toInt()); //aSmeshActor->SetNodeSize(sizes[3].toInt()); // made obsolete
aSmeshActor->SetShrinkFactor(sizes[5].toFloat()); aSmeshActor->SetShrinkFactor(sizes[5].toFloat());
} }
} }
} }
// Point marker
else if (paramNameStr == "PointMarker") {
QStringList data = val.split(gDigitsSep, QString::SkipEmptyParts);
if( data.count() >= 2 ) {
bool ok = false;
int aParam1 = data[1].toInt( &ok );
if( ok ) {
if( data[0] == "std" && data.count() == 3 ) {
int aParam2 = data[2].toInt( &ok );
aSmeshActor->SetMarkerStd( (VTK::MarkerType)aParam1, (VTK::MarkerScale)aParam2 );
}
else if( data[0] == "custom" ) {
VTK::MarkerMap::const_iterator markerIt = aMarkerMap.find( aParam1 );
if( markerIt != aMarkerMap.end() ) {
VTK::MarkerData aMarkerData = markerIt->second;
aSmeshActor->SetMarkerTexture( aParam1, aMarkerData.second );
}
}
}
}
}
// Opacity // Opacity
else if (paramNameStr == "Opacity") { else if (paramNameStr == "Opacity") {
aSmeshActor->SetOpacity(val.toFloat()); aSmeshActor->SetOpacity(val.toFloat());

View File

@ -31,6 +31,7 @@
// SALOME GUI includes // SALOME GUI includes
#include <SalomeApp_Module.h> #include <SalomeApp_Module.h>
#include <VTKViewer_MarkerDef.h>
#include <SALOME_InteractiveObject.hxx> #include <SALOME_InteractiveObject.hxx>
// IDL includes // IDL includes
@ -52,6 +53,8 @@ class LightApp_SelectionMgr;
class SMESHGUI_FilterLibraryDlg; class SMESHGUI_FilterLibraryDlg;
typedef std::map<int, VTK::MarkerMap> SMESHGUI_StudyId2MarkerMap;
//================================================================================= //=================================================================================
// class : SMESHGUI // class : SMESHGUI
// purpose : // purpose :
@ -166,6 +169,8 @@ private :
LightApp_Displayer* myDisplayer; LightApp_Displayer* myDisplayer;
SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg; SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg;
SMESHGUI_StudyId2MarkerMap myMarkerMap;
}; };
#endif // SMESHGUI_H #endif // SMESHGUI_H

View File

@ -34,6 +34,7 @@
#include <QtxColorButton.h> #include <QtxColorButton.h>
#include <QtxDoubleSpinBox.h> #include <QtxDoubleSpinBox.h>
#include <QtxIntSpinBox.h> #include <QtxIntSpinBox.h>
#include <VTKViewer_MarkerWidget.h>
// Qt includes // Qt includes
#include <QGroupBox> #include <QGroupBox>
@ -124,24 +125,26 @@ SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModul
// ------------------------------- // -------------------------------
QGroupBox* ButtonGroup2 = new QGroupBox( tr( "Nodes" ), this ); QGroupBox* ButtonGroup2 = new QGroupBox( tr( "Nodes" ), this );
QHBoxLayout* ButtonGroup2Layout = new QHBoxLayout( ButtonGroup2 ); QGridLayout* ButtonGroup2Layout = new QGridLayout( ButtonGroup2 );
ButtonGroup2Layout->setSpacing( SPACING ); ButtonGroup2Layout->setSpacing( SPACING );
ButtonGroup2Layout->setMargin( MARGIN ); ButtonGroup2Layout->setMargin( MARGIN );
QLabel* TextLabel_Nodes_Color = new QLabel( tr( "Color" ), ButtonGroup2 ); QLabel* TextLabel_Nodes_Color = new QLabel( tr( "Color" ), ButtonGroup2 );
btnNodeColor = new QtxColorButton( ButtonGroup2 ); btnNodeColor = new QtxColorButton( ButtonGroup2 );
QLabel* TextLabel_Nodes_Size = new QLabel( tr( "Size" ), ButtonGroup2 ); QGroupBox* MarkerGroup = new QGroupBox( tr( "Marker" ), ButtonGroup2 );
SpinBox_Nodes_Size = new QSpinBox( ButtonGroup2 ); QVBoxLayout* MarkerGroupLayout = new QVBoxLayout( MarkerGroup );
SpinBox_Nodes_Size->setRange( 0, 5 ); MarkerGroupLayout->setSpacing( 0 );
SpinBox_Nodes_Size->setSingleStep( 1 ); MarkerGroupLayout->setMargin( 0 );
SpinBox_Nodes_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBox_Nodes_Size->setButtonSymbols( QSpinBox::PlusMinus );
ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color ); MarkerWidget = new VTKViewer_MarkerWidget( MarkerGroup );
ButtonGroup2Layout->addWidget( btnNodeColor );
ButtonGroup2Layout->addWidget( TextLabel_Nodes_Size ); MarkerGroupLayout->addWidget( MarkerWidget );
ButtonGroup2Layout->addWidget( SpinBox_Nodes_Size );
ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color, 0, 0 );
ButtonGroup2Layout->addWidget( btnNodeColor, 0, 1 );
ButtonGroup2Layout->addWidget( MarkerGroup, 1, 0, 1, 3 );
ButtonGroup2Layout->setColumnStretch( 2, 1 );
// ------------------------------- // -------------------------------
QGroupBox* ButtonGroup3 = new QGroupBox( tr( "Orientation of faces" ), this ); QGroupBox* ButtonGroup3 = new QGroupBox( tr( "Orientation of faces" ), this );
@ -304,9 +307,8 @@ void SMESHGUI_Preferences_ColorDlg::SetIntValue( int type, int value )
{ {
switch ( type ) { switch ( type ) {
case 1 : SpinBox_Width->setValue( value ); break; // width case 1 : SpinBox_Width->setValue( value ); break; // width
case 2 : SpinBox_Nodes_Size->setValue( value ); break; // nodes size = value; break; case 2 : SpinBox_Shrink->setValue( value ); break; // shrink coeff
case 3 : SpinBox_Shrink->setValue( value ); break; // shrink coeff case 3 : SpinBox_0DElements_Size->setValue( value ); break; // 0d elements
case 4 : SpinBox_0DElements_Size->setValue( value ); break; // 0d elements
default: break; default: break;
} }
} }
@ -320,9 +322,8 @@ int SMESHGUI_Preferences_ColorDlg::GetIntValue( int type )
int res = 0; int res = 0;
switch ( type ) { switch ( type ) {
case 1 : res = SpinBox_Width->value(); break; // width case 1 : res = SpinBox_Width->value(); break; // width
case 2 : res = SpinBox_Nodes_Size->value(); break; // nodes size case 2 : res = SpinBox_Shrink->value(); break; // shrink coeff
case 3 : res = SpinBox_Shrink->value(); break; // shrink coeff case 3 : res = SpinBox_0DElements_Size->value(); break; // 0d elements
case 4 : res = SpinBox_0DElements_Size->value(); break; // 0d elements
default: break; default: break;
} }
return res; return res;
@ -379,3 +380,67 @@ bool SMESHGUI_Preferences_ColorDlg::GetBooleanValue( int type )
} }
return res; return res;
} }
//=================================================================================
// function : setCustomMarkerMap()
// purpose :
//=================================================================================
void SMESHGUI_Preferences_ColorDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
{
MarkerWidget->setCustomMarkerMap( theMarkerMap );
}
//=================================================================================
// function : getCustomMarkerMap()
// purpose :
//=================================================================================
VTK::MarkerMap SMESHGUI_Preferences_ColorDlg::getCustomMarkerMap()
{
return MarkerWidget->getCustomMarkerMap();
}
//=================================================================================
// function : setStandardMarker()
// purpose :
//=================================================================================
void SMESHGUI_Preferences_ColorDlg::setStandardMarker( VTK::MarkerType theMarkerType,
VTK::MarkerScale theMarkerScale )
{
MarkerWidget->setStandardMarker( theMarkerType, theMarkerScale );
}
//=================================================================================
// function : setCustomMarker()
// purpose :
//=================================================================================
void SMESHGUI_Preferences_ColorDlg::setCustomMarker( int theId )
{
MarkerWidget->setCustomMarker( theId );
}
//=================================================================================
// function : getMarkerType()
// purpose :
//=================================================================================
VTK::MarkerType SMESHGUI_Preferences_ColorDlg::getMarkerType() const
{
return MarkerWidget->getMarkerType();
}
//=================================================================================
// function : getStandardMarkerScale()
// purpose :
//=================================================================================
VTK::MarkerScale SMESHGUI_Preferences_ColorDlg::getStandardMarkerScale() const
{
return MarkerWidget->getStandardMarkerScale();
}
//=================================================================================
// function : getCustomMarkerID()
// purpose :
//=================================================================================
int SMESHGUI_Preferences_ColorDlg::getCustomMarkerID() const
{
return MarkerWidget->getCustomMarkerID();
}

View File

@ -29,6 +29,9 @@
// SMESH includes // SMESH includes
#include "SMESH_SMESHGUI.hxx" #include "SMESH_SMESHGUI.hxx"
// SALOME GUI includes
#include <VTKViewer_MarkerDef.h>
// Qt includes // Qt includes
#include <QDialog> #include <QDialog>
@ -38,6 +41,7 @@ class SMESHGUI;
class QtxDoubleSpinBox; class QtxDoubleSpinBox;
class QtxIntSpinBox; class QtxIntSpinBox;
class QtxColorButton; class QtxColorButton;
class VTKViewer_MarkerWidget;
class SMESHGUI_EXPORT SMESHGUI_Preferences_ColorDlg : public QDialog class SMESHGUI_EXPORT SMESHGUI_Preferences_ColorDlg : public QDialog
{ {
@ -56,6 +60,15 @@ public:
void SetBooleanValue( int, bool ); void SetBooleanValue( int, bool );
bool GetBooleanValue( int ); bool GetBooleanValue( int );
void setCustomMarkerMap( VTK::MarkerMap );
VTK::MarkerMap getCustomMarkerMap();
void setStandardMarker( VTK::MarkerType, VTK::MarkerScale );
void setCustomMarker( int );
VTK::MarkerType getMarkerType() const;
VTK::MarkerScale getStandardMarkerScale() const;
int getCustomMarkerID() const;
protected: protected:
void closeEvent( QCloseEvent* ); void closeEvent( QCloseEvent* );
@ -76,7 +89,7 @@ private:
QSpinBox* SpinBox_Width; QSpinBox* SpinBox_Width;
QtxIntSpinBox* SpinBox_Shrink; QtxIntSpinBox* SpinBox_Shrink;
QtxColorButton* btnNodeColor; QtxColorButton* btnNodeColor;
QSpinBox* SpinBox_Nodes_Size; VTKViewer_MarkerWidget* MarkerWidget;
QtxColorButton* btnOrientationColor; QtxColorButton* btnOrientationColor;
QtxDoubleSpinBox* SpinBox_Orientation_Scale; QtxDoubleSpinBox* SpinBox_Orientation_Scale;
QCheckBox* CheckBox_Orientation_3DVectors; QCheckBox* CheckBox_Orientation_3DVectors;

View File

@ -822,10 +822,9 @@ namespace SMESH
PW = mgr->integerValue( "SMESH", "highlight_width", 5 ); PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
// adjust highlight_width to the width of mesh entities // adjust highlight_width to the width of mesh entities
int aPointSize = mgr->integerValue("SMESH", "node_size", 3);
int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5); int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5);
int aLineWidth = mgr->integerValue("SMESH", "element_width", 1); int aLineWidth = mgr->integerValue("SMESH", "element_width", 1);
int maxSize = aPointSize; int maxSize = aElem0DSize;
if (aElem0DSize > maxSize) maxSize = aElem0DSize; if (aElem0DSize > maxSize) maxSize = aElem0DSize;
if (aLineWidth > maxSize) maxSize = aLineWidth; if (aLineWidth > maxSize) maxSize = aLineWidth;
if (PW < maxSize + 2) PW = maxSize + 2; if (PW < maxSize + 2) PW = maxSize + 2;

View File

@ -3278,6 +3278,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_LABELS_COLOR</source> <source>PREF_LABELS_COLOR</source>
<translation>Labels color</translation> <translation>Labels color</translation>
</message> </message>
<message>
<source>PREF_MARKER_SCALE</source>
<translation>Scale of marker</translation>
</message>
<message> <message>
<source>PREF_NODES</source> <source>PREF_NODES</source>
<translation>Nodes</translation> <translation>Nodes</translation>
@ -3310,10 +3314,6 @@ Please, create VTK viewer and try again</translation>
<source>PREF_SHRINK_COEFF</source> <source>PREF_SHRINK_COEFF</source>
<translation>Shrink coef.</translation> <translation>Shrink coef.</translation>
</message> </message>
<message>
<source>PREF_SIZE</source>
<translation>Size</translation>
</message>
<message> <message>
<source>PREF_TAB_GENERAL</source> <source>PREF_TAB_GENERAL</source>
<translation>General</translation> <translation>General</translation>
@ -3330,6 +3330,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_TITLE_COLOR</source> <source>PREF_TITLE_COLOR</source>
<translation>Title color</translation> <translation>Title color</translation>
</message> </message>
<message>
<source>PREF_TYPE_OF_MARKER</source>
<translation>Type of marker</translation>
</message>
<message> <message>
<source>PREF_COLOR_0D</source> <source>PREF_COLOR_0D</source>
<translation>0D elements</translation> <translation>0D elements</translation>