1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File: VISU_PipeLine.cxx
25 // Author: Alexey PETROV
29 #include "VISU_IsoSurfacesPL.hxx"
30 #include "VISU_PipeLineUtils.hxx"
32 #include <vtkContourFilter.h>
34 vtkStandardNewMacro(VISU_IsoSurfacesPL);
37 ::VISU_IsoSurfacesPL()
39 myContourFilter = vtkContourFilter::New();
40 myCellDataToPointData = vtkCellDataToPointData::New();
41 myIsShrinkable = false;
45 ::~VISU_IsoSurfacesPL()
47 myContourFilter->UnRegisterAllOutputs();
48 myContourFilter->Delete();
50 myCellDataToPointData->UnRegisterAllOutputs();
51 myCellDataToPointData->Delete();
56 ::ShallowCopy(VISU_PipeLine *thePipeLine)
58 if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine)){
59 SetNbParts(aPipeLine->GetNbParts());
60 vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
63 VISU_ScalarMapPL::ShallowCopy(thePipeLine);
70 return myContourFilter->GetNumberOfContours();
74 ::SetNbParts(int theNb)
76 myContourFilter->SetNumberOfContours(theNb);
83 ::SetScaling(int theScaling)
85 VISU_ScalarMapPL::SetScaling(theScaling);
90 ::SetRange(vtkFloatingPointType theRange[2])
92 if(theRange[0] <= theRange[1]){
93 myRange[0] = theRange[0]; myRange[1] = theRange[1];
94 vtkFloatingPointType aRange[2] = {myRange[0], myRange[1]};
95 if(GetScaling() == VTK_SCALE_LOG10)
96 VISU_LookupTable::ComputeLogRange(theRange,aRange);
97 myContourFilter->GenerateValues(GetNbParts(),aRange);
121 VISU_ScalarMapPL::Init();
124 vtkFloatingPointType aScalarRange[2];
125 GetSourceRange(aScalarRange);
126 SetRange(aScalarRange);
129 VISU_ScalarMapPL::THook*
133 VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
134 return myContourFilter->GetOutput();
142 VISU_ScalarMapPL::Update();
147 ::SetMapScale(vtkFloatingPointType theMapScale)
149 VISU_ScalarMapPL::SetMapScale(theMapScale);
151 vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()};
152 vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]};
153 if(GetScaling() == VTK_SCALE_LOG10)
154 VISU_LookupTable::ComputeLogRange(aRange,aNewRange);
155 myContourFilter->GenerateValues(GetNbParts(),aNewRange);