#include <vtkImplicitBoolean.h>
#include <vtkImplicitFunctionCollection.h>
+#include <vtkConfigure.h>
+#if !defined(VTK_XVERSION)
+#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
+#endif
+
#include "utilities.h"
#ifdef _DEBUG_
SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear)
+ const char* theEntry,
+ const char* theName,
+ int theIsClear)
{
SMESH_ActorDef* anActor = SMESH_ActorDef::New();
if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
myHighlitableActor->PickableOff();
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
+ aMatrix->Delete();
+
myName = "";
myIO = NULL;
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
+#if (VTK_XVERSION < 0x050200)
myPtsLabeledDataMapper->SetLabelFormat("%g");
+#endif
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
+#if (VTK_XVERSION < 0x050200)
myClsLabeledDataMapper->SetLabelFormat("%g");
+#endif
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues( aNbElem );
- for ( int anId = 0; anId < aNbElem; anId++ )
+ for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
{
int aSMDSId = myVisualObj->GetNodeObjId( anId );
anArray->SetValue( anId, aSMDSId );
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::
SetControlMode(eControl theMode,
- bool theCheckEntityMode)
+ bool theCheckEntityMode)
{
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
myControlMode = theMode;
switch(myControlMode){
case eFreeNodes:
- myNodeExtActor->SetExtControlMode(aFunctor);
- break;
+ myNodeExtActor->SetExtControlMode(aFunctor);
+ break;
case eFreeEdges:
case eFreeBorders:
- my1DExtActor->SetExtControlMode(aFunctor);
- break;
+ my1DExtActor->SetExtControlMode(aFunctor);
+ break;
case eFreeFaces:
- my2DExtActor->SetExtControlMode(aFunctor);
- break;
+ my2DExtActor->SetExtControlMode(aFunctor);
+ break;
case eLength2D:
case eMultiConnection2D:
- my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
- break;
+ my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
+ break;
default:
- myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
+ myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
}
}
if(theCheckEntityMode){
if(myControlActor == my1DActor)
- SetEntityMode(eEdges);
+ SetEntityMode(eEdges);
else if(myControlActor == my2DActor){
- switch(myControlMode){
- case eLength2D:
- case eFreeEdges:
- case eFreeFaces:
- case eMultiConnection2D:
- //SetEntityMode(eEdges);
- SetEntityMode(eFaces);
- break;
- default:
- SetEntityMode(eFaces);
- }
+ switch(myControlMode){
+ case eLength2D:
+ case eFreeEdges:
+ case eFreeFaces:
+ case eMultiConnection2D:
+ //SetEntityMode(eEdges);
+ SetEntityMode(eFaces);
+ break;
+ default:
+ SetEntityMode(eFaces);
+ }
}else if(myControlActor == my3DActor)
- SetEntityMode(eVolumes);
+ SetEntityMode(eVolumes);
}
}else if(theCheckEntityMode){
bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear)
+ const char* theEntry,
+ const char* theName,
+ int theIsClear)
{
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
setIO(anIO);
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
- aDataSet->GetNumberOfCells() == 1 &&
- aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX;
+ ( aDataSet->GetNumberOfCells() == 1 &&
+ aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
return SALOME_Actor::IsInfinitive();
}
if(myControlMode != eNone){
switch(myControlMode){
case eFreeNodes:
- myNodeExtActor->VisibilityOn();
- break;
+ myNodeExtActor->VisibilityOn();
+ break;
case eFreeEdges:
case eFreeBorders:
- my1DExtActor->VisibilityOn();
- break;
+ my1DExtActor->VisibilityOn();
+ break;
case eFreeFaces:
- my2DExtActor->VisibilityOn();
- break;
+ my2DExtActor->VisibilityOn();
+ break;
case eLength2D:
case eMultiConnection2D:
- my1DExtActor->VisibilityOn();
+ my1DExtActor->VisibilityOn();
default:
- if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
- myScalarBarActor->VisibilityOn();
+ if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
+ myScalarBarActor->VisibilityOn();
}
}
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
- SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
+ SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
}else if(myRepresentation == ePoint || GetPointRepresentation()){
myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()->
- SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
}
mySurfaceProp->SetColor(r,g,b);
if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
if( aGroupObj->GetElementType() == SMDSAbs_Face ||
- aGroupObj->GetElementType() == SMDSAbs_Volume )
+ aGroupObj->GetElementType() == SMDSAbs_Volume )
myNameActor->SetBackgroundColor(r,g,b);
Modified();
}
::GetColor(myNodeProp,r,g,b);
}
+void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+ my0DProp->SetColor(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();
return myNodeProp->GetPointSize();
}
+void SMESH_ActorDef::Set0DSize(vtkFloatingPointType 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();
+}
+
+vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
+ return my0DProp->GetPointSize();
+}
+
int SMESH_ActorDef::GetObjDimension( const int theObjId )
{
return myVisualObj->GetElemDimension( theObjId );
static void ComputeBoundsParam(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
- vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
+ vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
+ vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
{
vtkFloatingPointType aBounds[6];
theDataSet->GetBounds(aBounds);
}
vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
- {aBounds[1],aBounds[2],aBounds[4]},
- {aBounds[0],aBounds[3],aBounds[4]},
- {aBounds[1],aBounds[3],aBounds[4]},
- {aBounds[0],aBounds[2],aBounds[5]},
- {aBounds[1],aBounds[2],aBounds[5]},
- {aBounds[0],aBounds[3],aBounds[5]},
- {aBounds[1],aBounds[3],aBounds[5]}};
+ {aBounds[1],aBounds[2],aBounds[4]},
+ {aBounds[0],aBounds[3],aBounds[4]},
+ {aBounds[1],aBounds[3],aBounds[4]},
+ {aBounds[0],aBounds[2],aBounds[5]},
+ {aBounds[1],aBounds[2],aBounds[5]},
+ {aBounds[0],aBounds[3],aBounds[5]},
+ {aBounds[1],aBounds[3],aBounds[5]}};
int aMaxId = 0, aMinId = aMaxId;
theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
static void DistanceToPosition(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
+ vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
{
vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
static void PositionToDistance(vtkDataSet* theDataSet,
- vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
+ vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
{
vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);