-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2010 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
+//
+// 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.
//
-// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// 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:
// Author:
// Module : VISU
-
+//
#include "VISU_PointCoords.hxx"
#include "VISU_ConvertorUtils.hxx"
void
TCoordHolderBase
::Init(vtkIdType theNbPoints,
- vtkIdType theDim)
+ vtkIdType theDim)
{
myDim = theDim;
myNbPoints = theNbPoints;
vtkIdType aDim = GetDim();
INITMSG(MYDEBUG,"TPointCoords::GetPoints - aNbPoints = "<<aNbPoints<<
- "; aDim = "<<aDim<<
- endl);
+ "; aDim = "<<aDim<<
+ endl);
if(GetDim() == 3){
- INITMSG(MYDEBUG,"TPointCoords::GetPoints - SetVoidArray()"<<endl);
- SetVoidArray();
+ INITMSG(MYDEBUG,"TPointCoords::GetPoints - SetVoidArray()"<<endl);
+ SetVoidArray();
}else{
- vtkPoints* aPoints = myPointSet->GetPoints();
- for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
- TCCoordSlice aSlice = GetCoordSlice(aPointId);
+ vtkPoints* aPoints = myPointSet->GetPoints();
+ for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
+ TCCoordSlice aSlice = GetCoordSlice(aPointId);
- vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
- for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
- aCoords[aDimId] = aSlice[aDimId];
+ vtkFloatingPointType aCoords[3] = {0.0, 0.0, 0.0};
+ for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
+ aCoords[aDimId] = aSlice[aDimId];
- aPoints->SetPoint(aPointId, aCoords);
- }
+ aPoints->SetPoint(aPointId, aCoords);
+ }
}
myIsVTKDone = true;
VISU::TCoord
GetCoord(VISU::TCCoordSlice& theCoordSlice,
- int theCoordId)
+ int theCoordId)
{
return (*myGetCoord[theCoordId])(theCoordSlice);
}
// 1D - always along X
// 2D - always in XOY plane
anIsDimPresent[iDim] = iDim < GetDim();
-// std::string aName = GetName(iDim);
-// if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16
-// aName = aName.substr(0,1);
-// if(aName == "x" || aName == "X")
-// anIsDimPresent[eX] = true;
-// else if(aName == "y" || aName == "Y")
-// anIsDimPresent[eY] = true;
-// else if(aName == "z" || aName == "Z")
-// anIsDimPresent[eZ] = true;
+// std::string aName = GetName(iDim);
+// if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16
+// aName = aName.substr(0,1);
+// if(aName == "x" || aName == "X")
+// anIsDimPresent[eX] = true;
+// else if(aName == "y" || aName == "Y")
+// anIsDimPresent[eY] = true;
+// else if(aName == "z" || aName == "Z")
+// anIsDimPresent[eZ] = true;
}
switch(GetDim()){
case 3:
- aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
- break;
+ aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
+ break;
case 2:
- if(anIsDimPresent[eY] && anIsDimPresent[eZ])
- aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
- else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
- aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
- else
- aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
- break;
+ if(anIsDimPresent[eY] && anIsDimPresent[eZ])
+ aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
+ else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
+ aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
+ else
+ aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
+ break;
case 1:
- if(anIsDimPresent[eY])
- aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
- else if(anIsDimPresent[eZ])
- aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
- else
- aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
- break;
+ if(anIsDimPresent[eY])
+ aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
+ else if(anIsDimPresent[eZ])
+ aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
+ else
+ aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
+ break;
}
INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - aNbPoints = "<<GetNbPoints()<<
- "; aDim = "<<GetDim()<<
- endl);
+ "; aDim = "<<GetDim()<<
+ endl);
if(anIsDimPresent[eX] && anIsDimPresent[eY] && anIsDimPresent[eZ]){
- INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - SetVoidArray()"<<endl);
- SetVoidArray();
+ INITMSG(MYDEBUG,"TNamedPointCoords::GetPoints - SetVoidArray()"<<endl);
+ SetVoidArray();
}else{
- vtkPoints* aPoints = myPointSet->GetPoints();
- for(vtkIdType aNodeId = 0; aNodeId < GetNbPoints(); aNodeId++){
- TCCoordSlice aCoordSlice = GetCoordSlice(aNodeId);
- aPoints->SetPoint(aNodeId,
- aCoordHelperPtr->GetCoord(aCoordSlice,eX),
- aCoordHelperPtr->GetCoord(aCoordSlice,eY),
- aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
- }
+ vtkPoints* aPoints = myPointSet->GetPoints();
+ for(vtkIdType aNodeId = 0; aNodeId < GetNbPoints(); aNodeId++){
+ TCCoordSlice aCoordSlice = GetCoordSlice(aNodeId);
+ aPoints->SetPoint(aNodeId,
+ aCoordHelperPtr->GetCoord(aCoordSlice,eX),
+ aCoordHelperPtr->GetCoord(aCoordSlice,eY),
+ aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
+ }
}
{
- vtkIdType aNbTuples = GetNbPoints();
- int anEntity = int(VISU::NODE_ENTITY);
- vtkIntArray *aDataArray = vtkIntArray::New();
- aDataArray->SetName("VISU_POINTS_MAPPER");
- aDataArray->SetNumberOfComponents(2);
- aDataArray->SetNumberOfTuples(aNbTuples);
- int *aPtr = aDataArray->GetPointer(0);
- for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
- vtkIdType anObjID = GetObjID(aTupleId);
- *aPtr++ = anObjID;
- *aPtr++ = anEntity;
- }
- myPointSet->GetPointData()->AddArray(aDataArray);
- aDataArray->Delete();
+ vtkIdType aNbTuples = GetNbPoints();
+ int anEntity = int(VISU::NODE_ENTITY);
+ vtkIntArray *aDataArray = vtkIntArray::New();
+ aDataArray->SetName("VISU_POINTS_MAPPER");
+ aDataArray->SetNumberOfComponents(2);
+ aDataArray->SetNumberOfTuples(aNbTuples);
+ int *aPtr = aDataArray->GetPointer(0);
+ for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+ vtkIdType anObjID = GetObjID(aTupleId);
+ *aPtr++ = anObjID;
+ *aPtr++ = anEntity;
+ }
+ myPointSet->GetPointData()->AddArray(aDataArray);
+ aDataArray->Delete();
}
myIsVTKDone = true;