-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
// 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_Actor.cxx
#include <vtkMath.h>
#include <vtkPlane.h>
+#include <vtkPlaneCollection.h>
#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_
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
my2DExtProp = vtkProperty::New();
my2DExtProp->DeepCopy(mySurfaceProp);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
my3DActor = SMESH_CellLabelActor::New();
my3DActor->SetStoreGemetryMapping(true);
my0DActor->SetProperty(my0DProp);
my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
aFilter = my0DActor->GetExtractUnstructuredGrid();
- //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_VERTEX);
myBallActor->SetVisibility(false);
myBallActor->SetProperty(myBallProp);
myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ myBallActor->SetBallEnabled(true);
aFilter = myBallActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
myHighlightProp->SetLineWidth(aLineWidth);
myHighlightProp->SetRepresentation(1);
- myBallHighlightProp = vtkProperty::New();
- myBallHighlightProp->DeepCopy(myHighlightProp);
- myBallHighlightProp->SetPointSize(aBallElemSize);
-
-
myOutLineProp = vtkProperty::New();
myOutLineProp->SetAmbient(1.0);
myOutLineProp->SetDiffuse(0.0);
myPreselectProp->SetLineWidth(aLineWidth);
myPreselectProp->SetRepresentation(1);
- myBallPreselectProp = vtkProperty::New();
- myBallPreselectProp->DeepCopy(myPreselectProp);
- myBallPreselectProp->SetPointSize(aBallElemSize);
-
myHighlitableActor = SMESH_DeviceActor::New();
myHighlitableActor->SetUserMatrix(aMatrix);
myHighlitableActor->PickableOff();
myImplicitBoolean = vtkImplicitBoolean::New();
myImplicitBoolean->SetOperationTypeToIntersection();
+ myPlaneCollection = vtkPlaneCollection::New();
+
//Quadratic 2D elements representation
//-----------------------------------------------------------------------------
int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
myOutLineProp->Delete();
myPreselectProp->Delete();
- myBallHighlightProp->Delete();
- myBallPreselectProp->Delete();
-
myHighlitableActor->Delete();
my2DExtProp->Delete();
//my0DExtActor->Delete();
myImplicitBoolean->Delete();
+ myPlaneCollection->Delete();
#ifndef DISABLE_PLOT2DVIEWER
if(my2dHistogram) {
{
if(my3DActor) {
my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
- SetRepresentation( GetRepresentation() );
- myTimeStamp->Modified();
}
if(my2DActor) {
my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
- //myHighlightActor->AddToRender(theRenderer);
-
theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor);
my1DActor ->AddToRender(theRenderer);
my0DActor ->AddToRender(theRenderer);
myBallActor ->AddToRender(theRenderer);
- //theRenderer->AddActor(my0DExtActor);
theRenderer->AddActor(myHighlitableActor);
myVisualObj = theVisualObj;
myVisualObj->Update(theIsClear);
+ SMESH_SVTKActor::SafeDownCast(myHighlightActor)->SetVisualObject(myVisualObj);
+ SMESH_SVTKActor::SafeDownCast(myPreHighlightActor)->SetVisualObject(myVisualObj);
+
myNodeActor->Init(myVisualObj,myImplicitBoolean);
myBaseActor->Init(myVisualObj,myImplicitBoolean);
if (myEntityMode & eBallElem) {
aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
- aHightFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
}
if (myEntityMode & eEdges) {
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
aHightFilter->RegisterCellsWithType(VTK_TRIANGLE);
aHightFilter->RegisterCellsWithType(VTK_POLYGON);
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
+ aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
}
if (myEntityMode & eVolumes) {
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
//#ifdef VTK_HAVE_POLYHEDRON
if (theMode < 0) {
myRepresentation = eSurface;
- if (!aNbFaces && !aNbVolumes && aNbEdges) {
+ if (!aNbFaces && !aNbVolumes && !aNbBalls && aNbEdges) {
myRepresentation = eEdge;
- } else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
+ } else if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNbBalls) {
myRepresentation = ePoint;
}
} else {
my3DActor->SetBackfaceProperty(aPropVR);
my3DActor->SetRepresentation(aReperesent);
- //my0DExtActor->SetVisibility(false);
+
my1DExtActor->SetVisibility(false);
my2DExtActor->SetVisibility(false);
my3DExtActor->SetVisibility(false);
- // ???
- //my0DActor->SetProperty(aProp);
- //my0DActor->SetBackfaceProperty(aBackProp);
my0DActor->SetRepresentation(aReperesent);
myBallActor->SetRepresentation(aReperesent);
- //my0DExtActor->SetRepresentation(aReperesent);
switch(myControlMode){
case eLength:
void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetHighlited(false);
myHighlitableActor->SetVisibility(false);
-
bool anIsVisible = GetVisibility();
switch(myRepresentation){
{
if(myIsHighlighted) {
myHighlitableActor->SetProperty(myHighlightProp);
- myBallActor->SetProperty(myBallHighlightProp);
}else if(myIsPreselected){
myHighlitableActor->SetProperty(myPreselectProp);
- myBallActor->SetProperty(myBallPreselectProp);
} else if(anIsVisible){
- myBallActor->SetProperty(myBallProp);
(myRepresentation == eSurface) ?
myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
}
void SMESH_ActorDef::SetHighlightColor(double r,double g,double b){
myHighlightProp->SetColor(r,g,b);
- myBallHighlightProp->SetColor(r,g,b);
Modified();
}
void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b){
myPreselectProp->SetColor(r,g,b);
- myBallPreselectProp->SetColor(r,g,b);
Modified();
}
void SMESH_ActorDef::SetBallSize(double theVal){
myBallProp->SetPointSize(theVal);
- myBallHighlightProp->SetPointSize(theVal);
- myBallPreselectProp->SetPointSize(theVal);
+
if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
aCustom->SetBallSize(theVal);
}
return myCippingPlaneCont.size();
}
+void
+SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane)
+{
+ if(thePlane)
+ myPlaneCollection->AddItem( thePlane );
+}
+
+void
+SMESH_ActorDef::SetOpenGLClippingPlane()
+{
+ // before use this method you must add clipping planes using method
+ // SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane)
+ if( !myPlaneCollection->GetNumberOfItems() )
+ return;
+
+ // It is necessary to set plane collection for each mapper of actor
+ // and update current inputs of mapper
+ myNodeActor->SetPlaneCollection( myPlaneCollection );
+ myNodeActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ myBaseActor->SetPlaneCollection( myPlaneCollection );
+ myBaseActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ myHighlitableActor->SetPlaneCollection( myPlaneCollection );
+ myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my1DActor->SetPlaneCollection( myPlaneCollection );
+ my1DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my2DActor->SetPlaneCollection( myPlaneCollection );
+ my2DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ myNodeExtActor->SetPlaneCollection( myPlaneCollection );
+ myNodeExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my0DActor->SetPlaneCollection( myPlaneCollection );
+ my0DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ myBallActor->SetPlaneCollection( myPlaneCollection );
+ myBallActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my1DExtActor->SetPlaneCollection( myPlaneCollection );
+ my1DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my2DExtActor->SetPlaneCollection( myPlaneCollection );
+ my2DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my3DActor->SetPlaneCollection( myPlaneCollection );
+ my3DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ my3DExtActor->SetPlaneCollection( myPlaneCollection );
+ my3DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
+
+ Modified();
+}
+
void
SMESH_ActorDef::
RemoveAllClippingPlanes()
{
+ myPlaneCollection->RemoveAllItems();
myImplicitBoolean->GetFunction()->RemoveAllItems();
myImplicitBoolean->GetFunction()->Modified(); // VTK bug
myCippingPlaneCont.clear();