First step for the "21793: [CEA 625] Clipping : from coordinates or from bounding box" issue.

This commit is contained in:
rnv 2013-10-16 12:56:06 +00:00
parent fcec7fb454
commit 824f011cef
18 changed files with 2082 additions and 911 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -75,6 +75,7 @@
#include <vtkMath.h>
#include <vtkPlane.h>
#include <vtkPlaneCollection.h>
#include <vtkImplicitBoolean.h>
#include <vtkImplicitFunctionCollection.h>
@ -534,6 +535,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);
@ -619,6 +622,7 @@ SMESH_ActorDef::~SMESH_ActorDef()
//my0DExtActor->Delete();
myImplicitBoolean->Delete();
myPlaneCollection->Delete();
#ifndef DISABLE_PLOT2DVIEWER
if(my2dHistogram) {
@ -2149,10 +2153,67 @@ 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());
Modified();
}
void
SMESH_ActorDef::
RemoveAllClippingPlanes()
{
myPlaneCollection->RemoveAllItems();
myImplicitBoolean->GetFunction()->RemoveAllItems();
myImplicitBoolean->GetFunction()->Modified(); // VTK bug
myCippingPlaneCont.clear();

View File

@ -154,6 +154,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual vtkIdType GetNumberOfClippingPlanes() = 0;
virtual vtkPlane* GetClippingPlane(vtkIdType theID) = 0;
virtual vtkIdType AddClippingPlane(vtkPlane* thePlane) = 0;
virtual void AddOpenGLClippingPlane(vtkPlane* thePlane) = 0;
virtual void SetOpenGLClippingPlane() = 0;
virtual TVisualObjPtr GetObject() = 0;

View File

@ -65,6 +65,7 @@ class vtkLookupTable;
class vtkPlane;
class vtkImplicitBoolean;
class vtkTimeStamp;
class vtkPlaneCollection;
class SMESH_DeviceActor;
class SMESH_NodeLabelActor;
@ -212,6 +213,8 @@ class SMESH_ActorDef : public SMESH_Actor
virtual vtkIdType GetNumberOfClippingPlanes();
virtual vtkPlane* GetClippingPlane(vtkIdType theID);
virtual vtkIdType AddClippingPlane(vtkPlane* thePlane);
virtual void AddOpenGLClippingPlane(vtkPlane* thePlane);
virtual void SetOpenGLClippingPlane();
virtual TVisualObjPtr GetObject() { return myVisualObj;}
@ -296,6 +299,7 @@ class SMESH_ActorDef : public SMESH_Actor
bool myIsShrunk;
vtkImplicitBoolean* myImplicitBoolean;
vtkPlaneCollection* myPlaneCollection;
typedef TVTKSmartPtr<vtkPlane> TPlanePtr;
typedef std::vector<TPlanePtr> TCippingPlaneCont;
TCippingPlaneCont myCippingPlaneCont;

View File

@ -63,6 +63,8 @@
#include <vtkRenderer.h>
#include <vtkPlaneCollection.h>
#include "utilities.h"
#ifdef _DEBUG_
@ -90,6 +92,7 @@ SMESH_DeviceActor
myProperty = vtkProperty::New();
myMapper = VTKViewer_PolyDataMapper::New();
myPlaneCollection = vtkPlaneCollection::New();
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
myPolygonOffsetUnits);
@ -139,6 +142,7 @@ SMESH_DeviceActor
if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
myMapper->Delete();
myPlaneCollection->Delete();
myProperty->Delete();
@ -256,12 +260,20 @@ SMESH_DeviceActor
anId++; // 5
myMapper->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
if( myPlaneCollection->GetNumberOfItems() )
myMapper->SetClippingPlanes( myPlaneCollection );
vtkLODActor::SetMapper( myMapper );
Modified();
}
}
void
SMESH_DeviceActor
::SetPlaneCollection( vtkPlaneCollection* theCollection )
{
myPlaneCollection = theCollection;
}
VTKViewer_ExtractUnstructuredGrid*
SMESH_DeviceActor

View File

@ -45,6 +45,7 @@ class vtkUnstructuredGrid;
class vtkLookupTable;
class vtkImplicitBoolean;
class vtkPassThroughFilter;
class vtkPlaneCollection;
class VTKViewer_Transform;
class VTKViewer_TransformFilter;
@ -119,6 +120,8 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
VTKViewer_ExtractUnstructuredGrid* GetExtractUnstructuredGrid();
vtkUnstructuredGrid* GetUnstructuredGrid();
void SetPlaneCollection( vtkPlaneCollection* theCollection );
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_ScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
@ -158,6 +161,7 @@ class SMESHOBJECT_EXPORT SMESH_DeviceActor: public vtkLODActor{
VTKViewer_PolyDataMapper *myMapper;
TVisualObjPtr myVisualObj;
vtkPlaneCollection* myPlaneCollection;
vtkProperty *myProperty;
EReperesent myRepresentation;

View File

@ -960,7 +960,7 @@
{
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
//SALOMEDS::Color aColor = aGroupObject->GetColor();
#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
#else // old algorithm for auto-colors
@ -1004,7 +1004,7 @@
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() ) {
@ -1228,7 +1228,7 @@
SALOME_ListIO selected;
if( aSel ) {
aSel->selectedObjects( selected );
if(selected.Extent()){
Handle(SALOME_InteractiveObject) anIObject = selected.First();
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
@ -2065,7 +2065,7 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
}
total += nbBalls;
}
return autoUpdate && !exceeded;
}
@ -3505,7 +3505,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
tr( "NOT_A_VTK_VIEWER" ) );
}
break;
case 6032:
case 6032:
OverallMeshQuality();
break;
case 9010:
@ -4516,7 +4516,7 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert ( action( 6031 ), aSubId, -1 ); // EQUAL_VOLUME
popupMgr()->setRule( action( 6031 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6031 ), "controlMode = 'eCoincidentElems3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
@ -5533,13 +5533,34 @@ void SMESHGUI::storeVisualParameters (int savePoint)
aPropertyName += gSeparator;
aPropertyName += QString::number( anId );
QString aPropertyValue = QString::number( (int)aPlane->GetOrientation() ).toLatin1().constData();
QString aPropertyValue = QString::number( (int)aPlane->PlaneMode ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->GetDistance() ).toLatin1().constData();
aPropertyValue += QString::number( aPlane->IsOpenGLClipping ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->myAngle[0] ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->myAngle[1] ).toLatin1().constData();
if ( aPlane->PlaneMode == SMESH::Absolute ) {
aPropertyValue += QString::number( aPlane->myAbsoluteOrientation ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->X ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->Y ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->Z ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->Dx ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->Dy ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->Dz ).toLatin1().constData();
}
else if ( aPlane->PlaneMode == SMESH::Relative ) {
aPropertyValue += QString::number( (int)aPlane->myRelativeOrientation ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->GetDistance() ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->myAngle[0] ).toLatin1().constData();
aPropertyValue += gDigitsSep;
aPropertyValue += QString::number( aPlane->myAngle[1] ).toLatin1().constData();
}
ip->setProperty( aPropertyName.toStdString(), aPropertyValue.toStdString() );
}
@ -5749,9 +5770,13 @@ void SMESHGUI::storeVisualParameters (int savePoint)
// data structures for clipping planes processing
typedef struct {
int Id;
vtkIdType Orientation;
int Mode;
bool isOpenGLClipping;
vtkIdType RelativeOrientation;
double Distance;
double Angle[2];
int AbsoluteOrientation;
double X, Y, Z, Dx, Dy, Dz;
} TPlaneData;
typedef std::list<TPlaneData> TPlaneDataList;
typedef std::map<int, TPlaneDataList> TPlaneDataMap;
@ -5868,31 +5893,80 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
continue;
QStringList aPropertyValueList = aPropertyValue.split( gDigitsSep, QString::SkipEmptyParts );
if( aPropertyValueList.size() != 4 )
if( aPropertyValueList.size() != 6 && aPropertyValueList.size() != 9 )
continue;
TPlaneData aPlaneData;
aPlaneData.Id = aClippingPlaneId;
ok = false;
aPlaneData.Orientation = aPropertyValueList[0].toInt( &ok );
aPlaneData.Mode = aPropertyValueList[0].toInt( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.isOpenGLClipping = aPropertyValueList[1].toInt( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Distance = aPropertyValueList[1].toDouble( &ok );
if( !ok )
continue;
if ( (SMESH::Mode)aPlaneData.Mode == SMESH::Absolute )
{
ok = false;
aPlaneData.AbsoluteOrientation = aPropertyValueList[2].toInt( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Angle[0] = aPropertyValueList[2].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.X = aPropertyValueList[3].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Angle[1] = aPropertyValueList[3].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Y = aPropertyValueList[4].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Z = aPropertyValueList[5].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Dx = aPropertyValueList[6].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Dy = aPropertyValueList[7].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Dz = aPropertyValueList[8].toDouble( &ok );
if( !ok )
continue;
}
else if ( (SMESH::Mode)aPlaneData.Mode == SMESH::Relative ) {
ok = false;
aPlaneData.RelativeOrientation = aPropertyValueList[2].toInt( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Distance = aPropertyValueList[3].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Angle[0] = aPropertyValueList[4].toDouble( &ok );
if( !ok )
continue;
ok = false;
aPlaneData.Angle[1] = aPropertyValueList[5].toDouble( &ok );
if( !ok )
continue;
}
TPlaneDataList& aPlaneDataList = aPlaneDataMap[ aViewId ];
aPlaneDataList.push_back( aPlaneData );
@ -6315,21 +6389,18 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
// Clipping
else if (paramNameStr.startsWith("ClippingPlane")) {
QStringList vals = val.split(gDigitsSep, QString::SkipEmptyParts);
// old format - val looks like "Off" or "0:0.5:0:0" (orientation, distance, two angles)
// old format - val looks like "Off" or "1:0:0:0.5:0:0"
// (mode(relative), is OpenGL clipping plane, orientation, distance, two angles)
// or "0:1:1:10.5:1.0:1.0:15.0:10.0:10.0"
// (mode(absolute), is OpenGL clipping plane, orientation, base point(x, y, z), direction (dx, dy, dz))
// new format - val looks like "Off" or "0" (plane id)
// (note: in new format "Off" value is used only for consistency,
// so it is processed together with values in old format)
bool anIsOldFormat = ( vals.count() == 4 || val == "Off" );
bool anIsOldFormat = ( vals.count() == 6 || vals.count() == 9 || val == "Off" );
if( anIsOldFormat ) {
if (paramNameStr == "ClippingPlane1" || val == "Off")
aSmeshActor->RemoveAllClippingPlanes();
if (val != "Off") {
SMESH::Orientation anOrientation = (SMESH::Orientation)vals[0].toInt();
double aDistance = vals[1].toFloat();
double anAngle[2];
anAngle[0] = vals[2].toFloat();
anAngle[1] = vals[3].toFloat();
QList<SUIT_ViewManager*> lst;
getApp()->viewManagers(viewerTypStr, lst);
// SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
@ -6341,13 +6412,35 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
SMESH::TActorList anActorList;
anActorList.push_back( aSmeshActor );
SMESH::OrientedPlane* aPlane =
SMESHGUI_ClippingDlg::AddPlane(anActorList, vtkView, anOrientation, aDistance, anAngle);
SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New( vtkView );
aPlane->myViewWindow = vtkView;
SMESH::Mode aMode = ( SMESH::Mode )vals[0].toInt();
aPlane->PlaneMode = aMode;
bool isOpenGLClipping = ( bool )vals[1].toInt();
aPlane->IsOpenGLClipping = isOpenGLClipping;
if ( aMode == SMESH::Absolute ) {
aPlane->myAbsoluteOrientation = vals[2].toInt();
aPlane->X = vals[3].toFloat();
aPlane->Y = vals[4].toFloat();
aPlane->Z = vals[5].toFloat();
aPlane->Dx = vals[6].toFloat();
aPlane->Dy = vals[7].toFloat();
aPlane->Dz = vals[8].toFloat();
}
else if ( aMode == SMESH::Relative ) {
aPlane->myRelativeOrientation = (SMESH::Orientation)vals[2].toInt();
aPlane->myDistance = vals[3].toFloat();
aPlane->myAngle[0] = vals[4].toFloat();
aPlane->myAngle[1] = vals[5].toFloat();
}
if( aPlane ) {
SMESH::ClippingPlaneInfo aClippingPlaneInfo;
aClippingPlaneInfo.Plane = aPlane;
aClippingPlaneInfo.ActorList = anActorList;
aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
if ( SMESHGUI_ClippingDlg::AddPlane( anActorList, aPlane ) ) {
SMESH::ClippingPlaneInfo aClippingPlaneInfo;
aClippingPlaneInfo.Plane = aPlane;
aClippingPlaneInfo.ActorList = anActorList;
aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
}
}
}
}
@ -6468,23 +6561,40 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
for( ; anIter4 != aPlaneDataList.end(); anIter4++ ) {
const TPlaneData& aPlaneData = *anIter4;
if( aPlaneData.Id == aPlaneId ) {
SMESH::OrientedPlane* aPlane =
SMESHGUI_ClippingDlg::AddPlane( anActorList,
aViewWindow,
(SMESH::Orientation)aPlaneData.Orientation,
aPlaneData.Distance,
aPlaneData.Angle );
SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New( aViewWindow );
aPlane->myViewWindow = aViewWindow;
aPlane->PlaneMode = (SMESH::Mode)aPlaneData.Mode;
aPlane->IsOpenGLClipping = aPlaneData.isOpenGLClipping;
if ( aPlane->PlaneMode == SMESH::Absolute ) {
aPlane->myAbsoluteOrientation = aPlaneData.AbsoluteOrientation;
aPlane->X = aPlaneData.X;
aPlane->Y = aPlaneData.Y;
aPlane->Z = aPlaneData.Z;
aPlane->Dx = aPlaneData.Dx;
aPlane->Dy = aPlaneData.Dy;
aPlane->Dz = aPlaneData.Dz;
}
else if ( aPlane->PlaneMode == SMESH::Relative ) {
aPlane->myRelativeOrientation = (SMESH::Orientation)aPlaneData.RelativeOrientation;
aPlane->myDistance = aPlaneData.Distance;
aPlane->myAngle[0] = aPlaneData.Angle[0];
aPlane->myAngle[1] = aPlaneData.Angle[1];
}
if( aPlane ) {
SMESH::ClippingPlaneInfo aClippingPlaneInfo;
aClippingPlaneInfo.Plane = aPlane;
aClippingPlaneInfo.ActorList = anActorList;
aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
if ( SMESHGUI_ClippingDlg::AddPlane( anActorList, aPlane ) ) {
SMESH::ClippingPlaneInfo aClippingPlaneInfo;
aClippingPlaneInfo.Plane = aPlane;
aClippingPlaneInfo.ActorList = anActorList;
aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
}
}
break;
}
}
}
}
// update all VTK views
QList<SUIT_ViewManager*> lst;
@ -6493,6 +6603,14 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
SUIT_ViewModel* vmodel = (*it)->getViewModel();
if (vmodel && vmodel->getType() == SVTK_Viewer::Type()) {
SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
// set OpenGL clipping planes
VTK::ActorCollectionCopy aCopy( vtkView->getRenderer()->GetActors() );
vtkActorCollection* anAllActors = aCopy.GetActors();
anAllActors->InitTraversal();
while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
anActor->SetOpenGLClippingPlane();
vtkView->getRenderer()->ResetCameraClippingRange();
vtkView->Repaint();
}
@ -6691,7 +6809,6 @@ bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
return false;
}
SALOMEDS::Color SMESHGUI::getPredefinedUniqueColor()
{
static QList<QColor> colors;

File diff suppressed because it is too large Load Diff

View File

@ -46,60 +46,74 @@
#include <map>
#include <vector>
class QGroupBox;
class QLabel;
class QPushButton;
class QCheckBox;
class QComboBox;
class QListWidget;
class QListWidgetItem;
class QStackedLayout;
class QSlider;
class QMenu;
class SALOME_Actor;
class SMESHGUI;
class SMESH_Actor;
class SMESHGUI_SpinBox;
class QtxDoubleSpinBox;
class vtkActor;
class vtkDataSetMapper;
class vtkPlaneSource;
class vtkCallbackCommand;
class vtkObject;
class vtkImplicitPlaneWidget;
namespace SMESH
{
enum Mode { Absolute, Relative };
enum Orientation { XY, YZ, ZX };
class OrientedPlane: public vtkPlane
{
QPointer<SVTK_ViewWindow> myViewWindow;
vtkDataSetMapper* myMapper;
public:
static OrientedPlane *New();
static OrientedPlane *New(SVTK_ViewWindow* theViewWindow);
vtkTypeMacro (OrientedPlane, vtkPlane);
public:
static OrientedPlane *New();
static OrientedPlane *New(SVTK_ViewWindow* theViewWindow);
vtkTypeMacro (OrientedPlane, vtkPlane);
SMESH::Orientation myOrientation;
float myDistance;
double myAngle[2];
QPointer<SVTK_ViewWindow> myViewWindow;
SMESH::Orientation myRelativeOrientation;
float myDistance;
double myAngle[2];
double X, Y, Z, Dx, Dy, Dz;
int myAbsoluteOrientation;
bool IsInvert;
bool IsOpenGLClipping;
Mode PlaneMode;
vtkPlaneSource* myPlaneSource;
SALOME_Actor *myActor;
vtkPlaneSource* myPlaneSource;
SALOME_Actor *myActor;
void SetOrientation (SMESH::Orientation theOrientation) { myOrientation = theOrientation; }
SMESH::Orientation GetOrientation() { return myOrientation; }
void SetOrientation (SMESH::Orientation theOrientation) { myRelativeOrientation = theOrientation; }
SMESH::Orientation GetOrientation() { return myRelativeOrientation; }
void SetDistance (float theDistance) { myDistance = theDistance; }
float GetDistance() { return myDistance; }
void SetDistance (float theDistance) { myDistance = theDistance; }
float GetDistance() { return myDistance; }
void ShallowCopy (OrientedPlane* theOrientedPlane);
void ShallowCopy (OrientedPlane* theOrientedPlane);
OrientedPlane* InvertPlane ();
protected:
OrientedPlane(SVTK_ViewWindow* theViewWindow);
OrientedPlane();
protected:
OrientedPlane(SVTK_ViewWindow* theViewWindow);
OrientedPlane();
void Init();
void Init();
~OrientedPlane();
private:
// Not implemented.
OrientedPlane (const OrientedPlane&);
void operator= (const OrientedPlane&);
~OrientedPlane();
private:
// Not implemented.
OrientedPlane (const OrientedPlane&);
void operator= (const OrientedPlane&);
};
typedef vtkSmartPointer<OrientedPlane> TPlane;
@ -132,82 +146,133 @@ class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog
public:
SMESHGUI_ClippingDlg( SMESHGUI*, SVTK_ViewWindow* );
~SMESHGUI_ClippingDlg();
double getDistance() const;
void setDistance( const double );
double getRotation1() const;
double getRotation2() const;
void setRotation( const double, const double );
// used in SMESHGUI::restoreVisualParameters() to avoid
// declaration of OrientedPlane outside of SMESHGUI_ClippingDlg.cxx
static SMESH::OrientedPlane* AddPlane (SMESH::TActorList theActorList,
SVTK_ViewWindow* theViewWindow,
SMESH::Orientation theOrientation,
double theDistance,
const double theAngle[2]);
protected:
void keyPressEvent( QKeyEvent* );
static bool AddPlane ( SMESH::TActorList theActorList,
SMESH::OrientedPlane* thePlane );
protected:
void keyPressEvent( QKeyEvent* );
static void ProcessEvents( vtkObject* theObject,
unsigned long theEvent,
void* theClientData,
void* theCallData);
private:
void initializePlaneData();
double getDistance() const;
void setDistance( const double );
double getRotation1() const;
double getRotation2() const;
void setRotation( const double, const double );
void synchronize();
void setOrigin(double theVal[3]);
void setDirection(double theVal[3]);
void updateActorList();
SMESH::TActorList getCurrentActors();
void initializePlaneData();
void initParam();
void synchronize();
void updateActorList();
void updateActorItem( QListWidgetItem* theItem,
bool theUpdateSelectAll,
bool theUpdateClippingPlaneMap );
SMESH::TActorList getCurrentActors();
void updateActorItem( QListWidgetItem* theItem,
bool theUpdateSelectAll,
bool theUpdateClippingPlaneMap );
void dumpPlaneData() const;
void absolutePlaneToRelative ( double theOrigin[3], double theDir[3] );
void setBoundsForPreviewWidget();
vtkImplicitPlaneWidget* createPreviewWidget();
void dumpPlaneData() const;
private:
SMESHGUI* mySMESHGUI;
SVTK_ViewWindow* myViewWindow;
SMESH::TPlaneDataVector myPlanes;
vtkCallbackCommand* myCallback;
vtkImplicitPlaneWidget* myPreviewWidget;
double myBounds[6];
QComboBox* ComboBoxPlanes;
QCheckBox* isOpenGLClipping;
QPushButton* buttonNew;
QMenu* MenuMode;
QPushButton* buttonDelete;
QListWidget* ActorList;
QCheckBox* SelectAllCheckBox;
QStackedLayout* ModeStackedLayout;
QGroupBox* GroupAbsolutePoint;
QLabel* TextLabelX;
QLabel* TextLabelY;
QLabel* TextLabelZ;
QtxDoubleSpinBox* SpinBox_X;
QtxDoubleSpinBox* SpinBox_Y;
QtxDoubleSpinBox* SpinBox_Z;
QPushButton* resetButton;
QGroupBox* GroupAbsoluteDirection;
QLabel* TextLabelDx;
QLabel* TextLabelDy;
QLabel* TextLabelDz;
QtxDoubleSpinBox* SpinBox_Dx;
QtxDoubleSpinBox* SpinBox_Dy;
QtxDoubleSpinBox* SpinBox_Dz;
QPushButton* invertButton;
QComboBox* CBAbsoluteOrientation;
QGroupBox* GroupRelative;
QLabel* TextLabelOrientation;
QComboBox* ComboBoxOrientation;
QLabel* TextLabelDistance;
SMESHGUI_SpinBox* SpinBoxDistance;
QLabel* TextLabelRot1;
SMESHGUI_SpinBox* SpinBoxRot1;
QLabel* TextLabelRot2;
SMESHGUI_SpinBox* SpinBoxRot2;
QLabel* TextLabelRotation1;
QLabel* TextLabelRotation2;
QLabel* TLValueDistance;
QLabel* TLValueRotation1;
QLabel* TLValueRotation2;
QSlider* SliderDistance;
QSlider* SliderRotation1;
QSlider* SliderRotation2;
QComboBox* CBRelativeOrientation;
QCheckBox* PreviewCheckBox;
QCheckBox* AutoApplyCheckBox;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QPushButton* buttonHelp;
bool myIsSelectPlane;
bool myIsPreviewMoved;
QString myHelpFileName;
SMESH::Mode CurrentMode;
protected slots:
virtual void reject();
virtual void reject();
public slots:
void onSelectPlane( int );
void ClickOnNew();
void ClickOnDelete();
void onActorItemChanged( QListWidgetItem* );
void onSelectAll( int );
void onSelectOrientation( int );
void SetCurrentPlaneParam();
void OnPreviewToggle( bool );
void onAutoApply(bool);
void ClickOnOk();
void ClickOnApply();
void ClickOnHelp();
void onModeAbsolute();
void onModeRelative();
void ClickOnNew();
void ClickOnDelete();
void onSelectPlane( int );
void onSelectAll( int );
void onActorItemChanged( QListWidgetItem* );
void SetCurrentPlaneParam();
void onIsOpenGLClipping(bool);
void OnPreviewToggle( bool );
void onAutoApply(bool);
void ClickOnOk();
void ClickOnApply();
void ClickOnHelp();
void SliderDistanceHasMoved(int);
void SliderRotation1HasMoved(int);
void SliderRotation2HasMoved(int);
void onSelectAbsoluteOrientation( int );
void onSelectRelativeOrientation( int );
void onReset();
void onInvert();
};
#endif // SMESHGUI_CLIPPINGDLG_H

View File

@ -1396,6 +1396,20 @@ namespace SMESH
double theDist,
double theBounds[6],
double theOrigin[3] )
{
bool anIsOk = false;
anIsOk = ComputeBounds( theActorList, theBounds );
if( !anIsOk )
return false;
DistanceToPosition( theBounds, theNormal, theDist, theOrigin );
return true;
}
bool ComputeBounds( std::list<vtkActor*> theActorList,
double theBounds[6])
{
bool anIsOk = false;
theBounds[0] = theBounds[2] = theBounds[4] = VTK_DOUBLE_MAX;
@ -1416,12 +1430,7 @@ namespace SMESH
}
}
}
if( !anIsOk )
return false;
DistanceToPosition( theBounds, theNormal, theDist, theOrigin );
return true;
return anIsOk;
}
#ifndef DISABLE_PLOT2DVIEWER

View File

@ -206,6 +206,14 @@ SMESHGUI_EXPORT
double theDist,
double theBounds[6],
double theOrigin[3] );
bool ComputeBounds( std::list<vtkActor*> theActorList,
double theBounds[6]);
void PositionToDistance( double theBounds[6],
double theDirection[3],
double thePos[3],
double& theDist );
SMESHGUI_EXPORT
void RemoveVisualObjectWithActors( const char* theEntry, bool fromAllViews = false );
};

View File

@ -6548,6 +6548,10 @@ It is impossible to read point coordinates from file</translation>
<source>CLIP_PLANES</source>
<translation>Clipping planes</translation>
</message>
<message>
<source>IS_OPENGL_CLIPPING</source>
<translation>OpenGL clipping</translation>
</message>
<message>
<source>MESHES_SUBMESHES_GROUPS</source>
<translation>Meshes, sub-meshes and groups</translation>
@ -6608,6 +6612,30 @@ It is impossible to read point coordinates from file</translation>
<source>NO_PLANES</source>
<translation>No planes</translation>
</message>
<message>
<source>ABSOLUTE</source>
<translation>Absolute</translation>
</message>
<message>
<source>RELATIVE</source>
<translation>Relative</translation>
</message>
<message>
<source>BASE_POINT</source>
<translation>Base point</translation>
</message>
<message>
<source>DIRECTION</source>
<translation>Direction</translation>
</message>
<message>
<source>RESET</source>
<translation>Reset</translation>
</message>
<message>
<source>INVERT</source>
<translation>Invert</translation>
</message>
</context>
<context>
<name>SMESHGUI_DuplicateNodesDlg</name>

View File

@ -6486,6 +6486,10 @@ Il y a trop peu de points dans le fichier </translation>
<source>CLIP_PLANES</source>
<translation>Plans de découpe</translation>
</message>
<message>
<source>IS_OPENGL_CLIPPING</source>
<translation>OpenGL découpage</translation>
</message>
<message>
<source>MESHES_SUBMESHES_GROUPS</source>
<translation>Maillages, sous-maillages et groupes</translation>
@ -6546,6 +6550,30 @@ Il y a trop peu de points dans le fichier </translation>
<source>NO_PLANES</source>
<translation>Pas de plans</translation>
</message>
<message>
<source>ABSOLUTE</source>
<translation>Absolute</translation>
</message>
<message>
<source>RELATIVE</source>
<translation>Relative</translation>
</message>
<message>
<source>RESET</source>
<translation>Réinitialiser</translation>
</message>
<message>
<source>INVERT</source>
<translation>Inverser</translation>
</message>
<message>
<source>BASE_POINT</source>
<translation>Le point fondamental</translation>
</message>
<message>
<source>DIRECTION</source>
<translation>Direction</translation>
</message>
</context>
<context>
<name>SMESHGUI_DuplicateNodesDlg</name>