return NULL;
}
+vtkImplicitFunctionCollection* VISU_Actor::GetClippingPlanes()
+{
+ return NULL;
+}
+
//----------------------------------------------------------------------------
template<class TData> std::string getScalar(TData* theData, int theId)
{
class VTKViewer_ShrinkFilter;
class VISU_PipeLine;
class vtkPlane;
+class vtkImplicitFunctionCollection;
class VISU_FramedTextActor;
virtual vtkPlane* GetClippingPlane(vtkIdType theID);
+ virtual vtkImplicitFunctionCollection* GetClippingPlanes();
+
//----------------------------------------------------------------------------
//! Apply the picking settings on the actor.
void
#include <vtkObjectFactory.h>
#include <vtkImplicitBoolean.h>
#include <SALOME_ExtractGeometry.h>
-#include <vtkExtractPolyDataGeometry.h>
+#include <SALOME_ExtractPolyDataGeometry.h>
#include <vtkImplicitFunctionCollection.h>
#include <vtkPlane.h>
::VISU_DataSetActor():
myMapper(vtkDataSetMapper::New()),
myExtractor(SALOME_ExtractGeometry::New()),
- myPolyDataExtractor(vtkExtractPolyDataGeometry::New()),
+ myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()),
myFunction(vtkImplicitBoolean::New())
{
if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<<this);
myExtractor->SetImplicitFunction(myFunction);
myPolyDataExtractor->SetImplicitFunction(myFunction);
- //myExtractor->ExtractBoundaryCellsOn();
+ myExtractor->ExtractBoundaryCellsOn();
myFunction->SetOperationTypeToIntersection();
myExtractor->SetInput(theDataSet);
myMapper->SetInput(myExtractor->GetOutput());
}
+ // myMapper->SetInput(theDataSet);
SetMapper(myMapper.GetPointer());
}
class vtkDataSetMapper;
class SALOME_ExtractGeometry;
-class vtkExtractPolyDataGeometry;
+class SALOME_ExtractPolyDataGeometry;
class vtkImplicitBoolean;
class vtkImplicitFunctionCollection;
//----------------------------------------------------------------------------
vtkSmartPointer<vtkDataSetMapper> myMapper;
vtkSmartPointer<SALOME_ExtractGeometry> myExtractor;
- vtkSmartPointer<vtkExtractPolyDataGeometry> myPolyDataExtractor;
+ vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
vtkSmartPointer<vtkImplicitBoolean> myFunction;
};
#include "VISU_PipeLineUtils.hxx"
#include <SALOME_ExtractGeometry.h>
+#include <SALOME_ExtractPolyDataGeometry.h>
#include <vtkObjectFactory.h>
#include <vtkRenderer.h>
{
Superclass::SetMapperInput( theDataSet );
-// myPointsActor->SetInput( theDataSet );
-// mySurfaceActor->SetInput( theDataSet );
-// myEdgeActor->SetInput( theDataSet );
- myPointsActor->SetInput( myExtractor->GetOutput() );
- mySurfaceActor->SetInput( myExtractor->GetOutput() );
- myEdgeActor->SetInput( myExtractor->GetOutput() );
+// myPointsActor->SetInput( theDataSet );
+// mySurfaceActor->SetInput( theDataSet );
+// myEdgeActor->SetInput( theDataSet );
+
+ if (theDataSet->IsA("vtkPolyData")) {
+ myPointsActor->SetInput( myPolyDataExtractor->GetOutput() );
+ mySurfaceActor->SetInput( myPolyDataExtractor->GetOutput() );
+ myEdgeActor->SetInput( myPolyDataExtractor->GetOutput() );
+ } else {
+ myPointsActor->SetInput( myExtractor->GetOutput() );
+ mySurfaceActor->SetInput( myExtractor->GetOutput() );
+ myEdgeActor->SetInput( myExtractor->GetOutput() );
+ }
}
//----------------------------------------------------------------------------
if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
aFunction->AddItem(thePlane);
+ aBoolean->Modified();
// Check, that at least one cell present after clipping.
// This check was introduced because of bug IPAL8849.
vtkDataSet* aClippedDataSet = GetClippedInput();
return aPlane;
}
+//----------------------------------------------------------------------------
+void VISU_DataSetMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+ aFunctions->RemoveItem(theID);
+ aBoolean->Modified();
+ }
+ }
+}
+
+
//----------------------------------------------------------------------------
void
VISU_DataSetMapperHolder
vtkPlane*
GetClippingPlane(vtkIdType theID);
+ virtual void RemoveClippingPlane(vtkIdType theID);
+
protected:
//----------------------------------------------------------------------------
VISU_DataSetMapperHolder();
vtkPlane*
GetClippingPlane(vtkIdType theID) = 0;
+ virtual void RemoveClippingPlane(vtkIdType theID) = 0;
+
//----------------------------------------------------------------------------
virtual
void
return GetMapperHolder()->GetClippingPlane(theID);
}
+//----------------------------------------------------------------------------
+void VISU_PipeLine::RemoveClippingPlane(vtkIdType theID)
+{
+ return GetMapperHolder()->RemoveClippingPlane(theID);
+}
+
//----------------------------------------------------------------------------
vtkDataSet*
VISU_PipeLine
vtkPlane*
GetClippingPlane(vtkIdType theID);
+ virtual void RemoveClippingPlane(vtkIdType theID);
+
virtual
void
SetPlaneParam(vtkFloatingPointType theDir[3],
if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) {
vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
aFunction->AddItem(thePlane);
+ aBoolean->Modified();
// Check, that at least one cell present after clipping.
// This check was introduced because of bug IPAL8849.
vtkDataSet* aClippedDataSet = GetClippedInput();
return aPlane;
}
+//----------------------------------------------------------------------------
+void VISU_PolyDataMapperHolder::RemoveClippingPlane(vtkIdType theID)
+{
+ if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
+ if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction();
+ aFunctions->RemoveItem(theID);
+ aBoolean->Modified();
+ }
+ }
+}
+
//----------------------------------------------------------------------------
void
VISU_PolyDataMapperHolder
virtual
vtkPlane*
GetClippingPlane(vtkIdType theID);
+
+ void RemoveClippingPlane(vtkIdType theID);
protected:
//----------------------------------------------------------------------------
VisuGUI_SegmentationMgr* aSegmentationMgr = aVisuExtender->getSegmentationMgr(aViewWindow);
myDSActor->RemoveAllClippingPlanes();
+
const QListOfPlanes& aPlanes = aSegmentationMgr->getPlanes();
PlaneDef aPlane;
+
for (int i = 0; i < myGlobalPlanes->count(); i++) {
if (myGlobalPlanes->item(i)->checkState() == Qt::Checked) {
aPlane = aPlanes.at(i);
QListWidgetItem* aItem = new QListWidgetItem(aPlane.name, myGlobalPlanes);
if (aPlane.isAuto)
aItem->setFlags(0);
- else
- aItem->setCheckState(Qt::Unchecked);
+ // else
+ aItem->setCheckState(Qt::Unchecked);
myGlobalPlanes->addItem(aItem);
//Create preview
break;
}
}
- }
+ }
}
// function : initGlobalPlanes()
// purpose :
//=================================================================================
-VISU_DataSetActor* VisuGUI_ClippingDlg::getSelectedActor()
+VISU_Actor* VisuGUI_ClippingDlg::getSelectedActor()
{
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI);
if (!aPrs) return 0;
VISU_Actor* aActor = VISU::FindActor(aViewWindow, aPrs);
- if (!aActor) return 0;
-
- VISU_DataSetActor* aDSActor = dynamic_cast<VISU_DataSetActor*>(aActor);
- return aDSActor;
+ return aActor;
}
//=================================================================================
class vtkPlaneSource;
class vtkDataSetMapper;
class OrientedPlane;
-class VISU_DataSetActor;
+class VISU_Actor;
class PreviewPlane;
namespace VISU {
void initGlobalPlanes();
bool hasGlobalPlanes();
- VISU_DataSetActor* getSelectedActor();
+ VISU_Actor* getSelectedActor();
void applyLocalPlanes();
void applyGlobalPlanes();
QButtonGroup* myPlaneTypeGrp;
QListWidget* myGlobalPlanes;
bool myHasGlobalPl;
- VISU_DataSetActor* myDSActor;
+ VISU_Actor* myDSActor;
QList<PreviewPlane*> myPreviewList;
protected:
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
-#include "VISU_DataSetActor.h"
+#include "VISU_Actor.h"
#include <LightApp_Application.h>
#include <SUIT_Desktop.h>
while ( (aActor = anActors->GetNextActor()) ) {
VISU_Actor* vActor = VISU_Actor::SafeDownCast( aActor );
if (vActor) {
- VISU_DataSetActor* aDSActor = dynamic_cast<VISU_DataSetActor*>(vActor);
- if (aDSActor) {
- ListOfvtkPlanes aList;
- vtkImplicitFunctionCollection* aFunctions = aDSActor->GetClippingPlanes();
- aFunctions->InitTraversal();
- vtkImplicitFunction* aItem;
- while ((aItem = aFunctions->GetNextItem())) {
- for (int i = 0; i < myPlanes.size(); i++) {
- aPlane = myPlanes.at(i);
- if (aPlane.plane.GetPointer() == aItem)
- aList.append(aPlane.plane);
- }
+ ListOfvtkPlanes aList;
+ vtkImplicitFunctionCollection* aFunctions = vActor->GetClippingPlanes();
+ aFunctions->InitTraversal();
+ vtkImplicitFunction* aItem;
+ while ((aItem = aFunctions->GetNextItem())) {
+ for (int i = 0; i < myPlanes.size(); i++) {
+ aPlane = myPlanes.at(i);
+ if (aPlane.plane.GetPointer() == aItem)
+ aList.append(aPlane.plane);
}
- myActorsMap[aDSActor] = aList;
- aDSActor->RemoveAllClippingPlanes();
}
+ myActorsMap[vActor] = aList;
+ vActor->RemoveAllClippingPlanes();
}
}
myCopyActorsMap = myActorsMap;
void VisuGUI_ClippingPlaneMgr::deletePlaneFromActors(int thePlaneId)
{
vtkPlane* aPl = myPlanes.at(thePlaneId).plane;
- QList<VISU_DataSetActor*> aActors = myActorsMap.keys();
- VISU_DataSetActor* aActor;
+ QList<VISU_Actor*> aActors = myActorsMap.keys();
+ VISU_Actor* aActor;
vtkPlane* aPlane;
for (int i = 0; i < aActors.size(); i++) {
aActor = aActors.at(i);
//****************************************************************
-void VisuGUI_ClippingPlaneMgr::restoreState(const QMap<VISU_DataSetActor*, ListOfvtkPlanes>& theState)
+void VisuGUI_ClippingPlaneMgr::restoreState(const QMap<VISU_Actor*, ListOfvtkPlanes>& theState)
{
- QList<VISU_DataSetActor*> aActors = theState.keys();
- VISU_DataSetActor* aActor;
+ QList<VISU_Actor*> aActors = theState.keys();
+ VISU_Actor* aActor;
vtkPlane* aPlane;
- QMapIterator<VISU_DataSetActor*, ListOfvtkPlanes> aIt(theState);
+ QMapIterator<VISU_Actor*, ListOfvtkPlanes> aIt(theState);
while (aIt.hasNext()) {
aIt.next();
aActor = aIt.key();
class vtkImplicitPlaneWidget;
class vtkCallbackCommand;
-class VISU_DataSetActor;
+class VISU_Actor;
#include <QDialog>
#include <VisuGUI_SegmentationMgr.h>
void saveState();
void deletePlaneFromActors(int thePlaneId);
- void restoreState(const QMap<VISU_DataSetActor*, ListOfvtkPlanes>& theState);
+ void restoreState(const QMap<VISU_Actor*, ListOfvtkPlanes>& theState);
VisuGUI_SegmentationMgr* mySegmentationMgr;
vtkSmartPointer<vtkCallbackCommand> myCallback;
//Stores Actors and Ids of applied planes (position in myPlanes)
- QMap<VISU_DataSetActor*, ListOfvtkPlanes> myActorsMap;
- QMap<VISU_DataSetActor*, ListOfvtkPlanes> myCopyActorsMap;
+ QMap<VISU_Actor*, ListOfvtkPlanes> myActorsMap;
+ QMap<VISU_Actor*, ListOfvtkPlanes> myCopyActorsMap;
double myBounds[6];
{
}
+// void CutPlaneFunction::removeCutPlaneFunctions(VISU_Actor* theActor)
+// {
+// VISU_PipeLine* aPL = theActor->GetPipeLine();
+// vtkIdType aNbPlanes = aPL->GetNumberOfClippingPlanes();
+// CutPlaneFunction* aPlane = 0;
+// printf("#### Before delete Nb = %i\n", aNbPlanes);
+// for (vtkIdType i = aNbPlanes - 1; i >= 0; i--) {
+// aPlane = dynamic_cast<CutPlaneFunction*>(aPL->GetClippingPlane(i));
+// if (aPlane) {
+// aPL->RemoveClippingPlane(i);
+// }
+// }
+// printf("#### After delete Nb = %i\n", aPL->GetNumberOfClippingPlanes());
+// }
//****************************************************************
//****************************************************************
VisuGUI_SegmentationMgr::VisuGUI_SegmentationMgr(VisuGUI* theModule, SVTK_ViewWindow* theWindow):
- myIsPlanesNonActive(true),
+ myIsPlanesNonActive(false),
myIsPlanesVisible(false),
myWindow(theWindow),
myModule(theModule),
aPlane.plane->setActive(!theNonActive);
}
myWindow->Repaint();
-
}
//****************************************************************
//****************************************************************
bool VisuGUI_SegmentationMgr::isContainsPlane(VISU_Actor* theActor, vtkPlane* thePlane)
{
- VISU_DataSetActor* aDSActor = dynamic_cast<VISU_DataSetActor*>(theActor);
- if (!aDSActor) return false;
-
- vtkImplicitFunctionCollection* aFunctions = aDSActor->GetClippingPlanes();
+ vtkImplicitFunctionCollection* aFunctions = theActor->GetClippingPlanes();
aFunctions->InitTraversal();
vtkImplicitFunction* aItem;
while ((aItem = aFunctions->GetNextItem())) {
void setActive(bool theActive);
bool isActive() const { return myIsActive; }
+ //static void removeCutPlaneFunctions(VISU_Actor* theActor);
+
protected:
CutPlaneFunction();
~CutPlaneFunction();