#define _LOAD_FAMILIES_
#define _EDF_NODE_IDS_
-#define _NAME_MAPPING_ 0
namespace
{
TNamedPointCoords::Init(theNbPoints,theDim,theNodeInfo->myElemNum);
else
TNamedPointCoords::Init(theNbPoints,theDim);
-
- if(_NAME_MAPPING_ && theNodeInfo->IsElemNames() && theNbPoints > 0){
- myPointNames.resize(theNbPoints);
- for(vtkIdType anID = 0; anID < theNbPoints; anID++)
- myPointNames[anID] = theNodeInfo->GetElemName(anID);
- }
+ if(theNodeInfo->IsElemNames())
+ myNodeInfo = theNodeInfo;
}
std::string
TMEDNamedPointCoords
::GetNodeName(vtkIdType theObjID) const
{
- if(myPointNames.empty())
- return TNamedPointCoords::GetNodeName(theObjID);
- return myPointNames[theObjID];
+ if(myNodeInfo)
+ return myNodeInfo->GetElemName(theObjID);
+ return TNamedPointCoords::GetNodeName(theObjID);
}
{
myIsElemNum = theElemInfo->IsElemNum();
myElemNum = theElemInfo->myElemNum;
- if(_NAME_MAPPING_ && theElemInfo->IsElemNames()){
- TInt aNbElem = theElemInfo->GetNbElem();
- myElemNames.resize(aNbElem);
- for(TInt anID = 0; anID < aNbElem; anID++){
- myElemNames[anID] = theElemInfo->GetElemName(anID);
- }
- }
+ if(theElemInfo->IsElemNames())
+ myElemInfo = theElemInfo;
}
vtkIdType
TMEDSubMesh
::GetElemName(vtkIdType theObjID) const
{
- if(myElemNames.empty())
- return TSubMeshImpl::GetElemName(theObjID);
- else
- return myElemNames[theObjID];
+ if(myElemInfo)
+ return myElemInfo->GetElemName(theObjID);
+ return TSubMeshImpl::GetElemName(theObjID);
}
}
static int MYDEBUG1 = 0;
static int MYDEBUG2 = 0;
#endif
-//modified by NIZNHY-PKV Tue Oct 4 16:00:12 2005f
-static float s_Radius=0;
-//modified by NIZNHY-PKV Tue Oct 4 16:00:15 2005t
+
+
//----------------------------------------------------------------
vtkStandardNewMacro( VISU_OutsideCursorSettings );
vtkStandardNewMacro( VISU_PickingSettings );
VISU::TCellID aCellID = aGaussPointID.first;
VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
aStr<<"\nParentCellID: "<<aCellID;
- //aStr<<"\nParentCellName: '"<<aParent->GetElemName(aCellID)<<"'";
+ std::string aParentName = aParent->GetElemName(aCellID);
+ if(aParentName != "")
+ aStr<<"\nParentCellName: '"<<aParentName<<"'";
aStr<<"\nLocalPntID: "<<aLocalPntID;
vtkDataSet* aDataSet = GetInput();
}
return bRet;
}
- //
+
vtkIdType aVtkId = myPointPicker->GetPointId();
- printf(" * Highlight() aVtkId=%d\n", aVtkId);
if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) && hasIO()) {
vtkIdType anObjId = GetNodeObjId( aVtkId );
if(anObjId >= 0){
if(vtkDataArray* aScalarArray = aCellData->GetScalars()){
float aVal = aScalarArray->GetTuple1(aVtkId);
float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
- //modified by NIZNHY-PKV Tue Oct 4 16:00:45 2005f
- s_Radius=aRadius;
- //modified by NIZNHY-PKV Tue Oct 4 16:00:47 2005t
mySphereSourceSelected->SetRadius(aRadius);
- //
if(theSelector->HasIndex(myIO)){
mySphereActorSelected->SetVisibility(1);
GetScalarBarCtrl()->SetIsMarked(true);
GetScalarBarCtrl()->SetIsMarked(false);
GetScalarBarCtrl()->Update();
}
- }// if( !isRectangle )
- //
- else {
- if( vtkDataSet* aDataSet = GetInput() ) {
- float x1 = theSelectionEvent->myX;
- float y1 = theSelectionEvent->myY;
- float x2 = theSelectionEvent->myLastX;
- float y2 = theSelectionEvent->myLastY;
-
- int aNbPnts=aDataSet->GetNumberOfPoints();
- for(int i = 0; i < aNbPnts && !bRet; i++){
- float aPoint[3];
- aDataSet->GetPoint( i, aPoint );
-
- float aPnt[3];
- aRenderer->SetWorldPoint( aPoint[0], aPoint[1], aPoint[2], 1.0 );
- aRenderer->WorldToDisplay();
- aRenderer->GetDisplayPoint( aPnt );
-
- if( aPnt[0] > x2 && aPnt[0] < x1 && aPnt[1] > y1 && aPnt[1] < y2 ) {
- float aDisp[3];
- aRenderer->SetWorldPoint( aPoint[0], aPoint[1], aPoint[2], 1.0 );
- aRenderer->WorldToDisplay();
- aRenderer->GetDisplayPoint( aDisp );
-
- if( myPointPicker->Pick( aDisp[0], aDisp[1], 0.0, aRenderer ) ) {
- if( vtkActorCollection* anActorCollection = myPointPicker->GetActors() ) {
- if( anActorCollection->IsItemPresent( this ) ) {
- float aPickedPoint[3];
- myPointPicker->GetMapperPosition( aPickedPoint );
- vtkIdType aVtkId = aDataSet->FindPoint( aPickedPoint );
- if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) ) {
- vtkIdType anObjId = GetNodeObjId( aVtkId );
-
- if( anObjId >= 0 ) {
- //
- bool bIsAdded=false;
- bRet=!bRet; // true
- //
- if( theSelector->IsSelected( myIO ) ) {
- theSelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
- }
- else {
- if(!theSelectionEvent->myIsShift)
- theSelector->ClearIObjects();
-
- theSelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
- theSelector->AddIObject( this );
- bIsAdded=!bIsAdded;
- }
- //
- if (bIsAdded){
- float* aNodeCoord = GetNodeCoord(anObjId);
- anIteractor->FlyTo (aRenderer, aNodeCoord);
- aRenderer->ResetCameraClippingRange();
- // To calculate display (2D) position of the annotation
- float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.0};
- aRenderer->SetWorldPoint(aWorldCoord);
- aRenderer->WorldToDisplay();
- float aSelectionPoint[3];
- aRenderer->GetDisplayPoint(aSelectionPoint);
- myTextActor->SetPosition(aSelectionPoint);
- //
- // annotation text
- {
- std::ostringstream aStr;
- aStr<<"Global ID: "<<anObjId;
-
- VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId);
- VISU::TCellID aCellID = aGaussPointID.first;
- VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
- aStr<<"\nParentCellID: "<<aCellID;
- 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);
- }
-
- if(vtkDataArray *aVectorArray = aCellData->GetVectors()){
- float* aVal = aVectorArray->GetTuple3(aVtkId);
- aStr<<"\nVector: {"<<aVal[0]<<"; "<<aVal[1]<<"; "<<aVal[2]<<"}";
- }
-
- std::string aString = aStr.str();
- myTextMapper->SetInput(aString.c_str());
- }// annotation text
- //
- float aColor[3]={1.,1.,1.};
- mySphereActor->GetProperty()->SetColor(aColor);
- // shoe sphere
- myTextActor->SetVisibility(1);
- mySphereActor->SetVisibility(1);
- //
- return bRet;
- }// if (bIsAdded){
- }// if( anObjId >= 0 )
- }
- }
- }
- }
- }
- }
- }
- }//else ... if(!isRectangle )
+ }
//myTextActor->SetVisibility(aTextVisibility);
//mySphereActor->SetVisibility(aSphereVisibility);
return bRet;
}
+
+
//==================================================================
// function : highlight
// purpose :
//==================================================================
-void VISU_GaussPtsAct::highlight(bool theHighlight,
- SVTK_Selector* theSelector)
+void
+VISU_GaussPtsAct
+::highlight(bool theHighlight,
+ SVTK_Selector* theSelector)
{
- Superclass::highlight(theHighlight, theSelector);
- //
TColStd_IndexedMapOfInteger aMapIndex;
theSelector->GetIndex( getIO(), aMapIndex );
int aNbOfParts = aMapIndex.Extent();
- if (!aNbOfParts){
+ if(!aNbOfParts){
mySphereActorSelected->SetVisibility(0);
- }
- else if (aNbOfParts==1){
+ }else if(aNbOfParts == 1){
int anObjId = aMapIndex(1);
- vtkIdType aVtkId;
- float* aNodeCoord = GetNodeCoord(anObjId);
- printf(" *highlight() anObjId=%d { %f, %f, %f }\n",
- anObjId, aNodeCoord[0], aNodeCoord[1], aNodeCoord[2]);
- mySphereSourceSelected->SetCenter(aNodeCoord);
- //mySphereSourceSelected->SetRadius(s_Radius);
- //
-
- aVtkId=myGaussPointsPL->GetElemVTKID(anObjId);
- printf(" aVtkId=%d\n", aVtkId);
- vtkDataSet* aDataSet = GetInput();
- vtkCellData* aCellData = aDataSet->GetCellData();
- if(vtkDataArray* aScalarArray = aCellData->GetScalars()){
- float aVal = aScalarArray->GetTuple1(aVtkId);
- float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
- mySphereSourceSelected->SetRadius(aRadius);
- //
- GetScalarBarCtrl()->SetMarkValue(aVal);
+ vtkIdType aVtkId = GetNodeVTKID(anObjId);
+ if(aVtkId >= 0){
+ float* aNodeCoord = GetNodeCoord(anObjId);
+ mySphereSourceSelected->SetCenter(aNodeCoord);
+
+ vtkDataSet* aDataSet = GetInput();
+ vtkCellData* aCellData = aDataSet->GetCellData();
+ if(vtkDataArray* aScalarArray = aCellData->GetScalars()){
+ float aVal = aScalarArray->GetTuple1(aVtkId);
+ float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
+ mySphereSourceSelected->SetRadius(aRadius);
+ GetScalarBarCtrl()->SetMarkValue(aVal);
+ }
+ mySphereActorSelected->SetVisibility(1);
}
-
- mySphereActorSelected->SetVisibility(1);
}
}
//----------------------------------------------------------------
{
return myStoreMapping;
}
-//modified by NIZNHY-PKV Tue Oct 4 16:52:22 2005f
+
+
//----------------------------------------------------------------------------
vtkIdType
SALOME_ExtractGeometry
-::GetElemVTKId(int theObjID)
+::GetElemVTKId(vtkIdType theID)
{
- if (myElemVTK2ObjIds.empty())
- return theObjID;
+ if(myElemVTK2ObjIds.empty())
+ return theID;
- int i, aNb;
- vtkIdType anObjId, aVTKId=-1;
- //
- aNb=myElemVTK2ObjIds.size();
- for (i=0; i<aNb; ++i){
-#if defined __GNUC_2__
- anObjId=myElemVTK2ObjIds[i];
-#else
- anObjId=myElemVTK2ObjIds.at(i);
-#endif
- if (anObjId==theObjID){
- aVTKId=i;
- return aVTKId;
- }
- }
- return aVTKId;
+ vtkIdType iEnd = myElemVTK2ObjIds.size();
+ for(vtkIdType i = 0; i < iEnd; i++)
+ if(myElemVTK2ObjIds[i] == theID)
+ return i;
+
+ return -1;
}
vtkIdType
SALOME_ExtractGeometry
-::GetNodeVTKId(int theObjID)
+::GetNodeVTKId(vtkIdType theID)
{
- if (myNodeVTK2ObjIds.empty())
- return theObjID;
+ if (myElemVTK2ObjIds.empty())
+ return theID;
- int i, aNb;
- vtkIdType anObjId, aVTKId=-1;
- //
- aNb=myNodeVTK2ObjIds.size();
- for (i=0; i<aNb; ++i){
-#if defined __GNUC_2__
- anObjId=myNodeVTK2ObjIds[i];
-#else
- anObjId=myNodeVTK2ObjIds.at(i);
-#endif
- if (anObjId==theObjID){
- aVTKId=i;
- return aVTKId;
- }
- }
- return aVTKId;
+ vtkIdType iEnd = myNodeVTK2ObjIds.size();
+ for(vtkIdType i = 0; i < iEnd; i++)
+ if(myNodeVTK2ObjIds[i] == theID)
+ return i;
+
+ return -1;
}
-//modified by NIZNHY-PKV Tue Oct 4 16:52:24 2005t
+
//----------------------------------------------------------------------------
vtkIdType
if (myElemVTK2ObjIds.empty())
return theVtkID;
- if (theVtkID < 0 || myElemVTK2ObjIds.size() <= theVtkID)
- return -1;
-
#if defined __GNUC_2__
return myElemVTK2ObjIds[theVtkID];
#else
if (myNodeVTK2ObjIds.empty())
return theVtkID;
- if (theVtkID < 0 || myNodeVTK2ObjIds.size() <= theVtkID)
- return -1;
-
#if defined __GNUC_2__
return myNodeVTK2ObjIds[theVtkID];
#else