myGaussPointsPL(NULL),
myLastObjPointID(-1),
myTextActor(VISU_FramedTextActor::New()),
- mySphereSource(vtkSphereSource::New()),
- mySphereMapper(vtkPolyDataMapper::New()),
- mySphereActor(vtkActor::New()),
myCursorPyramid(VISU_CursorPyramid::New()),
- mySphereSourceSelected(vtkSphereSource::New()),
- mySphereActorSelected(vtkActor::New()),
+ myCursorPyramidSelected(VISU_CursorPyramid::New()),
myCellSource(vtkUnstructuredGrid::New()),
myCellActor(vtkActor::New()),
myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
myDeviceActor->Delete();
myTextActor->Delete();
- mySphereSource->Delete();
- mySphereMapper->Delete();
- mySphereActor->Delete();
-
myCursorPyramid->Delete();
-
- mySphereSourceSelected->Delete();
- mySphereActorSelected->Delete();
+ myCursorPyramidSelected->Delete();
myCellSource->Delete();
myCellActor->Delete();
myTextActor->SetVisibility(false);
myTextActor->SetPickable(false);
-
- mySphereMapper->SetInput(mySphereSource->GetOutput());
- mySphereActor->SetMapper(mySphereMapper.GetPointer());
- mySphereActor->SetVisibility(false);
- mySphereActor->SetPickable(false);
-
- vtkPolyDataMapper* aSphereMapperSelected = vtkPolyDataMapper::New();
- aSphereMapperSelected->SetInput(mySphereSourceSelected->GetOutput());
-
- mySphereActorSelected->SetMapper(aSphereMapperSelected);
- mySphereActorSelected->GetProperty()->SetColor(1.0,1.0,1.0);
- mySphereActorSelected->SetVisibility(false);
- mySphereActorSelected->SetPickable(false);
-
+ //
myCellSource->Allocate();
vtkDataSetMapper* aCellMapper = vtkDataSetMapper::New();
aCellMapper->SetInput(myCellSource.GetPointer());
myDeviceActor->AddToRender(theRenderer);
theRenderer->AddActor(myTextActor.GetPointer());
- theRenderer->AddActor(mySphereActor.GetPointer());
- theRenderer->AddActor(mySphereActorSelected.GetPointer());
theRenderer->AddActor(myCellActor.GetPointer());
myCursorPyramid->AddToRender(theRenderer);
+ myCursorPyramidSelected->AddToRender(theRenderer);
myScalarBarCtrl->AddToRender(theRenderer);
}
myDeviceActor->RemoveFromRender(theRenderer);
- theRenderer->RemoveActor(mySphereActor.GetPointer());
theRenderer->RemoveActor(myTextActor.GetPointer());
- theRenderer->RemoveActor(mySphereActorSelected.GetPointer());
theRenderer->RemoveActor(myCellActor.GetPointer());
myCursorPyramid->RemoveFromRender(theRenderer);
+ myCursorPyramidSelected->RemoveFromRender(theRenderer);
myScalarBarCtrl->RemoveFromRender(theRenderer);
}
::SetBarVisibility(bool theMode)
{
myBarVisibility = theMode;
- myScalarBarCtrl->SetBarVisibility(theMode);
+ myScalarBarCtrl->SetBarVisibility(theMode);
}
bool
//----------------------------------------------------------------------------
-bool
-VISU_GaussPtsAct
-::PreHighlight(SVTK_Selector* theSelector,
- vtkInteractorStyle* theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight)
+bool VISU_GaussPtsAct::PreHighlight(SVTK_Selector* theSelector,
+ vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight)
{
- mySphereActor->SetVisibility(false);
+ if (!myBarVisibility) {
+ return false;
+ }
myCursorPyramid->SetVisibility(false);
if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight)
// To calculate display (2D) position of the annotation
float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.0};
//
- // To prepare the annotation text
- std::ostringstream aStr;
- aStr<<"Global ID: "<<anObjId;
-
const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
myGaussPointsPL->GetGaussPtsIDMapper();
VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId);
VISU::TCellID aCellID = aGaussPointID.first;
VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
- aStr<<"\nParentCellID: "<<aCellID;
std::string aParentName = aParent->GetElemName(aCellID);
- if(aParentName != "")
- aStr<<"\nParentCellName: '"<<aParentName<<"'";
- aStr<<"\nLocalPntID: "<<aLocalPntID;
-
+ //
vtkDataSet* aDataSet = GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
if(vtkDataArray *aScalarArray = aCellData->GetScalars()){
float aVal = aScalarArray->GetTuple1(aVtkId);
- aStr<<"\nScalar: "<<aVal;
-
- mySphereSource->SetCenter(aNodeCoord);
float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
- mySphereSource->SetRadius(aRadius);
-
- float aColor[3];
- VISU_LookupTable* aLookupTable = myGaussPointsPL->GetMapperTable();
- aLookupTable->GetColor(aVal,aColor);
- mySphereActor->GetProperty()->SetColor(aColor);
+ //float aColor[3];
+ //VISU_LookupTable* aLookupTable = myGaussPointsPL->GetMapperTable();
+ //aLookupTable->GetColor(aVal,aColor);
//
float aPyramidHeight = myPickingSettings->GetPyramidHeight();
aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
myCursorPyramid->Init(aPyramidHeight,
aRadius,
aNodeCoord,
- aColor);
+ myPreHighlightProperty.GetPointer()->GetColor());
}
if(vtkDataArray *aVectorArray = aCellData->GetVectors()){
float* aVal = aVectorArray->GetTuple3(aVtkId);
- aStr<<"\nVector: {"<<aVal[0]<<"; "<<aVal[1]<<"; "<<aVal[2]<<"}";
}
- std::string aString = aStr.str();
myLastObjPointID = anObjId;
}
- mySphereActor->SetVisibility(true);
myCursorPyramid->SetVisibility(true);
myIsPreselected = theIsHighlight;
anIsChanged = true;
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ if (!myBarVisibility) {
+ return false;
+ }
vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
//
Selection_Mode theSelectionMode)
{
myTextActor->SetVisibility(0);
- mySphereActorSelected->SetVisibility(0);
+ myCursorPyramidSelected->SetVisibility(0);
+ myCursorPyramid->SetVisibility(0);
myCellActor->SetVisibility(0);
GetScalarBarCtrl()->SetIsMarked(false);
GetScalarBarCtrl()->Update();
theSelector->GetIndex( getIO(), aMapIndex );
int aNbOfParts = aMapIndex.Extent();
//
- if(aNbOfParts!=1) {
+ if(aNbOfParts!=1 || !myBarVisibility) {
return;
}
//
vtkDataArray* aScalarArray = aCellData->GetScalars();
vtkDataArray *aVectorArray = aCellData->GetVectors();
//
- // mySphereSourceSelected
if(aScalarArray){
aVal = aScalarArray->GetTuple1(aVtkId);
aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
//
- mySphereSourceSelected->SetCenter(aNodeCoord);
- mySphereSourceSelected->SetRadius(aRadius);
- mySphereActorSelected->SetVisibility(1);
- // ScalarBarCtrl
GetScalarBarCtrl()->SetIsMarked(true);
GetScalarBarCtrl()->SetMarkValue(aVal);
GetScalarBarCtrl()->Update();
//
+ float aPyramidHeight = myPickingSettings->GetPyramidHeight();
+ aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+ myCursorPyramidSelected->Init(aPyramidHeight,
+ aRadius,
+ aNodeCoord,
+ myHighlightProperty.GetPointer()->GetColor());
+ myCursorPyramidSelected->SetVisibility(1);
+ //
const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper=
myGaussPointsPL->GetGaussPtsIDMapper();
VISU::TNamedIDMapper* aParent=aGaussPtsIDMapper->GetParent();