return myChangeMagnification;
}
-//----------------------------------------------------------------
-void
-VISU_GaussPtsAct
-::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings)
-{
- myOutsideCursorSettings = theOutsideCursorSettings;
-}
-
-//----------------------------------------------------------------
-void
-VISU_GaussPtsAct
-::UpdateOutsideCursorSettings()
-{
- // update actor from myOutsideCursorSettings
-}
-
//----------------------------------------------------------------------------
namespace
{
aStr<<"\nScalar: "<<aVal;
mySphereSource->SetCenter(aNodeCoord);
- float aRadius = myGaussPointsPL->GetPointSize(anObjId,aScalarArray);
+ float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
mySphereSource->SetRadius(aRadius);
float aColor[3];
vtkDataSet* aDataSet = GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
if(vtkDataArray* aScalarArray = aCellData->GetScalars()){
- float aRadius = myGaussPointsPL->GetPointSize(anObjId, aScalarArray);
+ float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
mySphereSourceSelected->SetRadius(aRadius);
if(theSelector->HasIndex(myIO)){
mySphereActorSelected->SetVisibility(1);
vtkIdType aCellID = aGaussPointID.first;
vtkCell* aCell = aParent->GetElemCell(aCellID);
myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-
+ myCellActor->GetProperty()->SetRepresentationToWireframe(); // VTK bug
myCellActor->SetVisibility(1);
}
}
aStr<<"\nScalar: "<<aVal;
mySphereSource->SetCenter(aNodeCoord);
- float aRadius = myGaussPointsPL->GetPointSize(anObjId,aScalarArray);
+ float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
mySphereSource->SetRadius(aRadius);
}
VISU_GaussPtsAct1
::VISU_GaussPtsAct1():
myInsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
- myOutsideDeviceActor(VISU_GaussPtsDeviceActor::New())
+ myOutsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
+ myOutsideCursorSettings(NULL)
{
if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::VISU_GaussPtsAct1 - this = "<<this);
+
+ myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
+
myInsideDeviceActor->SetProperty(GetProperty());
myInsideDeviceActor->SetVisibility(false);
myInsideDeviceActor->SetPickable(false);
myInsideDeviceActor->Delete();
- myOutsideDeviceActor->SetProperty(GetProperty());
myOutsideDeviceActor->SetVisibility(false);
myOutsideDeviceActor->SetPickable(false);
myOutsideDeviceActor->Delete();
::~VISU_GaussPtsAct1()
{
if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::~VISU_GaussPtsAct1 - this = "<<this);
+
+ SetOutsideCursorSettings(NULL);
}
}
}
+
+//----------------------------------------------------------------
void
VISU_GaussPtsAct1
::Connect(VISU_GaussPtsAct2* theActor)
mySetVisibilitySignal(GetVisibility());
}
+//----------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings)
+{
+ if(myOutsideCursorSettings == theOutsideCursorSettings)
+ return;
+
+ if(myOutsideCursorSettings)
+ myOutsideCursorSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+ myOutsideCursorSettings = theOutsideCursorSettings;
+
+ if(theOutsideCursorSettings)
+ theOutsideCursorSettings->AddObserver(vtkCommand::ModifiedEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+}
+
+void
+VISU_GaussPtsAct1
+::UpdateOutsideCursorSettings()
+{
+ // update actor from myOutsideCursorSettings
+ VISU_OpenGLPointSpriteMapper* aMapper = myOutsideDeviceActor->GetPSMapper();
+ aMapper->SetPointSpriteClamp(myOutsideCursorSettings->GetClamp());
+ aMapper->SetImageData(myOutsideCursorSettings->GetTexture());
+ aMapper->SetPointSpriteAlphaThreshold(myOutsideCursorSettings->GetAlphaThreshold());
+ aMapper->SetPointSpriteSize(myOutsideCursorSettings->GetSize());
+ aMapper->SetPointSpriteClamp(myOutsideCursorSettings->GetClamp());
+ myOutsideDeviceActor->GetProperty()->SetColor(myOutsideCursorSettings->GetColor());
+
+ Update();
+}
+
+
+//----------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::ProcessEvents(vtkObject* theObject,
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData)
+{
+ if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
+ if(VISU_GaussPtsAct1* self = dynamic_cast<VISU_GaussPtsAct1*>(anObject))
+ if(theEvent == vtkCommand::ModifiedEvent)
+ self->UpdateOutsideCursorSettings();
+
+ Superclass::ProcessEvents(theObject,theEvent,theClientData,theCallData);
+}
void
VISU_GaussPtsAct1
::VISU_GaussPtsAct2()
{
if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::VISU_GaussPtsAct2 - this = "<<this);
+ myDeviceActor->SetVisibility(false);
}
VISU_GaussPtsAct2
myEventCallbackCommand.GetPointer(),
myPriority);
myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
- myDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled());
+ myDeviceActor->SetVisibility(Superclass::GetVisibility() && theWidget->IsEnabled());
}
Superclass::SetImplicitFunctionWidget(theWidget);
Superclass::SetVisibility(theMode);
- myDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+ myDeviceActor->SetVisibility(Superclass::GetVisibility() && myWidget->IsEnabled());
+}
+
+int
+VISU_GaussPtsAct2
+::GetVisibility()
+{
+ return Superclass::GetVisibility() && myWidget->IsEnabled();
}
void
switch(theEvent){
case vtkCommand::EnableEvent:
case vtkCommand::DisableEvent:
- myDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+ myDeviceActor->SetVisibility(Superclass::GetVisibility() && myWidget->IsEnabled());
+ Update();
break;
case vtkCommand::EndInteractionEvent:
//vtkLODActor::SetMapper(GetMapper());
void
SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
- void
- SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
-
- void
- UpdateOutsideCursorSettings();
-
bool
ChangeMagnification();
bool myBarVisibility;
vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
-
- vtkSmartPointer<VISU_OutsideCursorSettings> myOutsideCursorSettings;
};
void
Connect(VISU_GaussPtsAct2* theActor);
+ //----------------------------------------------------------------------------
+ void
+ SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
+
+ void
+ UpdateOutsideCursorSettings();
+
//----------------------------------------------------------------------------
virtual
void
SetMapperInput(vtkDataSet* theDataSet);
//----------------------------------------------------------------------------
+ // Main process VTK event method
+ static
+ void
+ ProcessEvents(vtkObject* theObject,
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData);
+
// To process VTK event method
virtual
void
OnInteractorEvent(unsigned long theEvent);
boost::signal1<void,int> mySetVisibilitySignal;
+ VISU_OutsideCursorSettings* myOutsideCursorSettings;
//----------------------------------------------------------------------------
PDeviceActor myInsideDeviceActor;
void
SetVisibility(int theMode);
+ virtual
+ int
+ GetVisibility();
+
virtual
void
SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);