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)){
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);
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();
}
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);
public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor);
static SMESH_Actor* New(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear);
+ const char* theEntry,
+ const char* theName,
+ int theIsClear);
virtual void SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
- eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
+ eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;
~SMESH_ActorDef();
bool Init(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear);
+ const char* theEntry,
+ const char* theName,
+ int theIsClear);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
vtkFloatingPointType
GetFloat( const QString& theValue,
- vtkFloatingPointType theDefault )
+ vtkFloatingPointType theDefault )
{
int pos = theValue.indexOf( ":" );
vtkFloatingPointType val = theDefault;
QString name = theValue.right( theValue.length()-pos-1 ),
sect = theValue.left( pos );
if( !name.isEmpty() && !sect.isEmpty() )
- val = GetFloat( name, sect, theDefault );
+ val = GetFloat( name, sect, theDefault );
}
return val;
}
vtkFloatingPointType
GetFloat( const QString& theValue,
- const QString& theSection,
- vtkFloatingPointType theDefault )
+ const QString& theSection,
+ vtkFloatingPointType theDefault )
{
vtkFloatingPointType val = theDefault;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
- const char* theFileName)
+ const char* theFileName)
{
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
aWriter->SetFileName(theFileName);
QColor
GetColor( const QString& theSect,
- const QString& theName,
- const QColor& def )
+ const QString& theName,
+ const QColor& def )
{
QColor c = def;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
void
GetColor( const QString& theSect,
- const QString& theName,
- int& r,
- int& g,
- int& b,
- const QColor& def )
+ const QString& theName,
+ int& r,
+ int& g,
+ int& b,
+ const QColor& def )
{
QColor c = def;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
void
GetColor( const QString& theSect,
- const QString& theName,
- vtkFloatingPointType& r,
- vtkFloatingPointType& g,
- vtkFloatingPointType& b,
- const QColor& def )
+ const QString& theName,
+ vtkFloatingPointType& r,
+ vtkFloatingPointType& g,
+ vtkFloatingPointType& b,
+ const QColor& def )
{
int ir( 0 ), ig( 0 ), ib( 0 );
GetColor( theSect, theName, ir, ig, ib, def );
SMESHOBJECT_EXPORT
vtkFloatingPointType
GetFloat( const QString& theValue,
- vtkFloatingPointType theDefault = 0 );
+ vtkFloatingPointType theDefault = 0 );
SMESHOBJECT_EXPORT
vtkFloatingPointType
GetFloat( const QString& theName,
- const QString& theSection,
- vtkFloatingPointType theDefault = 0 );
+ const QString& theSection,
+ vtkFloatingPointType theDefault = 0 );
SMESHOBJECT_EXPORT
QColor
GetColor( const QString& theSect,
- const QString& theName,
- const QColor& = QColor() );
+ const QString& theName,
+ const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
GetColor( const QString& theSect,
- const QString& theName,
- int&,
- int&,
- int&,
- const QColor& = QColor() );
+ const QString& theName,
+ int&,
+ int&,
+ int&,
+ const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
GetColor( const QString& theSect,
- const QString& theName,
- vtkFloatingPointType&,
- vtkFloatingPointType&,
- vtkFloatingPointType&,
- const QColor& = QColor() );
+ const QString& theName,
+ vtkFloatingPointType&,
+ vtkFloatingPointType&,
+ vtkFloatingPointType&,
+ const QColor& = QColor() );
SMESHOBJECT_EXPORT
void
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
- const char* theFileName);
+ const char* theFileName);
}
myMapper = vtkPolyDataMapper::New();
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ myPolygonOffsetUnits);
myMapper->UseLookupTableScalarRangeOn();
myMapper->SetColorModeToMapScalars();
void
SMESH_DeviceActor
::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable)
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
if(anIsInitialized){
using namespace SMESH::Controls;
if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get())){
for(vtkIdType i = 0; i < aNbCells; i++){
- vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
- vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
- double aValue = aNumericalFunctor->GetValue(anObjId);
- aScalars->SetValue(i,aValue);
+ vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+ vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
+ double aValue = aNumericalFunctor->GetValue(anObjId);
+ aScalars->SetValue(i,aValue);
}
}else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get())){
for(vtkIdType i = 0; i < aNbCells; i++){
- vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
- vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
- bool aValue = aPredicate->IsSatisfy(anObjId);
- aScalars->SetValue(i,aValue);
+ vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
+ vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
+ bool aValue = aPredicate->IsSatisfy(anObjId);
+ aScalars->SetValue(i,aValue);
}
}
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
-
+
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors());
theLookupTable->Build();
void
SMESH_DeviceActor
::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable)
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
myExtractUnstructuredGrid->ClearRegisteredCells();
Length2D::TValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
- const Length2D::Value& aValue = *anIter;
- int aNode[2] = {
- myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
- myVisualObj->GetNodeVTKId(aValue.myPntId[1])
- };
- if(aNode[0] >= 0 && aNode[1] >= 0){
- anIdList->SetId( 0, aNode[0] );
- anIdList->SetId( 1, aNode[1] );
- aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,aValue.myLength);
- }
+ const Length2D::Value& aValue = *anIter;
+ int aNode[2] = {
+ myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+ };
+ if(aNode[0] >= 0 && aNode[1] >= 0){
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
+ aScalars->SetValue(aVtkId,aValue.myLength);
+ }
}
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
- aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
- const MultiConnection2D::Value& aValue = (*anIter).first;
- int aNode[2] = {
- myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
- myVisualObj->GetNodeVTKId(aValue.myPntId[1])
- };
- if(aNode[0] >= 0 && aNode[1] >= 0){
- anIdList->SetId( 0, aNode[0] );
- anIdList->SetId( 1, aNode[1] );
- aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( VTK_LINE );
- aScalars->SetValue(aVtkId,(*anIter).second);
- }
+ const MultiConnection2D::Value& aValue = (*anIter).first;
+ int aNode[2] = {
+ myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+ };
+ if(aNode[0] >= 0 && aNode[1] >= 0){
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
+ aScalars->SetValue(aVtkId,(*anIter).second);
+ }
}
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
- aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetElemObjId(i);
if(aFreePredicate->IsSatisfy(anObjId))
- myExtractUnstructuredGrid->RegisterCell(i);
+ myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
for(; anIter != aBorders.end(); anIter++){
const FreeEdges::Border& aBorder = *anIter;
int aNode[2] = {
- myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
- myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
+ myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aBorder.myPntId[1])
};
//cout<<"aNode = "<<aBorder.myPntId[0]<<"; "<<aBorder.myPntId[1]<<endl;
if(aNode[0] >= 0 && aNode[1] >= 0){
- anIdList->SetId( 0, aNode[0] );
- anIdList->SetId( 1, aNode[1] );
- aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( VTK_LINE );
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
}
}
for( vtkIdType i = 0; i < aNbNodes; i++ ){
vtkIdType anObjId = myVisualObj->GetNodeObjId(i);
if(aFreeNodes->IsSatisfy(anObjId))
- myExtractUnstructuredGrid->RegisterCell(i);
+ myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
myExtractUnstructuredGrid->RegisterCell(-1);
void
SMESH_DeviceActor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units)
+ vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
vtkUnstructuredGrid* GetUnstructuredGrid();
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable);
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
- vtkScalarBarActor* theScalarBarActor,
- vtkLookupTable* theLookupTable);
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor);
bool IsHighlited() { return myIsHighlited;}
void
SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units);
+ vtkFloatingPointType units);
void
GetPolygonOffsetParameters(vtkFloatingPointType& factor,
- vtkFloatingPointType& units)
+ vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;
{
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
- myNodeVTK2ObjIds.push_back(ptId);
+ myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
}
{
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
- myNodeVTK2ObjIds.push_back(ptId);
+ myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
}
x = input->GetPoint(ptId);
newId = newPts->InsertNextPoint(x);
pointMap[ptId] = newId;
- myNodeVTK2ObjIds.push_back(ptId);
+ myNodeVTK2ObjIds.push_back(ptId);
outputPD->CopyData(pd,ptId,newId);
}
newCellPts->InsertId(i,pointMap[ptId]);
double* aBounds = theFace->GetBounds();
theSize = pow( pow( aBounds[1] - aBounds[0], 2 ) +
- pow( aBounds[3] - aBounds[2], 2 ) +
- pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
+ pow( aBounds[3] - aBounds[2], 2 ) +
+ pow( aBounds[5] - aBounds[4], 2 ), 0.5 );
}
/*!
input->GetCellNeighbors( aCellId, aFace->PointIds, aNeighborIds );
if( aNeighborIds->GetNumberOfIds() > 0 )
- continue;
+ continue;
double aSize, aNormal[3];
GetFaceParams( aFace, aNormal, aSize );
#include <vtkUnstructuredGrid.h>
#include <memory>
-#include <sstream>
+#include <sstream>
#include <stdexcept>
#include <set>
// purpose : Get type of VTK cell
//=================================================================================
static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
- const bool thePoly,
+ const bool thePoly,
const int theNbNodes )
{
switch( theType )
typedef std::vector<const SMDS_MeshElement*> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
- TConnect& theConnect)
+ TConnect& theConnect)
{
theConnect.clear();
for(; theNodesIter->more();)
inline
void SetId(vtkIdList *theIdList,
- const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
- const TConnect& theConnect,
- int thePosition,
- int theId)
+ const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
+ const TConnect& theConnect,
+ int thePosition,
+ int theId)
{
theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second);
}
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- switch (aType) {
- case SMDSAbs_Volume:{
+ switch (aType) {
+ case SMDSAbs_Volume:{
aConnect.clear();
- std::vector<int> aConnectivities;
- // Convertions connectivities from SMDS to VTK
- if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
+ std::vector<int> aConnectivities;
+ // Convertions connectivities from SMDS to VTK
+ if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
if ( const SMDS_PolyhedralVolumeOfNodes* ph =
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
anIdList->SetNumberOfIds( aNbNodes );
}
- for (int k = 0; k < aNbNodes; k++)
- aConnectivities.push_back(k);
+ for (int k = 0; k < aNbNodes; k++)
+ aConnectivities.push_back(k);
} else if (aNbNodes == 4) {
- static int anIds[] = {0,2,1,3};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ static int anIds[] = {0,2,1,3};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- } else if (aNbNodes == 5) {
- static int anIds[] = {0,3,2,1,4};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ } else if (aNbNodes == 5) {
+ static int anIds[] = {0,3,2,1,4};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- } else if (aNbNodes == 6) {
- static int anIds[] = {0,1,2,3,4,5};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ } else if (aNbNodes == 6) {
+ static int anIds[] = {0,1,2,3,4,5};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ }
else if (aNbNodes == 8) {
- static int anIds[] = {0,3,2,1,4,7,6,5};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ static int anIds[] = {0,3,2,1,4,7,6,5};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ }
else if (aNbNodes == 10) {
- static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
else if (aNbNodes == 13) {
- static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
else if (aNbNodes == 15) {
//static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- //for (int k = 0; k < aNbNodes; k++) {
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ //for (int k = 0; k < aNbNodes; k++) {
// int nn = aConnectivities[k];
// const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
// cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
//}
- }
+ }
else if (aNbNodes == 20) {
- static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
- for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- }
+ static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
else {
}
if ( aConnect.empty() )
GetConnect(aNodesIter,aConnect);
- if (aConnectivities.size() > 0) {
- for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
- SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
- }
- break;
- }
- default:
- for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
- const SMDS_MeshElement* aNode = aNodesIter->next();
- anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
- }
- }
+ if (aConnectivities.size() > 0) {
+ for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
+ SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
+ }
+ break;
+ }
+ default:
+ for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
+ const SMDS_MeshElement* aNode = aNodesIter->next();
+ anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
+ }
+ }
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
//=================================================================================
bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
- const int theEdgeNum,
- int& theNodeId1,
- int& theNodeId2 ) const
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const
{
const SMDS_Mesh* aMesh = GetMesh();
if ( aMesh == 0 )
case SMDSAbs_Volume:
{
SMESH::long_array_var anIds =
- mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
+ mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return anIds->length();
}
default:
else
{
SMESH::long_array_var anIds =
- mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
+ mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return getPointers( theType, anIds, aMesh, theResList );
}
}
virtual SMDS_Mesh* GetMesh() const = 0;
virtual bool GetEdgeNodes( const int theElemId,
- const int theEdgeNum,
- int& theNodeId1,
- int& theNodeId2 ) const = 0;
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const = 0;
virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
actor->SetShape(shape,0,0);
//Color Properties
- /*
- vtkProperty* aProp = vtkProperty::New();
- vtkProperty* aHLProp = vtkProperty::New();
- vtkProperty* aPHLProp = vtkProperty::New();
-
- aProp->SetColor( 255, 0, 0);
- actor->SetProperty(aProp);
-
- aHLProp->SetColor( 255, 255, 255);
- actor->SetHighlightProperty(aHLProp);
-
- aPHLProp->SetColor( 155, 155, 155);
- aPHLProp->SetLineWidth ( 3 );
- aPHLProp->SetOpacity ( 0.75 );
- actor->SetPreHighlightProperty(aPHLProp);
-
- aProp->Delete();
- aHLProp->Delete();
- aPHLProp->Delete();
+ /*
+ vtkProperty* aProp = vtkProperty::New();
+ vtkProperty* aHLProp = vtkProperty::New();
+ vtkProperty* aPHLProp = vtkProperty::New();
+
+ aProp->SetColor( 255, 0, 0);
+ actor->SetProperty(aProp);
+
+ aHLProp->SetColor( 255, 255, 255);
+ actor->SetHighlightProperty(aHLProp);
+
+ aPHLProp->SetColor( 155, 155, 155);
+ aPHLProp->SetLineWidth ( 3 );
+ aPHLProp->SetOpacity ( 0.75 );
+ actor->SetPreHighlightProperty(aPHLProp);
+
+ aProp->Delete();
+ aHLProp->Delete();
+ aPHLProp->Delete();
*/
return actor;