X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_DeviceActor.cxx;h=b3046dd88b0fe03aa949c220c0d252359cda9210;hb=133cb381393ea728f6c6ff3a732738ecd1ad72d8;hp=4785155d80478fffa598fa2f65c66c8da1519838;hpb=b0a908c0d20341651771d0249fb10882f54b2aad;p=modules%2Fsmesh.git diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 4785155d8..b3046dd88 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -393,12 +393,13 @@ SMESH_DeviceActor vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); aCellTypesArray->SetNumberOfComponents( 1 ); aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); - + vtkIdList *anIdList = vtkIdList::New(); anIdList->SetNumberOfIds(2); - + Length2D::TValues::const_iterator anIter = aValues.begin(); - for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){ + aNbCells = 0; + for(; anIter != aValues.end(); anIter++){ const Length2D::Value& aValue = *anIter; int aNode[2] = { myVisualObj->GetNodeVTKId(aValue.myPntId[0]), @@ -409,27 +410,30 @@ SMESH_DeviceActor anIdList->SetId( 1, aNode[1] ); aConnectivity->InsertNextCell( anIdList ); aCellTypesArray->InsertNextValue( VTK_LINE ); - aScalars->SetValue(aVtkId,aValue.myLength); + aScalars->SetValue(aNbCells,aValue.myLength); + aNbCells++; } } - + aCellTypesArray->SetNumberOfTuples( aNbCells ); + aScalars->SetNumberOfTuples( aNbCells ); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents( 1 ); aCellLocationsArray->SetNumberOfTuples( aNbCells ); - + aConnectivity->InitTraversal(); for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ) aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); - - aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); + + aDataSet->SetCells( aCellTypesArray, aCellLocationsArray, aConnectivity ); SetUnstructuredGrid(aDataSet); aDataSet->GetCellData()->SetScalars(aScalars); aScalars->Delete(); - + theLookupTable->SetRange(aScalars->GetRange()); theLookupTable->Build(); - + myMergeFilter->SetScalarsData(aDataSet); aDataSet->Delete(); } @@ -449,16 +453,17 @@ SMESH_DeviceActor vtkIdType aCellsSize = 3*aNbCells; vtkCellArray* aConnectivity = vtkCellArray::New(); aConnectivity->Allocate( aCellsSize, 0 ); - + vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); aCellTypesArray->SetNumberOfComponents( 1 ); aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); - + vtkIdList *anIdList = vtkIdList::New(); anIdList->SetNumberOfIds(2); - + MultiConnection2D::MValues::const_iterator anIter = aValues.begin(); - for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){ + aNbCells = 0; + for(; anIter != aValues.end(); anIter++){ const MultiConnection2D::Value& aValue = (*anIter).first; int aNode[2] = { myVisualObj->GetNodeVTKId(aValue.myPntId[0]), @@ -469,27 +474,30 @@ SMESH_DeviceActor anIdList->SetId( 1, aNode[1] ); aConnectivity->InsertNextCell( anIdList ); aCellTypesArray->InsertNextValue( VTK_LINE ); - aScalars->SetValue(aVtkId,(*anIter).second); + aScalars->SetValue( aNbCells,(*anIter).second); + aNbCells++; } } - + aCellTypesArray->SetNumberOfTuples( aNbCells ); + aScalars->SetNumberOfTuples( aNbCells ); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents( 1 ); aCellLocationsArray->SetNumberOfTuples( aNbCells ); - + aConnectivity->InitTraversal(); for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ) aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); - + aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); SetUnstructuredGrid(aDataSet); aDataSet->GetCellData()->SetScalars(aScalars); aScalars->Delete(); - + theLookupTable->SetRange(aScalars->GetRange()); theLookupTable->Build(); - + myMergeFilter->SetScalarsData(aDataSet); aDataSet->Delete(); } @@ -959,6 +967,16 @@ void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) { myMapper->SetBallEnabled( theBallEnabled ); } +/*! + * Set point marker scale factor + * \param theBallScale double value which specifies a scale factor of ball element + */ +void SMESH_DeviceActor::SetBallScale( double theBallScale ) +{ + myMapper->SetBallScale( theBallScale ); + myMapper->Modified(); +} + /*! * Set standard point marker * \param theMarkerType type of the marker @@ -1005,6 +1023,15 @@ int SMESH_DeviceActor::GetMarkerTexture() return myMapper->GetMarkerTexture(); } +/*! + * Get scale factor of ball element + * \return scale factor of ball element + */ +double SMESH_DeviceActor::GetBallScale() +{ + return myMapper->GetBallScale(); +} + void SMESH_DeviceActor::SetCoincident3DAllowed(bool theFlag) { myGeomFilter->SetAppendCoincident3D(theFlag); }