mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-28 07:00:34 +05:00
Implementation of the "21459: EDF 1495 SMESH: Manipulation of discrete elements with attributes" issue: visualization of the 0D and balls elements.
This commit is contained in:
parent
6aa20cc1a7
commit
0368b0a293
@ -37,7 +37,9 @@ salomeinclude_HEADERS = \
|
|||||||
SMESH_FaceOrientationFilter.h \
|
SMESH_FaceOrientationFilter.h \
|
||||||
SMESH_ScalarBarActor.h \
|
SMESH_ScalarBarActor.h \
|
||||||
SMESH_NodeLabelActor.h \
|
SMESH_NodeLabelActor.h \
|
||||||
SMESH_CellLabelActor.h
|
SMESH_CellLabelActor.h \
|
||||||
|
SMESH_SVTKActor.h
|
||||||
|
|
||||||
|
|
||||||
# Libraries targets
|
# Libraries targets
|
||||||
|
|
||||||
@ -52,7 +54,8 @@ dist_libSMESHObject_la_SOURCES = \
|
|||||||
SMESH_FaceOrientationFilter.cxx \
|
SMESH_FaceOrientationFilter.cxx \
|
||||||
SMESH_ScalarBarActor.cxx \
|
SMESH_ScalarBarActor.cxx \
|
||||||
SMESH_NodeLabelActor.cxx \
|
SMESH_NodeLabelActor.cxx \
|
||||||
SMESH_CellLabelActor.cxx
|
SMESH_CellLabelActor.cxx \
|
||||||
|
SMESH_SVTKActor.cxx
|
||||||
|
|
||||||
libSMESHObject_la_CPPFLAGS = \
|
libSMESHObject_la_CPPFLAGS = \
|
||||||
$(QT_INCLUDES) \
|
$(QT_INCLUDES) \
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "VTKViewer_ExtractUnstructuredGrid.h"
|
#include "VTKViewer_ExtractUnstructuredGrid.h"
|
||||||
#include "VTKViewer_FramedTextActor.h"
|
#include "VTKViewer_FramedTextActor.h"
|
||||||
#include "SALOME_InteractiveObject.hxx"
|
#include "SALOME_InteractiveObject.hxx"
|
||||||
|
#include "SMESH_SVTKActor.h"
|
||||||
|
|
||||||
#include "SUIT_Session.h"
|
#include "SUIT_Session.h"
|
||||||
#include "SUIT_ResourceMgr.h"
|
#include "SUIT_ResourceMgr.h"
|
||||||
@ -127,6 +128,12 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myIsPointsVisible = false;
|
myIsPointsVisible = false;
|
||||||
myIsEntityModeCache = false;
|
myIsEntityModeCache = false;
|
||||||
|
|
||||||
|
myHighlightActor = SMESH_SVTKActor::New();
|
||||||
|
myHighlightActor->Initialize();
|
||||||
|
|
||||||
|
myPreHighlightActor = SMESH_SVTKActor::New();
|
||||||
|
myPreHighlightActor->Initialize();
|
||||||
|
|
||||||
myIsShrinkable = false;
|
myIsShrinkable = false;
|
||||||
myIsShrunk = false;
|
myIsShrunk = false;
|
||||||
|
|
||||||
@ -318,7 +325,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
//Definition 0D device of the actor (ball elements)
|
//Definition 0D device of the actor (ball elements)
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
myBallProp = vtkProperty::New();
|
myBallProp = vtkProperty::New();
|
||||||
SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
|
SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 85, 255 ) );
|
||||||
myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||||
myBallProp->SetPointSize(aBallElemSize);
|
myBallProp->SetPointSize(aBallElemSize);
|
||||||
|
|
||||||
@ -330,9 +337,7 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myBallActor->SetProperty(myBallProp);
|
myBallActor->SetProperty(myBallProp);
|
||||||
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
|
||||||
aFilter = myBallActor->GetExtractUnstructuredGrid();
|
aFilter = myBallActor->GetExtractUnstructuredGrid();
|
||||||
//aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
|
|
||||||
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
|
||||||
aFilter->RegisterCellsWithType(VTK_VERTEX);
|
|
||||||
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
|
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
|
||||||
|
|
||||||
//my0DExtProp = vtkProperty::New();
|
//my0DExtProp = vtkProperty::New();
|
||||||
@ -410,13 +415,17 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myHighlightProp->SetLineWidth(aLineWidth);
|
myHighlightProp->SetLineWidth(aLineWidth);
|
||||||
myHighlightProp->SetRepresentation(1);
|
myHighlightProp->SetRepresentation(1);
|
||||||
|
|
||||||
|
myBallHighlightProp = vtkProperty::New();
|
||||||
|
myBallHighlightProp->DeepCopy(myHighlightProp);
|
||||||
|
myBallHighlightProp->SetPointSize(aBallElemSize);
|
||||||
|
|
||||||
|
|
||||||
myOutLineProp = vtkProperty::New();
|
myOutLineProp = vtkProperty::New();
|
||||||
myOutLineProp->SetAmbient(1.0);
|
myOutLineProp->SetAmbient(1.0);
|
||||||
myOutLineProp->SetDiffuse(0.0);
|
myOutLineProp->SetDiffuse(0.0);
|
||||||
myOutLineProp->SetSpecular(0.0);
|
myOutLineProp->SetSpecular(0.0);
|
||||||
SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
|
SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
|
||||||
myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
|
||||||
myOutLineProp->SetPointSize(aElem0DSize); // ??
|
|
||||||
myOutLineProp->SetLineWidth(aLineWidth);
|
myOutLineProp->SetLineWidth(aLineWidth);
|
||||||
myOutLineProp->SetRepresentation(1);
|
myOutLineProp->SetRepresentation(1);
|
||||||
|
|
||||||
@ -430,6 +439,10 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
myPreselectProp->SetLineWidth(aLineWidth);
|
myPreselectProp->SetLineWidth(aLineWidth);
|
||||||
myPreselectProp->SetRepresentation(1);
|
myPreselectProp->SetRepresentation(1);
|
||||||
|
|
||||||
|
myBallPreselectProp = vtkProperty::New();
|
||||||
|
myBallPreselectProp->DeepCopy(myPreselectProp);
|
||||||
|
myBallPreselectProp->SetPointSize(aBallElemSize);
|
||||||
|
|
||||||
myHighlitableActor = SMESH_DeviceActor::New();
|
myHighlitableActor = SMESH_DeviceActor::New();
|
||||||
myHighlitableActor->SetUserMatrix(aMatrix);
|
myHighlitableActor->SetUserMatrix(aMatrix);
|
||||||
myHighlitableActor->PickableOff();
|
myHighlitableActor->PickableOff();
|
||||||
@ -499,6 +512,8 @@ SMESH_ActorDef::SMESH_ActorDef()
|
|||||||
my2dHistogram = 0;
|
my2dHistogram = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SetBallSize(aBallElemSize);
|
||||||
|
Set0DSize(aElem0DSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -555,6 +570,9 @@ SMESH_ActorDef::~SMESH_ActorDef()
|
|||||||
myImplicitBoolean->Delete();
|
myImplicitBoolean->Delete();
|
||||||
|
|
||||||
myTimeStamp->Delete();
|
myTimeStamp->Delete();
|
||||||
|
myBallHighlightProp->Delete();
|
||||||
|
myBallPreselectProp->Delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESH_ActorDef::Delete()
|
void SMESH_ActorDef::Delete()
|
||||||
@ -957,6 +975,9 @@ SetControlMode(eControl theMode,
|
|||||||
|
|
||||||
|
|
||||||
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
|
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
|
||||||
|
|
||||||
|
//myHighlightActor->AddToRender(theRenderer);
|
||||||
|
|
||||||
theRenderer->AddActor(myBaseActor);
|
theRenderer->AddActor(myBaseActor);
|
||||||
theRenderer->AddActor(myNodeExtActor);
|
theRenderer->AddActor(myNodeExtActor);
|
||||||
theRenderer->AddActor(my1DExtActor);
|
theRenderer->AddActor(my1DExtActor);
|
||||||
@ -1307,10 +1328,10 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
|
|||||||
myNodeActor->VisibilityOn();
|
myNodeActor->VisibilityOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myEntityMode & e0DElements){
|
if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){
|
||||||
my0DActor->VisibilityOn();
|
my0DActor->VisibilityOn();
|
||||||
}
|
}
|
||||||
if(myEntityMode & eBallElem){
|
if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){
|
||||||
myBallActor->VisibilityOn();
|
myBallActor->VisibilityOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1492,6 +1513,8 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
|
|||||||
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
|
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
|
||||||
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
|
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
|
||||||
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
|
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
|
||||||
|
int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement);
|
||||||
|
int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball);
|
||||||
|
|
||||||
if (theMode < 0) {
|
if (theMode < 0) {
|
||||||
myRepresentation = eSurface;
|
myRepresentation = eSurface;
|
||||||
@ -1503,10 +1526,10 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
|
|||||||
} else {
|
} else {
|
||||||
switch (theMode) {
|
switch (theMode) {
|
||||||
case eEdge:
|
case eEdge:
|
||||||
if (!aNbFaces && !aNbVolumes && !aNbEdges) return;
|
if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNb0Ds && !aNbBalls) return;
|
||||||
break;
|
break;
|
||||||
case eSurface:
|
case eSurface:
|
||||||
if (!aNbFaces && !aNbVolumes) return;
|
if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
myRepresentation = theMode;
|
myRepresentation = theMode;
|
||||||
@ -1633,9 +1656,12 @@ void SMESH_ActorDef::UpdateHighlight(){
|
|||||||
{
|
{
|
||||||
if(myIsHighlighted) {
|
if(myIsHighlighted) {
|
||||||
myHighlitableActor->SetProperty(myHighlightProp);
|
myHighlitableActor->SetProperty(myHighlightProp);
|
||||||
|
myBallActor->SetProperty(myBallHighlightProp);
|
||||||
}else if(myIsPreselected){
|
}else if(myIsPreselected){
|
||||||
myHighlitableActor->SetProperty(myPreselectProp);
|
myHighlitableActor->SetProperty(myPreselectProp);
|
||||||
|
myBallActor->SetProperty(myBallPreselectProp);
|
||||||
} else if(anIsVisible){
|
} else if(anIsVisible){
|
||||||
|
myBallActor->SetProperty(myBallProp);
|
||||||
(myRepresentation == eSurface) ?
|
(myRepresentation == eSurface) ?
|
||||||
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
|
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
|
||||||
}
|
}
|
||||||
@ -1781,6 +1807,8 @@ void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){
|
|||||||
myNodeProp->SetOpacity(theValue);
|
myNodeProp->SetOpacity(theValue);
|
||||||
|
|
||||||
my1DProp->SetOpacity(theValue);
|
my1DProp->SetOpacity(theValue);
|
||||||
|
my0DProp->SetOpacity(theValue);
|
||||||
|
myBallProp->SetOpacity(theValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1871,6 +1899,7 @@ void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType&
|
|||||||
|
|
||||||
void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
|
void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
|
||||||
myHighlightProp->SetColor(r,g,b);
|
myHighlightProp->SetColor(r,g,b);
|
||||||
|
myBallHighlightProp->SetColor(r,g,b);
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1880,6 +1909,7 @@ void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointT
|
|||||||
|
|
||||||
void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
|
void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
|
||||||
myPreselectProp->SetColor(r,g,b);
|
myPreselectProp->SetColor(r,g,b);
|
||||||
|
myBallPreselectProp->SetColor(r,g,b);
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1908,6 +1938,16 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
|
|||||||
|
|
||||||
void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
|
void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
|
||||||
my0DProp->SetPointSize(theVal);
|
my0DProp->SetPointSize(theVal);
|
||||||
|
myHighlightProp->SetPointSize(theVal);
|
||||||
|
myPreselectProp->SetPointSize(theVal);
|
||||||
|
|
||||||
|
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
|
||||||
|
aCustom->Set0DSize(theVal);
|
||||||
|
}
|
||||||
|
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
|
||||||
|
aCustom->Set0DSize(theVal);
|
||||||
|
}
|
||||||
|
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1917,6 +1957,15 @@ vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
|
|||||||
|
|
||||||
void SMESH_ActorDef::SetBallSize(vtkFloatingPointType theVal){
|
void SMESH_ActorDef::SetBallSize(vtkFloatingPointType theVal){
|
||||||
myBallProp->SetPointSize(theVal);
|
myBallProp->SetPointSize(theVal);
|
||||||
|
myBallHighlightProp->SetPointSize(theVal);
|
||||||
|
myBallPreselectProp->SetPointSize(theVal);
|
||||||
|
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
|
||||||
|
aCustom->SetBallSize(theVal);
|
||||||
|
}
|
||||||
|
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
|
||||||
|
aCustom->SetBallSize(theVal);
|
||||||
|
}
|
||||||
|
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +243,9 @@ class SMESH_ActorDef : public SMESH_Actor
|
|||||||
vtkProperty* myHighlightProp;
|
vtkProperty* myHighlightProp;
|
||||||
vtkProperty* myOutLineProp;
|
vtkProperty* myOutLineProp;
|
||||||
vtkProperty* myPreselectProp;
|
vtkProperty* myPreselectProp;
|
||||||
|
|
||||||
|
vtkProperty* myBallHighlightProp;
|
||||||
|
vtkProperty* myBallPreselectProp;
|
||||||
|
|
||||||
SMESH_DeviceActor* myHighlitableActor;
|
SMESH_DeviceActor* myHighlitableActor;
|
||||||
|
|
||||||
|
184
src/OBJECT/SMESH_SVTKActor.cxx
Normal file
184
src/OBJECT/SMESH_SVTKActor.cxx
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
// Copyright (C) 2007-2012 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
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
// SMESH OBJECT : interactive object for SMESH visualization
|
||||||
|
// File : SMESH_SVTKActor.cxx
|
||||||
|
// Author : Roman NIKOLAEV
|
||||||
|
// Module : SMESH
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "SMESH_SVTKActor.h"
|
||||||
|
|
||||||
|
#include <SVTK_Utils.h>
|
||||||
|
#include <SALOME_Actor.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include <SVTK_DeviceActor.h>
|
||||||
|
#include <vtkPoints.h>
|
||||||
|
#include <vtkRenderer.h>
|
||||||
|
#include <vtkObjectFactory.h>
|
||||||
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
#include <vtkCell.h>
|
||||||
|
#include <vtkDataSetMapper.h>
|
||||||
|
|
||||||
|
vtkStandardNewMacro(SMESH_SVTKActor);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Constructor
|
||||||
|
*/
|
||||||
|
SMESH_SVTKActor::SMESH_SVTKActor():
|
||||||
|
my0DGrid(vtkUnstructuredGrid::New()),
|
||||||
|
myBallGrid(vtkUnstructuredGrid::New())
|
||||||
|
{
|
||||||
|
my0DActor = SVTK_DeviceActor::New();
|
||||||
|
myBallActor = SVTK_DeviceActor::New();
|
||||||
|
|
||||||
|
myBallActor->SetResolveCoincidentTopology(false);
|
||||||
|
myBallActor->SetCoincident3DAllowed(true);
|
||||||
|
myBallActor->PickableOff();
|
||||||
|
my0DActor->SetResolveCoincidentTopology(false);
|
||||||
|
my0DActor->SetCoincident3DAllowed(true);
|
||||||
|
my0DActor->PickableOff();
|
||||||
|
|
||||||
|
my0DGrid->Allocate();
|
||||||
|
myBallGrid->Allocate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Constructor
|
||||||
|
*/
|
||||||
|
SMESH_SVTKActor::~SMESH_SVTKActor() {
|
||||||
|
my0DActor->Delete();
|
||||||
|
myBallActor->Delete();
|
||||||
|
my0DGrid->Delete();
|
||||||
|
myBallGrid->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Publishes the actor in all its internal devices
|
||||||
|
*/
|
||||||
|
void SMESH_SVTKActor::AddToRender(vtkRenderer* theRenderer) {
|
||||||
|
Superclass::AddToRender(theRenderer);
|
||||||
|
float a0D = my0DActor->GetProperty()->GetPointSize();
|
||||||
|
float aBall = myBallActor->GetProperty()->GetPointSize();
|
||||||
|
my0DActor->GetProperty()->DeepCopy(GetProperty());
|
||||||
|
myBallActor->GetProperty()->DeepCopy(GetProperty());
|
||||||
|
my0DActor->GetProperty()->SetPointSize(a0D);
|
||||||
|
myBallActor->GetProperty()->SetPointSize(aBall);
|
||||||
|
theRenderer->AddActor(my0DActor);
|
||||||
|
theRenderer->AddActor(myBallActor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Removes the actor from all its internal devices
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
SMESH_SVTKActor
|
||||||
|
::RemoveFromRender(vtkRenderer* theRenderer)
|
||||||
|
{
|
||||||
|
Superclass::RemoveFromRender(theRenderer);
|
||||||
|
theRenderer->RemoveActor( myBallActor );
|
||||||
|
theRenderer->RemoveActor( my0DActor );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SMESH_SVTKActor
|
||||||
|
::MapCells(SALOME_Actor* theMapActor,
|
||||||
|
const TColStd_IndexedMapOfInteger& theMapIndex)
|
||||||
|
{
|
||||||
|
myUnstructuredGrid->Initialize();
|
||||||
|
myUnstructuredGrid->Allocate();
|
||||||
|
|
||||||
|
my0DGrid->Initialize();
|
||||||
|
my0DGrid->Allocate();
|
||||||
|
|
||||||
|
myBallGrid->Initialize();
|
||||||
|
myBallGrid->Allocate();
|
||||||
|
|
||||||
|
vtkDataSet *aSourceDataSet = theMapActor->GetInput();
|
||||||
|
SVTK::CopyPoints( GetSource(), aSourceDataSet );
|
||||||
|
SVTK::CopyPoints( myBallGrid, aSourceDataSet );
|
||||||
|
SVTK::CopyPoints( my0DGrid, aSourceDataSet );
|
||||||
|
|
||||||
|
int aNbOfParts = theMapIndex.Extent();
|
||||||
|
for(int ind = 1; ind <= aNbOfParts; ind++){
|
||||||
|
int aPartId = theMapIndex( ind );
|
||||||
|
if(vtkCell* aCell = theMapActor->GetElemCell(aPartId))
|
||||||
|
{
|
||||||
|
#if VTK_XVERSION > 50700
|
||||||
|
if (aCell->GetCellType() != VTK_POLYHEDRON)
|
||||||
|
#endif
|
||||||
|
if(aCell->GetCellType() == VTK_VERTEX ) {
|
||||||
|
my0DGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
|
||||||
|
} else if(aCell->GetCellType() == VTK_POLY_VERTEX ) {
|
||||||
|
myBallGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
|
||||||
|
} else {
|
||||||
|
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
|
||||||
|
}
|
||||||
|
#if VTK_XVERSION > 50700
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vtkPolyhedron *polyhedron = dynamic_cast<vtkPolyhedron*>(aCell);
|
||||||
|
if (!polyhedron)
|
||||||
|
throw SALOME_Exception(LOCALIZED ("not a polyhedron"));
|
||||||
|
vtkIdType *pts = polyhedron->GetFaces();
|
||||||
|
myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),pts[0], pts+1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
UnShrink();
|
||||||
|
if(theMapActor->IsShrunk()){
|
||||||
|
SetShrinkFactor(theMapActor->GetShrinkFactor());
|
||||||
|
SetShrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
myMapIndex = theMapIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SMESH_SVTKActor
|
||||||
|
::Initialize()
|
||||||
|
{
|
||||||
|
Superclass::Initialize();
|
||||||
|
my0DActor->SetInput(my0DGrid);
|
||||||
|
myBallActor->SetInput(myBallGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SMESH_SVTKActor::SetVisibility( int theVisibility ) {
|
||||||
|
Superclass::SetVisibility( theVisibility );
|
||||||
|
my0DActor->SetVisibility( theVisibility );
|
||||||
|
myBallActor->SetVisibility( theVisibility );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SMESH_SVTKActor::Set0DSize(float theSize) {
|
||||||
|
my0DActor->GetProperty()->SetPointSize(theSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMESH_SVTKActor::SetBallSize(float theSize) {
|
||||||
|
myBallActor->GetProperty()->SetPointSize(theSize);
|
||||||
|
}
|
||||||
|
|
82
src/OBJECT/SMESH_SVTKActor.h
Normal file
82
src/OBJECT/SMESH_SVTKActor.h
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Copyright (C) 2007-2012 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
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
// SMESH OBJECT : interactive object for SMESH visualization
|
||||||
|
// File : SMESH_SVTKActor.h
|
||||||
|
// Author : Roman NIKOLAEV
|
||||||
|
// Module : SMESH
|
||||||
|
//
|
||||||
|
#ifndef SMESH_SVTKACTOR_H
|
||||||
|
#define SMESH_SVTKACTOR_H
|
||||||
|
|
||||||
|
#include "SMESH_Object.h"
|
||||||
|
#include <SVTK_Actor.h>
|
||||||
|
|
||||||
|
|
||||||
|
class SVTK_Actor;
|
||||||
|
class vtkUnstructureGrid;
|
||||||
|
class vtkDataSetMapper;
|
||||||
|
|
||||||
|
class SMESHOBJECT_EXPORT SMESH_SVTKActor : public SVTK_Actor {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static SMESH_SVTKActor* New();
|
||||||
|
|
||||||
|
vtkTypeMacro(SMESH_SVTKActor, SVTK_Actor);
|
||||||
|
|
||||||
|
void SetBallSize(float theSize);
|
||||||
|
void Set0DSize(float theSize);
|
||||||
|
|
||||||
|
//! To publish the actor an all its internal devices
|
||||||
|
virtual
|
||||||
|
void
|
||||||
|
AddToRender(vtkRenderer* theRendere);
|
||||||
|
|
||||||
|
virtual void SetVisibility( int theVisibility );
|
||||||
|
|
||||||
|
//! Initialiaze the instance completely
|
||||||
|
virtual void
|
||||||
|
Initialize();
|
||||||
|
|
||||||
|
//! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes
|
||||||
|
virtual void
|
||||||
|
MapCells(SALOME_Actor* theMapActor,
|
||||||
|
const TColStd_IndexedMapOfInteger& theMapIndex);
|
||||||
|
|
||||||
|
|
||||||
|
//! To remove the actor an all its internal devices
|
||||||
|
virtual
|
||||||
|
void
|
||||||
|
RemoveFromRender(vtkRenderer* theRendere);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SVTK_DeviceActor* my0DActor;
|
||||||
|
SVTK_DeviceActor* myBallActor;
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* my0DGrid;
|
||||||
|
vtkUnstructuredGrid* myBallGrid;
|
||||||
|
|
||||||
|
SMESH_SVTKActor();
|
||||||
|
virtual ~SMESH_SVTKActor();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -805,7 +805,7 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
|
|||||||
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : EdgeSelection);
|
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : EdgeSelection);
|
||||||
break;
|
break;
|
||||||
case grpBallSelection:
|
case grpBallSelection:
|
||||||
//if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : BallSelection);
|
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : CellSelection);
|
||||||
break;
|
break;
|
||||||
case grpFaceSelection:
|
case grpFaceSelection:
|
||||||
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : FaceSelection);
|
if ( aViewWindow ) aViewWindow->SetSelectionMode(isSelectAll ? ActorSelection : FaceSelection);
|
||||||
@ -1759,7 +1759,7 @@ void SMESHGUI_GroupDlg::onAdd()
|
|||||||
break;
|
break;
|
||||||
case grpBallSelection:
|
case grpBallSelection:
|
||||||
aType = SMESH::BALL;
|
aType = SMESH::BALL;
|
||||||
//mySelector->SetSelectionMode(BallSelection);
|
mySelector->SetSelectionMode(CellSelection);
|
||||||
break;
|
break;
|
||||||
case grpEdgeSelection:
|
case grpEdgeSelection:
|
||||||
aType = SMESH::EDGE;
|
aType = SMESH::EDGE;
|
||||||
|
Loading…
Reference in New Issue
Block a user