X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_ScalarBarActor.cxx;h=a3057121887929d0e589deb49395b9c78134f23d;hp=3f762267229d12b359253c08f6f42295ecda3d9c;hb=d4a710ce52f6e76786a7b3845e2f7975dc9a00b1;hpb=d8f644ca3d4ce62f2ef41d4aacb52f5bb1221df3 diff --git a/src/OBJECT/SMESH_ScalarBarActor.cxx b/src/OBJECT/SMESH_ScalarBarActor.cxx index 3f7622672..a30571218 100644 --- a/src/OBJECT/SMESH_ScalarBarActor.cxx +++ b/src/OBJECT/SMESH_ScalarBarActor.cxx @@ -1,23 +1,23 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : SMESH_ScalarBarActor.cxx // Author : Roman NIKOLAEV @@ -330,10 +330,10 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) if (distrVisibility && GetDistributionVisibility()) { for( i=0 ;iDelete(); distrPolys->Delete(); if ( myDistributionColoringType == SMESH_MULTICOLOR_TYPE ) { - distColors = vtkUnsignedCharArray::New(); - distColors->SetNumberOfComponents(3); - distColors->SetNumberOfTuples(numPositiveVal); - this->myDistribution->GetCellData()->SetScalars(distColors); - distColors->Delete(); + distColors = vtkUnsignedCharArray::New(); + distColors->SetNumberOfComponents(3); + distColors->SetNumberOfTuples(numPositiveVal); + this->myDistribution->GetCellData()->SetScalars(distColors); + distColors->Delete(); } else if( myDistributionColoringType == SMESH_MONOCOLOR_TYPE ){ - this->myDistribution->GetCellData()->SetScalars(NULL); + this->myDistribution->GetCellData()->SetScalars(NULL); } } else { myDistribution->Reset(); @@ -412,12 +412,12 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) // Customization of the vtkScalarBarActor to show distribution histogram. double delimeter=0.0; if(GetDistributionVisibility() && distrVisibility) { - delimeter=0.01*size[0]; //1 % from horizontal size of the full presentation size. - barWidth = size[0] - 4 - labelSize[0]; - distrHeight = barWidth/2; + delimeter=0.01*size[0]; //1 % from horizontal size of the full presentation size. + barWidth = size[0] - 4 - labelSize[0]; + distrHeight = barWidth/2; } else { - barWidth = size[0] - 4 - labelSize[0]; - distrHeight = 0; + barWidth = size[0] - 4 - labelSize[0]; + distrHeight = 0; } barHeight = (int)(0.86*size[1]); @@ -432,45 +432,45 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) } if(GetDistributionVisibility() && distrVisibility) { - // Distribution points - shrink = delta*SHRINK_COEF; - vtkIdType distPtsId=0; - vtkIdType distPtsIds[4]; - for(i=0; iSetPoint(distPtsId++,x); - - // second point of polygon (quadrangle) - x[0] = itemH; - distPtsIds[1] = distPtsId; - distrPts->SetPoint(distPtsId++,x); - - x[1] = i*delta+delta-shrink; - - // third point of polygon (quadrangle) - x[0] = 0; - distPtsIds[3] = distPtsId; - distrPts->SetPoint(distPtsId++,x); - - // fourth point of polygon (quadrangle) - x[0] = itemH; - distPtsIds[2] = distPtsId; - distrPts->SetPoint(distPtsId++,x); - - //Inser Quadrangle - distrPolys->InsertNextCell(4,distPtsIds); - } - } + // Distribution points + shrink = delta*SHRINK_COEF; + vtkIdType distPtsId=0; + vtkIdType distPtsIds[4]; + for(i=0; iSetPoint(distPtsId++,x); + + // second point of polygon (quadrangle) + x[0] = itemH; + distPtsIds[1] = distPtsId; + distrPts->SetPoint(distPtsId++,x); + + x[1] = i*delta+delta-shrink; + + // third point of polygon (quadrangle) + x[0] = 0; + distPtsIds[3] = distPtsId; + distrPts->SetPoint(distPtsId++,x); + + // fourth point of polygon (quadrangle) + x[0] = itemH; + distPtsIds[2] = distPtsId; + distrPts->SetPoint(distPtsId++,x); + + //Inser Quadrangle + distrPolys->InsertNextCell(4,distPtsIds); + } + } } } // rnv end @@ -481,15 +481,15 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) // Customization of the vtkScalarBarActor to show distribution histogram. double coef1, delimeter=0.0; if(GetDistributionVisibility() && distrVisibility) { - coef1=0.62; - distrHeight = (int)((coef1/2)*size[1]); - //delimeter between distribution diagram and scalar bar - delimeter=0.02*size[1]; + coef1=0.62; + distrHeight = (int)((coef1/2)*size[1]); + //delimeter between distribution diagram and scalar bar + delimeter=0.02*size[1]; } else { - coef1=0.4; - barHeight = (int)(coef1*size[1]); - distrHeight = 0; + coef1=0.4; + barHeight = (int)(coef1*size[1]); + distrHeight = 0; } barHeight = (int)(coef1*size[1]); @@ -498,48 +498,48 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) for (i=0; iSetPoint(2*i,x); + pts->SetPoint(2*i,x); x[1] = distrHeight + delimeter; pts->SetPoint(2*i+1,x); } if(GetDistributionVisibility() && distrVisibility) { - // Distribution points - shrink = delta*SHRINK_COEF; - vtkIdType distPtsId=0; - vtkIdType distPtsIds[4]; - for(i=0; iSetPoint(distPtsId++,x); - - // second point of polygon (quadrangle) - x[0] = i*delta+shrink; - x[1] = itemH; - distPtsIds[3] = distPtsId; - distrPts->SetPoint(distPtsId++,x); - - // third point of polygon (quadrangle) - x[0] = i*delta+delta-shrink; - x[1] = 0; - distPtsIds[1] = distPtsId; - distrPts->SetPoint(distPtsId++,x); - - // fourth point of polygon (quadrangle) - x[0] = i*delta+delta-shrink; - x[1] = itemH; - distPtsIds[2] = distPtsId; - distrPts->SetPoint(distPtsId++,x); - - // Add polygon into poly data - distrPolys->InsertNextCell(4,distPtsIds); - } - } + // Distribution points + shrink = delta*SHRINK_COEF; + vtkIdType distPtsId=0; + vtkIdType distPtsIds[4]; + for(i=0; iSetPoint(distPtsId++,x); + + // second point of polygon (quadrangle) + x[0] = i*delta+shrink; + x[1] = itemH; + distPtsIds[3] = distPtsId; + distrPts->SetPoint(distPtsId++,x); + + // third point of polygon (quadrangle) + x[0] = i*delta+delta-shrink; + x[1] = 0; + distPtsIds[1] = distPtsId; + distrPts->SetPoint(distPtsId++,x); + + // fourth point of polygon (quadrangle) + x[0] = i*delta+delta-shrink; + x[1] = itemH; + distPtsIds[2] = distPtsId; + distrPts->SetPoint(distPtsId++,x); + + // Add polygon into poly data + distrPolys->InsertNextCell(4,distPtsIds); + } + } } // rnv end } @@ -575,13 +575,13 @@ int SMESH_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) // rnv begin // Customization of the vtkScalarBarActor to show distribution histogram. if(myNbValues[i] && myDistributionColoringType == SMESH_MULTICOLOR_TYPE && GetDistributionVisibility() && distrVisibility) - { - rgb = distColors->GetPointer(3*dcCount); //write into array directly - rgb[0] = rgba[0]; - rgb[1] = rgba[1]; - rgb[2] = rgba[2]; - dcCount++; - } + { + rgb = distColors->GetPointer(3*dcCount); //write into array directly + rgb[0] = rgba[0]; + rgb[1] = rgba[1]; + rgb[2] = rgba[2]; + dcCount++; + } } // Now position everything properly @@ -824,14 +824,14 @@ void SMESH_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, double coef; if( GetDistributionVisibility() && distrVisibility ) if(this->Orientation == VTK_ORIENT_VERTICAL) - coef = 0.4; + coef = 0.4; else - coef = 0.18; + coef = 0.18; else if(this->Orientation == VTK_ORIENT_VERTICAL) - coef = 0.6; + coef = 0.6; else - coef=0.25; + coef=0.25; if ( this->Orientation == VTK_ORIENT_VERTICAL )