-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2008 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
//
-// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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
+//
+// VISU OBJECT : interactive object for VISU entities implementation
// File : VISU_MeshAct.hxx
// Author : Laurent CORNABE with the help of Nicolas REJNERI
// Module : VISU
// $Header$
-
+//
#include "VISU_GaussPtsAct.h"
#include "VISU_GaussPointsPL.hxx"
#include "VISU_GaussPtsSettings.h"
#include "VISU_GaussPtsDeviceActor.h"
+#include "VISU_PickingSettings.h"
#include "VISU_WidgetCtrl.hxx"
#include "VISU_SphereWidget.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_ScalarBarCtrl.hxx"
#include "VISU_ScalarBarActor.hxx"
-#include "SALOME_ExtractGeometry.h"
-
#include "VISU_Event.h"
#include "SVTK_Actor.h"
+#include <SALOME_ExtractPolyDataGeometry.h>
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkPointPicker.h>
+#include <vtkMatrix4x4.h>
#include <vtkScalarBarWidget.h>
-#include <vtkScalarBarActor.h>
#include <vtkTextMapper.h>
#include <vtkTextProperty.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+#include <vtkPlane.h>
-#include <vtkCellData.h>
#include <vtkPointData.h>
-
+#include <vtkCellData.h>
#include <vtkDataArray.h>
-#include <vtkFloatArray.h>
#include <vtkSphereSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyData.h>
#include <vtkActor.h>
+#include <vtkTransform.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
#include <boost/bind.hpp>
#include <vtkUnstructuredGrid.h>
-#include <vtkDataSetMapper.h>
+#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkCellArray.h>
+#include <vtkWarpVector.h>
+#include <vtkCellDataToPointData.h>
#include <vtkCell.h>
#include <vtkMath.h>
#endif
+namespace
+{
+ bool
+ CheckIsSameValue(vtkFloatingPointType theTarget,
+ vtkFloatingPointType theSource)
+ {
+ static vtkFloatingPointType TOL = 10.0 / VTK_LARGE_FLOAT;
+ return fabs(theTarget - theSource) < TOL;
+ }
+
+ bool
+ CheckIsSameVector(vtkFloatingPointType* theTarget,
+ vtkFloatingPointType* theSource,
+ size_t theLength)
+ {
+ for ( size_t anId = 0; anId < theLength; anId++ ) {
+ if ( !CheckIsSameValue( theTarget[ anId ], theSource[ anId ] ) )
+ return false;
+ }
+
+ return true;
+ }
+
+}
+
//============================================================================
vtkStandardNewMacro(VISU_GaussPtsAct);
myDeviceActor(VISU_GaussPtsDeviceActor::New()),
myWidgetCtrl(NULL),
myGaussPointsPL(NULL),
- myLastObjPointID(-1),
- myTextActor(VISU_FramedTextActor::New()),
+ myLastPreHighlightObjID(-1),
myCursorPyramid(VISU_CursorPyramid::New()),
myCursorPyramidSelected(VISU_CursorPyramid::New()),
myCellSource(vtkUnstructuredGrid::New()),
myCellActor(SVTK_Actor::New()),
myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
myBarVisibility(true),
- myPickingSettings(NULL),
myInsideCursorSettings(NULL),
- myCurrentPL(NULL)
+ myCurrentPL(NULL),
+ myMapper(vtkPolyDataMapper::New()),
+ myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()),
+ myFunction(vtkImplicitBoolean::New()),
+ myWarpVector(vtkWarpVector::New()),
+ myCellDataToPointData(vtkCellDataToPointData::New())
{
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
myEventCallbackCommand->Delete();
myDeviceActor->Delete();
- myTextActor->Delete();
myCursorPyramid->Delete();
myCursorPyramid->SetPickable(0);
myEventCallbackCommand->SetClientData(this);
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct::ProcessEvents);
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+
myDeviceActor->SetProperty(GetProperty());
+ myDeviceActor->SetUserMatrix(aMatrix);
myDeviceActor->SetVisibility(true);
myDeviceActor->SetPickable(false);
- myTextActor->SetVisibility(false);
- myTextActor->SetPickable(false);
-
myCellSource->Allocate();
myCellActor->Initialize();
myCellActor->SetRepresentation(VTK_WIREFRAME);
myCellActor->SetSource(myCellSource.GetPointer());
-
+
myCellActor->SetVisibility(0);
myCellActor->SetPickable(0);
myCellActor->GetProperty()->SetAmbient(1.0);
myCellActor->GetProperty()->SetDiffuse(0.0);
myScalarBarCtrl->Delete();
+
+ myMapper->Delete();
+ aMatrix->Delete();
+
+ myWarpVector->Delete();
+ myCellDataToPointData->Delete();
+
+ myPolyDataExtractor->SetImplicitFunction(myFunction);
+ //myPolyDataExtractor->ExtractBoundaryCellsOn();
+
+ myFunction->SetOperationTypeToIntersection();
+ myPolyDataExtractor->Delete();
+ myFunction->Delete();
+
+ if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() )
+ aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
VISU_GaussPtsAct
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
SetWidgetCtrl(NULL);
SetInteractor(NULL);
- SetPickingSettings(NULL);
SetInsideCursorSettings(NULL);
}
return myGaussPointsPL.GetPointer();
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::DeepCopy(VISU_Actor *theActor)
+{
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+ Superclass::DeepCopy(theActor);
+ SetBarVisibility(anActor->GetBarVisibility());
+ }
+}
+
+//----------------------------------------------------------------------------
void
VISU_GaussPtsAct
::ShallowCopyPL(VISU_PipeLine* thePipeLine)
{
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::ShallowCopyPL - this = "<<this);
-
+
Superclass::ShallowCopyPL(thePipeLine);
-
+
UpdateInsideCursorSettings();
-
+
Highlight(isHighlighted());
}
//----------------------------------------------------------------------------
+
vtkMapper*
VISU_GaussPtsAct
::GetMapper()
{
+ //vtkMapper* aMapper = myCurrentPL->GetPointSpriteMapper();
+ //aMapper->Update();
+ //return aMapper;
myMapper->Update();
- return Superclass::GetMapper();
+ return myMapper.GetPointer();
}
-float*
+vtkFloatingPointType*
VISU_GaussPtsAct
::GetBounds()
{
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct
+::GetMemorySize()
+{
+ vtkDataSet* aDataSet = myDeviceActor->GetMapper()->GetInput();
+ unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
+
+ aSize += Superclass::GetMemorySize();
+
+ return aSize;
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPtsAct
myDeviceActor->AddToRender(theRenderer);
- theRenderer->AddActor(myTextActor.GetPointer());
theRenderer->AddActor(myCellActor.GetPointer());
myCursorPyramid->AddToRender(theRenderer);
{
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::RemoveFromRender - this = "<<this);
- Superclass::RemoveFromRender(theRenderer);
-
myDeviceActor->RemoveFromRender(theRenderer);
- theRenderer->RemoveActor(myTextActor.GetPointer());
theRenderer->RemoveActor(myCellActor.GetPointer());
myCursorPyramid->RemoveFromRender(theRenderer);
myCursorPyramidSelected->RemoveFromRender(theRenderer);
myScalarBarCtrl->RemoveFromRender(theRenderer);
+
+ Superclass::RemoveFromRender(theRenderer);
}
void
VISU_GaussPtsAct
::RenderOpaqueGeometry(vtkViewport *viewport)
{
+ GetMatrix(myDeviceActor->GetUserMatrix());
return 1;
}
VISU_GaussPtsAct
::RenderTranslucentGeometry(vtkViewport *viewport)
{
+ GetMatrix(myDeviceActor->GetUserMatrix());
return 1;
}
{
myEventCallbackCommand->SetAbortFlag(1);
- float aMagnification = myInsideCursorSettings->GetMagnification();
- float anIncrement = myInsideCursorSettings->GetIncrement();
- float coefficient = up ? anIncrement : 1 / anIncrement;
+ vtkFloatingPointType aMagnification = myInsideCursorSettings->GetMagnification();
+ vtkFloatingPointType anIncrement = myInsideCursorSettings->GetIncrement();
+ vtkFloatingPointType coefficient = up ? anIncrement : 1 / anIncrement;
myInsideCursorSettings->SetMagnification( aMagnification * coefficient );
myInsideCursorSettings->InvokeEvent(VISU::UpdateFromSettingsEvent,NULL);
CreatePipeLine(VISU_GaussPointsPL* thePipeLine)
{
VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
- aPipeLine->SetGaussPtsIDMapper(thePipeLine->GetGaussPtsIDMapper());
- aPipeLine->ShallowCopy(thePipeLine);
+ aPipeLine->ShallowCopy(thePipeLine, true);
aPipeLine->Update();
return aPipeLine;
}
{
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<<this);
+ myDeviceActor->SetExtractor(myPolyDataExtractor);
myDeviceActor->SetPipeLine(GetGaussPointsPL());
myCurrentPL = myDeviceActor->GetPipeLine();
+ //SetMapper(myCurrentPL->GetPointSpriteMapper());
+
+ // myPolyDataExtractor->SetInput(myCurrentPL->GetPickableDataSet());
+ //myMapper->SetInput(myPolyDataExtractor->GetOutput());
myMapper->SetInput(myCurrentPL->GetPickableDataSet());
SetMapper(myMapper.GetPointer());
}
namespace
{
inline
- float
+ vtkFloatingPointType
GetRadius(vtkIdType theVTKID,
vtkDataArray *theScalarArray,
VISU_GaussPointsPL* theGaussPointsPL)
{
- float aRadius = 0.5;
- if(theGaussPointsPL->GetPSMapper()->GetPointSpriteMode() == 1) // Geometry mode
+ vtkFloatingPointType aRadius = 0.5;
+ if(theGaussPointsPL->GetPointSpriteMapper()->GetPointSpriteMode() == 1) // Geometry mode
aRadius *= theGaussPointsPL->GetSize() * theGaussPointsPL->GetAverageCellSize();
else if(theGaussPointsPL->GetBicolor()){
- float aVal = theScalarArray->GetTuple1(theVTKID);
+ vtkFloatingPointType aVal = theScalarArray->GetTuple1(theVTKID);
if(aVal > 0.0)
aRadius *= theGaussPointsPL->GetMaxSize();
else
}
}
-float
+vtkFloatingPointType
VISU_GaussPtsAct
::GetRadius(vtkIdType theObjID,
vtkIdType theVTKID,
}
//----------------------------------------------------------------------------
-float
+vtkFloatingPointType
VISU_GaussPtsAct
::GetMagnification(vtkIdType theObjID)
{
namespace
{
inline
- float
+ vtkFloatingPointType
GetClamp(VISU_GaussPointsPL* theGaussPointsPL)
{
- float aClamp = theGaussPointsPL->GetClamp();
+ vtkFloatingPointType aClamp = theGaussPointsPL->GetClamp();
if(theGaussPointsPL->GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere)
return -aClamp;
return aClamp;
}
}
-float
+vtkFloatingPointType
VISU_GaussPtsAct
::GetClamp(vtkIdType theObjID)
{
::SetVisibility(int theMode)
{
Superclass::SetVisibility(theMode);
+ myDeviceActor->SetVisibility(GetVisibility()); // VSV
myScalarBarCtrl->SetVisibility(theMode);
Highlight(isHighlighted());
}
case 'M' :
case 'm' :
{
- if( myWidgetCtrl->GetEnabled() )
+ if( IsSegmentationEnabled() )
{
this->ChangeMagnification( myInteractor->GetShiftKey() );
return;
case 'D' :
case 'd' :
{
- if( myWidgetCtrl->GetEnabled() && myWidgetCtrl->IsSphereActive() )
+ if( IsSegmentationEnabled() && myWidgetCtrl->IsSphereActive() )
{
VISU_SphereWidget* aSphereWidget = myWidgetCtrl->GetSphereWidget();
aSphereWidget->ChangeRadius( myInteractor->GetShiftKey() );
}
//----------------------------------------------------------------------------
-bool VISU_GaussPtsAct::IsInfinitive()
+bool
+VISU_GaussPtsAct
+::IsInfinitive()
{
if(vtkMapper* aMapper = myDeviceActor->GetMapper()){
if(vtkDataSet* aDataSet= aMapper->GetInput()){
return myIsInfinite;
}
+//----------------------------------------------------------------------------
+int
+VISU_GaussPtsAct
+::GetPickable()
+{
+ if(Superclass::GetPickable()){
+ if(vtkMapper* aMapper = GetMapper()){
+ if(vtkDataSet* aDataSet= aMapper->GetInput()){
+ aDataSet->Update();
+ return aDataSet->GetNumberOfCells() > 0;
+ }
+ }
+ }
+
+ return false;
+}
+
//----------------------------------------------------------------------------
bool
VISU_GaussPtsAct
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ if ( !GetPickable() )
+ return false;
+
myPreHighlightActor->SetVisibility(false);
myCursorPyramid->SetVisibility(false);
- if (!myBarVisibility) {
+ if (!myBarVisibility)
return false;
- }
+
if(!theIsHighlight)
- myLastObjPointID = -1;
+ myLastPreHighlightObjID = -1;
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
bool anIsChanged = (mySelectionMode != aSelectionMode);
bool anIsPreselected = myIsPreselected;
myIsPreselected = false;
+
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
if(aSelectionMode == GaussPointSelection && theIsHighlight){
myPointPicker->Pick(theSelectionEvent->myX,
vtkIdType anObjId = GetNodeObjId( aVtkId );
myIsPreselected = (anObjId >= 0);
if(myIsPreselected){
- anIsChanged = (myLastObjPointID != anObjId);
+ anIsChanged = (myLastPreHighlightObjID != anObjId);
if(anIsChanged){
- float* aNodeCoord = GetNodeCoord(anObjId);
+ vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ //Take into account translation
+ vtkFloatingPointType aLocalNodeCoord[3];
+ this->Transform->Push();
+ this->Transform->PostMultiply();
+ this->Transform->Identity();
+
+ this->Transform->Translate(this->Position[0],
+ this->Position[1],
+ this->Position[2]);
+ double aPosition[3];
+ this->Transform->GetPosition(aPosition);
+
+ aLocalNodeCoord[0] = aNodeCoord[0] + aPosition[0];
+ aLocalNodeCoord[1] = aNodeCoord[1] + aPosition[1];
+ aLocalNodeCoord[2] = aNodeCoord[2] + aPosition[2];
+
vtkDataSet* aDataSet = GetInput();
- vtkCellData* aCellData = aDataSet->GetCellData();
- if(vtkDataArray *aScalarArray = aCellData->GetScalars()){
- float aPyramidHeight = myPickingSettings->GetPyramidHeight();
+ vtkPointData* aPointData = aDataSet->GetPointData();
+ if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
+ vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight();
aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
- //float aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
- float aColor[3];
+ //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
+ vtkFloatingPointType aColor[3];
theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
aColor[0] = 1. - aColor[0];
aColor[1] = 1. - aColor[1];
aColor[2] = 1. - aColor[2];
myCursorPyramid->Init(aPyramidHeight,
- myPickingSettings->GetCursorSize(),
+ aPickingSettings->GetCursorSize(),
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
aNodeCoord,
aColor);
}
- myLastObjPointID = anObjId;
+ this->Transform->Pop();
+ myLastPreHighlightObjID = anObjId;
}
myCursorPyramid->SetVisibility(true);
}
inline
void
ChangeZoom(VISU_PickingSettings *thePickingSettings,
- vtkInteractorStyle* theInteractorStyle,
- int theInitialHasIndex,
- SVTK_Selector* theSelector,
- const Handle(SALOME_InteractiveObject)& theIO)
+ vtkRenderer* theRenderer,
+ vtkIdType theInitialHasIndex,
+ vtkIdType theCurrentHasIndex)
{
- int aCurrentHasIndex = theSelector->HasIndex(theIO);
+ if( (theInitialHasIndex + theCurrentHasIndex == 1) && thePickingSettings){
+ vtkCamera *aCamera = theRenderer->GetActiveCamera();
- if(theInitialHasIndex + aCurrentHasIndex == 1){
- vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
- vtkCamera *aCamera = aRenderer->GetActiveCamera();
- float aZoomFactor = thePickingSettings->GetZoomFactor();
+ vtkFloatingPointType aZoomFactor = thePickingSettings->GetZoomFactor();
double aScale = aCamera->GetParallelScale();
- if (!theInitialHasIndex && aCurrentHasIndex) {
- aCamera->SetParallelScale(aScale/aZoomFactor);
+ if ( !theInitialHasIndex && theCurrentHasIndex ) {
+ aCamera->SetParallelScale( aScale/aZoomFactor );
}
else {
- aCamera->SetParallelScale(aScale*aZoomFactor);
+ aCamera->SetParallelScale( aScale*aZoomFactor );
}
}
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
- myIsHighlighted = false;
+ if ( !GetPickable() )
+ return false;
+
+ // int anInitialHasIndex = myIsSubElementsHighlighted && mySelectionMode == GaussPointSelection;
Handle(SALOME_InteractiveObject) anIO = getIO();
- int anInitialHasIndex = mySelector->HasIndex(anIO);
+ // myIsSubElementsHighlighted = false;
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
- //
+
if(!theIsHighlight && aSelectionMode == GaussPointSelection){
mySelector->RemoveIObject(anIO);
- ChangeZoom(myPickingSettings,
+ /* ChangeZoom(myPickingSettings,
theInteractorStyle,
anInitialHasIndex,
- mySelector.GetPointer(),
- anIO);
+ false,
+ anIO);*/
return true;
}
- if (!myBarVisibility) {
+ if (!myBarVisibility)
return false;
- }
- //
- if(aSelectionMode == ActorSelection){
+
+
+ if(aSelectionMode == ActorSelection)
return Superclass::Highlight(theInteractorStyle,
theSelectionEvent,
theIsHighlight);
- }
- //
+
if(aSelectionMode == GaussPointSelection && !theSelectionEvent->myIsRectangle){
vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
if(myPointPicker->GetActor() != this) {
mySelector->ClearIObjects();
- ChangeZoom(myPickingSettings,
+ /* ChangeZoom(myPickingSettings,
theInteractorStyle,
anInitialHasIndex,
- mySelector.GetPointer(),
- anIO);
+ false,
+ anIO);*/
return true;
}
if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO()) {
vtkIdType anObjId = GetNodeObjId( aVtkId );
if(anObjId >= 0){
- myIsHighlighted = true;
+ // myIsHighlighted = true;
// Update the Selector
if(mySelector->IsSelected(myIO))
mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
mySelector->AddIObject(this);
}
- //
- float* aNodeCoord = GetNodeCoord(anObjId);
+ /*
+ vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
//
// FlyTo
vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
- float aDollyWas = anInteractor->GetDolly();
+ vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
anInteractor->SetDolly(0.);
anInteractor->SetDolly(aDollyWas);
anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+ anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);*/
+
mySelectionMode = aSelectionMode;
- ChangeZoom(myPickingSettings,
+ /* ChangeZoom(myPickingSettings,
theInteractorStyle,
anInitialHasIndex,
- mySelector.GetPointer(),
- anIO);
+ true,
+ anIO);*/
return true;
- //
}// if( anObjId >= 0 ) {
}//if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO())
}//if(!theSelectionEvent->myIsRectangle){
- ChangeZoom(myPickingSettings,
+ /* ChangeZoom(myPickingSettings,
theInteractorStyle,
anInitialHasIndex,
- mySelector.GetPointer(),
- anIO);
+ false,
+ anIO);*/
return false;
}
+
+
+void VISU_GaussPtsAct::SetPosition(double _arg[3]){
+ Superclass::SetPosition(_arg);
+ Highlight(isHighlighted());
+}
+
//==================================================================
// function : Highlight
// purpose :
if(!mySelector.GetPointer())
return;
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+ Selection_Mode aSelectionMode = mySelector->SelectionMode();
+
+ bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode == GaussPointSelection;
+
+ TColStd_IndexedMapOfInteger aMapIndex;
+ mySelector->GetIndex( getIO(), aMapIndex );
+ bool aCurrentHasIndex = aMapIndex.Extent() == 1;
+ bool anIsVisible = GetVisibility() && aCurrentHasIndex && theIsHighlight;
+ bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled();
+ bool aShowCellActor = aPickingSettings->GetDisplayParentMesh();
+
myOutlineActor->SetVisibility(false);
- myTextActor->SetVisibility(0);
- myCursorPyramidSelected->SetVisibility(0);
- myCursorPyramid->SetVisibility(0);
- myCellActor->SetVisibility(0);
- GetScalarBarCtrl()->SetIsMarked(false);
- GetScalarBarCtrl()->Update();
+ myCursorPyramid->SetVisibility(false);
+ myTextActor->SetVisibility(anIsVisible && aShowTextActor);
+ myCellActor->SetVisibility(anIsVisible && aShowCellActor);
+ GetScalarBarCtrl()->SetIsMarked(anIsVisible);
+ myCursorPyramidSelected->SetVisibility(anIsVisible);
+ //GetScalarBarCtrl()->Update();
- bool anIsVisible = GetVisibility();
+ myIsSubElementsHighlighted = aCurrentHasIndex;
- Selection_Mode aSelectionMode = mySelector->SelectionMode();
+ // Zoom if necessary
+ if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+ {
+ ChangeZoom(aPickingSettings,
+ GetRenderer(),
+ anInitialHasIndex,
+ aCurrentHasIndex);
+ }
- if(aSelectionMode == ActorSelection)
- Superclass::highlight(theIsHighlight);
- else if(aSelectionMode != GaussPointSelection)
+ if( aSelectionMode == ActorSelection ) {
+ Superclass::Highlight(theIsHighlight);
return;
+ }
- TColStd_IndexedMapOfInteger aMapIndex;
+ if(!theIsHighlight)
+ return;
+
+ if( aSelectionMode != GaussPointSelection )
+ return;
+
+ if ( !aCurrentHasIndex || !myBarVisibility )
+ return;
+
+ // myTextActor->SetVisibility(anIsVisible);
+ // myCellActor->SetVisibility(anIsVisible && myPickingSettings->GetDisplayParentMesh());
+ // GetScalarBarCtrl()->SetIsMarked(anIsVisible);
+ // myCursorPyramidSelected->SetVisibility(anIsVisible);
+//GetScalarBarCtrl()->Update();
+
+// myIsHighlighted = aCurrentHasIndex;
+
+ // Zoom if necessary
+// ChangeZoom(myPickingSettings,
+// GetRenderer(),
+// anInitialHasIndex,
+// aCurrentHasIndex);
+
+ // TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
if(aMapIndex.Extent() != 1 || !myBarVisibility) {
return;
}
+
+ vtkRenderer *aRenderer = GetRenderer();
+ vtkCamera* aCamera = aRenderer->GetActiveCamera();
+
+ int anObjId = aMapIndex(1);
+ vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ if ( !aNodeCoord )
+ return;
+ //Take into account translation
+ vtkFloatingPointType aLocalNodeCoord[3];
+ this->Transform->Push();
+ this->Transform->PostMultiply();
+ this->Transform->Identity();
+ this->Transform->Translate(this->Position[0],
+ this->Position[1],
+ this->Position[2]);
+ double aPosition[3];
+ this->Transform->GetPosition(aPosition);
+ aLocalNodeCoord[0] = aNodeCoord[0] + aPosition[0];
+ aLocalNodeCoord[1] = aNodeCoord[1] + aPosition[1];
+ aLocalNodeCoord[2] = aNodeCoord[2] + aPosition[2];
+ this->Transform->Pop();
+
+ vtkFloatingPointType aFocalPnt[3];
+ aCamera->GetFocalPoint(aFocalPnt);
+
+ if ( CheckIsSameVector(aLocalNodeCoord, aFocalPnt, 3 ) )
+ return;
+
+ // FlyTo
+ if( anIsVisible && aPickingSettings->GetCameraMovementEnabled() )
+ {
+ vtkRenderWindowInteractor* anInteractor = myInteractor;
+ vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
+ int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+
+ anInteractor->SetDolly(0.0);
+ anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber());
+ anInteractor->FlyTo(aRenderer, aNodeCoord);
+ aRenderer->ResetCameraClippingRange();
+ anInteractor->SetDolly(aDollyWas);
+ anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+ anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
+ }
//
std::ostringstream aStr;
- int anObjId = aMapIndex(1);
+ // int anObjId = aMapIndex(1);
aStr<<"Global ID: "<<anObjId;
//
vtkIdType aVtkId = GetNodeVTKID(anObjId);
if(aVtkId >= 0){
- float *aNodeCoord = GetNodeCoord(anObjId);
- float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
+ vtkFloatingPointType aWorldCoord[4] = {aLocalNodeCoord[0], aLocalNodeCoord[1], aLocalNodeCoord[2], 1.};
//
vtkDataSet* aDataSet = GetInput();
- vtkCellData* aDataSetAttributes = aDataSet->GetCellData();
+ vtkPointData* aDataSetAttributes = aDataSet->GetPointData();
//
if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
- float aVal = aScalarArray->GetTuple1(aVtkId);
+ vtkFloatingPointType aVal = aScalarArray->GetTuple1(aVtkId);
//
- GetScalarBarCtrl()->SetIsMarked(true);
+ // GetScalarBarCtrl()->SetIsMarked(true);
GetScalarBarCtrl()->SetMarkValue(aVal);
GetScalarBarCtrl()->Update();
//
- float aPyramidHeight = myPickingSettings->GetPyramidHeight();
+ vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight();
aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
myCursorPyramidSelected->Init(aPyramidHeight,
- myPickingSettings->GetCursorSize(),
+ aPickingSettings->GetCursorSize(),
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
- aNodeCoord,
+ aLocalNodeCoord,
myHighlightActor->GetProperty()->GetColor());
myCursorPyramidSelected->SetVisibility(anIsVisible && theIsHighlight);
//
}
if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){
- if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
- int aNbComp = aFloatArray->GetNumberOfComponents();
- aStr<<"\nData: {";
- int anId = 0;
- while(anId < aNbComp){
- float aComp = aFloatArray->GetComponent(aVtkId,anId++);
- aStr<<aComp;
- if(anId < aNbComp)
- aStr<<"; ";
- }
- aStr<<"}";
+ int aNbComp = aFieldArray->GetNumberOfComponents();
+ std::vector<vtkFloatingPointType> aTuple(aNbComp);
+ aFieldArray->GetTuple(aVtkId, &aTuple[0]);
+
+ aStr<<"\nData: {";
+ int anId = 0;
+ while(anId < aNbComp){
+ vtkFloatingPointType aComp = aTuple[anId++];
+ aStr<<aComp;
+ if(anId < aNbComp)
+ aStr<<"; ";
}
+ aStr<<"}";
}
//
// myTextActor
std::string aString = aStr.str();
- myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
- myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
myTextActor->SetWorldPoint(aWorldCoord);
myTextActor->SetText(aString.c_str());
- myTextActor->SetVisibility(anIsVisible && theIsHighlight);
+ myTextActor->SetVisibility(anIsVisible && theIsHighlight && aShowTextActor);
//
// myCellActor
- if(myPickingSettings->GetDisplayParentMesh()){
- const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
- myGaussPointsPL->GetGaussPtsIDMapper();
- VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
+ const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = myGaussPointsPL->GetGaussPtsIDMapper();
+ VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
+ //
+ myCellSource->Reset();
+ myCellSource->Modified(); // a VTK bug
+ vtkUnstructuredGrid* aCellDataSet = aParent->GetUnstructuredGridOutput();
+
+ // get parent cell and insert it to myCellSource
+ VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
+ vtkIdType aCellID = aGaussPointID.first;
+ vtkCell* aCell = aParent->GetElemCell(aCellID);
+ myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+
+ if (myGaussPointsPL->GetIsDeformed()) {
+ // find neighbour cells ids
+ vtkIdList* aNeighbourCells = vtkIdList::New();
+ aNeighbourCells->Allocate(VTK_CELL_SIZE);
- myCellSource->Reset();
- myCellSource->Modified(); // a VTK bug
- myCellSource->SetPoints(aParent->GetVTKOutput()->GetPoints());
+ vtkIdList* aCellPoints = aCell->GetPointIds();
- VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
- vtkIdType aCellID = aGaussPointID.first;
- vtkCell* aCell = aParent->GetElemCell(aCellID);
- myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
- myCellActor->SetVisibility(anIsVisible && theIsHighlight);
- myCellActor->SetRepresentation(VTK_WIREFRAME);
- }
- }
-}
+ vtkIdList *aPointCells = vtkIdList::New();
+ aPointCells->Allocate(VTK_CELL_SIZE);
+
+ vtkIdType aNbPoints = aCellPoints->GetNumberOfIds();
+ for (vtkIdType i = 0; i < aNbPoints; i++) {
+ aCellDataSet->GetPointCells(aCellPoints->GetId(i), aPointCells);
+
+ // add cell ids
+ vtkIdType aNbCells = aPointCells->GetNumberOfIds();
+ for (vtkIdType j = 0; j < aNbCells; j++)
+ aNeighbourCells->InsertUniqueId(aPointCells->GetId(j));
+ }
+ aPointCells->Delete();
-//----------------------------------------------------------------
-void
-VISU_GaussPtsAct
-::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
-{
- if(myPickingSettings == thePickingSettings)
- return;
+ // get vector data
+ vtkDataArray* anInputVectors = aDataSetAttributes->GetVectors();
+ if (!anInputVectors)
+ return;
+
+ // insert neighbour cells to the special dataset
+ vtkUnstructuredGrid *aCellsToWarp = vtkUnstructuredGrid::New();
+ aCellsToWarp->SetPoints(aCellDataSet->GetPoints());
- if(myPickingSettings)
- myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
+ vtkIdType aNbNeighbourCells = aNeighbourCells->GetNumberOfIds();
- myPickingSettings = thePickingSettings;
+ vtkDataArray *aVectorsToSet = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+ aVectorsToSet->SetNumberOfComponents(3);
+ aVectorsToSet->SetNumberOfTuples(aNbNeighbourCells);
- if(thePickingSettings)
- {
- thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- this->UpdatePickingSettings();
+ vtkDataArray *aCellVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+ aCellVectors->SetNumberOfComponents(3);
+
+ int aNbComp = anInputVectors->GetNumberOfComponents();
+ std::vector<vtkFloatingPointType> aTuple(aNbComp);
+
+ for (vtkIdType i = 0; i < aNbNeighbourCells; i++) {
+ vtkIdType aVTKCellId = aNeighbourCells->GetId(i);
+ vtkIdType anObjCellId = aParent->GetElemObjID(aVTKCellId);
+
+ vtkCell* aCurCell = aParent->GetElemCell(anObjCellId);
+
+ vtkIdType aNewCellId = aCellsToWarp->InsertNextCell(aCurCell->GetCellType(), aCurCell->GetPointIds());
+
+ // get gauss points corresponding to the current cell
+ vtkIdType aPointVtkId = -1;
+ vtkIdType aLocalPntId = 0;
+ aPointVtkId = aGaussPtsIDMapper->GetVTKID(VISU::TGaussPointID(anObjCellId, aLocalPntId));
+
+ if (aPointVtkId >= 0) {
+ // Compute average vector
+ aCellVectors->Reset();
+ while (aPointVtkId >= 0) {
+ anInputVectors->GetTuple(aPointVtkId, &aTuple[0]);
+
+ if (aNbComp >= 3)
+ aCellVectors->InsertNextTuple3(aTuple[0], aTuple[1], aTuple[2]);
+ else if (aNbComp == 2)
+ aCellVectors->InsertNextTuple3(aTuple[0], aTuple[1], 0);
+ else if (aNbComp == 1)
+ aCellVectors->InsertNextTuple3(aTuple[0], 0, 0);
+
+ aPointVtkId = aGaussPtsIDMapper->GetVTKID(VISU::TGaussPointID(anObjCellId, ++aLocalPntId));
+ }
+
+ double aXCoord = 0, anYCoord = 0, aZCoord = 0;
+
+ vtkIdType aNbVectors = aCellVectors->GetNumberOfTuples();
+
+ for (vtkIdType aVecId = 0; aVecId < aNbVectors; aVecId++) {
+ aXCoord += aCellVectors->GetComponent(aVecId, 0);
+ anYCoord += aCellVectors->GetComponent(aVecId, 1);
+ aZCoord += aCellVectors->GetComponent(aVecId, 2);
+ }
+
+ aXCoord = aXCoord / aNbVectors;
+ anYCoord = anYCoord / aNbVectors;
+ aZCoord = aZCoord / aNbVectors;
+
+ // set vector data for the cell
+ aVectorsToSet->SetTuple3(aNewCellId, aXCoord, anYCoord, aZCoord);
+ }
+ else
+ aVectorsToSet->SetTuple3(aNewCellId, 0, 0, 0);
+ }
+
+ aCellsToWarp->GetCellData()->SetVectors(aVectorsToSet);
+
+ aVectorsToSet->Delete();
+ aCellVectors->Delete();
+ aNeighbourCells->Delete();
+
+ // warp
+ myWarpVector->SetScaleFactor(myGaussPointsPL->GetScale());
+
+ myCellDataToPointData->SetInput(aCellsToWarp);
+ myCellDataToPointData->PassCellDataOn();
+ aCellsToWarp->Delete();
+
+ myWarpVector->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());
+ vtkUnstructuredGrid* aWarpedDataSet = myWarpVector->GetUnstructuredGridOutput();
+ aWarpedDataSet->Update();
+ myCellSource->SetPoints(aWarpedDataSet->GetPoints());
+ }
+ else
+ myCellSource->SetPoints(aCellDataSet->GetPoints());
+
+ myCellActor->SetVisibility(anIsVisible && theIsHighlight && aShowCellActor);
}
}
VISU_GaussPtsAct
::UpdatePickingSettings()
{
- if(!myPickingSettings || myPickingSettings->GetInitial())
+ //printf( "VISU_GaussPtsAct::UpdatePickingSettings()\n" );
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ if(!aPickingSettings)
return;
- myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
- myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
- float aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
- float aCursorSize = myPickingSettings->GetCursorSize();
+ vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*aPickingSettings->GetPyramidHeight();
+ vtkFloatingPointType aCursorSize = aPickingSettings->GetCursorSize();
myCursorPyramid->SetPreferences(aHeight,aCursorSize);
myCursorPyramidSelected->SetPreferences(aHeight,aCursorSize);
- myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() );
- myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() );
+ myHighlightActor->GetProperty()->SetColor( aPickingSettings->GetColor() );
+ myPointPicker->SetTolerance( aPickingSettings->GetPointTolerance() );
Highlight(isHighlighted());
VISU_GaussPointsPL* aPipeline = theActor->GetPipeLine();
- SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
- vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
+ vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
- aPipeline->ShallowCopy(GetGaussPointsPL());
+ aPipeline->ShallowCopy(GetGaussPointsPL(), true);
aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
Update();
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct
+::GetMTime()
+{
+ unsigned long int aTime = Superclass::GetMTime();
+ aTime = std::max(aTime, myGaussPointsPL->GetPointSpriteMapper()->GetMTime() );
+ return aTime;
+}
+
+void VISU_GaussPtsAct::RemoveAllClippingPlanes()
+{
+ myFunction->GetFunction()->RemoveAllItems();
+ myFunction->Modified();
+}
+
+vtkIdType VISU_GaussPtsAct::GetNumberOfClippingPlanes()
+{
+ return myFunction->GetFunction()->GetNumberOfItems();
+}
+
+bool VISU_GaussPtsAct::AddClippingPlane(vtkPlane* thePlane)
+{
+ vtkImplicitFunctionCollection* aFunctions = GetClippingPlanes();
+ aFunctions->InitTraversal();
+ vtkImplicitFunction* aItem;
+ while ((aItem = aFunctions->GetNextItem())) {
+ if (thePlane == aItem)
+ return false;
+ }
+ myFunction->AddFunction(thePlane);
+ return true;
+}
+
+vtkPlane* VISU_GaussPtsAct::GetClippingPlane(vtkIdType theID)
+{
+ vtkPlane* aPlane = NULL;
+ if ((theID >= 0) && (theID < GetNumberOfClippingPlanes())) {
+ vtkImplicitFunctionCollection* aFunction = myFunction->GetFunction();
+ vtkImplicitFunction* aFun = NULL;
+ aFunction->InitTraversal();
+ for (vtkIdType i = 0; i <= theID; i++)
+ aFun = aFunction->GetNextItem();
+ aPlane = dynamic_cast<vtkPlane*>(aFun);
+ }
+ return aPlane;
+}
+
+vtkImplicitFunctionCollection* VISU_GaussPtsAct::GetClippingPlanes()
+{
+ return myFunction->GetFunction();
+}
+
+
+
//==============================================================================
vtkStandardNewMacro(VISU_GaussPtsAct1);
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+
myInsideDeviceActor->SetVisibility(false);
myInsideDeviceActor->SetPickable(false);
+ myInsideDeviceActor->SetUserMatrix(aMatrix);
myInsideDeviceActor->Delete();
myOutsideDeviceActor->SetVisibility(false);
myOutsideDeviceActor->SetPickable(false);
+ myOutsideDeviceActor->SetUserMatrix(aMatrix);
myOutsideDeviceActor->Delete();
+ aMatrix->Delete();
}
VISU_GaussPtsAct1
{
Superclass::AddToRender(theRenderer);
- myInsideDeviceActor->AddToRender(theRenderer);
- myOutsideDeviceActor->AddToRender(theRenderer);
+ //myInsideDeviceActor->AddToRender(theRenderer);
+ //myOutsideDeviceActor->AddToRender(theRenderer);
}
void
VISU_GaussPtsAct1
::RemoveFromRender(vtkRenderer* theRenderer)
{
- Superclass::RemoveFromRender(theRenderer);
+ //myInsideDeviceActor->RemoveFromRender(theRenderer);
+ //myOutsideDeviceActor->RemoveFromRender(theRenderer);
- myInsideDeviceActor->RemoveFromRender(theRenderer);
- myOutsideDeviceActor->RemoveFromRender(theRenderer);
+ Superclass::RemoveFromRender(theRenderer);
}
void
}
+int
+VISU_GaussPtsAct1
+::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+
+ Superclass::RenderOpaqueGeometry(viewport);
+ GetMatrix(myInsideDeviceActor->GetUserMatrix());
+ GetMatrix(myOutsideDeviceActor->GetUserMatrix());
+ return 1;
+}
+
+int
+VISU_GaussPtsAct1
+::RenderTranslucentGeometry(vtkViewport *viewport)
+{
+ Superclass::RenderTranslucentGeometry(viewport);
+ GetMatrix(myInsideDeviceActor->GetUserMatrix());
+ GetMatrix(myOutsideDeviceActor->GetUserMatrix());
+
+ return 1;
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPtsAct1
Superclass::SetMapperInput(theDataSet);
- if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
- myInsideDeviceActor->SetPipeLine(aPipeLine);
- aPipeLine->Delete();
- }
+// if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+// myInsideDeviceActor->SetPipeLine(aPipeLine);
+// aPipeLine->Delete();
+// }
- if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
- myOutsideDeviceActor->SetPipeLine(aPipeLine);
- aPipeLine->Delete();
+// if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+// myOutsideDeviceActor->SetPipeLine(aPipeLine);
+// aPipeLine->Delete();
- SALOME_ExtractGeometry* anExtractGeometry = aPipeLine->GetExtractGeometryFilter();
- anExtractGeometry->SetExtractBoundaryCells(true);
- anExtractGeometry->SetExtractInside(true);
- }
+// aPipeLine->SetExtractBoundaryCells(true);
+// aPipeLine->SetExtractInside(true);
+// }
}
//----------------------------------------------------------------------------
-float
+vtkFloatingPointType
VISU_GaussPtsAct1
::GetRadius(vtkIdType theObjID,
vtkIdType theVTKID,
//----------------------------------------------------------------------------
-float
+vtkFloatingPointType
VISU_GaussPtsAct1
::GetMagnification(vtkIdType theObjID)
{
//----------------------------------------------------------------------------
-float
+vtkFloatingPointType
VISU_GaussPtsAct1
::GetClamp(vtkIdType theObjID)
{
//----------------------------------------------------------------
+
+void
+VISU_GaussPtsAct1::SetPosition(double _arg[3]){
+ if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetPosition - this = "<<this);
+ Superclass::SetPosition(_arg);
+ myUpdatePositionSignal(_arg);
+}
+
void
VISU_GaussPtsAct1
::Connect(VISU_GaussPtsAct2* theActor)
{
mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct2::SetVisibility,theActor,_1));
+ myUpdatePositionSignal.connect(boost::bind(&VISU_GaussPtsAct2::SetPosition, theActor,_1));
}
void
bool aVisisbility = GetVisibility();
bool anIsSegementation = IsSegmentationEnabled();
- myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation);
+ myDeviceActor->SetVisibility(aVisisbility/* && !anIsSegementation*/);
myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
VISU_GaussPointsPL* aPipeline = myOutsideDeviceActor->GetPipeLine();
- SALOME_ExtractGeometry* anExtractGeometry = aPipeline->GetExtractGeometryFilter();
- vtkImplicitFunction* anImplicitFunction = anExtractGeometry->GetImplicitFunction();
- float aMagnification = aPipeline->GetMagnification();
+ vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
+ vtkFloatingPointType aMagnification = aPipeline->GetMagnification();
- aPipeline->ShallowCopy(GetGaussPointsPL());
+ aPipeline->ShallowCopy(GetGaussPointsPL(), true);
aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
- anExtractGeometry->SetExtractBoundaryCells(true);
- anExtractGeometry->SetExtractInside(true);
+ aPipeline->SetExtractBoundaryCells(true);
+ //aPipeline->SetExtractInside(true);
aPipeline->SetMagnification( aMagnification );
aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() );
if( myOutsideCursorSettings->GetUniform() )
{
- myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOff();
- myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 1 ); // Geometry mode
+ myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOff();
+ myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 1 ); // Geometry mode
myOutsideDeviceActor->GetProperty()->SetColor( myOutsideCursorSettings->GetColor() );
}
else
{
- myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
- myOutsideDeviceActor->GetPSMapper()->SetColorModeToMapScalars();
- myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOn();
+ myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
+ myOutsideDeviceActor->GetPointSpriteMapper()->SetColorModeToMapScalars();
+ myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOn();
}
aPipeline->Update();
case vtkCommand::EndInteractionEvent: {
bool aVisisbility = GetVisibility();
bool anIsSegementation = IsSegmentationEnabled();
- myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation);
+ myDeviceActor->SetVisibility(aVisisbility/* && !anIsSegementation*/);
myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
break;
Superclass::OnInteractorEvent(theEvent);
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct1
+::GetMemorySize()
+{
+ unsigned long int aSize = Superclass::GetMemorySize();
+ if(IsSegmentationEnabled()){
+ aSize += myInsideDeviceActor->GetMemorySize();
+ aSize += myOutsideDeviceActor->GetMemorySize();
+ }
+ return aSize;
+}
+
+
//==============================================================================
vtkStandardNewMacro(VISU_GaussPtsAct2);
Superclass::ShallowCopyPL(thePipeLine);
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2::SetPosition(double _arg[3]){
+ if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct2::SetPosition - this = "<<this);
+ Superclass::SetPosition(_arg);
+}
//----------------------------------------------------------------------------
void
::SetMapperInput(vtkDataSet* theDataSet)
{
if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetMapperInput - this = "<<this);
+ Superclass::SetMapperInput(theDataSet);
+// if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+// myDeviceActor->SetPipeLine(aPipeLine);
+// myCurrentPL = aPipeLine;
+// aPipeLine->Delete();
- if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
- myDeviceActor->SetPipeLine(aPipeLine);
- myCurrentPL = aPipeLine;
- aPipeLine->Delete();
-
- myMapper->SetInput(myCurrentPL->GetPickableDataSet());
- SetMapper(myMapper.GetPointer());
- }
+// myMapper->SetInput(myCurrentPL->GetPickableDataSet());
+// SetMapper(myMapper.GetPointer());
+// }
}
//----------------------------------------------------------------------------
}
+//----------------------------------------------------------------------------
+unsigned long int
+VISU_GaussPtsAct2
+::GetMemorySize()
+{
+ if(IsSegmentationEnabled())
+ return Superclass::GetMemorySize();
+ return 0;
+}
+
+
//----------------------------------------------------------------------------
void
VISU_GaussPtsAct2