X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_Actor.cxx;h=045bb9ccef4caf2d900868832b80c17da4b0b59f;hp=ec2a7c949bc29db214b71bccf95f0b10343af4d1;hb=6bac08c1a81f34d3f21c550bd92f83654b2546a5;hpb=519f45e49541ef86004a139b9dccc909927bc406 diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index ec2a7c949..045bb9cce 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -75,6 +75,7 @@ #include #include +#include #include #include @@ -142,10 +143,11 @@ SMESH_ActorDef::SMESH_ActorDef() if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) ) myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1); - double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); - double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); - double aLineWidth = SMESH::GetFloat("SMESH:element_width",1); - double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); + double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); + double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); + double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1.0); + double aLineWidth = SMESH::GetFloat("SMESH:element_width",1); + double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); SMESH::LabelFont aFamilyNd = SMESH::FntTimes; bool aBoldNd = true; @@ -534,6 +536,8 @@ SMESH_ActorDef::SMESH_ActorDef() myImplicitBoolean = vtkImplicitBoolean::New(); myImplicitBoolean->SetOperationTypeToIntersection(); + myPlaneCollection = vtkPlaneCollection::New(); + //Quadratic 2D elements representation //----------------------------------------------------------------------------- int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0); @@ -563,6 +567,7 @@ SMESH_ActorDef::SMESH_ActorDef() #endif SetBallSize(aBallElemSize); + SetBallScale(aBallElemScale); Set0DSize(aElem0DSize); } @@ -619,6 +624,7 @@ SMESH_ActorDef::~SMESH_ActorDef() //my0DExtActor->Delete(); myImplicitBoolean->Delete(); + myPlaneCollection->Delete(); #ifndef DISABLE_PLOT2DVIEWER if(my2dHistogram) { @@ -1309,7 +1315,7 @@ void SMESH_ActorDef::SetShrinkFactor(double theValue){ Modified(); } -void SMESH_ActorDef::SetShrink(){ +void SMESH_ActorDef::SetShrink() { if(!myIsShrinkable) return; myBaseActor->SetShrink(); @@ -1586,6 +1592,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) 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 @@ -2101,6 +2108,16 @@ double SMESH_ActorDef::GetBallSize(){ return myBallProp->GetPointSize(); } +double SMESH_ActorDef::GetBallScale() +{ + return myBallActor->GetBallScale(); +} + +void SMESH_ActorDef::SetBallScale( double theVal ) +{ + myBallActor->SetBallScale( theVal ); +} + int SMESH_ActorDef::GetObjDimension( const int theObjId ) { return myVisualObj->GetElemDimension( theObjId ); @@ -2149,10 +2166,70 @@ SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane) 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()); + + if(IsShrunk()) + SetShrink(); + else + Modified(); +} + void SMESH_ActorDef:: RemoveAllClippingPlanes() { + myPlaneCollection->RemoveAllItems(); myImplicitBoolean->GetFunction()->RemoveAllItems(); myImplicitBoolean->GetFunction()->Modified(); // VTK bug myCippingPlaneCont.clear();