-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// SMESH OBJECT : interactive object for SMESH visualization
// File : SMESH_Actor.cxx
// Author : Nicolas REJNERI
// Module : SMESH
-
-
+//
#include "SMESH_ActorDef.h"
#include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h"
#endif
static int aLineWidthInc = 2;
-static int aPointSizeInc = 2;
SMESH_ActorDef* SMESH_ActorDef::New(){
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
- vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
my1DProp = vtkProperty::New();
my1DProp->DeepCopy(myEdgeProp);
my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
- my1DProp->SetPointSize(aPointSize);
+ my1DProp->SetPointSize(aElem0DSize);
my1DExtProp = vtkProperty::New();
my1DExtProp->DeepCopy(myEdgeProp);
anRGB[2] = 1 - anRGB[2];
my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
- my1DExtProp->SetPointSize(aPointSize + aPointSizeInc);
+ my1DExtProp->SetPointSize(aElem0DSize);
my1DExtActor = SMESH_DeviceActor::New();
my1DExtActor->SetUserMatrix(aMatrix);
myNodeProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- myNodeProp->SetPointSize(aPointSize);
myNodeActor = SMESH_DeviceActor::New();
myNodeActor->SetUserMatrix(aMatrix);
anRGB[1] = 1 - anRGB[1];
anRGB[2] = 1 - anRGB[2];
myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- myNodeExtProp->SetPointSize(aPointSize);
myNodeExtActor = SMESH_DeviceActor::New();
myNodeExtActor->SetUserMatrix(aMatrix);
myHighlightProp->SetSpecular(0.0);
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->SetPointSize(aPointSize);
- myHighlightProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
+ myHighlightProp->SetPointSize(aElem0DSize); // ??
myHighlightProp->SetRepresentation(1);
myPreselectProp = vtkProperty::New();
myPreselectProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- //myPreselectProp->SetPointSize(aPointSize);
- myPreselectProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
+ myPreselectProp->SetPointSize(aElem0DSize); // ??
myPreselectProp->SetRepresentation(1);
myHighlitableActor = SMESH_DeviceActor::New();
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
-#if (VTK_XVERSION >= 0x050200)
- myPtsLabeledDataMapper->SetLabelFormat("%d");
-#else
+#if (VTK_XVERSION < 0x050200)
myPtsLabeledDataMapper->SetLabelFormat("%g");
#endif
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
-#if (VTK_XVERSION >= 0x050200)
- myClsLabeledDataMapper->SetLabelFormat("%d");
-#else
+#if (VTK_XVERSION < 0x050200)
myClsLabeledDataMapper->SetLabelFormat("%g");
#endif
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
return myIsFacesOriented;
}
+void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType theColor[3])
+{
+ my2DActor->SetFacesOrientationColor( theColor );
+ my3DActor->SetFacesOrientationColor( theColor );
+}
+
+void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType theColor[3])
+{
+ my3DActor->GetFacesOrientationColor( theColor );
+}
+
+void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale)
+{
+ my2DActor->SetFacesOrientationScale( theScale );
+ my3DActor->SetFacesOrientationScale( theScale );
+}
+
+vtkFloatingPointType SMESH_ActorDef::GetFacesOrientationScale()
+{
+ return my3DActor->GetFacesOrientationScale();
+}
+
+void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState)
+{
+ my2DActor->SetFacesOrientation3DVectors( theState );
+ my3DActor->SetFacesOrientation3DVectors( theState );
+}
+
+bool SMESH_ActorDef::GetFacesOrientation3DVectors()
+{
+ return my3DActor->GetFacesOrientation3DVectors();
+}
+
void
SMESH_ActorDef::
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
- SALOME_Actor::AddToRender(theRenderer);
-
theRenderer->AddActor(myNodeActor);
theRenderer->AddActor(myBaseActor);
theRenderer->AddActor2D(myPointLabels);
theRenderer->AddActor2D(myCellsLabels);
+
+ // the superclass' method should be called at the end
+ // (in particular, for correct work of selection)
+ SALOME_Actor::AddToRender(theRenderer);
}
void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
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();
Modified();
return true;
my0DActor->VisibilityOn();
}
- if(myEntityMode & eEdges){
+ if(myEntityMode & eEdges && GetRepresentation() != ePoint){
my1DActor->VisibilityOn();
}
- if(myEntityMode & eFaces){
+ if(myEntityMode & eFaces && GetRepresentation() != ePoint){
my2DActor->VisibilityOn();
}
- if(myEntityMode & eVolumes){
+ if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
my3DActor->VisibilityOn();
}
VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
aHightFilter->ClearRegisteredCellsWithType();
-
- // The following row has been commented (initially added in 1.28.2.3.1 revision)
- // Reason: seems to be unnecessary, this filter should always have default (ePassAll) mode of changing
- // In addition, it leads to exception (see bug IPAL21372)
- //aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
if (myEntityMode & e0DElements) {
if (MYDEBUG) MESSAGE("0D ELEMENTS");
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
+
+ VTK::MarkerType aMarkerType = GetMarkerType();
+ if(aMarkerType != VTK::MT_USER)
+ myHighlitableActor->SetMarkerStd(aMarkerType, GetMarkerScale());
+ else
+ myHighlitableActor->SetMarkerTexture(GetMarkerTexture(), myMarkerTexture);
}
}
}
::GetColor(myNodeProp,r,g,b);
}
+void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+ my0DProp->SetColor(r,g,b);
+ if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
+ if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
+ myNameActor->SetBackgroundColor(r,g,b);
+ Modified();
+}
+
+void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+ ::GetColor(my0DProp,r,g,b);
+}
+
void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myHighlightProp->SetColor(r,g,b);
Modified();
}
-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);
-
+void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
+ my0DProp->SetPointSize(theVal);
Modified();
}
-vtkFloatingPointType SMESH_ActorDef::GetNodeSize(){
- return myNodeProp->GetPointSize();
+vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
+ return my0DProp->GetPointSize();
}
int SMESH_ActorDef::GetObjDimension( const int theObjId )
else
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
+}